/* Maths Battle's own look, over the shared layout in application.css and arcade.css (this loads last). Chunky slab
   type for the title, headings, scores and the questions themselves; everything else in Lexend. Cards, buttons and
   keys are "stickers": a thick ink outline and a hard shadow, and buttons and keys press down into their shadow */

:root {
  --edge: 3px solid var(--line);
  --lift: 4px 4px 0 var(--shadow);
  --lift-small: 3px 3px 0 var(--shadow);
}

/* ── Type ─────────────────────────────────────────── */

.app-shell :is(.heading, .settings__heading, .ui-home__heading, .ui-header__hello, .home-action__label, .dialog__title,
  .card__number, .live-code, .group-code__code, .test__score, .test__right, .test__seconds, .question, .answer,
  .leaderboard__score, .leaderboard__rank, .stats dd, .score-pop, .result__score) {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}
.app-shell .heading { font-size: clamp(32px, 6vw, 46px); line-height: 1.05; }
.app-shell .settings__heading { font-size: 20px; }
.app-shell .heading .icon { width: 0.9em; height: 0.9em; vertical-align: -0.08em; }

/* ── The title: crossed swords, then MATHS in ink and BATTLE in blaze orange, outlined, with a hard shadow ── */

.ui-brand, .logo { gap: 0.25em; font-family: var(--font-display); font-weight: 400; letter-spacing: 0; text-transform: uppercase; }
.app-shell .ui-brand { font-size: clamp(26px, 8.6vw, 58px); white-space: nowrap; }
.ui-brand__mark, .logo__mark { width: 1em; height: 1em; flex: none; filter: drop-shadow(3px 3px 0 var(--shadow)); }
.ui-brand__minute, .logo__minute {
  margin-left: 0.22em;
  color: var(--pink);
  -webkit-text-stroke: 0.05em var(--line);
  paint-order: stroke fill;
  text-shadow: 0.06em 0.06em 0 var(--shadow);
}
.logo__word { font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }
.app-shell .ui-home__heading { margin: 0; font-size: clamp(16px, 4.5vw, 30px); text-align: center; }
.app-shell .ui-home__heading span { color: var(--pink-text); }

/* ── Stickers ─────────────────────────────────────── */

.app-shell :is(.ui-actions .home-action, .stats > div, .groups > section, .settings__section, .live-status, .result,
  .group-card, .group-code, .leaderboard__row, .banner, .flash, .save-nudge, .ui-progress, .how-to, .league,
  .group-members, .dialog) {
  border: var(--edge);
  border-radius: var(--radius-big);
  background: var(--paper-alt);
  box-shadow: var(--lift);
}
.app-shell :is(.ui-progress, .how-to) { display: grid; gap: 16px; padding: 22px; }
.app-shell .ui-progress .hint { margin: 0; }
.app-shell .leaderboard__row { border-radius: var(--radius); box-shadow: var(--lift-small); }
.app-shell .leaderboard__row--you { background: var(--ui-soft); }
.app-shell .leaderboard__rank { display: grid; place-items: center; width: 2rem; height: 2rem; border: 2px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 15px; }
.app-shell .leaderboard__rank--1 { background: var(--yellow); color: var(--on-neon); }
.app-shell .leaderboard__rank--2 { background: var(--blue); color: #fff; }
.app-shell .leaderboard__rank--3 { background: var(--pink); color: #fff; }
.app-shell .leaderboard__score { font-size: 20px; }
.app-shell .banner { background: var(--yellow); color: var(--on-neon); font-weight: 700; }
.app-shell .avatar { border: 2px solid var(--line); }

/* The two ways to play, on the home page: big, bright and tilted a touch, like stickers slapped on */
.app-shell .home-actions--modes .home-action { min-height: 170px; transition: transform 120ms, box-shadow 120ms; }
.app-shell .ui-actions .home-action--solo { background: var(--blue); color: #fff; transform: rotate(-1.2deg); }
.app-shell .ui-actions .home-action--battle { background: var(--pink); color: #fff; transform: rotate(1.2deg); }
.app-shell .home-actions--modes .home-action .ui-secondary__description { color: inherit; opacity: 0.92; }
.app-shell .home-actions--modes .home-action .ui-secondary__icon { border: 2px solid var(--line); background: var(--paper-alt); }
.app-shell .home-actions--modes .home-action .home-action__label { font-size: clamp(22px, 5.5vw, 30px); line-height: 1.05; }
.app-shell .home-actions--modes .home-action:hover { transform: rotate(0) translate(-1px, -1px); box-shadow: 6px 6px 0 var(--shadow); }
.app-shell .home-actions--modes .home-action:active { transform: rotate(0) translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }

/* ── Buttons and fields ───────────────────────────── */

.app-shell .button {
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--paper-alt);
  color: var(--ink);
  box-shadow: var(--lift-small);
  font-weight: 700;
  transition: transform 80ms, box-shadow 80ms;
}
.app-shell .button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.app-shell :is(.button--start, .button--go) { background: var(--pink); color: #fff; }
.app-shell .button--start { font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: 0.01em; }
.app-shell .button--blue { background: var(--blue); color: #fff; }
.app-shell .button--share { background: var(--yellow); color: var(--on-neon); }
.app-shell .back-link { padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper-alt); color: var(--ink); font-weight: 600; }
.app-shell :is(.form input[type="text"], .form input[type="password"], .form__select, .group-join__code) { border: var(--edge); border-radius: var(--radius); }
.app-shell .choice__option { border: var(--edge); border-radius: var(--radius); }
.app-shell .choice__option:has(:checked) { border-color: var(--line); background: var(--yellow); color: var(--on-neon); }
.app-shell .live-code, .app-shell .group-code__code { color: var(--pink-text); }

/* ── Header and tab bar ───────────────────────────── */

.app-shell .ui-header__hello { font-size: clamp(26px, 7vw, 36px); }
.app-shell .ui-navigation { border: var(--edge); border-radius: var(--radius-big); background: var(--paper-alt); box-shadow: var(--lift); }
.ui-navigation nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-shell .ui-navigation .site-footer__tab { color: var(--muted); font-weight: 700; }
/* The tab's own colours follow its text (arcade.css), so the gold comes from --ui-hero */
.app-shell .ui-navigation .site-footer__tab[aria-current] { border: 2px solid var(--line); background: var(--ui-hero); color: var(--ui-hero-ink); }

/* ── Find a match ─────────────────────────────────── */

.match__radar { border: var(--edge); background: var(--yellow); box-shadow: var(--lift); }

/* ── The game ─────────────────────────────────────── */

/* The score and clock on top, then the strip with the level, the power-up spinner and the streak, then the
   question, which gets all the room left above the keypad. A battle has its rivals' scores under the strip */
.test { grid-template-rows: auto auto 1fr auto; row-gap: 0.5rem; }
.test--live { grid-template-rows: auto auto auto 1fr auto; }
.app-shell .test__bar { padding: 10px 8px 12px; border-bottom: var(--edge); }
.app-shell .test__score { font-size: 40px; }
.app-shell .test__seconds { font-size: 30px; }
.app-shell .test__count-label { font-family: var(--font); font-weight: 700; }

.test__powers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  height: 3.4rem;
  min-height: 0;
}
.app-shell .test__combo {
  padding: 0.2rem 0.65rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--shadow);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}
.app-shell .test__combo { grid-column: 3; justify-self: end; transform-origin: right center; background: var(--pink); color: #fff; }
.test__spinner { grid-column: 2; border: var(--edge); box-shadow: var(--lift-small); }
.test__spinner-icon { border: 2px solid var(--line); }

/* What a power-up did: over the top of the question, so it takes no room of its own */
.test__stage .test__power-news { position: absolute; top: 0; right: 0; left: 0; z-index: 4; margin: 0; pointer-events: none; }

/* As big as the room allows: the question sized to the stage's own width and height (cqw, cqh), smaller only for
   the longest, like 0.08 × 700 */
/* The top of the stage is kept for what floats up and what a power-up did, so neither covers the question */
.test__stage { justify-content: center; gap: 0.4rem; padding-top: 2.4rem; }
.test .question--current:not(.question--done) { font-size: clamp(2.75rem, min(21cqw, 50cqh), 10rem); line-height: 1; }
.test .question--current.question--long:not(.question--done) { font-size: clamp(2.4rem, min(15cqw, 42cqh), 8rem); }
.test .question--current.question--longer:not(.question--done) { font-size: clamp(2.1rem, min(12cqw, 36cqh), 6.5rem); }
.test .question--done { font-size: clamp(2.5rem, min(14cqw, 26cqh), 5.5rem); }
.test__stage .answer {
  min-width: 3ch;
  height: clamp(2.4rem, min(15cqw, 22cqh), 5.5rem);
  font-size: clamp(2rem, min(13cqw, 19cqh), 4.75rem);
  border-bottom: 7px solid var(--pink);
}
.test__stage .answer--wrong { border-color: var(--wrong); }

/* What floats up rises from the top of the stage, above the question, and fades */
.test__stage .score-pop { top: 1.1rem; font-size: 1.35rem; animation: battle-pop 1.1s ease-out forwards; }
.test__stage .score-pop--lightning { font-size: 1.6rem; }
@keyframes battle-pop {
  0% { opacity: 0; transform: translate(calc(-50% + var(--drift) * 0.2), 0.4rem) scale(0.6); }
  15% { opacity: 1; transform: translate(calc(-50% + var(--drift) * 0.4), 0) scale(1.15); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift) * 0.6), -0.9rem) scale(1); }
}

/* Chunky keys that press down */
.app-shell .test .keypad__key {
  height: clamp(48px, 7dvh, 68px);
  min-height: 48px;
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--paper-alt);
  box-shadow: var(--lift-small);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  transition: transform 60ms, box-shadow 60ms;
}
.app-shell .test .keypad__key:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); background: var(--yellow); color: var(--on-neon); }
.app-shell .test .keypad__key--back { background: var(--paper); }
.app-shell .test .keypad__key--submit { background: var(--pink); color: #fff; font-family: var(--font); font-weight: 800; font-size: 1.05rem; }
.app-shell .test__stop { border: 2px solid var(--line); background: var(--paper-alt); }

/* Short phones: a smaller clock and slimmer keys, so the question keeps its room */
@media (max-height: 740px) {
  .app-shell .test .timer__clock { width: 54px; height: 54px; }
  .app-shell .test__score { font-size: 32px; }
  .app-shell .test__seconds { font-size: 26px; }
  .app-shell .test__bar { padding-block: 6px 8px; }
  .test__powers { height: 3rem; }
  .app-shell .test .keypad__key { height: 46px; min-height: 46px; font-size: 1.6rem; }
  .app-shell .test .keypad__key--submit { height: 40px; min-height: 40px; font-size: 1rem; }
  .test .keypad { gap: 0.4rem; }
}
