@font-face {
  font-family: 'PressStart';
  src: url('../assets/PressStart2P.ttf') format('truetype');
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }

html, body {
  width: 100%; height: 100%;
  background: #0d0a0a;
  overflow: hidden;
  font-family: 'PressStart', monospace;
  color: #f3e9d2;
  touch-action: none;            /* the game handles all gestures itself */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: relative; width: 100%; height: 100%; }

#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10;
}
.hidden { display: none !important; }

/* ---------- TITLE ---------- */
#title-screen {
  background:
    linear-gradient(rgba(10, 5, 5, 0.45), rgba(10, 5, 5, 0.78)),
    url('../assets/img/splash.webp') center / cover no-repeat;
  image-rendering: pixelated;
}
.title-inner { text-align: center; animation: fadein 0.8s ease-out; }
.game-title {
  display: flex; flex-direction: column; gap: 10px;
  font-size: 52px; line-height: 1;
  color: #ffd24a;
  text-shadow: 4px 4px 0 #7a0c0c, 8px 8px 0 rgba(0,0,0,0.6);
  letter-spacing: 4px;
  margin-bottom: 18px;
}
.game-title .t2 { color: #e23b3b; text-shadow: 4px 4px 0 #2b0606, 8px 8px 0 rgba(0,0,0,0.6); }
.tagline { font-size: 13px; color: #f3e9d2; margin-bottom: 34px; text-shadow: 2px 2px 0 #000; }

.big-btn {
  font-family: 'PressStart', monospace;
  font-size: 16px;
  padding: 18px 34px;
  background: #a01212;
  color: #ffd24a;
  border: 4px solid #ffd24a;
  box-shadow: 0 6px 0 #5a0808, 4px 4px 0 rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.06s;
}
.big-btn:hover { transform: translateY(-2px) scale(1.03); background: #c01818; }
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #5a0808; }

.small-btn {
  font-family: 'PressStart', monospace;
  font-size: 10px; margin-top: 14px;
  padding: 10px 16px;
  background: transparent; color: #b9a98c;
  border: 2px solid #b9a98c; cursor: pointer;
}
.small-btn:hover { color: #ffd24a; border-color: #ffd24a; }

.howto {
  margin-top: 30px; font-size: 9px; line-height: 2;
  color: #cfc3a6; text-shadow: 1px 1px 0 #000;
  background: rgba(0,0,0,0.55);
  padding: 14px 22px; border: 2px solid rgba(255, 210, 74, 0.35);
}
.howto .warn { color: #ff9a3d; }

/* ---------- CSS-drawn propaganda frame (scales cleanly, no stretched images) ---- */
.frame {
  position: relative;
  background:
    linear-gradient(180deg, #4a0d0d 0%, #320a0a 55%, #1c0606 100%);
  border: 3px solid #ffd24a;
  box-shadow:
    0 0 0 3px #7a0c0c,
    0 0 0 5px rgba(0,0,0,0.6),
    inset 0 0 22px rgba(0,0,0,0.55),
    0 10px 0 rgba(0,0,0,0.45);
}
/* gold star ornament at the top center of every frame */
.frame::before {
  content: '★';
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  color: #ffd24a; font-size: 20px;
  text-shadow: 0 0 6px rgba(255,210,74,0.8), 2px 2px 0 #4a0505;
  background: #320a0a; padding: 0 8px;
}

/* ---------- LEVEL UP ---------- */
#levelup-screen {
  background: rgba(8, 4, 4, 0.74);
  animation: lvlflash 0.4s ease-out;
}
@keyframes lvlflash {
  0% { background: rgba(255, 210, 74, 0.35); }
  100% { background: rgba(8, 4, 4, 0.74); }
}
.banner-title {
  padding: 16px clamp(20px, 5vw, 60px);
  max-width: 92vw; text-align: center;
  font-size: clamp(10px, 1.6vw, 15px); color: #ffe9b0;
  text-shadow: 2px 2px 0 #4a0505;
  margin-bottom: 26px;
  background: linear-gradient(180deg, #b01616, #7a0c0c);
  border: 2px solid #ffd24a;
  box-shadow: 0 0 0 2px #4a0505, 0 5px 0 rgba(0,0,0,0.4);
  animation: dropin 0.25s ease-out;
}
.choices { display: flex; gap: clamp(12px, 1.6vw, 24px); animation: dropin 0.3s ease-out; max-width: 96vw; }
.choice-card {
  width: clamp(190px, 25vw, 260px);
  padding: 26px clamp(14px, 1.8vw, 22px) 20px;
  text-align: center; cursor: pointer;
  transition: transform 0.08s, filter 0.08s;
  display: flex; flex-direction: column; align-items: center;
  /* inherits .frame */
}
.choice-card:hover { transform: scale(1.05) translateY(-6px); filter: brightness(1.18); }
.choice-card img {
  width: clamp(56px, 7vw, 76px); height: clamp(56px, 7vw, 76px);
  image-rendering: pixelated;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.6));
}
.choice-card .c-body {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; flex: 1;
}
.choice-card .c-name { font-size: clamp(9px, 1.1vw, 12px); color: #ffd24a; margin-bottom: 8px; line-height: 1.5; }
.choice-card .c-lvl {
  font-size: 8px; color: #7cf07c; margin-bottom: 12px;
  border: 1px solid #2e7d32; border-radius: 2px; padding: 3px 7px;
}
.choice-card .c-lvl.new { color: #0a2030; background: #6ecbff; border-color: #6ecbff; }
.choice-card .c-desc { font-size: 8px; line-height: 1.7; color: #cdbf9f; margin-bottom: 12px; min-height: 2.6em; }
.choice-card .c-stats {
  width: 100%; margin-top: auto;
  border-top: 1px solid rgba(255,210,74,0.25); padding-top: 10px;
}
.choice-card .c-stat {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 8px; line-height: 2; color: #efe4c8;
}
.choice-card .c-stat .v { color: #7cf07c; }
.choice-card .c-stat.neutral .v { color: #ffd24a; }

/* ---------- PAUSE / END ---------- */
.pause-box, .end-box {
  padding: clamp(30px, 5vw, 56px) clamp(28px, 5vw, 64px);
  text-align: center;
  width: min(560px, 92vw);
  animation: dropin 0.25s ease-out;
  /* inherits .frame */
}
.pause-box h2, .end-box h2 {
  font-size: clamp(16px, 2.4vw, 24px); color: #ffd24a;
  text-shadow: 3px 3px 0 #4a0505;
  margin-bottom: 20px; line-height: 1.4;
}
#pause-stats, #end-stats { font-size: clamp(8px, 1vw, 10px); line-height: 2.2; color: #efe4c8; margin-bottom: 22px; }
#end-flavor { font-size: clamp(8px, 1.05vw, 11px); line-height: 1.9; color: #ffb35c; margin-bottom: 20px; }
#end-stats b, #pause-stats b { color: #ffd24a; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropin {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- CHEST JACKPOT ---------- */
#chest-screen { background: rgba(8, 4, 4, 0.78); }
.chest-box {
  padding: clamp(24px, 4vw, 44px) clamp(22px, 4vw, 52px);
  text-align: center;
  width: min(520px, 94vw);
  animation: dropin 0.22s ease-out;
}
.chest-box h2 {
  font-size: clamp(13px, 2vw, 20px); color: #ffd24a;
  text-shadow: 3px 3px 0 #4a0505;
  margin-bottom: 18px; line-height: 1.4;
}
.chest-box h2.jackpot {
  color: #ff5a3c;
  animation: jackpotPulse 0.45s ease-in-out infinite alternate;
}
@keyframes jackpotPulse {
  from { transform: scale(1); text-shadow: 3px 3px 0 #4a0505; }
  to   { transform: scale(1.12); text-shadow: 0 0 18px rgba(255, 210, 74, 0.9), 3px 3px 0 #4a0505; }
}
#chest-reel {
  width: 110px; height: 110px; margin: 0 auto 16px;
  border: 3px solid #ffd24a; background: rgba(0,0,0,0.45);
  box-shadow: inset 0 0 16px rgba(0,0,0,0.7), 0 0 14px rgba(255,210,74,0.25);
  display: flex; align-items: center; justify-content: center;
}
#chest-reel img { width: 84px; height: 84px; image-rendering: pixelated; }
#chest-rewards {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  min-height: 44px; margin-bottom: 16px;
}
.reward-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.45);
  border: 2px solid #ffd24a;
  padding: 6px 10px;
  animation: chipPop 0.25s ease-out;
}
.reward-chip img { width: 28px; height: 28px; image-rendering: pixelated; }
.reward-chip span { font-size: 8px; color: #efe4c8; }
.reward-chip b { font-size: 8px; color: #7cf07c; }
@keyframes chipPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- MOBILE PAUSE BUTTON ---------- */
#btn-pause-mobile {
  position: absolute; top: 64px; right: 12px; z-index: 15;
  width: 44px; height: 44px;
  font-family: 'PressStart', monospace; font-size: 14px;
  color: #ffd24a; background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255, 210, 74, 0.6);
  cursor: pointer;
}

/* ---------- MUTE BUTTON ---------- */
#btn-mute {
  position: absolute; top: 64px; right: 64px; z-index: 15;
  width: 44px; height: 44px;
  font-size: 18px; line-height: 1;
  color: #ffd24a; background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255, 210, 74, 0.6);
  cursor: pointer;
}
@media (pointer: fine) { #btn-mute { right: 12px; } } /* no pause button next to it on desktop */

/* ---------- SMALL SCREENS / PORTRAIT (phones) ---------- */
@media (max-width: 740px) {
  .game-title { font-size: clamp(26px, 8vw, 42px); letter-spacing: 2px; }
  .tagline { font-size: 10px; }
  .big-btn { font-size: 12px; padding: 14px 20px; }
  .howto { font-size: 8px; padding: 10px 12px; max-width: 94vw; }

  /* level-up: vertical stack of compact row-cards (thumb-friendly) */
  .choices {
    flex-direction: column;
    width: min(440px, 94vw);
    max-height: 70vh; overflow-y: auto;
    touch-action: pan-y;
    gap: 10px;
  }
  .choice-card {
    width: 100%;
    flex-direction: row; align-items: center; text-align: left;
    padding: 14px 14px 14px 12px; gap: 12px;
    min-height: 0;
  }
  .choice-card img { width: 52px; height: 52px; margin: 0; flex-shrink: 0; }
  .choice-card .c-body { align-items: flex-start; }
  .choice-card .c-name { margin-bottom: 4px; }
  .choice-card .c-lvl { margin-bottom: 6px; }
  .choice-card .c-desc { margin-bottom: 6px; min-height: 0; }
  .choice-card .c-stats { padding-top: 6px; }
  .frame::before { display: none; } /* skip the star ornament on cramped cards */
  .banner-title { margin-bottom: 14px; padding: 12px 18px; }
}
