:root {
  color-scheme: dark;
  --bg: #151025;
  --panel: #1e172f;
  --border: #3b304e;
  --text: #fff3e9;
  --muted: #cabdd6;
  --faint: #a798b7;
  --pink: #ff9fb6;
  --gold: #ffd299;
  --mint: #91eddb;
  --accent: #ffc184;
  --display: 'Arial Black', 'Segoe UI', sans-serif;
  --body: 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(ellipse at 52% 14%, #261630 0%, transparent 57%), var(--bg); color: var(--text); font: 15px/1.5 var(--body); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
.shell { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: #171125; border-bottom: 1px solid #ffffff14; }
.topbar-content { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 900; letter-spacing: .08em; line-height: 1.16; flex-shrink: 0; }
.brand svg { width: 39px; height: 39px; }
.brand small { display: block; color: var(--faint); font-size: .625rem; letter-spacing: .12em; margin-top: 4px; }
nav { display: flex; align-items: center; gap: clamp(12px, 2.7vw, 34px); }
#account-button { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link, .link-btn { background: none; border: 0; text-decoration: none; padding: 6px 0; color: var(--muted); font-weight: 650; }
.nav-link:hover, .link-btn:hover { color: var(--gold); }
.journal-mobile { display: none; }
.primary, .outline { min-height: 46px; padding: 10px 19px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; display: inline-flex; justify-content: center; align-items: center; gap: 12px; text-decoration: none; }
.primary { background: linear-gradient(104deg, #ffcb8d, #ff9db4); color: #27162d; }
.primary:hover { filter: brightness(1.1); }
.outline { border-color: #a990b46b; background: #24192f8c; }
.outline:hover { border-color: var(--pink); background: #3c2444; }
.primary svg, .outline svg { width: 18px; height: 18px; }
.primary:disabled, .outline:disabled { opacity: .65; }
.small { min-height: 37px; padding: 7px 13px; }
.hero { margin-top: 24px; min-height: 392px; border: 1px solid #845669; border-radius: 22px; position: relative; overflow: hidden; display: flex; align-items: center; isolation: isolate;
  background: linear-gradient(90deg, #1b1125 0%, #211329ed 23%, #241431a0 47%, #2617341c 73%), linear-gradient(0deg, #181020aa, transparent 45%), url('assets/lago-cover.webp') center 57% / cover no-repeat, #322140; }
.hero-inner { position: relative; padding: 42px clamp(25px, 6vw, 78px); max-width: 770px; }
.kicker { margin: 0; color: var(--pink); font-weight: 800; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.kicker span, .hero-place span { width: 8px; height: 8px; display: inline-block; border-radius: 50%; margin-right: 7px; background: var(--pink); box-shadow: 0 0 14px #ff9fb6ba; }
.hero h1 { font: 900 clamp(2.8rem, 6.5vw, 5.7rem)/.98 var(--display); letter-spacing: -.065em; text-transform: uppercase; margin: 17px 0 20px; text-shadow: 0 5px 30px #130a1c77; }
.hero-copy { color: #fff0ed; font-size: clamp(.98rem, 1.65vw, 1.2rem); max-width: 455px; margin: 0 0 24px; text-shadow: 0 2px 10px #181020; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-place { position: absolute; margin: 0; right: 19px; bottom: 18px; padding: 7px 11px; border: 1px solid #e0b0ba60; border-radius: 7px; background: #231628d9; color: #ffe4d2; font-size: .68rem; letter-spacing: .1em; }
.hero-place b { margin-left: 7px; color: var(--gold); }
.dispatch { margin: 29px 0 44px; scroll-margin-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 15px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -.035em; margin: 0; line-height: 1.15; }
.metrics { display: flex; flex-wrap: wrap; gap: 7px; }
.metric { display: flex; align-items: center; min-height: 36px; gap: 6px; border: 1px solid var(--border); background: #21182f; padding: 5px 11px; border-radius: 8px; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.metric b { color: var(--text); font-variant-numeric: tabular-nums; }
.metric svg { width: 15px; height: 15px; color: var(--gold); margin-right: 2px; }
.status-banner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; border: 1px solid #9ae8d363; background: #1e3036; padding: 14px 17px; border-radius: 12px; margin-bottom: 13px; }
.status-banner p { margin: 0; }
.banner-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dispatch-grid { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.16fr); gap: 14px; align-items: start; }
.chart-panel, .mission-panel { min-width: 0; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(140deg, #251a33, var(--panel) 65%); overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 17px; gap: 10px; }
.chart-head h3 { margin: 0; font-size: 1.03rem; }
.chart-head span { color: var(--faint); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.city-map { position: relative; border-block: 1px solid var(--border); aspect-ratio: 440 / 322; }
.city-map > svg { width: 100%; height: 100%; display: block; }
.map-bridge { fill: none; stroke: #9f829a; stroke-width: 1; opacity: .7; }
.map-track { fill: none; stroke: #ea9aa862; stroke-width: 4.8; }
.map-track.bright { stroke: #ffbc8c; stroke-width: 1.8; stroke-dasharray: 4 6; }
.water-label, .north-label { fill: #c6a9cf; font: 700 9px var(--body); letter-spacing: 2px; }
.north { fill: #f2b59f; }
.pin { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 39px; height: 39px; background: #241b36; border-radius: 50%; border: 2px solid #a89ab3; color: #ded0e6; box-shadow: 0 2px 11px #161020ba; font-weight: 800; }
.pin[data-region="1"] { left: 17%; top: 74%; }
.pin[data-region="2"] { left: 37%; top: 50%; }
.pin[data-region="3"] { left: 50%; top: 60%; }
.pin[data-region="4"] { left: 62%; top: 72%; }
.pin[data-region="5"] { left: 83%; top: 18%; }
.pin.is-open { color: var(--gold); border-color: #ffbd88; }
.pin.is-done { color: var(--mint); border-color: var(--mint); }
.pin[aria-pressed="true"] { box-shadow: 0 0 0 4px #eba9b241, 0 2px 14px #f4a59a60; background: var(--gold); color: #301a37; border-color: #ffe7b8; }
.pin svg { width: 18px; height: 18px; }
.map-footer { margin: 0; padding: 10px 16px; color: var(--muted); font-size: .83rem; }
.mission-panel { padding: 16px 17px; }
.mission-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mission-head h3 { margin: 2px 0 0; font-size: clamp(1.32rem, 2.8vw, 1.88rem); line-height: 1.12; letter-spacing: -.025em; }
.region-icon { border: 1px solid #dd99af51; background: #f899b716; color: var(--gold); width: 43px; height: 43px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 43px; }
.region-icon svg { width: 23px; height: 23px; }
.region-story { color: var(--muted); margin: 9px 0 14px; }
.mission-list { display: grid; gap: 8px; }
.mission { text-align: left; display: grid; grid-template-columns: minmax(78px, 24%) minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 86px; border: 1px solid #67547883; background: #2d223d; border-radius: 10px; padding: 6px 11px 6px 6px; }
.mission:not(:disabled):hover { border-color: var(--pink); background: #362746; }
.mission:disabled { background: #251d35; color: #d5c8df; border-color: #5a4a6b80; }
.mission-thumb { display: block; width: 100%; height: 74px; border-radius: 7px; object-fit: cover; background: #302140; }
.mission:disabled .mission-thumb { filter: saturate(.7) brightness(.76); }
.mission .number { display: inline-block; color: var(--pink); border: 1px solid #ed94b441; background: #dc6a9f15; padding: 0 5px; margin-bottom: 3px; border-radius: 5px; font-size: .68rem; font-weight: 800; }
.mission.is-recent .number { color: var(--mint); border-color: #88e8d34d; background: #88e8d316; }
.mission b { display: block; color: inherit; font-size: .96rem; line-height: 1.2; }
.mission small { color: var(--muted); display: block; margin-top: 3px; }
.mission .trail { color: var(--gold); font-weight: 800; font-size: .84rem; }
.mission .trail svg { vertical-align: middle; width: 16px; height: 16px; }
.mission:disabled .trail { color: var(--faint); }
.mission.is-done .trail { color: var(--mint); }
.garage { margin-top: 11px; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--faint); font-size: .82rem; border-top: 1px solid var(--border); padding: 15px 0 22px; }
dialog { width: min(630px, calc(100% - 26px)); max-height: calc(100dvh - 30px); color: var(--text); border: 1px solid #675575; border-radius: 17px; background: #231934; padding: 0; box-shadow: 0 25px 85px #0c0616b5; overflow: auto; }
dialog::backdrop { background: #100a1bd1; backdrop-filter: blur(4px); }
.dialog-head { position: sticky; top: 0; z-index: 1; background: #31203e; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 2px 0 0; letter-spacing: -.03em; font-size: clamp(1.43rem, 3.6vw, 1.95rem); line-height: 1.15; }
.close { background: #1f162a; border: 1px solid var(--border); border-radius: 9px; min-height: 38px; min-width: 38px; font-size: 1.6rem; line-height: 1; }
#dialog-body { padding: 16px 20px 20px; }
#dialog-body > p:first-child, #dialog-body > ul:first-child { margin-top: 0; }
.scene { color: var(--mint); margin: 0 0 12px; border-left: 2px solid #99e7d4; padding-left: 11px; }
.question { padding: 13px; border-radius: 10px; border: 1px solid #604c74; background: #191326; }
.question > :first-child { margin-top: 0; }
.question > :last-child { margin-bottom: 0; }
.question pre, .formula, .data-line { border-radius: 7px; background: #32223f; padding: 10px 12px; overflow-wrap: anywhere; }
.question pre { overflow: auto; color: #b9ede4; }
.question p.formula, .data-line { font-size: 1.18rem; font-weight: 700; }
.question blockquote { margin-inline: 8px; padding-left: 11px; border-left: 2px solid var(--pink); }
.question .table-scroll, .rank-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--muted); font-size: .85rem; margin: 0 0 4px; }
th, td { border: 1px solid var(--border); padding: 5px 7px; text-align: center; }
th { color: var(--gold); background: #352742; }
.runs { color: var(--gold); }
.fragments { columns: 2; max-width: 460px; margin-block: 8px; padding-left: 27px; }
.fragments li { margin-bottom: 3px; }
.task-graph { display: block; width: 100%; max-width: 515px; margin: auto; }
.task-graph line { stroke: #c2b3d4; stroke-width: 1.6; }
.task-graph marker path { fill: #c2b3d4; }
.task-graph circle { fill: #302243; stroke: #f4b2c9; stroke-width: 1.5; }
.task-graph .special circle { fill: #49666c; stroke: var(--mint); }
.task-graph text { fill: #fff; font: 700 14px var(--body); text-anchor: middle; dominant-baseline: central; }
.edge-list { color: var(--muted); font-size: .88rem; }
details summary { cursor: pointer; }
.journal-list details { padding: 8px 0; border-bottom: 1px solid var(--border); }
.journal-list summary { font-weight: 700; }
.journal-list p { margin: 8px 0 0 17px; color: var(--muted); }
.radio-note { border-top: 1px solid var(--border); margin-top: 15px; padding-top: 12px; }
.answer-form, .stack { display: grid; gap: 10px; }
.answer-form { margin-top: 15px; }
.answer-form .primary { justify-self: start; }
input { width: 100%; border: 1px solid #8f789e; border-radius: 8px; min-height: 44px; background: #1b142a; color: var(--text); padding: 7px 10px; }
label { display: block; color: var(--muted); font-weight: 650; }
label input { margin-top: 3px; }
.feedback { margin: 12px 0 0; border: 1px solid #c77a926d; background: #382238; color: #ffc3d0; padding: 9px 11px; border-radius: 8px; }
.feedback.good { color: var(--mint); background: #213432; border-color: #6fbfa37a; }
.solution { border-left: 2px solid var(--mint); padding-left: 10px; margin: 12px 0; color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.story-screen, .auth-screen, .rank-screen, .mission-screen { width: min(735px, calc(100% - 26px)); }
.story-image, .mission-image, .rank-art { width: 100%; display: block; border-radius: 10px; object-fit: cover; border: 1px solid #ad79966b; background: #342241; }
.story-image { height: clamp(165px, 39vw, 320px); }
.story-copy { font-size: clamp(.98rem, 2.4vw, 1.13rem); color: #f5e7f2; margin: 15px 0 20px; }
.story-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.story-nav > :first-child { justify-self: start; }
.story-nav > :last-child { justify-self: end; }
.slide-count { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mission-image { height: clamp(120px, 29vw, 220px); margin-bottom: 15px; }
.auth-layout { display: grid; grid-template-columns: minmax(145px, .72fr) minmax(0, 1.3fr); gap: 20px; }
.auth-art { width: 100%; height: 100%; min-height: 227px; max-height: 390px; border-radius: 10px; display: block; object-fit: cover; object-position: 49% 50%; border: 1px solid #ad79966b; background: #342241; }
.auth-lead { color: var(--muted); margin: 0 0 12px; }
.crew-choice { justify-content: space-between; text-align: left; }
.crew-choice small { margin-left: 6px; color: var(--muted); font-weight: 500; }
.rank-art { height: clamp(86px, 20vw, 155px); margin-bottom: 12px; object-position: center 53%; }
.rank-summary { display: flex; gap: 8px; justify-content: space-between; align-items: center; border: 1px solid #cdaf845e; border-radius: 8px; padding: 8px 10px; background: #423143; color: var(--muted); }
.rank-summary b { color: var(--gold); }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 8; max-width: min(360px, calc(100% - 32px)); border: 1px solid #b99ace; border-radius: 8px; padding: 9px 13px; background: #352345; box-shadow: 0 5px 25px #0e0919aa; }
.rank-wrap td, .rank-wrap th { padding: 8px; }
.rank-wrap th:nth-child(2) { text-align: left; overflow-wrap: anywhere; }
.rank-wrap th[scope="row"] { color: var(--text); background: transparent; }
.rank-wrap th small { display: block; color: var(--muted); font-weight: 500; font-size: .75rem; }
.rank-wrap tr.me > * { background: #3a2c48; color: var(--gold); }
.rank-place { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 6px; font-weight: 800; }
.rank-wrap tbody tr:nth-child(1) .rank-place { color: #351c35; background: #ffc98c; }
.rank-wrap tbody tr:nth-child(2) .rank-place { color: #351c35; background: #ded3f6; }
.rank-wrap tbody tr:nth-child(3) .rank-place { color: #351c35; background: #e9a0a7; }
.rank-score { color: var(--gold); font-weight: 800; white-space: nowrap; }
.rank-status { color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .topbar-content { min-height: 66px; }
  .hero { min-height: 340px; margin-top: 16px; background-position: center, center, 61% 55%; }
  .hero-inner { padding: 28px 23px; }
  .dispatch-grid { grid-template-columns: 1fr; }
  .city-map { aspect-ratio: 440 / 298; }
  .hero-place { right: 9px; bottom: 8px; }
  .dispatch { margin-top: 22px; }
}
@media (max-width: 570px) {
  .topbar .nav-link, #journal-button { display: none; }
  .journal-mobile { display: block; margin: 0 0 10px auto; }
  .auth-layout { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .auth-art { height: 104px; min-height: 0; object-position: center 41%; }
  .rank-wrap td, .rank-wrap th { padding-inline: 5px; }
  .rank-status { font-size: .74rem; }
}
@media (max-width: 410px) {
  .shell { width: calc(100% - 22px); }
  .brand { font-size: .86rem; gap: 6px; }
  .brand svg { width: 31px; height: 31px; }
  .brand small { font-size: .53rem; }
  nav { gap: 9px; font-size: .78rem; }
  #account-button { max-width: 92px; }
  .nav-link { display: none; }
  .hero h1 { max-width: 6ch; }
  .hero-inner { padding: 24px 15px; }
  .hero-place { display: none; }
  .mission-panel { padding: 13px 11px; }
  .mission { grid-template-columns: 65px minmax(0, 1fr) auto; gap: 8px; padding-inline: 6px; }
  .mission-thumb { height: 67px; }
  .mission .trail { font-size: .72rem; }
  .story-nav { gap: 6px; }
  .story-nav .primary { padding-inline: 9px; }
  .pin { width: 34px; height: 34px; }
  .metric { padding-inline: 7px; }
  #dialog-body, .dialog-head { padding-inline: 13px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
