/* ============================================================
   TANK BRAINS — arcade marquee / sticker-book aesthetic
   Thick ink outlines, hard offset shadows, saturated poster colors.
   ============================================================ */

:root {
  --ink: #131A33;
  --ink-soft: #253059;
  --cream: #FFF4DC;
  --cream-dim: #EFE0C2;
  --sun: #FFC531;
  --coral: #FF6B4A;
  --pink: #FF3D77;
  --lime: #9CE04A;
  --sky: #4FC8FF;
  --grape: #7A5CFF;

  --edge: 4px;
  --pop: 6px;

  --display: 'Bungee', 'Futura', 'Trebuchet MS', Impact, sans-serif;
  --body: 'Fredoka', 'Futura', 'Trebuchet MS', 'Avenir Next', sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--body);
  background: var(--ink);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Atmospheric backdrop: radial glow + printed halftone grain */
#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 8%, #35406F 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 15% 95%, #5B2A4E 0%, transparent 65%),
    radial-gradient(ellipse 70% 60% at 88% 88%, #2A4A5B 0%, transparent 65%),
    var(--ink);
}
#backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 4px 4px;
  mix-blend-mode: overlay;
}

/* ---------- shared chrome ---------- */

.sticker {
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--pop) var(--pop) 0 var(--ink);
}

.btn {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--sun);
  border: var(--edge) solid var(--ink);
  border-radius: 14px;
  padding: 0.8em 1.4em;
  cursor: pointer;
  box-shadow: 0 var(--pop) 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  text-transform: uppercase;
}
.btn:hover { background: #FFD65E; }
.btn:active,
.btn.is-pressed {
  transform: translateY(var(--pop));
  box-shadow: 0 0 0 var(--ink);
}
.btn:focus-visible {
  outline: 4px dashed var(--sky);
  outline-offset: 4px;
}
.btn--coral { background: var(--coral); color: var(--cream); }
.btn--coral:hover { background: #FF8163; }
.btn--pink { background: var(--pink); color: var(--cream); }
.btn--pink:hover { background: #FF5C8F; }
.btn--sky { background: var(--sky); }
.btn--sky:hover { background: #74D6FF; }
.btn--ghost {
  background: transparent;
  color: var(--cream);
  border-color: var(--cream);
  box-shadow: 0 var(--pop) 0 rgba(255, 244, 220, 0.35);
}
.btn--ghost:hover { background: rgba(255, 244, 220, 0.12); }
.btn--sm { font-size: 0.72rem; padding: 0.6em 0.9em; border-radius: 11px; }

/* ---------- screen switching ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* ============================================================
   TITLE
   ============================================================ */

#screen-title {
  flex-direction: column;
  align-items: center;
  /* `safe center` keeps the content centred until it outgrows the viewport,
     then pins it to the top. Plain `center` pushes the overflow above the
     scroll origin, where it can never be reached. */
  justify-content: center;
  justify-content: safe center;
  padding: 20px 24px 32px;
  gap: 18px;
  text-align: center;
  /* Sampled from the hero art so the two backgrounds are the same surface:
     near-black at the corners, a violet bloom behind the tank. */
  background:
    repeating-linear-gradient(90deg, rgba(130, 84, 232, 0.10) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(130, 84, 232, 0.08) 0 1px, transparent 1px 64px),
    radial-gradient(ellipse 70% 58% at 50% 30%, #1B0850 0%, transparent 68%),
    #04021A;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(720px, 100%);
}

.hero__tank {
  display: block;
  width: min(500px, 88%);
  height: auto;
  margin-top: -6%;
  /* The artwork is a JPEG carrying its own near-black backdrop. The page
     behind it is painted to the same sampled colors, and this radial mask
     feathers the rectangle away so the two surfaces read as one. Blend modes
     were tried here and rejected — screen washed the tank's colors out. */
  -webkit-mask-image: radial-gradient(ellipse 78% 80% at 50% 47%, #000 54%, rgba(0, 0, 0, 0.55) 76%, transparent 97%);
  mask-image: radial-gradient(ellipse 78% 80% at 50% 47%, #000 54%, rgba(0, 0, 0, 0.55) 76%, transparent 97%);
  animation: heroRoll 0.9s 0.1s cubic-bezier(0.2, 1.3, 0.4, 1) both,
             heroFloat 5.5s 1s ease-in-out infinite;
  pointer-events: none;
}

/* If the art file isn't present, the wordmark simply stands on its own. */
.hero--noart .hero__tank { display: none; }
.hero--noart .logo { margin-bottom: 6px; }

@keyframes heroRoll {
  from { opacity: 0; transform: translateY(40px) scale(0.9) rotate(-3deg); }
  to { opacity: 1; transform: none; }
}
@keyframes heroFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.logo { position: relative; z-index: 2; animation: dropIn 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.logo__line1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 11vw, 6.5rem);
  line-height: 0.92;
  color: var(--sun);
  text-shadow:
    3px 3px 0 var(--ink), 6px 6px 0 var(--pink), 9px 9px 0 var(--ink);
  letter-spacing: 0.02em;
}
.logo__line2 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 11vw, 6.5rem);
  line-height: 0.92;
  color: var(--lime);
  text-shadow:
    3px 3px 0 var(--ink), 6px 6px 0 var(--sky), 9px 9px 0 var(--ink);
  letter-spacing: 0.02em;
}

.tagline {
  font-size: clamp(0.9rem, 2.6vw, 1.2rem);
  color: var(--cream);
  background: var(--ink-soft);
  border: 3px solid var(--cream);
  border-radius: 999px;
  padding: 0.5em 1.4em;
  display: inline-block;
  animation: dropIn 0.7s 0.12s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: min(720px, 100%);
  animation: dropIn 0.7s 0.24s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@media (max-width: 560px) {
  .mode-grid { grid-template-columns: 1fr; }
}

.mode-card {
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--pop) var(--pop) 0 var(--ink);
  padding: 22px 18px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.mode-card:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 var(--ink); }
.mode-card:active { transform: translate(var(--pop), var(--pop)); box-shadow: 0 0 0 var(--ink); }
.mode-card__icon { font-size: 2.6rem; line-height: 1; }
.mode-card__title { font-family: var(--display); font-size: 1.15rem; margin: 10px 0 6px; }
.mode-card__desc { font-size: 0.86rem; line-height: 1.35; color: #4A5478; }

.title-foot {
  font-size: 0.8rem;
  color: rgba(255, 244, 220, 0.6);
  animation: dropIn 0.7s 0.36s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-26px) rotate(-1.5deg); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   SETUP
   ============================================================ */

#screen-setup {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 20px 40px;
  gap: 20px;
}

.panel {
  width: min(720px, 100%);
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--pop) var(--pop) 0 var(--ink);
  padding: 22px;
}

.panel__title {
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 4px;
}
.panel__sub { font-size: 0.88rem; color: #55608A; margin-bottom: 16px; }

.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin-bottom: 10px;
  display: block;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.95rem;
  background: #FFFFFF;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.55em 1.2em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s ease, background 0.15s ease;
  box-shadow: 0 3px 0 var(--ink);
}
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.chip[aria-pressed='true'] { background: var(--lime); }
.chip[aria-pressed='true'].chip--math { background: var(--sun); }
.chip[aria-pressed='true'].chip--reading { background: var(--coral); color: #fff; }
.chip[aria-pressed='true'].chip--science { background: var(--sky); }
.chip[aria-pressed='true'].chip--world { background: var(--grape); color: #fff; }
.chip__check { font-size: 0.9em; opacity: 0; transition: opacity 0.15s; }
.chip[aria-pressed='true'] .chip__check { opacity: 1; }

.grade-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grade-select {
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.6em 2.2em 0.6em 1em;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.grade-select:focus { outline: 3px solid var(--sky); outline-offset: 2px; }
.grade-badge {
  font-family: var(--display);
  font-size: 0.72rem;
  background: var(--grape);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.4em 0.9em;
}

.name-row { display: flex; gap: 12px; flex-wrap: wrap; }
.name-input {
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  flex: 1 1 200px;
  padding: 0.7em 1em;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.name-input:focus { outline: 3px solid var(--sky); outline-offset: 2px; }

.setup-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.diff-help { font-size: 0.82rem; color: #55608A; margin-top: 8px; line-height: 1.4; }

/* ============================================================
   GAME
   ============================================================ */

#screen-game { flex-direction: column; overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  flex-wrap: wrap;
  background: rgba(19, 26, 51, 0.9);
  border-bottom: 3px solid rgba(255, 244, 220, 0.2);
  flex: 0 0 auto;
}

.stat {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: var(--ink-soft);
  border: 3px solid var(--cream);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  white-space: nowrap;
}
.stat b { color: var(--sun); font-family: var(--display); }

.hp-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; }

.hp-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 244, 220, 0.1);
  border: 2px solid rgba(255, 244, 220, 0.35);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-size: 0.76rem;
  font-weight: 600;
}
.hp-chip.is-turn {
  border-color: var(--sun);
  background: rgba(255, 197, 49, 0.18);
  box-shadow: 0 0 0 2px rgba(255, 197, 49, 0.3);
}
.hp-chip.is-dead { opacity: 0.4; text-decoration: line-through; }
.hp-chip__dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); flex: 0 0 auto; }
.hp-chip__bar { width: 46px; height: 7px; background: rgba(0, 0, 0, 0.45); border-radius: 4px; overflow: hidden; }
.hp-chip__fill { height: 100%; background: var(--lime); transition: width 0.3s ease; }

.topbar__spacer { flex: 1 1 auto; }

/* stage */
.stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  min-height: 0;
}

.stage__frame {
  position: relative;
  width: 100%;
  max-width: min(1100px, calc((100vh - 240px) * 1.7778));
  aspect-ratio: 16 / 9;
  border: var(--edge) solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(255, 244, 220, 0.25);
  background: #1B2A5E;
}

#battlefield { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* ---------- quiz overlay ---------- */

.quiz {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 3% 4%;
  background: rgba(19, 26, 51, 0.86);
  backdrop-filter: blur(3px);
}
.quiz.active { display: flex; animation: quizIn 0.28s ease both; }

@keyframes quizIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.quiz__banner {
  font-family: var(--display);
  font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  letter-spacing: 0.08em;
  background: var(--pink);
  color: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.35em 1.2em;
  box-shadow: 0 4px 0 var(--ink);
  animation: dropIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.quiz__subject {
  font-family: var(--display);
  font-size: clamp(0.55rem, 1.2vw, 0.7rem);
  letter-spacing: 0.1em;
  color: var(--ink);
  background: var(--sun);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  border: 2px solid var(--ink);
}

.quiz__prompt {
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(1.05rem, 3.1vw, 2rem);
  line-height: 1.25;
  text-align: center;
  color: var(--cream);
  max-width: 90%;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, 0.5);
  animation: dropIn 0.4s 0.06s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.quiz__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 16px);
  width: min(760px, 100%);
}

.choice {
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(0.9rem, 2.2vw, 1.35rem);
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 14px;
  padding: clamp(0.55em, 1.6vw, 0.85em) 0.8em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7em;
  text-align: left;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  animation: dropIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  min-height: 2.6em;
}
.choice:nth-child(1) { animation-delay: 0.10s; }
.choice:nth-child(2) { animation-delay: 0.16s; }
.choice:nth-child(3) { animation-delay: 0.22s; }
.choice:nth-child(4) { animation-delay: 0.28s; }
.choice:hover:not(:disabled) { background: #fff; transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.choice:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.choice:disabled { cursor: default; }
.choice__key {
  font-family: var(--display);
  font-size: 0.75em;
  background: var(--ink);
  color: var(--cream);
  border-radius: 8px;
  width: 1.9em;
  height: 1.9em;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.choice.is-right { background: var(--lime); }
.choice.is-right .choice__key { background: #3F7A17; }
.choice.is-wrong { background: var(--coral); color: #fff; }
.choice.is-wrong .choice__key { background: #8E2A16; }
.choice.is-dim { opacity: 0.45; }

.quiz__feedback {
  font-family: var(--display);
  font-size: clamp(0.8rem, 2.2vw, 1.3rem);
  text-align: center;
  min-height: 1.4em;
  padding: 0 12px;
}
.quiz__feedback small {
  display: block;
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.68em;
  letter-spacing: 0;
  opacity: 0.9;
  margin-top: 4px;
}
.quiz__hint {
  font-size: clamp(0.75rem, 1.8vw, 0.95rem);
  color: var(--sun);
  text-align: center;
  font-style: italic;
  max-width: 90%;
  line-height: 1.35;
}

/* The answer card waits for a click — nothing here is on a timer. */
.quiz__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 1px;
}
.quiz__actions:empty { display: none; }
.quiz__actions .btn {
  font-size: clamp(0.75rem, 1.9vw, 1rem);
  padding: 0.6em 1.3em;
  animation: dropIn 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

/* ---------- turn banner ---------- */

.turn-banner {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--display);
  font-size: clamp(0.8rem, 2.4vw, 1.4rem);
  padding: 0.5em 1.4em;
  border: var(--edge) solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.turn-banner.show { opacity: 1; animation: dropIn 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

/* ---------- controls ---------- */

.controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 18px);
  padding: 10px 12px 14px;
  flex-wrap: wrap;
}

.dial {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: var(--edge) solid var(--ink);
  border-radius: 16px;
  padding: 6px 8px;
  box-shadow: 0 5px 0 var(--ink);
  color: var(--ink);
}
.dial__label {
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  min-width: 3.6em;
  text-align: center;
  line-height: 1.15;
}
.dial__value {
  font-family: var(--display);
  font-size: 1.15rem;
  min-width: 2.6em;
  text-align: center;
}
.dial__btn {
  font-family: var(--display);
  font-size: 1.05rem;
  width: 2em;
  height: 2em;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.dial__btn:hover { background: var(--ink-soft); }
.dial__btn:active { transform: scale(0.9); }

.power-meter {
  width: 70px;
  height: 10px;
  background: rgba(19, 26, 51, 0.2);
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid var(--ink);
}
.power-meter__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--sun), var(--coral));
  transition: width 0.1s linear;
}

.fire-btn {
  font-family: var(--display);
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  letter-spacing: 0.06em;
  background: var(--pink);
  color: var(--cream);
  border: var(--edge) solid var(--ink);
  border-radius: 16px;
  padding: 0.55em 1.5em;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s, filter 0.2s;
}
.fire-btn:hover:not(:disabled) { background: #FF5C8F; }
.fire-btn:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.fire-btn:disabled { filter: grayscale(0.75); opacity: 0.5; cursor: not-allowed; }
.fire-btn.ready { animation: pulseFire 1.1s ease-in-out infinite; }

@keyframes pulseFire {
  0%, 100% { box-shadow: 0 6px 0 var(--ink), 0 0 0 0 rgba(255, 61, 119, 0.55); }
  50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 14px rgba(255, 61, 119, 0); }
}

.shell-badge {
  font-family: var(--display);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.4em 0.9em;
  background: var(--sun);
  color: var(--ink);
  white-space: nowrap;
}

.hint-line {
  width: 100%;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 244, 220, 0.65);
}
.hint-line kbd {
  font-family: var(--display);
  font-size: 0.85em;
  background: rgba(255, 244, 220, 0.15);
  border: 1px solid rgba(255, 244, 220, 0.4);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ============================================================
   RESULT
   ============================================================ */

#screen-result {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;   /* see the note on #screen-title */
  padding: 24px;
  gap: 20px;
  text-align: center;
}

.result__title {
  font-family: var(--display);
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: 1;
  animation: dropIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.result__title.win { color: var(--lime); text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--sun); }
.result__title.lose { color: var(--coral); text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--pink); }

.result__sub {
  font-size: clamp(0.95rem, 2.6vw, 1.25rem);
  color: var(--cream);
  animation: dropIn 0.6s 0.1s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.scorecard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  width: min(620px, 100%);
  animation: dropIn 0.6s 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.score-tile {
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--pop) var(--pop) 0 var(--ink);
  padding: 14px 10px;
}
.score-tile__num { font-family: var(--display); font-size: 1.7rem; line-height: 1; }
.score-tile__label { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: #55608A; margin-top: 6px; }

.result-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; animation: dropIn 0.6s 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.medal { font-size: clamp(3rem, 12vw, 5rem); line-height: 1; animation: dropIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 620px) {
  :root { --edge: 3px; --pop: 4px; }
  .quiz__choices { grid-template-columns: 1fr; }
  .dial__label { display: none; }
  .controls { gap: 8px; }
  .hint-line { display: none; }
  .stat { font-size: 0.62rem; }
}

@media (max-height: 620px) {
  .quiz__hint { display: none; }
}

/* Short screens: shrink the hero so the mode cards stay above the fold. */
@media (max-height: 940px) {
  .hero__tank { width: min(310px, 62%); }
  #screen-title { gap: 11px; padding-bottom: 18px; }
  .logo__line1, .logo__line2 { font-size: clamp(2.2rem, 9vw, 5rem); }
}
@media (max-height: 820px) {
  .hero__tank { width: min(330px, 62%); }
  #screen-title { gap: 11px; padding-top: 12px; }
  .logo__line1, .logo__line2 { font-size: clamp(2.2rem, 8vw, 4.4rem); }
}
@media (max-height: 700px) {
  .hero__tank { width: min(240px, 48%); }
  #screen-title { gap: 8px; }
  .mode-card { padding: 14px 12px; }
  .mode-card__icon { font-size: 2rem; }
}
@media (max-height: 600px) {
  .hero__tank { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================================================
   TITLE EXTRAS
   ============================================================ */

.rp-banner {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  animation: dropIn 0.7s 0.18s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.rp-banner__chip {
  font-size: 0.82rem;
  background: rgba(255, 244, 220, 0.12);
  border: 2px solid rgba(255, 244, 220, 0.4);
  border-radius: 999px;
  padding: 0.3em 0.9em;
}
.rp-banner__chip b { color: var(--sun); font-family: var(--display); font-size: 0.95em; }

.title-actions { animation: dropIn 0.7s 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

.mode-grid { width: min(940px, 100%); }
.mode-card--special {
  background: linear-gradient(150deg, #FFF4DC 60%, #FFE0F0 100%);
  position: relative;
}
.mode-card--special::after {
  content: 'NEW';
  position: absolute; top: -10px; right: -8px;
  font-family: var(--display); font-size: 0.6rem;
  background: var(--pink); color: var(--cream);
  border: 3px solid var(--ink); border-radius: 999px;
  padding: 0.25em 0.6em;
  transform: rotate(8deg);
}

/* ============================================================
   GARAGE
   ============================================================ */

#screen-garage, #screen-campaign {
  flex-direction: column;
  padding: 18px clamp(12px, 3vw, 28px) 40px;
  gap: 14px;
}

.garage-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: 100%;
}
.screen-title {
  font-family: var(--display);
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink);
}
.rp-pill {
  font-size: 0.8rem;
  background: var(--ink-soft);
  border: 3px solid var(--cream);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  white-space: nowrap;
}
.rp-pill b { font-family: var(--display); color: var(--sun); }
.rp-pill.is-warn b { color: var(--sun); }
.rp-pill.is-hot { border-color: var(--pink); }
.rp-pill.is-hot b { color: var(--pink); }

.garage-hint, .camp-msg {
  font-size: 0.86rem;
  color: rgba(255, 244, 220, 0.75);
  max-width: 900px;
}
.camp-msg strong { color: var(--sun); }

.country-block { margin-bottom: 26px; }
.country-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.country-name {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--cream);
}
.country-motto { font-size: 0.8rem; color: rgba(255, 244, 220, 0.6); font-style: italic; }

.tank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}

.tank-card {
  background: var(--cream);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tank-card.is-locked { background: #DED3BC; }
.tank-card.is-selected {
  box-shadow: 5px 5px 0 var(--ink), 0 0 0 4px var(--lime);
}
.tank-card__top { display: flex; align-items: center; gap: 8px; }
.tank-card__tier {
  font-family: var(--display); font-size: 0.6rem;
  background: var(--ink); color: var(--cream);
  border-radius: 6px; padding: 0.25em 0.5em;
}
.tank-card__name { font-family: var(--display); font-size: 0.92rem; line-height: 1.1; }
.tank-card__gun {
  font-size: 0.74rem; font-weight: 600;
  background: var(--ink); color: var(--sun);
  border-radius: 999px; padding: 0.2em 0.7em;
  align-self: flex-start;
}
.tank-card__gun.is-ap { color: #B8ECFF; }
.tank-card__blurb { font-size: 0.75rem; color: #55608A; line-height: 1.3; min-height: 2.4em; }

.tank-art { width: 100%; height: 54px; display: block; }

.stat-rows { display: grid; gap: 3px; }
.stat-row { display: grid; grid-template-columns: 46px 1fr 26px; align-items: center; gap: 6px; font-size: 0.62rem; }
.stat-row__label { letter-spacing: 0.04em; color: #55608A; text-transform: uppercase; font-weight: 600; }
.stat-row__track { height: 7px; background: rgba(19, 26, 51, 0.16); border-radius: 4px; overflow: hidden; }
.stat-row__fill { height: 100%; border-radius: 4px; }
.stat-row__num { font-family: var(--display); font-size: 0.62rem; text-align: right; }

.tank-card__badges { display: flex; gap: 5px; flex-wrap: wrap; }
.mini-badge {
  font-size: 0.6rem; font-weight: 700;
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 0.15em 0.5em; background: #fff;
}
.mini-badge--sloped { background: var(--sky); }
.mini-badge--ap { background: var(--grape); color: #fff; }

.tank-card__action { margin-top: auto; }
.tank-btn {
  width: 100%;
  font-family: var(--display); font-size: 0.7rem;
  border: 3px solid var(--ink); border-radius: 10px;
  padding: 0.55em; cursor: pointer;
  background: var(--lime); color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.tank-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.tank-btn--buy { background: var(--sun); }
.tank-btn--poor { background: #B9AF9A; cursor: not-allowed; color: #5A5344; }
.tank-btn--selected { background: var(--ink); color: var(--lime); cursor: default; }

/* tank picker strip on the setup screen */
.tank-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.tank-pick {
  flex: 0 0 auto;
  border: 3px solid var(--ink); border-radius: 12px;
  background: #fff; padding: 7px 10px; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  text-align: center; min-width: 118px;
}
.tank-pick[aria-pressed='true'] { background: var(--lime); }
.tank-pick__name { font-family: var(--display); font-size: 0.7rem; line-height: 1.15; }
.tank-pick__gun { font-size: 0.66rem; color: #55608A; font-weight: 600; }

/* ============================================================
   CAMPAIGN MAP
   ============================================================ */

.map-wrap {
  width: 100%;
  max-width: 1100px;
  border: var(--edge) solid var(--ink);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 80% 60% at 30% 20%, #24407A 0%, transparent 60%),
    #16224A;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45), inset 0 0 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
#world-map { display: block; width: 100%; height: auto; }

.cont-shape {
  stroke: #0E1530;
  stroke-width: 4;
  transition: fill-opacity 0.3s;
}
.cont-label {
  font-family: var(--display);
  font-size: 15px;
  fill: rgba(255, 244, 220, 0.55);
  text-anchor: middle;
  pointer-events: none;
}
.cont-label--owned { fill: var(--lime); }

.route-line { stroke: rgba(255, 244, 220, 0.22); stroke-width: 3; stroke-dasharray: 6 7; }

.city { cursor: default; }
.city__ring { fill: none; stroke-width: 4; }
.city__dot { stroke: #0E1530; stroke-width: 3.5; }
.city__name {
  font-family: var(--body); font-weight: 600; font-size: 14px;
  fill: var(--cream); text-anchor: middle;
  paint-order: stroke; stroke: rgba(14, 21, 48, 0.9); stroke-width: 4;
}
.city--you .city__dot { fill: var(--lime); }
.city--foe .city__dot { fill: #FF5C8A; }
.city--target { cursor: pointer; }
.city--target .city__dot { fill: var(--sun); }
.city--target .city__ring { stroke: var(--sun); animation: cityPulse 1.4s ease-in-out infinite; }
.city--target:hover .city__dot { fill: #FFE566; }
.city--danger .city__ring { stroke: var(--pink); animation: cityPulse 0.8s ease-in-out infinite; }
.city--danger .city__dot { fill: var(--pink); }

@keyframes cityPulse {
  0%, 100% { r: 17; opacity: 0.9; }
  50% { r: 25; opacity: 0.25; }
}

.city__wave {
  font-family: var(--display); font-size: 11px;
  fill: var(--ink); text-anchor: middle; pointer-events: none;
}

.camp-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 0.78rem; color: rgba(255, 244, 220, 0.75);
}
.camp-legend .dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px;
}
.dot--you { background: var(--lime); }
.dot--foe { background: #FF5C8A; }
.dot--target { background: var(--sun); }
.dot--danger { background: var(--pink); }

/* ============================================================
   DRIVE CONTROL
   ============================================================ */

.dial--move .dial__btn { background: var(--ink-soft); }
.move-meter {
  width: 58px; height: 10px;
  background: rgba(19, 26, 51, 0.2);
  border: 2px solid var(--ink);
  border-radius: 5px; overflow: hidden;
}
.move-meter__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sky), var(--lime));
  transition: width 0.12s linear;
}
.move-meter__fill.is-low { background: var(--coral); }
.dial--move.is-broken { opacity: 0.45; }
.dial--move.is-broken .move-meter__fill { background: #8A8A96; }

@media (max-width: 720px) {
  .tank-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .camp-legend { font-size: 0.7rem; gap: 10px; }
}
