:root {
  color-scheme: dark;
  --page: #101b28;
  --panel: #17283a;
  --edge: #395168;
  --text: #f8f5e9;
  --muted: #bdcbd8;
  --accent: #ffd168;
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: radial-gradient(ellipse at 70% 0%, #263b55, var(--page) 30rem); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, select, textarea { color: var(--text); }
button, select { min-height: 2.75rem; border: 1px solid var(--edge); border-radius: .45rem; background: var(--panel); }
button { cursor: pointer; padding: .48rem .8rem; font-weight: 700; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #20222c; border-color: transparent; }
button.primary:hover { background: #ffe1a0; }
:focus-visible { outline: 3px solid #ffe5a2; outline-offset: 3px; }
.shell { width: min(61rem, calc(100% - 1.5rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--edge); }
.mast .shell { display: flex; min-height: 3.35rem; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 850; letter-spacing: .09em; text-decoration: none; }
.mast .back { font-size: .9rem; }
.hero { padding: clamp(1rem, 3vw, 2.35rem) 0 1.1rem; }
.hero h1 { margin: 0; font: 900 clamp(2.55rem, 8vw, 5.3rem)/.95 system-ui, sans-serif; letter-spacing: -.065em; }
.kicker { margin: 0 0 .3rem; color: var(--accent); font: 700 .72rem/1.25 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.hero p:last-child { margin: .65rem 0 0; color: var(--muted); max-width: 42rem; }
.game { border: 1px solid var(--edge); border-radius: .85rem; overflow: hidden; background: #132234; scroll-margin-top: max(12px, var(--career-ad-top, 0px)); }
.pitch-zone { position: relative; background: #17283a; }
.pitch-zone canvas { display: block; width: 100%; height: auto; aspect-ratio: 2; }
.game[data-screen="setup"] canvas { max-height: 16rem; object-fit: cover; object-position: bottom; }
.game[data-screen="playing"] canvas { touch-action: none; }
.scoreboard { display: flex; align-items: center; justify-content: center; gap: .65rem; padding: .42rem .5rem; background: #101a29; color: var(--text); font-size: .82rem; }
.scoreboard span { min-width: 0; text-align: center; overflow-wrap: anywhere; }
.scoreboard #score { color: #0d1d2a; background: #edf0e8; border-radius: .25rem; font: 850 1rem/1.3 ui-monospace, monospace; padding: .25rem .5rem; flex: none; }
.scoreboard #clock { color: var(--accent); font: 750 .82rem/1.3 ui-monospace, monospace; flex: none; }
.game[data-screen="setup"] .scoreboard { display: none; }
.status { position: absolute; inset: 14% .5rem auto; margin: 0 auto; width: fit-content; max-width: 90%; padding: .3rem .75rem; background: #101b28e8; border-radius: .3rem; color: var(--accent); font-weight: 850; }
.status:empty { display: none; }
.pane { padding: .85rem clamp(.7rem, 3vw, 1.25rem) 1rem; }
.pane h2 { margin: 0 0 .4rem; }
.pane p { margin: .4rem 0; }
.setup-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .55rem; margin-bottom: .8rem; }
.setup-grid label { display: grid; align-content: end; gap: .2rem; min-width: 0; font-size: .86rem; color: var(--muted); }
.setup-grid select { width: 100%; padding-inline: .4rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.game-actions { padding: .55rem; justify-content: end; }
.game-actions button { min-height: 2.4rem; }
.touch { display: none; gap: .4rem; padding: .5rem; touch-action: none; }
.touch-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; width: 100%; }
.touch button { min-width: 0; padding: .35rem .15rem; font-size: 1.2rem; touch-action: none; user-select: none; }
.touch button[data-held] { color: var(--page); background: var(--accent); }
.game:not([data-mode="local_2p"]) [data-second] { display: none; }
.result-score { font-weight: 850; font-size: 1.25rem; }
.minor { color: var(--muted); }
.manual { display: grid; gap: .2rem; margin-top: .6rem; }
.manual textarea { width: 100%; min-height: 5rem; background: var(--page); border: 1px solid var(--edge); padding: .45rem; }
.standings { border-collapse: collapse; width: 100%; max-width: 27rem; margin: .6rem 0; }
.standings :is(th,td) { padding: .25rem .35rem; border-bottom: 1px solid var(--edge); text-align: start; overflow-wrap: anywhere; }
.chosen-team { color: var(--accent); }
.guide { max-width: 47rem; margin: 1.6rem 0; }
.guide h2 { margin: 0 0 .55rem; }
.guide p { color: var(--muted); }
.guide details { border-top: 1px solid var(--edge); padding: .6rem 0; }
.guide summary { cursor: pointer; font-weight: 700; }
.languages { display: flex; flex-wrap: wrap; gap: .5rem 1rem; padding-block: .8rem; }
.languages a[aria-current] { color: var(--text); text-decoration: none; }
@media (max-width: 42rem) {
  .setup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-grid label:first-child { grid-column: 1 / -1; }
  .game[data-screen="setup"] { display: flex; flex-direction: column; }
  .game[data-screen="setup"] .pitch-zone { order: 1; }
  .game[data-screen="setup"] canvas { max-height: 8rem; }
}
@media (pointer: coarse), (max-width: 42rem) {
  .touch { display: grid; }
  .game { margin-bottom: max(9.5rem, calc(var(--career-ad-bottom, 0px) + 5rem)); }
}
@media (orientation: landscape) and (max-height: 480px) {
  .game[data-screen="playing"] canvas { max-height: max(120px, calc(50svh - var(--career-ad-top, 0px) * 0.5)); object-fit: contain; }
  .game[data-screen="playing"] .game-actions { padding-block: .2rem; }
  .game[data-screen="playing"] .touch { padding-block: .2rem; }
}
