@font-face {
  font-family: 'ComicSans';
  src: url('../Comic-Sans-MS.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

/* ---- GAME AREA ---- */
#game-area {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ---- BACKGROUND ---- */
#bg {
  position: absolute;
  inset: 0;
  background-image: url('./assets/images/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

/* ---- GAME TITLE ---- */
#game-title {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 20;
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: clamp(1rem, 1.8vw, 1.6rem);
  color: #cc44ff;
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  text-align: left;
  line-height: 1.25;
  pointer-events: none;
  white-space: nowrap;
}

/* ---- UPGRADE PANEL ---- */
#upgrade-panel {
  position: absolute;
  top: 52px;
  left: 18px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- MONEY COUNTER ---- */
#money-counter {
  position: absolute;
  left: 18px;
  z-index: 20;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  color: #00ff44;
  -webkit-text-stroke: 2px #000;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 2px;
  /* Positioned dynamically by JS below the upgrade panel */
}

.upgrade-btn {
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: 0.78rem;
  border: 3px solid rgba(0,0,0,0.6);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  min-width: 160px;
  text-align: left;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  transition: transform 0.1s, filter 0.1s;
  line-height: 1.4;
}

.upgrade-btn:hover:not(:disabled) {
  transform: scale(1.05) translateY(-1px);
  filter: brightness(1.15);
}

.upgrade-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.upgrade-btn:disabled {
  cursor: not-allowed;
}

.upg-label {
  display: block;
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 2px;
}

.upg-label em {
  font-style: normal;
  opacity: 0.85;
}

.upg-info {
  display: block;
  font-size: 0.72rem;
  opacity: 0.95;
}

/* ---- MEEN + SHRED BUTTON AREA ---- */
#meen-shred-area {
  position: absolute;
  bottom: 30px;
  left: 50px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#meen-img {
  width: 180px;
  height: auto;
  display: block;
  /* Meen peeks over the button — offset him up so he's behind/above */
  margin-bottom: -28px;
  position: relative;
  z-index: 14;
  transform-origin: bottom center;
  transition: transform 0.05s;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7));
  image-rendering: pixelated; /* keep that crispy CD-ROM look */
}

@keyframes meenExcited {
  0%   { transform: rotate(-6deg) scale(1.08); }
  25%  { transform: rotate(6deg) scale(1.12); }
  50%  { transform: rotate(-4deg) scale(1.1); }
  75%  { transform: rotate(4deg) scale(1.08); }
  100% { transform: rotate(0deg) scale(1); }
}

#meen-img.meen-excited {
  animation: meenExcited 0.5s ease-in-out;
}

#shred-btn {
  position: relative;
  z-index: 15;
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: bold;
  color: #000;
  background: radial-gradient(ellipse at 35% 35%, #ff4d4d, #cc0000);
  border: 4px solid #800000;
  border-radius: 18px;
  padding: 16px 48px;
  cursor: pointer;
  box-shadow:
    0 6px 0 #7a0000,
    0 8px 16px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.3);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
  letter-spacing: 4px;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.2);
}

#shred-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 8px 0 #7a0000,
    0 12px 20px rgba(0,0,0,0.7),
    inset 0 2px 4px rgba(255,255,255,0.3);
  filter: brightness(1.1);
}

#shred-btn:active {
  transform: translateY(4px) scale(0.98);
  box-shadow:
    0 2px 0 #7a0000,
    0 4px 8px rgba(0,0,0,0.5),
    inset 0 2px 4px rgba(255,255,255,0.2);
}

/* ---- SHREDDER IMAGE ---- */
#shredder-img {
  position: absolute;
  bottom: 0;
  right: 0;
  width: min(55vw, 640px);
  height: auto;
  z-index: 10;
  image-rendering: auto;
  transform-origin: bottom center;
}

/* ---- YOUTUBE CREDIT ---- */
#yt-credit {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 20;
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: clamp(1.1rem, 1.8vw, 1.6rem);
  color: #ffd700;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  text-decoration: none;
  pointer-events: all;
  transition: filter 0.15s;
  white-space: nowrap;
}

#yt-credit:hover {
  filter: brightness(1.2);
  text-decoration: underline;
}

/* ---- HUB BUTTON ---- */
#hub-btn {
  position: absolute;
  left: 18px;
  z-index: 20;
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: clamp(0.8rem, 1.3vw, 1.05rem);
  font-weight: bold;
  color: #000;
  background: #c9a8f0;
  border: 3px solid #000;
  border-radius: 10px;
  padding: 6px 14px;
  text-decoration: none;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  transition: transform 0.1s, filter 0.1s;
  white-space: nowrap;
  /* Positioned dynamically by JS below the money counter */
}

#hub-btn:hover {
  transform: scale(1.05) translateY(-1px);
  filter: brightness(1.1);
}

#hub-btn:active {
  transform: scale(0.97);
}

/* ---- RESET BUTTON ---- */
#reset-btn {
  position: absolute;
  left: 18px;
  z-index: 20;
  font-family: 'ComicSans', 'Comic Sans MS', cursive;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  font-weight: bold;
  color: #fff;
  background: #8b0000;
  border: 3px solid #000;
  border-radius: 10px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  transition: transform 0.1s, filter 0.1s;
  white-space: nowrap;
  /* Positioned dynamically by JS below the hub button */
}

#reset-btn:hover {
  transform: scale(1.05) translateY(-1px);
  filter: brightness(1.2);
}

#reset-btn:active {
  transform: scale(0.97);
}

/* ---- FALLING BOOKS ---- */
.falling-book {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}

/* ---- SHREDDER OVERLAY (goes on top of books so they disappear behind it) ---- */
#shredder-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: min(55vw, 640px);
  height: auto;
  z-index: 11; /* above books (z:5) but below UI (z:15+) */
  pointer-events: none;
  /* This is the same image but we only show the lower portion to mask books */
  background-image: url('./assets/images/shredder.png');
  background-size: 100% auto;
  background-position: bottom right;
  background-repeat: no-repeat;
}