:root {
  color-scheme: dark;
  --bg: #0d1211;
  --panel: #121a18;
  --ink: #f6ede0;
  --muted: #abb6ad;
  --line: #2b3731;
  --gold: #ebbc69;
  --green: #a6d4ac;
  --red: #f3a995;
  --mono: ui-monospace, Consolas, monospace;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 18% 12%, #19201a 0, transparent 49rem); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.shell { width: min(calc(100% - 96px), 1200px); margin-inline: auto; }
.topbar, footer { display: flex; align-items: center; justify-content: space-between; }
.topbar { min-height: 73px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.45rem; font-weight: 750; letter-spacing: -.065em; }
.period { color: var(--gold); }
.help { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: .82rem; color: var(--muted); }
.help span { border: 1px solid #617168; border-radius: 50%; width: 15px; line-height: 13px; text-align: center; font: .65rem/13px var(--mono); }
.help:hover, .hint-toggle:hover, .result-actions button:hover { color: var(--ink); }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 26px; padding: clamp(32px, 4.2vw, 62px) 0 29px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.75rem, 5.5vw, 5.05rem); line-height: .98; letter-spacing: -.075em; font-weight: 760; }
h1 em { color: var(--gold); font: italic 400 1.07em/.93 Georgia, serif; letter-spacing: -.085em; }
.hero-break { display: none; }
.hero p { color: var(--muted); font-size: .96rem; line-height: 1.55; padding-bottom: 3px; }
.game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(286px, 318px); gap: 16px; }
.map-card, .panel { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.map-card { background: #101915; }
.map-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 42px; padding: 7px 14px; background: #121b17; border-bottom: 1px solid var(--line); }
.map-label, .map-scale, .progress-head, .verdict { font: .68rem/1.4 var(--mono); letter-spacing: .095em; color: var(--muted); }
.map-label { color: #e7c88f; }
.signal { display: inline-block; vertical-align: 1px; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px #ebbc6990; }
.viewport { position: relative; height: clamp(420px, 38vw, 540px); overflow: hidden; isolation: isolate; }
#map { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: default; }
#map.movable { cursor: grab; touch-action: none; }
#map.movable:active { cursor: grabbing; }
.map-frame { position: absolute; inset: 14px; pointer-events: none; }
.map-frame i { position: absolute; width: 16px; height: 16px; border: solid #d9b37399; }
.map-frame i:nth-child(1) { inset: 0 auto auto 0; border-width: 1px 0 0 1px; }
.map-frame i:nth-child(2) { inset: 0 0 auto auto; border-width: 1px 1px 0 0; }
.map-frame i:nth-child(3) { inset: auto 0 0 auto; border-width: 0 1px 1px 0; }
.map-frame i:nth-child(4) { inset: auto auto 0 0; border-width: 0 0 1px 1px; }
.map-controls { position: absolute; right: 23px; top: 50%; display: grid; transform: translateY(-50%); background: #111a17ed; border: 1px solid #6a6550; border-radius: 7px; }
.map-controls button { background: none; border: 0; padding: 0; width: 38px; height: 36px; font: 1.17rem var(--mono); }
.map-controls button + button { border-top: 1px solid #454b3f; }
.map-controls button:hover { background: #303c31; }
.map-controls button:disabled { cursor: default; color: #969f94; background: transparent; }
.north { position: absolute; top: 25px; right: 27px; display: grid; justify-items: center; color: #f5d9a1; text-shadow: 0 2px 5px #111a17; font: .7rem/1.2 var(--mono); pointer-events: none; }
.north span + span { font-size: 1.05rem; }
.map-credit { position: absolute; right: 22px; bottom: 21px; border-radius: 4px; background: #111a17ed; padding: 4px 7px; color: #c4cbc1; font-size: .625rem; line-height: 1.3; }
.map-credit a:hover, footer a:hover { color: var(--ink); }
.map-status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: 7px; padding: 10px 16px; background: var(--panel); text-align: center; }
.panel { display: flex; flex-direction: column; background: var(--panel); min-height: 100%; padding: 21px; }
.progress-head { display: flex; justify-content: space-between; gap: 7px; }
#score-label { color: var(--gold); }
.progress { list-style: none; display: flex; gap: 5px; margin: 11px 0 27px; padding: 0; }
.progress li { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.progress .active { background: var(--gold); }
.progress .correct { background: var(--green); }
.progress .incorrect { background: var(--red); }
h2 { font-size: 1.6rem; line-height: 1.1; font-weight: 730; letter-spacing: -.045em; }
.choices { display: grid; gap: 8px; margin-top: 18px; }
.choice { display: flex; text-align: left; align-items: center; gap: 10px; padding: 8px 11px; min-height: 49px; border: 1px solid #35433b; border-radius: 7px; background: #19221e; font-weight: 650; font-size: .96rem; transition: border-color .15s, background-color .15s; }
.choice:hover:not(:disabled) { border-color: var(--gold); background: #30291d; }
.choice:disabled { color: var(--muted); cursor: default; }
.choice kbd, .panel-bottom kbd { display: inline-grid; place-items: center; border: 1px solid #46534a; border-radius: 4px; color: #c4cbc1; font: .7rem var(--mono); width: 23px; height: 23px; }
.choice span:last-child { margin-left: auto; color: var(--muted); font-size: .71rem; font-weight: 400; }
.hint-row { margin-top: 14px; }
.hint-toggle, .result-actions button { border: 0; background: transparent; padding: 4px 0; color: var(--gold); font-size: .84rem; text-decoration: underline; text-underline-offset: 3px; }
#hint, #fact, .summary { margin-top: 8px; font-size: .95rem; line-height: 1.5; color: var(--muted); }
.verdict { margin-bottom: 10px; color: var(--green); }
.verdict.wrong { color: var(--red); }
.reveal h2 { color: var(--ink); font-size: clamp(2.2rem, 3.6vw, 3.2rem); }
.primary { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 22px; min-height: 45px; padding: 10px 12px; border: 1px solid transparent; border-radius: 7px; background: var(--gold); color: #1a1810; font-weight: 740; text-decoration: none; }
.primary:hover { background: #f7d48f; }
.result-score { color: var(--gold); font-size: 4.75rem; line-height: 1.03; font-weight: 760; letter-spacing: -.075em; }
.result-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; }
#export-status { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.panel-bottom { margin-top: auto; padding-top: 18px; color: var(--muted); font: .7rem/1.5 var(--mono); }
.panel-bottom kbd { width: 19px; height: 18px; font-size: .64rem; }
footer { flex-wrap: wrap; gap: 4px 20px; padding: 17px 0; color: var(--muted); font-size: .7rem; }
dialog { width: min(420px, calc(100% - 36px)); padding: 24px; border: 1px solid #4c5b50; border-radius: 12px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: #050a08bd; }
dialog p { margin-top: 11px; color: var(--muted); line-height: 1.5; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 20px; }

@media (max-width: 1100px) {
  .hero-break { display: initial; }
  .hero p { margin-right: 10px; }
}
@media (max-width: 800px) {
  .shell { width: calc(100% - 36px); }
  .hero { display: block; padding-top: 26px; padding-bottom: 21px; }
  .hero-break, .intro-break { display: none; }
  .hero p { margin-top: 12px; }
  .game { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .viewport { height: auto; aspect-ratio: 1.45; }
  .panel { padding: 16px; }
  .topbar { min-height: 57px; }
  .progress { margin-bottom: 18px; }
  .panel-bottom { display: none; }
}
@media (max-width: 450px) {
  .shell { width: calc(100% - 26px); }
  .hero h1 { font-size: clamp(2.25rem, 10vw, 2.75rem); }
  .hero p { font-size: .86rem; }
  .map-bar { min-height: 34px; padding-inline: 9px; }
  .map-label, .map-scale { font-size: .58rem; }
  .map-frame { inset: 8px; }
  .map-controls { right: 13px; }
  .map-controls button { width: 34px; height: 34px; }
  .north { top: 14px; right: 18px; }
  .map-credit { bottom: 12px; right: 12px; font-size: .57rem; max-width: calc(100% - 25px); }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
  .choice { min-height: 49px; padding: 7px; gap: 5px; font-size: .88rem; }
  .choice kbd { display: none; }
  .choice span:last-child { display: none; }
  .hint-row { margin-top: 7px; }
}
@media (pointer: coarse) {
  .map-controls button { width: 44px; height: 44px; }
  .map-scale { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
