:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: #091c24;
  color: #f4f8ef;
  --accent: #d8ff76;
  --panel: #102b34;
  --line: #2b4851;
  --muted: #b6c9c9;
  --ink: #0b231e;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: var(--accent); text-underline-offset: .2em; }
.masthead { max-width: 980px; min-height: 75px; margin: auto; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) 24px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: .94rem; font-weight: 750; }
.brand-dot { display: block; width: 10px; height: 14px; border-radius: 85% 45% 75% 55%; transform: rotate(27deg); background: var(--accent); }
#nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
#main { max-width: 980px; margin: auto; padding: 24px 24px max(32px,env(safe-area-inset-bottom)); }
.hero { position: relative; isolation: isolate; padding: clamp(24px,5vw,50px); overflow: hidden; border-radius: 26px; background: radial-gradient(ellipse at 82% 18%, #226052, transparent 68%), linear-gradient(146deg,#153941,#123039 60%,#0d2530); border: 1px solid #32605c; }
.hero h1 { position: relative; font-size: clamp(2.3rem,8.5vw,5.3rem); letter-spacing: -.073em; line-height: .99; margin: .24em 0 .25em; font-weight: 880; text-wrap: balance; max-width: fit-content; }
.hero p { max-width: 36ch; margin: 0; font-size: clamp(1rem,2.6vw,1.18rem); color: #d6e8df; line-height: 1.55; }
.radar { position: absolute; z-index: -1; pointer-events: none; width: clamp(200px,43vw,430px); aspect-ratio: 1; right: clamp(-52px,-3vw,-12px); top: 50%; transform: translateY(-50%); border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 13%, #a7ead045 13.1% 13.5%, transparent 13.6% 14.4%), conic-gradient(from 36deg,transparent 68%,#7deca130 96%,#a7f99b77 99.6%,transparent); opacity: .74; }
.eyebrow { color: var(--accent); font-size: .77rem; text-transform: uppercase; font-weight: 750; letter-spacing: .12em; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.54fr); gap: 14px; margin-top: 14px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: clamp(16px,3vw,27px); min-width: 0; }
.card + .card { margin-top: 14px; }
.layout > .card + .card { margin-top: 0; }
h1, h2, h3 { line-height: 1.17; margin: 0 0 .6em; }
h2 { letter-spacing: -.035em; font-size: clamp(1.3rem,3vw,1.8rem); }
p { line-height: 1.48; }
.muted { color: var(--muted); }
.eyebrow + h2 { margin-top: .4em; }
.rules { list-style: none; padding: 0; margin: 0; }
.rules li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.rules li:last-child { border-bottom: 0; }
.rules li span { color: var(--muted); }
.buttons { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0 0; }
.primary, .secondary, .quiet { min-height: 46px; border-radius: 11px; padding: 10px 15px; border: 1px solid transparent; font-weight: 710; color: inherit; }
.primary { background: var(--accent); color: var(--ink); }
.secondary { background: #173842; border-color: #41616b; }
.quiet { padding: 6px 10px; min-height: 35px; border-color: var(--line); background: transparent; font-size: .83rem; }
.primary:hover { background: #e4ffa1; }.secondary:hover,.quiet:hover { background: #22505a; }
.game { max-width: 640px; margin: 0 auto; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clock { color: var(--accent); font-weight: 800; font-size: 1.22rem; font-variant-numeric: tabular-nums; }
.clock.urgent { color: #ffc185; }
.meter { display: block; width: 100%; height: 5px; margin: 12px 0 25px; appearance: none; border: 0; border-radius: 99px; background: #2a4951; overflow: hidden; }
.meter::-webkit-progress-bar { background: #2a4951; }.meter::-webkit-progress-value { background: var(--accent); }
.meter::-moz-progress-bar { background: var(--accent); }
.prompt { margin-bottom: 20px; font-weight: 760; font-size: clamp(1.3rem,5vw,2rem); text-wrap: pretty; }
.options { display: grid; gap: 8px; }
.option { min-height: 52px; width: 100%; display: flex; align-items: center; gap: 12px; border: 1px solid #365761; border-radius: 11px; padding: 8px 12px; background: #163642; color: inherit; text-align: left; font-weight: 650; line-height: 1.2; }
.option:hover { background: #22505a; }.option.chosen { border-color: var(--accent); }
.option.answer-correct { border-color: #65e6a3; background: #123e32; color: #eafff2; box-shadow: inset 4px 0 #65e6a3; }
.option.answer-wrong { border-color: #ff8d8d; background: #4a292d; color: #fff0ef; box-shadow: inset 4px 0 #ff8d8d; }
.option.answer-correct .letter { color: #8ff2ba; background: #0d3027; }
.option.answer-wrong .letter { color: #ffaaaa; background: #3a2226; }
.answer-feedback { margin: 14px 0 6px; padding: 10px 12px; border-radius: 9px; font-weight: 800; }
.answer-feedback.is-correct { color: #b5ffd1; background: #123e32; border: 1px solid #65e6a3; }
.answer-feedback.is-wrong { color: #ffd0ce; background: #4a292d; border: 1px solid #ff8d8d; }
.answer-feedback.is-timeout { color: #ffe0aa; background: #46351f; border: 1px solid #e7b45e; }
.letter { display: grid; place-items: center; flex: 0 0 29px; height: 29px; color: var(--accent); background: #0d2933; border-radius: 6px; }
.score { display: block; font-size: clamp(2rem,7vw,3.6rem); font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: -.06em; color: var(--accent); line-height: 1.1; }
.field { display: grid; gap: 6px; margin: 10px 0; }
input, textarea, select { max-width: 100%; color: inherit; border-radius: 8px; border: 1px solid #47646a; background: #0b232b; padding: 9px 10px; }
textarea { width: 100%; min-height: 220px; }
.tournament-panel { margin-top: 14px; }
.stage-track { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.stage-card { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 13px; border: 1px solid #36535b; border-top: 3px solid #54717a; border-radius: 12px; background: #0c242c; }
.stage-card[data-phase="open"], .stage-card[data-phase="tiebreak"] { border-top-color: var(--accent); background: #15352e; }
.stage-card[data-phase="confirmed"] { border-top-color: #7bceae; }
.stage-card[data-phase="review"] { border-top-color: #ffc781; }
.stage-name { letter-spacing: -.02em; overflow-wrap: anywhere; }
.stage-state { min-height: 1.2em; font-size: .76rem; font-weight: 740; color: #c2d7d8; }
.stage-card[data-phase="open"] .stage-state, .stage-card[data-phase="tiebreak"] .stage-state { color: var(--accent); }
.stage-detail { color: var(--muted); font-size: .83rem; }
.stage-card .quiet { justify-self: start; margin-top: 2px; min-height: 44px; }
.standings-filter { max-width: 400px; font-size: .87rem; }
.standings-filter select { min-height: 44px; }
.standings-metrics { grid-template-columns: repeat(auto-fit,minmax(92px,1fr)); margin: 16px 0; }
.standings-metrics .metric { font-size: .83rem; }
.own-standing { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 11px 13px; border: 1px solid #698951; border-radius: 10px; background: #183b30; line-height: 1.35; }
.own-standing strong { color: var(--accent); }
.own-standing .quiet { min-height: 44px; }
.standings-note { font-size: .87rem; color: var(--muted); }
.standings { width: 100%; table-layout: fixed; border-spacing: 0; border: 1px solid #3d626c; border-radius: 12px; overflow: hidden; text-align: left; font-variant-numeric: tabular-nums; }
.standings th, .standings td { padding: 10px 12px; }
.standings thead th { background: #244b55; color: #effaf4; font-size: .85rem; }
.standings thead th:first-child { width: 14%; }
.standings thead th:nth-child(3) { width: 16%; }
.standings thead th:last-child { width: 29%; }
.standings tbody tr:nth-child(odd) { background: #112f38; }
.standings tbody tr:nth-child(even) { background: #15363f; }
.standings tbody tr[data-own="true"] { background: #29483c; }
.standings tbody tr + tr > * { border-top: 1px solid #38535a; }
.table-name { color: #f4f8ef; font-weight: 720; overflow-wrap: anywhere; }
.table-name small { display: block; color: #bed5d3; font-size: .75rem; font-weight: 500; margin-top: 4px; }
.table-place, .table-score { font-weight: 800; }
.standings .table-place { box-shadow: inset 3px 0 var(--qualification-color, transparent); }
.standings tr[data-result="advanced"] { --qualification-color: #72d59b; }
.standings tr[data-result="tiebreak"], .standings tr[data-result="winner"] { --qualification-color: #f2c46d; }
.table-score { white-space: nowrap; }
.result-chip { display: inline-block; background: #2d4850; color: #e6f0ee; border-radius: 5px; padding: 4px 6px; font-size: .79rem; font-weight: 700; }
[data-result="advanced"] .result-chip { background: #244a37; color: #cdf8da; }
[data-result="tiebreak"] .result-chip, [data-result="winner"] .result-chip { background: #594624; color: #ffe4a6; }
.page-position { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
details { padding: 10px 0; border-top: 1px solid var(--line); }
summary { cursor: pointer; color: #d8eee6; }
.review { padding-left: 1.25em; }.review li { margin: 12px 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 10px; }
.metric { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }.metric strong { display: block; font-size: 1.4rem; color: var(--accent); }
#notice { position: fixed; z-index: 2; bottom: max(16px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); color: #0d2925; background: var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: 0 4px 18px #0005; }
#notice:empty { display: none; }
@media(max-width:640px) {
  .masthead { min-height: 57px; padding-inline: 13px; }
  #main { padding: 12px 12px max(22px,env(safe-area-inset-bottom)); }
  .layout { grid-template-columns: 1fr; }
  .stage-track { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .standings th, .standings td { padding: 8px 5px; font-size: .82rem; }
  .standings thead th { font-size: .75rem; }
  .standings thead th:last-child { width: 31%; }
  .result-chip { font-size: .72rem; }
  .hero { border-radius: 18px; }.radar { right: -84px; opacity: .48; }
  .game .card { padding: 13px; }
}
@media(prefers-reduced-motion:no-preference) {
  .option, .meter::-webkit-progress-value { transition: background .12s, width .15s linear; }
}

.qualifier-countdown { margin-top:14px; padding:20px 24px; border:1px solid #668b54; border-radius:18px; background:#153b30; display:grid; gap:7px; }
.qualifier-countdown-label { color:#d8eee0; font-weight:700; }
.qualifier-countdown-value { color:var(--accent); font-size:clamp(1.5rem,5vw,3rem); line-height:1.15; font-variant-numeric:tabular-nums; }
.qualifier-countdown-end { color:var(--muted); font-size:.88rem; }
