:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #15352d;
  background: #f4f8f3;
  font-synthesis: none;
  --green: #176748;
  --muted: #4e665c;
  --border: #dce8df;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 85% 0%, #dfefe6, transparent 560px); }
[hidden] { display: none !important; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #1662c9; outline-offset: 3px; }
.page { width: min(1040px, calc(100% - 36px)); margin: auto; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 0; font-weight: 750; }
.top a { color: var(--green); font-size: .9rem; }
.top span { white-space: nowrap; }
.top .game-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: #244452; }
.game-brand-mark { display: grid; place-items: center; width: 50px; height: 50px; flex: none; border-radius: 14px; background: #f8e9d5; font-size: 1.65rem; }
.game-brand-copy { display: grid; gap: 4px; }
.game-brand-copy strong { font-size: 1.35rem; line-height: 1; font-weight: 850; }
.game-brand-copy small { color: #527278; font-size: .78rem; font-weight: 750; }
.game-brand:hover small { color: #ad5927; }
@media (max-width: 480px) { .game-brand-mark { width: 44px; height: 44px; font-size: 1.45rem; } .game-brand-copy strong { font-size: 1.15rem; } .game-brand-copy small { font-size: .72rem; } }

.header-actions { position: relative; display: flex; align-items: center; gap: 10px; }
.menu-toggle { width: 44px; height: 44px; display: grid; place-content: center; gap: 4px; padding: 0; border: 0; background: none; color: #a85122; }
.menu-toggle span { display: block; width: 22px; height: 3px; border-radius: 3px; background: currentColor; }
.header-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 3; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 12px 28px #15352d20; }
.header-menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 9px; text-decoration: none; white-space: nowrap; }
.header-menu a:hover { background: #eaf6ed; }
.back-to-game { display: inline-block; color: var(--green); font-weight: 750; font-size: .9rem; }
.intro { margin: 15px 0 26px; }
.intro h1 { margin: 0 0 8px; font-size: clamp(2.6rem, 7vw, 4.25rem); letter-spacing: -.065em; line-height: 1.06; }
.intro p:not(.kicker) { margin: 0; max-width: 55ch; line-height: 1.55; color: var(--muted); }
.kicker { margin: 0 0 8px; color: var(--green); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; }
.ranking-card { max-width: 680px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 12px 36px #193c2e0c; }
.arena { padding: clamp(14px, 3vw, 24px); }
.side-card { padding: 18px; }
h2 { margin: 0; font-size: 1.15rem; }
.arena-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
#round { color: var(--muted); font-size: .9rem; }
.score { display: grid; place-items: center; min-width: 88px; padding: 6px 10px; border-radius: 12px; background: #e7f3eb; }
.score strong { font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.score span { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.stage { position: relative; display: grid; grid-template-rows: 96px 28px 20px; justify-items: center; align-content: center; gap: 8px; min-height: 194px; padding: 16px; border: 1px solid #24473d; border-radius: 18px; color: #f6fffb; background: radial-gradient(ellipse at 50% 0%, #24483d, #142b26 80%); }
.lamp { display: grid; place-items: center; width: 96px; height: 96px; border: 5px solid #55776b; border-radius: 50%; background: #2b4940; box-shadow: 0 0 0 7px #102923aa, inset 0 0 0 4px #20383038; font-size: 2.4rem; font-weight: 800; }
.stage[data-phase="show"] .lamp { background: var(--color); border-color: #ffffff65; box-shadow: 0 0 0 7px #0e2522, 0 0 27px var(--color); }
.stage[data-phase="correct"] .lamp { background: #a3edaf; border-color: #d2ffdb; color: #143b25; }
.stage[data-phase="finished"] .lamp { background: #ffe2a3; border-color: #fff0c8; color: #594112; }
.stage[data-mistake] .lamp { background: #ffe4e6; border-color: #e8a4ac; color: #a32839; }
.stage[data-mistake] .stage-label { color: #a32839; }
.stage-label { font-size: 1.15rem; font-weight: 800; }
.step { color: #d9e9df; font-size: .85rem; }
.palette { display: grid; gap: 8px; margin-top: 14px; }
:is([data-game="semafor"], [data-game="abeceda"]) .stage {
  --lamp-size: clamp(112px, 19vw, 150px);
  grid-template-rows: var(--lamp-size) 28px 20px;
  border-color: var(--border);
  color: #15352d;
  background: white;
}
:is([data-game="semafor"], [data-game="abeceda"]) .lamp { width: var(--lamp-size); height: var(--lamp-size); border: 2px solid #b9cdc2; background: #edf4ee; box-shadow: none; }
[data-game="semafor"] .stage[data-phase="show"] .lamp { background: var(--color); border-color: #0002; box-shadow: none; }
:is([data-game="semafor"], [data-game="abeceda"]) .stage[data-phase="gap"] .lamp { visibility: hidden; }
[data-game="semafor"] .stage[data-phase="show"] .stage-label { clip-path: inset(50%); }
:is([data-game="semafor"], [data-game="abeceda"]) .step { color: var(--muted); }
.stage[data-phase="answer"] #symbol { font-size: clamp(1.3rem, 4vw, 1.65rem); line-height: 1.1; white-space: nowrap; }
.stage[data-phase="ready"] #symbol { font-size: clamp(1.05rem, 3.8vw, 1.4rem); line-height: 1.1; white-space: nowrap; }
.stage:is([data-phase="ready"], [data-phase="answer"]) .stage-label { clip-path: inset(50%); }
[data-game="semafor"] .palette {
  width: min(100%, 528px);
  margin-inline: auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 1.4vw, 12px);
}
[data-color="green"] { --color: #36bd73; }
[data-color="red"] { --color: #ee5263; }
[data-color="yellow"] { --color: #f7d147; }
[data-color="blue"] { --color: #4a9cf2; }
[data-color="orange"] { --color: #f9913a; }
[data-color="purple"] { --color: #ab7ae7; }
.answer-history { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: #f5f8f4; }
#answer-title { margin: 0 0 8px; font-size: .82rem; font-weight: 750; color: var(--muted); }
.answer-history-content { position: relative; min-height: 36px; }
#answer-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; margin: 0; padding: 0; list-style: none; }
.answer-dot { position: relative; flex: 0 0 36px; height: 36px; border-radius: 50%; background: var(--color); border: 1px solid #0002; }
.answer-letter { display: grid; place-items: center; background: #f1e6ff; border-color: #d7c9e6; color: #483467; font-size: 1.35rem; font-weight: 800; }
.answer-dot.wrong { outline: 2px solid #a32839; outline-offset: 2px; }
.answer-dot.wrong span { position: absolute; right: -4px; top: -4px; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #a32839; border-radius: 50%; background: #fff; color: #a32839; font-size: 17px; font-weight: 800; line-height: 1; }
#answer-placeholder { position: absolute; inset: 0; display: flex; align-items: center; margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.color { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid #0003; border-radius: 50%; background: var(--color); }
.color:hover:not(:disabled) { border-color: #0006; filter: brightness(1.06); }
.color:active:not(:disabled) { transform: scale(.94); }
.color:disabled { opacity: .65; }
.message { min-height: 2.9em; margin: 14px 0 8px; color: #254e3d; font-weight: 700; line-height: 1.45; }
.actions { min-height: 44px; }
.primary, .secondary { padding: 10px 15px; min-height: 44px; border-radius: 11px; font-weight: 750; }
.primary { background: var(--green); color: white; border: 1px solid var(--green); }
.primary:disabled { opacity: .55; }
.secondary { border: 1px solid #b5cabe; background: white; color: #215440; }
.secondary:hover:not(:disabled) { background: #eaf6ed; }
.side-card label { display: grid; gap: 4px; margin-top: 10px; font-size: .84rem; font-weight: 650; }
select, input { width: 100%; min-height: 42px; padding: 7px 9px; border: 1px solid #b5cabe; border-radius: 9px; color: inherit; background: white; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--green); font-size: .88rem; font-weight: 700; }
form .secondary { margin-top: 10px; }
.note { margin: 8px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.note:empty { display: none; }
.leaderboard { margin: 0; padding-left: 26px; }
.leaderboard:empty { display: none; }
.leaderboard li { margin-bottom: 5px; padding: 5px 8px; border-radius: 9px; }
.leaderboard li::marker { color: var(--muted); font-weight: 750; }
.leaderboard li.current { background: #e4f4e8; }
.leaderboard li span { display: inline-grid; max-width: calc(100% - 42px); overflow-wrap: anywhere; }
.leaderboard li b { float: right; font-variant-numeric: tabular-nums; }
.leaderboard li small { color: var(--muted); }
#retry { margin-top: 8px; }
[data-game="abeceda"] { background: radial-gradient(ellipse at 85% 0%, #efe6f9, transparent 560px); }
[data-game="abeceda"] .stage[data-phase="show"] .lamp { background: #f1e6ff; border-color: #d7c9e6; color: #36234f; box-shadow: none; font-size: clamp(2.7rem, 8vw, 3.7rem); }
[data-game="abeceda"] .stage[data-phase="show"] .stage-label { clip-path: inset(50%); }
[data-game="abeceda"] .palette { grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 8px; }
[data-game="abeceda"] .palette:focus-visible { outline: none; }
.letter { min-width: 0; min-height: 56px; padding: 6px; border: 1px solid #d7c9e6; border-radius: 12px; background: #fbf7ff; color: #483467; font-size: 1.4rem; font-weight: 800; }
.letter:active:not(:disabled) { background: #e9daf9; border-color: #9575bd; }
@media (hover: hover) and (pointer: fine) {
  .letter:hover:not(:disabled) { background: #e9daf9; border-color: #9575bd; }
}
.letter:disabled { opacity: .58; }
@media (max-width: 900px) {
  [data-game="abeceda"] .palette { grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); }
}
footer { padding: 24px 0; color: var(--muted); font-size: .84rem; }
.stage {scroll-margin-top:112px;}
@media (max-width: 520px) {
  .page { width: calc(100% - 24px); }
  .top { padding-block: 15px; }
  .intro { margin-block: 4px 16px; }
  .stage { min-height: 170px; grid-template-rows: 78px 25px 17px; }
  .lamp { width: 78px; height: 78px; }
  .palette { gap: 5px; }
  [data-game="abeceda"] .palette { grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 6px; }
  [data-game="abeceda"] .stage {--lamp-size:96px;grid-template-rows:96px 20px 17px;min-height:163px;gap:5px;padding:10px;}
  [data-game="abeceda"] .letter {min-height:44px;font-size:1.2rem;}
  [data-game="abeceda"] .answer-history {margin-top:8px;padding:8px 10px;}
  [data-game="abeceda"] #answer-title {margin-bottom:5px;}
  [data-game="abeceda"] #answer-trail {gap:5px;}
}
