@font-face {
  font-family: Manrope; src: url("assets/manrope-latin.woff2") format("woff2");
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: Manrope; src: url("assets/manrope-cyrillic.woff2") format("woff2");
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("assets/plex-latin.woff2") format("woff2");
  font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("assets/plex-cyrillic.woff2") format("woff2");
  font-weight: 500; font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}

:root {
  color-scheme: dark;
  --background: #090f1c;
  --surface: #0d1727;
  --raised: #111f32;
  --border: #35596e;
  --rule: #243d51;
  --cyan: #73f0f2;
  --ink: #f0f5fa;
  --muted: #afc0d0;
  --subtle: #89a2b8;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: Georgia, "Times New Roman", serif;
  font-family: Manrope, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); }
h1, h2, h3, p, ol, ul { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, .choice:has(:focus-visible), h2:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
h2[tabindex] { scroll-margin: 30px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  display: block; width: 22px; height: 22px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.shell { width: min(100% - 72px, 1450px); margin-inline: auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 70px; padding-inline: 12px;
}
.brand, .topbar-tools, .topbar-progress { display: flex; align-items: center; }
.brand { gap: 16px; }
.brand p {
  padding-left: 16px; border-left: 1px solid var(--border);
  font: 500 14px/1.3 var(--mono); letter-spacing: .055em; text-transform: uppercase;
}
.brand-mark { flex: 0 0 auto; filter: drop-shadow(0 0 9px #5deaf42a); }
.brand-shift { color: var(--cyan); }
.brand-shift > span { margin-inline: 4px; }
.topbar-tools { gap: 20px; }
.topbar-progress {
  gap: 10px; padding-left: 20px; border-left: 1px solid var(--border);
  font-size: 13px; white-space: nowrap; color: var(--muted);
}
.topbar-progress strong { color: var(--cyan); font: 500 15px var(--mono); }
.link-button {
  display: inline-flex; gap: 7px; align-items: center; min-height: 36px; padding: 2px 0;
  border: 0; background: none; color: var(--cyan); font-size: 13px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 4px;
}
.link-button .icon { width: 16px; height: 16px; }
.link-button:hover { color: var(--ink); }

.hero {
  position: relative; isolation: isolate; display: flex; align-items: center; overflow: hidden;
  min-height: clamp(265px, 23vw, 326px); background: #081320; border: 1px solid #4a8294;
}
.hero-image {
  position: absolute; z-index: -2; inset: 0 0 0 auto; width: 79%; height: 100%;
  object-fit: cover; object-position: 75% 60%;
}
.hero::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, #081320 8%, #081320 22%, #081320de 32%, #0813205e 52%, transparent 69%);
}
.hero-copy { padding: 30px clamp(26px, 3.1vw, 48px); }
.hero h1 {
  font: 700 clamp(50px, 5.35vw, 84px)/.91 var(--display);
  letter-spacing: -.055em;
}
.hero h1 em { font-style: normal; color: var(--cyan); }
.hero p { max-width: 435px; margin-top: 19px; color: #dae5ef; font-size: 15px; line-height: 1.6; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.mission-panel, .finish-panel { padding: clamp(22px, 2.25vw, 35px); }
.panel-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mission-number, .mission-score {
  font: 500 12px/1.45 var(--mono); text-transform: uppercase; letter-spacing: .075em;
}
.mission-number { color: var(--cyan); }
.mission-score { color: var(--subtle); text-align: right; white-space: nowrap; }
.mission-score strong { color: var(--ink); font-weight: 500; }
.mission-panel h2, .finish-panel h2 {
  width: fit-content; margin-top: 8px; font: 700 clamp(34px, 4vw, 57px)/1.02 var(--display); letter-spacing: -.034em;
}
.mission-story { max-width: 630px; margin-top: 12px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.trip {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  padding: 11px 13px; border: 1px solid #386879; border-radius: 6px; background: #0c1c2c;
}
.trip .icon { color: var(--cyan); width: 21px; height: 21px; }
.stops {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 11px;
  padding: 0; list-style: none; font-size: 14px; font-weight: 750;
}
.stop + .stop::before { content: "→"; margin-right: 11px; color: var(--cyan); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.options { display: grid; gap: 8px; }
.choice {
  position: relative; display: grid; align-items: center; grid-template-columns: auto 1fr auto; gap: 12px;
  min-height: 53px; padding: 9px 13px; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--raised); cursor: pointer; transition: background .18s, border-color .18s;
}
.choice:not(:has(:disabled)):hover { background: #172c40; border-color: #5f8da2; }
.choice:has(:checked) { background: #132c39; border-color: #67c7d6; }
.choice:has(:disabled) { cursor: default; }
.choice-input {
  position: absolute; inset: auto; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.choice-code {
  min-width: 41px; padding: 4px 7px; border: 1px solid #49778b; border-radius: 4px;
  color: var(--cyan); text-align: center; font: 500 14px/1.25 var(--mono);
}
.choice-name { font-size: 14px; font-weight: 700; }
.choice-mark {
  display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #7896aa;
  border-radius: 50%; color: var(--cyan); font-size: 13px; line-height: 1;
}
.choice:has(:checked):not([data-state]) .choice-mark::before {
  content: ""; width: 8px; height: 8px; background: var(--cyan); border-radius: 50%;
}
.choice[data-state="excluded"] { background: #141c2a; }
.choice[data-state="excluded"] .choice-name { color: var(--subtle); text-decoration: line-through; }
.choice[data-state="excluded"] .choice-mark { border-color: #8c6670; color: #e9a4b1; }
.choice[data-state="correct"] .choice-mark { background: var(--cyan); border-color: var(--cyan); color: #0b1b25; }
.actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 18px; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 47px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: 6px;
  font-size: 14px; font-weight: 800; transition: background .18s, border-color .18s;
}
.button .icon { width: 19px; height: 19px; }
.primary { background: var(--cyan); color: #0a2130; }
.primary:hover { background: #a4faff; }
.primary[aria-disabled="true"] { background: #60c1c8; color: #0a2130; cursor: default; }
.secondary { border-color: #497589; background: transparent; color: var(--ink); }
.secondary .icon { color: var(--cyan); }
.secondary:hover { border-color: var(--cyan); background: #132536; }
.result, .hint-text {
  margin-top: 12px; padding: 11px 14px; border-left: 2px solid var(--cyan);
  background: #122a37; font-size: 14px; line-height: 1.55;
}
.result strong { color: var(--cyan); }
.result p { margin-top: 3px; }
.result-quote { color: var(--muted); }
.result[data-kind="retry"] { border-color: #edb493; background: #282433; }
.result[data-kind="retry"] strong { color: #ffc5a2; }
.hint-text { border-color: #7599ad; background: #132536; color: var(--muted); }

.map-panel { display: flex; flex-direction: column; overflow: hidden; }
.map-heading {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px;
  padding: 17px 19px 12px; background: #101c2e; border-bottom: 1px solid var(--rule);
}
.map-heading h2 { font-size: 15px; }
.map-heading > span { color: var(--subtle); font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .075em; }
#route-map { display: block; width: 100%; min-height: 0; aspect-ratio: 540 / 365; background: #0c192b; }
.map-footer {
  display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1fr); align-items: center; gap: 15px;
  margin-top: auto; padding: 15px 19px 17px; border-top: 1px solid var(--rule);
}
.map-legend { display: grid; gap: 7px; list-style: none; padding: 0; color: var(--muted); font-size: 12px; }
.map-legend li { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #b5cfe2; }
.legend-dot.active { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 7px #73f0f2b0; }
.legend-line { width: 11px; height: 2px; flex: 0 0 auto; background: #979afa; }
.journal { padding-left: 14px; border-left: 1px solid var(--rule); }
.journal h3 { margin-bottom: 8px; font-size: 13px; }
.shift-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; list-style: none; padding: 0; }
.step-button {
  display: grid; place-items: center; width: 100%; height: 30px; padding: 0;
  border: 1px solid #405d72; border-radius: 4px; background: #101d30;
  color: #a7bbc9; font: 500 11px var(--mono);
}
.step-button:disabled { color: #7993a8; border-color: #324a5d; }
.step-button[aria-current], .step-button[data-state] { color: var(--cyan); border-color: #60aeb9; }
.step-button:not(:disabled):hover { background: #1e394b; }
.step-button[data-state] { font-size: 14px; }

.finish-panel { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.finish-card {
  display: grid; gap: 8px; margin: 24px 0 20px; padding: 18px 22px; min-width: min(100%, 285px);
  border: 1px solid #477e91; border-radius: 6px; background: #10283a;
}
.finish-caption, .finish-rank { color: var(--muted); font-size: 14px; font-weight: 750; }
.finish-score { color: var(--cyan); font: 500 clamp(31px, 4vw, 47px)/1.2 var(--mono); }
.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 24px;
  margin-top: 18px; padding: 9px 1px 22px; border-top: 1px solid var(--border);
  color: var(--subtle); font-size: 12px;
}
.noscript { margin-block: 18px; }

dialog {
  width: min(520px, 100% - 32px); max-height: calc(100% - 32px); padding: 22px;
  color: var(--ink); background: var(--surface); border: 1px solid #54849a; border-radius: 10px;
}
dialog::backdrop { background: #050913c9; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-header h2 { font: 700 33px/1.05 var(--display); letter-spacing: -.03em; }
.close-button {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px; background: var(--raised);
}
.close-button:hover { border-color: var(--cyan); }
.dialog-body { color: var(--muted); font-size: 15px; line-height: 1.6; }
.dialog-body p + p, .source-list { margin-top: 12px; }
.dialog-route, .dialog-points, .source-list a { color: var(--cyan); }
.source-list { display: grid; gap: 7px; padding-left: 20px; }

@media (max-width: 1100px) {
  .shell { width: calc(100% - 48px); }
  .map-footer { grid-template-columns: 1fr; gap: 11px; align-items: start; }
  .map-legend { display: flex; flex-wrap: wrap; gap: 7px 11px; }
  .journal { padding: 9px 0 0; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 800px) {
  .shell { width: calc(100% - 32px); }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 13px; margin-top: 13px; }
  .map-footer { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); }
  .map-legend { display: grid; }
  .journal { padding: 0 0 0 10px; border-left: 1px solid var(--rule); border-top: 0; }
  .hero-image { width: 88%; object-position: 68% 58%; }
  .hero::after { background: linear-gradient(90deg, #081320 8%, #081320e8 24%, #08132077 55%, transparent 76%); }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 24px); }
  .topbar { min-height: 60px; gap: 7px; padding: 0 2px; }
  .brand { gap: 7px; }
  .brand-mark { width: 36px; height: 24px; }
  .brand p { padding-left: 7px; font-size: 10px; line-height: 1.45; letter-spacing: .035em; white-space: nowrap; }
  .brand-shift { display: block; }
  .brand-shift > span { display: none; }
  .topbar-tools { gap: 9px; }
  .topbar-tools .link-button { font-size: 11px; }
  .topbar-tools .icon, .topbar-progress > span { display: none; }
  .topbar-progress { padding-left: 9px; }
  .topbar-progress strong { font-size: 12px; }
  .hero { min-height: 318px; align-items: flex-end; }
  .hero-copy { padding: 0 17px 16px; }
  .hero h1 { font-size: clamp(42px, 12vw, 58px); }
  .hero p { margin-top: 10px; font-size: 13px; line-height: 1.5; }
  .hero-image { width: 100%; height: 81%; object-position: 75% 53%; }
  .hero::after { background: linear-gradient(0deg, #081320 12%, #081320f0 22%, #08132054 59%, transparent 85%); }
  .mission-panel, .finish-panel { padding: 17px 15px; }
  .mission-panel h2, .finish-panel h2 { font-size: 34px; }
  .mission-score, .mission-number { font-size: 10px; }
  .mission-story { font-size: 14px; margin-top: 9px; }
  .trip { margin: 13px 0; padding: 8px; gap: 7px; }
  .stops { font-size: 12px; gap: 3px 7px; }
  .stop + .stop::before { margin-right: 7px; }
  .choice { padding-inline: 9px; gap: 9px; }
  .choice-code { font-size: 12px; }
  .choice-name { font-size: 13px; }
  .actions { gap: 8px; margin-top: 13px; }
  .actions .button { flex: 1 1 auto; padding-inline: 10px; font-size: 12px; }
  .actions .button .icon { width: 16px; height: 16px; }
  .map-heading, .map-footer { padding-inline: 12px; }
  .map-footer { grid-template-columns: 1fr; }
  .map-legend { display: flex; flex-wrap: wrap; }
  .journal { padding: 9px 0 0; border-left: 0; border-top: 1px solid var(--rule); }
  .step-button { height: 38px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
