/* Mobile first. Sword / Shield's white status plates and command silhouettes. */
:root {
  --ink: #20222a;
  --ground: #e9eaec;
  --muted: #666b75;
  --red: #e93158;
  --blue: #1686b1;
  --gold: #f6d24a;
  --display: 'Avenir Next Condensed', 'Arial Narrow', Impact, sans-serif;
  --text: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--ground); font-family: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { border: 0; touch-action: manipulation; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
input, select { min-width: 0; border-radius: 0; }
.site-header { height: 48px; max-width: 1080px; margin: auto; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { text-decoration: none; display: flex; align-items: center; min-width: 44px; min-height: 44px; color: var(--ink); }
.brand-mark { width: 25px; height: 25px; border: 2px solid currentColor; border-radius: 50%; position: relative; display: block; flex: none; transform: rotate(-30deg); }
.brand-mark:before { content: ''; position: absolute; top: 9px; left: 0; right: 0; border-top: 2px solid currentColor; }
.brand-mark:after { content: ''; position: absolute; width: 7px; height: 7px; background: var(--ground); border: 2px solid currentColor; border-radius: 50%; left: 5px; top: 5px; }
.header-actions { display: flex; gap: 4px; }
.icon-button { height: 44px; min-width: 44px; padding: 0 10px; background: transparent; color: var(--ink); font-size: 11px; font-weight: 800; }
.help-button { font: 900 21px var(--display); }
.primary-button { width: 100%; min-height: 52px; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--ink); color: white; border-radius: 28px 0 0 28px; font-size: 17px; font-weight: 800; text-align: left; transition: background .15s, transform .15s; }
.primary-button b { font-size: 18px; color: var(--red); }
button:active:not(:disabled) { transform: translateY(2px); }
.text-button { min-height: 44px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; padding: 8px 12px; }
.secondary-button { min-height: 48px; padding: 12px 18px; background: var(--ground); color: var(--ink); font-weight: 700; border-radius: 24px 0 0 24px; }
.stadium-backdrop { position: absolute; inset: 0; background: #203c4b url('assets/stadium.webp') center 58% / cover no-repeat; }
/* Compact title: the artwork carries the atmosphere instead of a slogan. */
.home-screen { max-width: 500px; margin: auto; padding: 4px 16px 24px; }
.title-stage { position: relative; min-height: 200px; overflow: hidden; isolation: isolate; border-right: 6px solid var(--red); }
.title-stage:after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #10222c70, transparent 85%); z-index: 0; }
.title-stage .stadium-backdrop { background-position: center 52%; }
.title-lockup { position: absolute; z-index: 1; left: 17px; top: 26px; display: flex; flex-direction: column; align-items: flex-start; transform: rotate(-5deg); transform-origin: left center; }
.title-lockup span { background: white; color: var(--ink); padding: 4px 11px; font-size: 19px; font-weight: 800; letter-spacing: 1px; box-shadow: 4px 4px 0 #20222a; }
.title-lockup strong { margin-top: 7px; background: var(--red); color: white; padding: 4px 11px 7px; font-size: clamp(28px, 8vw, 36px); font-weight: 900; line-height: 1.35; letter-spacing: -1px; box-shadow: 5px 5px 0 #20222a; white-space: nowrap; }
.setup-menu { margin-top: 12px; padding-bottom: 20px; background: white; border-top: 4px solid var(--red); }
.setup-options { padding: 18px 18px 20px; }
.mode-field { padding: 0; margin: 0 0 20px; border: 0; }
.segmented { display: flex; gap: 7px; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 12px; background: #eef0f2; border-radius: 26px 0 0 26px; font-weight: 800; font-size: 14px; }
.segmented input:checked + span { color: white; background: var(--ink); box-shadow: inset 4px 0 var(--red); }
.segmented input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 3px; }
.name-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.name-fields.single-player { grid-template-columns: 1fr; }
.player-a { --player-color: var(--red); }
.player-b { --player-color: var(--blue); }
.name-field > span { display: block; margin-bottom: 6px; color: var(--player-color); font-size: 11px; font-weight: 700; }
.name-field input { width: 100%; height: 44px; padding: 8px; border: 0; border-bottom: 3px solid var(--player-color); background: #f2f3f5; color: var(--ink); font-size: 16px; font-weight: 700; }
.name-field input:disabled { color: #747a85; background: #e6e8ec; }
.select-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.question-setting { grid-column: 1 / -1; }
.select-fields > label { color: var(--muted); font-weight: 700; font-size: 11px; }
.select-fields select { display: block; width: 100%; height: 44px; margin-top: 4px; padding: 6px 4px; border: 0; border-bottom: 1px solid #ccd0d6; background: white; color: var(--ink); font-size: 16px; font-weight: 700; }
.setup-start { padding: 0 18px; }
/* Both players have equal-sized tap targets and see the same question. */
.battle-screen { max-width: 900px; margin: auto; padding: 0 12px 16px; }
.battle-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.battle-toolbar .text-button { padding-left: 0; }
.battle-toolbar strong, .battle-toolbar > span { font-size: 11px; }
.battle-toolbar > span { color: var(--muted); }
.arena { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.enemy-panel { grid-column: 1 / -1; margin-bottom: 12px; min-width: 0; }
.enemy-stage { position: relative; height: 100px; overflow: hidden; isolation: isolate; }
.enemy-stage .stadium-backdrop { background-position: center 56%; }
.target-info { position: relative; top: 14px; width: 83%; min-height: 74px; margin-left: auto; padding: 10px 14px 12px 24px; background: white; clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%); }
.target-caption { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.enemy-types { display: flex; gap: 6px; }
.type-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 62px; padding: 8px 16px; background: var(--type-color, #6c7788); color: white; border-radius: 18px 0 0 18px; font-size: 14px; line-height: 1; font-weight: 800; text-shadow: 0 1px 2px #0009; box-shadow: inset 0 -2px #0002; }
.concealed .target-info { visibility: hidden; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; background: #152c3d65; color: white; font: 900 italic 80px/1 var(--display); text-shadow: 4px 4px 0 var(--red); animation: count-in .8s ease-out infinite; }
.round-message { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 50px; padding: 11px 12px 15px; background: var(--ink); color: white; }
.round-message h2 { min-width: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.time-label { font: 900 italic 25px/1 var(--display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.time-label.time-warning { color: #ffb765; }
.timer-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #424651; }
.timer-track > div { height: 100%; background: #70d6ba; transform-origin: left; }
.timer-track .time-warning { background: #ffb765; }
.answer-explanation { padding: 11px 12px; background: var(--gold); color: #332b10; border-bottom: 2px solid #d7b432; line-height: 1.7; overflow-wrap: anywhere; }
.answer-explanation strong { font-size: 12px; }
.revealed .round-message { grid-template-columns: minmax(0, 1fr); }
.player-panel { grid-row: 2; min-width: 0; padding: 0 6px 8px; background: #f6f7f8; border-bottom: 3px solid var(--player-color); }
#panel0 { grid-column: 1; }
#panel1 { grid-column: 2; }
.player-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; min-height: 67px; margin: 0 -6px; padding: 8px 10px; background: white; border-top: 3px solid var(--player-color); }
.player-top > div:first-child { min-width: 0; }
.eyebrow { color: var(--player-color); font: 900 10px/1 var(--display); }
.player-top h2 { margin-top: 3px; min-height: 28px; font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.score { display: flex; align-items: baseline; gap: 2px; }
.score strong { font: 900 italic 31px/1 var(--display); }
.score small { color: var(--muted); font-size: 9px; }
.score-dots { display: flex; gap: 3px; margin-top: 6px; }
.score-dots i { flex: 1; height: 4px; transform: skew(-20deg); background: #d5d9df; }
.score-dots .earned { background: var(--player-color); }
.player-status { display: flex; align-items: center; min-height: 16px; color: #6b3b42; font-size: 9px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.type-button { position: relative; display: flex; align-items: center; min-width: 0; min-height: 44px; padding: 0 7px 0 9px; background: white; color: var(--ink); border-radius: 23px 0 0 23px; border-bottom: 2px solid #d9dce1; border-right: 4px solid var(--type-color); font-size: 11px; font-weight: 800; letter-spacing: -.3px; transition: background .13s, color .13s, transform .13s; }
.type-button > span { min-width: 0; white-space: nowrap; }
.type-button:disabled { color: #808693; background: #e8eaee; border-bottom-color: #e0e3e8; }
.type-button.rejected { background: #dbdee5; text-decoration: line-through; }
.button-multiplier { font: 900 13px/1 var(--display); }
.revealed .type-button { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; min-height: 46px; padding-left: 8px; background: white; color: #515864; }
.revealed .type-button.correct { background: var(--gold); color: #332b10; border-bottom-color: #d7b432; }
.revealed .button-multiplier { color: var(--ink); }
.next-button { grid-column: 1 / -1; margin-top: 12px; }
.panel-win .player-top { background: var(--player-color); color: white; animation: win-flash .4s ease-out; }
.panel-win .eyebrow, .panel-win .score small { color: white; }
.panel-miss { animation: miss-shake .25s ease-in-out; }
/* A result is a winner, two scores, and the requested type multipliers. */
.results-screen { max-width: 740px; margin: auto; padding: 8px 16px 24px; }
.victory-banner { position: relative; isolation: isolate; overflow: hidden; min-height: 114px; display: flex; align-items: center; padding: 24px; background: var(--ink); color: white; border-left: 6px solid var(--winner-color, var(--red)); }
.victory-banner:after { content: ''; position: absolute; z-index: -1; inset: 0 -8% 0 auto; width: 36%; background: var(--winner-color, var(--red)); transform: skew(-18deg); }
.victory-banner h1 { font-size: 23px; line-height: 1.6; overflow-wrap: anywhere; }
.result-scores { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 14px 0; }
.result-player { min-width: 0; padding: 14px; background: white; border-top: 4px solid var(--player-color); }
.result-player h2 { min-height: 32px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.result-player > strong { display: block; color: var(--player-color); font: 900 italic 56px/1.1 var(--display); }
.result-player > strong small { margin-left: 4px; color: var(--muted); font: 700 11px var(--text); }
.result-actions { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.review { background: white; }
.review > summary { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 15px; border-bottom: 3px solid var(--ink); font-size: 14px; font-weight: 800; }
.review > summary b { color: var(--red); font-size: 21px; }
.review[open] > summary b { transform: rotate(45deg); }
#review-list { margin: 0; padding: 0; list-style: none; }
.review-round { border-bottom: 1px solid #dce0e5; }
.review-round summary { min-height: 60px; padding: 14px; overflow-wrap: anywhere; }
.review-round summary strong { display: block; font-size: 12px; line-height: 1.7; }
.review-round summary small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.review-round summary::marker { color: var(--red); }
.review-best { display: inline-block; margin: 0 12px 10px; padding: 5px 8px; background: var(--gold); font-size: 10px; font-weight: 700; }
.multiplier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 12px 16px; }
.multiplier-cell { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-width: 0; min-height: 48px; padding: 8px 8px 8px 10px; background: #f0f2f4; border-right: 3px solid var(--type-color); border-radius: 23px 0 0 23px; font-size: 11px; font-weight: 600; }
.multiplier-cell strong { font: 900 13px/1 var(--display); }
.multiplier-cell.best { background: var(--gold); }
dialog { width: calc(100% - 32px); max-width: 480px; max-height: calc(100dvh - 40px); padding: 26px 20px 22px; border: 0; border-top: 5px solid var(--red); background: white; color: var(--ink); box-shadow: 0 18px 60px #0005; }
dialog::backdrop { background: #172333b8; backdrop-filter: blur(4px); }
dialog h2 { margin: 4px 30px 16px 0; font-size: 19px; line-height: 1.6; }
dialog p, dialog li { font-size: 12px; line-height: 1.9; }
dialog p + p { margin-top: 12px; }
dialog ol { padding-left: 20px; }
dialog li { padding: 5px 0; }
.dialog-close { position: absolute; top: 6px; right: 6px; font-size: 22px; }
.rule-example { margin: 16px 0; padding: 12px; background: #f1f3f5; border-left: 4px solid var(--red); font-weight: 700; }
.rule-example small, .small-note { font-size: 10px; color: var(--muted); }
.dialog-actions { display: flex; gap: 10px; margin-top: 24px; }
.dialog-actions > button { flex: 1; font-size: 14px; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
noscript { display: block; padding: 20px; background: var(--red); color: white; }
@keyframes count-in { 0% { opacity: .5; transform: scale(1.08); } 25%, 100% { opacity: 1; transform: scale(1); } }
@keyframes win-flash { 0% { filter: brightness(1.5); } 100% { filter: brightness(1); } }
@keyframes miss-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (max-width: 350px) {
  .site-header { padding: 0 12px; }
  .home-screen, .results-screen { padding-left: 12px; padding-right: 12px; }
  .title-stage { min-height: 180px; }
  .title-lockup { left: 12px; top: 24px; }
  .battle-screen { padding-left: 8px; padding-right: 8px; }
  .arena { column-gap: 10px; }
  .player-top { padding: 8px; gap: 4px; }
  .type-button { font-size: 10px; padding-left: 7px; padding-right: 5px; }
  .multiplier-cell { padding-left: 8px; font-size: 10px; }
}
@media (min-width: 600px) {
  .site-header { height: 60px; padding: 0 24px; }
  .battle-screen { padding: 0 24px 24px; }
  .arena { column-gap: 18px; }
  .battle-toolbar { min-height: 44px; }
  .enemy-stage { height: 170px; }
  .target-info { width: 62%; min-height: 98px; top: 28px; padding: 16px 24px 18px 32px; }
  .type-badge { font-size: 19px; padding: 11px 24px; }
  .round-message { padding: 15px 20px 19px; min-height: 64px; }
  .round-message h2 { font-size: 17px; }
  .time-label { font-size: 30px; }
  .player-panel { padding: 0 12px 12px; }
  .player-top { margin: 0 -12px; padding: 12px 15px; min-height: 78px; }
  .player-top h2 { font-size: 15px; min-height: 30px; }
  .score strong { font-size: 40px; }
  .type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .type-button { min-height: 48px; font-size: 12px; }
  .player-status { min-height: 26px; font-size: 11px; }
  .answer-explanation { padding: 12px 20px; }
  .answer-explanation strong { font-size: 14px; }
  .next-button { max-width: 420px; justify-self: center; }
  .results-screen { padding: 24px; }
  .victory-banner h1 { font-size: 30px; }
  .result-player h2 { font-size: 16px; }
  .result-player > strong { font-size: 68px; }
  .result-actions { flex-direction: row; align-items: center; gap: 14px; }
  .result-actions .primary-button { flex: 1; }
  .result-actions .text-button { white-space: nowrap; }
  .multiplier-cell { flex-direction: row; align-items: center; justify-content: space-between; font-size: 12px; padding: 12px; }
}
@media (min-width: 850px) {
  .home-screen { max-width: 1080px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: stretch; padding: 32px 24px; }
  .title-stage { min-height: 460px; }
  .title-lockup { left: 22px; top: 44px; }
  .title-lockup span { font-size: 24px; }
  .title-lockup strong { font-size: 38px; }
  .title-stage .stadium-backdrop { background-position: 48% center; }
  .setup-menu { margin-top: 0; display: flex; flex-direction: column; justify-content: center; }
  .setup-options { padding: 26px; }
  .setup-start { padding: 0 26px; }
}
@media (hover: hover) and (pointer: fine) {
  .icon-button:hover { background: #d9dce1; }
  .primary-button:hover { background: var(--red); }
  .primary-button:hover b { color: white; }
  .text-button:hover { color: var(--red); }
  .type-button:hover:not(:disabled) { background: var(--ink); color: white; border-bottom-color: var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
