:root {
  color-scheme: dark;
  --bg: #101b26;
  --card: #172634;
  --line: #334757;
  --text: #edf5fa;
  --muted: #aebfcc;
  --blue: #84bced;
  --green: #79d4bd;
  --yellow: #f1c267;
  --red: #ff9692;
  --purple: #c2a9fa;
  --seafoam: #9ce5cf;
  --paper: #f2f5f4;
  --ink: #172c35;
  --header-height: 4.5rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: .2em; }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
p, h1, h2, h3 { margin: 0; }
p + p { margin-top: .85rem; }
h1, h2, h3 { line-height: 1.12; }
h2 { font-size: clamp(1.65rem, 4vw, 2.4rem); letter-spacing: -.03em; }
h3 { font-size: 1.12rem; }
.wrap { width: min(100% - 4rem, 74rem); margin-inline: auto; }
[id] { scroll-margin-top: calc(var(--header-height) + 1.2rem); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 5; background: var(--bg); padding: .65rem; }

.topbar { position: sticky; top: 0; z-index: 3; background: #101a24; border-bottom: 1px solid #293846; }
.header-inner { width: min(100% - 4rem, 74rem); margin-inline: auto; min-height: calc(var(--header-height) - 1px); display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); font-size: 1.2rem; font-weight: 750; letter-spacing: -.035em; text-decoration: none; }
.brand-mark { width: 1.25rem; aspect-ratio: 1; border: 2px solid #88b9e0; border-radius: 50%; background: radial-gradient(circle, #f59a80 26%, #e7bc65 29% 47%, #628fba 50%); flex: none; }
nav { display: flex; align-items: center; gap: .35rem clamp(.8rem, 2vw, 1.65rem); flex-wrap: wrap; }
nav a { color: #c7d4de; text-decoration: none; font-size: .94rem; }
nav a:hover { color: var(--text); text-decoration: underline; }
.nav-cta { padding: .52rem .9rem; border: 1px solid #5b8c83; border-radius: .4rem; color: var(--seafoam); font-weight: 650; }
.nav-cta:hover { color: #c7f6e7; border-color: var(--seafoam); text-decoration: none; }

.hero { position: relative; isolation: isolate; overflow: hidden; background: #101c26; }
.hero-scene { position: absolute; z-index: -1; inset: 0; margin: 0; }
.hero-scene :is(img, video) { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 67% 50%; }
.hero-scene video { position: absolute; inset: 0; visibility: hidden; }
.hero-scene.has-video video { visibility: visible; }
.hero-scene::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #0c1622 0%, #0c1622f0 24%, #0c1622b3 44%, #0c162230 64%, transparent 81%), linear-gradient(0deg, #0c1622af, transparent 28%); }
.hero-media-tools { position: absolute; z-index: 1; right: max(2rem, calc((100% - 74rem) / 2)); bottom: 1rem; display: flex; align-items: center; gap: .45rem; color: #f1f3f2; }
.hero-media-tools span, .hero-media-tools button { background: #101a24e6; padding: .36rem .55rem; border-radius: .3rem; font-size: .82rem; }
.hero-media-tools button { color: #f1f3f2; border: 1px solid #71838d; min-height: 2.25rem; }
.hero-media-tools button:hover { background: #253a48; border-color: #d0dfdf; }
.hero-inner { display: flex; align-items: center; min-height: clamp(34rem, 50vw, 48rem); padding-block: 4rem; }
.hero-copy { width: min(100%, 40rem); }
.context { color: var(--seafoam); font-size: .9rem; letter-spacing: .015em; font-weight: 650; margin-bottom: 1rem; }
.context span { margin-inline: .3em; color: #91aab4; }
h1 { font-size: clamp(2.65rem, 5.4vw, 5.4rem); font-weight: 700; line-height: 1.02; max-width: 17ch; letter-spacing: -.057em; text-wrap: balance; color: #f7faf9; }
.intro { color: #d5dfe2; font-size: clamp(1.07rem, 1.7vw, 1.23rem); max-width: 43ch; margin-top: 1.35rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.75rem; }
.hero-actions a { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .76rem .95rem; min-height: 2.9rem; border-radius: .35rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.primary { border: 1px solid var(--seafoam); background: var(--seafoam); color: #142d2a; }
.primary:hover { background: #c5f3e4; border-color: #c5f3e4; }
.secondary { border: 1px solid #80919c; background: #0d192281; color: #f1f6f5; }
.secondary:hover { border-color: #d0dfdf; background: #253a48; }
.play-icon { width: .7rem; height: .8rem; background: var(--seafoam); clip-path: polygon(12% 0, 100% 50%, 12% 100%); }

.film-section { background: #111d29; border-block: 1px solid #2a3b49; padding-block: clamp(2.6rem, 6.2vw, 5.6rem); }
.film-layout { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.55fr); align-items: center; gap: clamp(1.75rem, 5vw, 5rem); }
.film-copy h2 { font-size: clamp(2rem, 4vw, 3.75rem); max-width: 11ch; letter-spacing: -.05em; }
.film-copy h2 + p { color: #c0cdd5; max-width: 34ch; margin-block: .9rem 1.25rem; }
.film-copy a { color: var(--seafoam); font-weight: 650; }
.film-player { min-width: 0; }
.film-player video { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: contain; background: #091017; border: 1px solid #465a68; border-radius: .6rem; box-shadow: 0 16px 48px #070e1480; }
.film-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .35rem .8rem; color: #bacbd4; font-size: .875rem; margin-top: .65rem; }
.film-meta a { color: inherit; }

.paper { --text: var(--ink); --muted: #445965; --line: #cedbd8; --blue: #166151; --card: #fafcfb; background: var(--paper); color: var(--ink); color-scheme: light; }
.editorial { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.4fr); gap: 1.25rem 3rem; padding-block: clamp(2.5rem, 6vw, 5rem); }
.editorial + .editorial { border-top: 1px solid var(--line); }
.editorial h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); text-wrap: balance; }
.editorial :is(p, li) { color: var(--muted); max-width: 68ch; }
.editorial .lead { color: var(--text); font-weight: 650; font-size: clamp(1.2rem, 2.5vw, 1.6rem); line-height: 1.3; }
.details, .steps { margin: 0; padding-left: 1.25rem; }
.lead + .details { margin-top: 1rem; }
.details li + li, .steps li + li { margin-top: .65rem; }
.editorial strong { color: var(--text); }
li::marker { color: var(--blue); }
.mission-quote { margin: 1.65rem 0 0; border-left: 2px solid #4e8a7c; padding: .2rem 0 .2rem 1rem; max-width: 54ch; font: 1.12rem/1.55 Georgia, serif; color: #345951; }
.contact { margin-top: 1.5rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); overflow-wrap: anywhere; }
.contact ul { display: flex; flex-wrap: wrap; gap: .4rem 1.15rem; list-style: none; padding: 0; margin: .65rem 0; }

.sim-section { background: #11202d; border-block: 1px solid var(--line); padding-block: clamp(2.5rem, 6vw, 5rem); }
.section-intro { margin: .7rem 0 1.65rem; max-width: 66ch; color: var(--muted); }
.sim-hud { position: sticky; top: var(--header-height); z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .65rem; min-height: 2.65rem; margin-bottom: .85rem; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: .4rem; background: #17212b; }
.sim-hud a { margin-left: auto; font-size: .87rem; }
#map { scroll-margin-top: calc(var(--header-height) + 3.65rem); }
.sim-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(16rem, 1fr); gap: 1rem; align-items: start; }
.panel { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: .65rem; padding: clamp(.85rem, 2vw, 1.2rem); }
.panel-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .35rem .85rem; margin-bottom: .65rem; }
.clock-label, .hint { color: var(--muted); font-size: .875rem; }
#clock, #hud-clock, .log-time { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.scenarios, .control-row, .control-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.scenarios { margin-block: .9rem 1rem; }
.control-row { justify-content: space-between; gap: .6rem 1rem; }
.sim-section button:not(.pin), select {
  border: 1px solid #4b6378; background: #203345; color: var(--text); border-radius: .4rem; padding: .48rem .65rem; min-height: 2.5rem; font-size: .88rem;
}
.sim-section button:not(.pin):hover, .sim-section button[aria-pressed="true"] { border-color: var(--blue); background: #2b4760; }
#scenarios button[aria-pressed="true"] { background: var(--blue); color: #102234; border-color: var(--blue); font-weight: 650; }
#map-help { margin-block: .7rem .5rem; }
.map { aspect-ratio: 3 / 2; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: .5rem .5rem 0 0; background: #202d38; }
.map canvas { width: 100%; height: 100%; display: block; }
.pin { position: absolute; display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; transform: translate(-50%, -50%); font-size: .72rem; font-weight: 800; color: #17212b; touch-action: none; cursor: grab; }
.pin::before { content: ''; position: absolute; z-index: -1; width: 1.35rem; height: 1.35rem; border: 2px solid #17212b; box-shadow: 0 1px 3px #111a23b3; }
.pin:active { cursor: grabbing; }
.pin:disabled { cursor: default; }
.victim-pin { color: #effaf7; }
.victim-pin::before { border-radius: 50%; background: #4fb79d; }
.monitor-pin::before { width: 1.15rem; height: 1.15rem; background: #ecf2f7; transform: rotate(45deg); }
.monitor-pin.dim { opacity: .56; }
.pin-label { position: absolute; left: 50%; top: calc(100% + 2px); transform: translateX(-50%); pointer-events: none; white-space: nowrap; color: #f0f5fa; text-shadow: 0 1px 2px #17212b, 1px 0 #17212b, -1px 0 #17212b; }
.victim-pin .pin-label { top: auto; bottom: calc(100% + 2px); }
.victim-pin.near .pin-label { top: 50%; right: calc(100% + 2px); bottom: auto; left: auto; transform: translateY(-50%); }
.map-status { min-height: 3.3rem; display: flex; align-items: center; flex-wrap: wrap; gap: .2rem .65rem; padding: .5rem .7rem; background: #111f2b; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 .5rem .5rem; }
.map-status span { color: var(--muted); font-size: .875rem; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; padding: 0; margin: .85rem 0; list-style: none; color: var(--muted); font-size: .855rem; }
.legend li::before { content: ''; display: inline-block; height: .63rem; width: .63rem; margin-right: .35rem; border: 2px solid var(--key); border-radius: 50%; }
.key-victim, .key-safe { --key: var(--green); }
.key-monitor::before { --key: #ecf2f7; background: var(--key); transform: rotate(45deg) scale(.8); }
.key-red { --key: var(--red); }
.key-known { --key: #d5d9e2; }
.key-known::before, .key-fixed::before { border-style: dashed !important; }
.key-judicial { --key: var(--blue); }
.key-yellow { --key: var(--yellow); }
.key-fixed { --key: var(--purple); }
.settings { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
summary { color: var(--blue); cursor: pointer; font-weight: 650; }
.setting-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin-block: .8rem; }
.setting-fields label { display: grid; gap: .25rem; align-content: start; color: var(--muted); font-size: .9rem; }
.setting-fields select { width: 100%; }
.readouts { display: grid; gap: 1rem; }
.status-pill { display: inline-block; padding: .24rem .55rem; border-radius: .35rem; color: var(--tone, var(--green)); background: #10202c; font-size: .9rem; font-weight: 700; }
#hud-status::before { content: ''; display: inline-block; width: .48rem; aspect-ratio: 1; border-radius: 50%; margin-right: .42rem; background: currentColor; vertical-align: .08em; }
[data-level="judicial"] { --tone: var(--blue); }
[data-level="yellow"], [data-level="review"] { --tone: var(--yellow); }
[data-level="red"], [data-level="sos"] { --tone: var(--red); }
[data-level="fixed"] { --tone: var(--purple); }
.map-status strong { color: var(--tone, var(--green)); }
.readout-list { margin: .75rem 0 0; }
.readout-list div { display: grid; gap: .08rem; padding-block: .48rem; border-top: 1px solid var(--line); }
.readout-list dt { font-size: .84rem; font-weight: 700; color: var(--text); }
.readout-list dd { margin: 0; font-size: .9rem; color: var(--muted); white-space: pre-line; }
.phone-message, .readouts h3 + p { margin-block: .65rem; }
.readouts .control-group + p { margin-top: .65rem; }
.log-card { grid-column: 1 / -1; }
#event-log { list-style: none; padding: 0; margin: .55rem 0 0; max-height: 16rem; overflow: auto; }
#event-log li { display: grid; grid-template-columns: 3.45rem 1fr; gap: .5rem; padding: .5rem .2rem; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
footer { border-top: 1px solid var(--line); background: #111e2b; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem 2rem; padding-block: 1.5rem; }
.footer-inner p { font-size: .92rem; color: var(--muted); max-width: 72ch; }

@media (max-width: 55rem) {
  .wrap, .header-inner { width: calc(100% - 3rem); }
  .hero-scene :is(img, video) { object-position: 71% 50%; }
  .hero-scene::after { background: linear-gradient(90deg, #0c1622 0%, #0c1622eb 27%, #0c1622af 50%, #0c162221 85%); }
  .sim-layout { grid-template-columns: minmax(0, 1fr); }
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 42rem) {
  :root { --header-height: 5.4rem; }
  .wrap, .header-inner { width: calc(100% - 2rem); }
  .header-inner { position: relative; align-items: flex-start; flex-direction: column; gap: .45rem; padding-block: .68rem .58rem; }
  nav { gap: .2rem clamp(.45rem, 2.3vw, 1rem); padding-bottom: .1rem; }
  nav a { font-size: .85rem; }
  .nav-cta { position: absolute; right: 0; top: .57rem; padding: .24rem .6rem; }
  .hero { --scene-height: clamp(15rem, 67vw, 23rem); }
  .hero-scene { bottom: auto; height: var(--scene-height); }
  .hero-scene :is(img, video) { object-position: 94% 49%; }
  .hero-scene::after { background: linear-gradient(0deg, #101c26 0%, #101c2670 20%, transparent 55%); }
  .hero-media-tools { top: .65rem; right: 1rem; bottom: auto; }
  .hero-inner { min-height: 0; padding-block: calc(var(--scene-height) - .7rem) 2.75rem; }
  h1 { font-size: clamp(2.55rem, 8.1vw, 3.65rem); max-width: 17ch; }
  .intro { margin-top: .9rem; }
  .hero-actions { margin-top: 1.25rem; }
  .hero-actions a { font-size: .92rem; }
  .film-layout { grid-template-columns: minmax(0, 1fr); gap: 1.35rem; }
  .film-copy h2 { max-width: 20ch; }
  .editorial, .readouts { grid-template-columns: minmax(0, 1fr); }
  .map { aspect-ratio: 4 / 3; }
  .pin { width: 1.72rem; height: 1.72rem; }
}

@media (max-width: 24rem) {
  .setting-fields { grid-template-columns: 1fr; }
}
