/* Presentation-only panorama. The question surface is never animated. */
.screen[data-view="game"] { padding: 0; }
.football-stage {
  --stage-night: #07392D;
  --stage-chalk: #F2F1DE;
  --stage-pan-duration: 420ms;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: start;
  justify-items: center;
  align-content: start;
  min-height: calc(100svh - 112px);
  padding: 24px clamp(12px, 3vw, 24px) 32px;
  background: #21734B;
  color: var(--stage-night);
}
.football-stage__world {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
}
.football-stage__pane {
  position: absolute;
  inset: 0;
  overflow: hidden;
  user-select: none;
  transform: translate3d(0, 0, 0);
}
.football-stage__pane[hidden] { display: none; }
.football-stage__pane > svg { display: block; width: 100%; height: 100%; }
.football-stage__foreground {
  --bg: var(--stage-chalk);
  --ink: var(--stage-night);
  --muted: color-mix(in srgb, var(--ink) 84%, var(--bg));
  --rule: color-mix(in srgb, var(--ink) 22%, transparent);
  --control-rule: color-mix(in srgb, var(--ink) 60%, transparent);
  box-sizing: border-box;
  width: min(100%, 500px);
  padding: 24px;
  border: 1px solid rgb(7 57 45 / .2);
  border-radius: 16px;
  background: var(--stage-chalk);
  color: var(--stage-night);
  /* One opaque surface keeps the artwork outside all game states and controls. */
}
.football-stage__foreground input[type="text"] {
  background: var(--stage-chalk);
}
.football-stage__foreground[data-round-status="ready"] {
  padding: clamp(24px, 5vw, 32px);
}
.football-stage__foreground[data-round-status="complete"] {
  padding: clamp(24px, 5vw, 32px);
}
#game-foreground .result { display: grid; gap: 28px; }
#game-foreground .result > * { margin-block: 0; }
#game-foreground .result-actions { gap: 12px; }
#game-foreground .result-actions > .button { margin: 0; }
#game-foreground .stage-feedback { margin-top: 24px; }
#game-foreground .stage-feedback[data-outcome="accepted"] { padding: 20px; }
#game-foreground .stage-feedback > .button { margin-top: 24px; }
#game-foreground .stage-feedback > .other-answers { margin-top: 24px; }
[data-stage-practice]:not(:empty) { margin-top: 20px; }
.football-stage__foreground input[type="text"]::placeholder {
  color: var(--muted);
  opacity: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .football-stage__pane[data-panning="true"] {
    transition: transform var(--stage-pan-duration) cubic-bezier(.22,.68,.18,1);
    will-change: transform;
  }
}
@media (prefers-reduced-motion: reduce) {
  .football-stage__pane { transition: none !important; }
}
@media (max-width: 480px) {
  .football-stage { padding-inline: 12px; }
  .football-stage__foreground { padding: 20px; }
}

.football-stage__foreground .progress { margin-bottom: 12px; }
.football-stage__foreground .question-top { min-height: 48px; margin-bottom: 16px; }
.football-stage__foreground .prompt { font-size: clamp(20px, 5.5vw, 28px); line-height: 1.25; margin-bottom: 12px; }
.football-stage__foreground .scope { font-size: 14px; line-height: 1.45; margin-bottom: 20px; }
.football-stage__foreground #answer-form > label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.football-stage__foreground input[type="text"] { padding: 10px 12px; font-size: 18px; }
.football-stage__foreground .answer-notice { min-height: 0; padding: 8px 0; }
.football-stage__foreground .answer-notice:empty { height: 16px; padding: 0; }
[data-edition-notice] > p { margin-top: 12px; }
.answer-actions { display: flex; align-items: stretch; gap: 8px; }
.answer-actions .button { flex: 1; min-width: 0; min-height: 48px; padding: 10px 12px; font-size: 16px; gap: 8px; }
.answer-actions .pass { flex: none; margin: 0; min-height: 48px; padding: 10px 12px; }
.answer-clock { padding: 4px 8px; border: 2px solid transparent; border-radius: 10px; }
.football-stage__foreground .timer-number { display: block; font-size: 28px; }
.football-stage__foreground .answer-clock > span:last-child { margin-top: 2px; line-height: 1.2; }
.answer-clock[data-urgency="urgent"], .answer-clock[data-urgency="expired"] {
  color: #A52222; border-color: currentColor; background: #F2F1DE;
}
.answer-clock[data-urgency="urgent"] > span:last-child,
.answer-clock[data-urgency="expired"] > span:last-child { color: inherit; }
/* Preserve the mounted form/input; feedback replaces only their visible space. */
.football-stage__foreground[data-round-status="feedback"] #answer-form,
.football-stage__foreground[data-round-status="feedback"] #question-scope,
.football-stage__foreground[data-round-status="feedback"] [data-edition-notice] { display: none; }
.football-stage__foreground [data-stage-feedback]:not([hidden]) {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.feedback-verdict { display: flex; align-items: center; gap: 10px; }
.feedback-symbol {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px;
  border: 2px solid currentColor; border-radius: 50%; font-size: 22px; font-weight: 700; line-height: 1;
}
.stage-feedback[data-outcome="accepted"] {
  padding: 12px; border: 2px solid var(--stage-night); border-radius: 10px; background: #B8E56A;
}
.stage-feedback[data-outcome="accepted"] .feedback-symbol { color: #F2F1DE; background: #07392D; }
.stage-feedback[data-outcome="timeout"] .feedback-verdict { color: #A52222; }
.football-stage__foreground .stage-points {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px;
  margin: 8px 0;
  font-size: 36px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -.03em;
}
.football-stage__foreground .stage-points span {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}
.football-stage__foreground .stage-answer { margin-bottom: 8px; font-size: 18px; font-weight: 700; }
.football-stage__foreground .stage-feedback .button { min-height: 48px; margin-top: 12px; font-size: 16px; }
.stage-feedback > .small { margin-top: 8px; }
.stage-feedback .report-question { margin-top: 8px; }
.football-stage__foreground [data-stage-result] .final-score { font-size: 64px; margin-block: 20px; }
@media (max-height: 700px) {
  .football-stage { padding-block: 8px 16px; }
  .football-stage__foreground { padding: 12px 14px; }
  .football-stage__foreground .progress { margin-bottom: 8px; }
  .football-stage__foreground .question-top { margin-bottom: 8px; }
  .football-stage__foreground .timer-number { font-size: 24px; }
  .football-stage__foreground .scope { margin-bottom: 12px; }
  .football-stage__foreground [data-stage-feedback]:not([hidden]) { margin-top: 10px; padding-top: 10px; }
  .football-stage__foreground .stage-points { margin-block: 4px; }
  .football-stage__foreground .stage-feedback .button { margin-top: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .stage-feedback[data-outcome="accepted"] .feedback-symbol { animation: answer-confirmed 320ms ease-out; }
}
@keyframes answer-confirmed { from { transform: scale(.65); } to { transform: scale(1); } }

/* A wider, top-aligned playing surface leaves room for the original panorama. */
@media (min-width: 1024px) {
  .screen[data-view="game"] { display: flex; flex-direction: column; }
  .football-stage {
    flex: 1;
    min-height: 0;
    padding: 24px 48px 32px;
  }
  .football-stage__foreground {
    width: min(100%, 640px);
    padding: 24px 32px;
  }
  .football-stage__foreground .scope { max-width: 52ch; }
}
@media (min-width: 1024px) and (max-height: 800px) {
  .football-stage { padding-block: 24px 32px; }
  .football-stage__foreground { padding-block: 24px; }
}

.feedback-symbol svg { display: block; width: 22px; height: 22px; }

/* Reports need a calm reading surface; active questions retain the panorama. */
.football-stage__foreground [data-stage-result] .final-score { margin-block: 16px; }
.football-stage__foreground .result-actions .button { font-size: 15px; padding-inline: 10px; }
@media(min-width:768px) and (max-width:1023px) { .football-stage__foreground { width: min(100%,640px); padding: 24px 28px; } }

/* During a phone round, the clock and answer actions take priority over site
   navigation. Sticky controls stay inside the ordinary document/form flow.
   VisualViewport offsets account for a keyboard that leaves the layout viewport
   unchanged; absent that API (or during pinch zoom), native scrolling remains. */
@media (max-width: 767px), (max-height: 500px) and (max-width: 1023px) {
  /* Keep this header the same height through Ready, play and feedback. */
  #app:has(.football-stage__foreground:not([data-round-status="complete"])) > .site-header {
    position: static; flex-wrap: nowrap; gap: 12px; padding-block: 8px;
  }
  #app:has(.football-stage__foreground:not([data-round-status="complete"])) .brand-mark { font-size: clamp(17px, 4.8vw, 22px); }
  #app:has(.football-stage__foreground:not([data-round-status="complete"])) .primary-nav {
    display: flex; flex-basis: auto; gap: 16px;
  }
  #app:has(.football-stage__foreground:not([data-round-status="complete"])) .primary-nav [data-dialog]:not([data-dialog="rules"]) { display: none; }
  #app:has(.football-stage__foreground:not([data-round-status="complete"])) .primary-nav .game-exit { display: block; }
  .football-stage__foreground[data-round-status="active"] .question-top {
    position: sticky;
    top: var(--stage-visible-top, 0px);
    z-index: 2;
    min-height: 44px;
    padding-block: 6px;
    background: var(--stage-chalk);
  }
  .football-stage__foreground[data-round-status="active"] .answer-actions {
    position: sticky;
    bottom: var(--stage-hidden-bottom, 0px);
    z-index: 1;
    padding-block: 8px max(8px, env(safe-area-inset-bottom, 0px));
    background: var(--stage-chalk);
  }
  /* Reserve both sticky bars when the browser reveals a focused field/choice. */
  .football-stage__foreground[data-round-status="active"] :is(#answer, .candidate, .candidate input) {
    scroll-margin-block-start: calc(var(--stage-visible-top, 0px) + 4rem);
    scroll-margin-block-end: calc(var(--stage-hidden-bottom, 0px) + 4.5rem + env(safe-area-inset-bottom, 0px));
  }
  .football-stage__foreground .question-top .eyebrow { font-size: 13px; }
  .football-stage__foreground .answer-clock { display: flex; align-items: baseline; gap: 4px; padding: 4px 6px; }
  .football-stage__foreground .answer-clock .timer-number { font-size: 24px; }
  .football-stage__foreground .answer-clock > span:last-child { margin: 0; }
  .football-stage__foreground .correction { margin: 8px 0 12px; }
  .football-stage__foreground .correction legend { font-size: 14px; margin-bottom: 6px; }
  .football-stage__foreground .correction > .small { font-size: 12px; line-height: 1.4; margin-bottom: 8px; }
  .football-stage__foreground .candidate { min-height: 48px; padding: 6px 10px; margin-bottom: 6px; gap: 10px; }
  .football-stage__foreground .candidate strong { font-size: 16px; line-height: 1.2; }
  .football-stage__foreground .candidate small { font-size: 12px; line-height: 1.3; }
}
