/* Tiny Cosmos — hard-science-fiction command interface */
:root {
  --bg: #030608;
  --bg-raised: #071014;
  --panel: rgba(7, 17, 22, 0.9);
  --panel-strong: rgba(9, 22, 28, 0.96);
  --line: rgba(113, 217, 235, 0.18);
  --line-strong: rgba(113, 217, 235, 0.42);
  --cyan: #72e5f5;
  --cyan-soft: #35aec1;
  --amber: #ffb84d;
  --green: #61e6a7;
  --red: #ff6577;
  --violet: #c594ff;
  --text: #d8e7ea;
  --text-bright: #f4fbfc;
  --muted: #6f8b91;
  --faint: #344a50;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", "Noto Sans Mono", monospace;
  --sans: Inter, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --fs-body: 15px;
  --fs-secondary: 13px;
  --fs-status: 12px;
  --fs-control: 13px;
  --fs-heading: 16px;
  --fs-display: 20px;
  --control-height: 38px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(3, 6, 8, 0.4), rgba(3, 6, 8, 0.66)),
    url('../assets/textures/background/star-dust.webp'),
    linear-gradient(rgba(62, 117, 126, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 117, 126, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 52% 24%, rgba(25, 85, 94, 0.13), transparent 38%),
    #030608;
  background-size: auto, 1024px 1024px, 32px 32px, 32px 32px, auto, auto;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.screen-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.11;
  background:
    url('../assets/textures/background/screen-noise.webp') repeat,
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(160, 231, 240, 0.018) 4px);
  background-size: 256px 256px, auto;
  mix-blend-mode: screen;
}

.command-header {
  height: 72px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(3, 9, 12, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
}

.command-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan) 0 11%, transparent 11% 92%, var(--amber) 92%);
  opacity: 0.5;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  position: relative;
  transform: rotate(45deg);
}
.brand-mark::before, .brand-mark::after, .brand-mark span {
  content: "";
  position: absolute;
  border: 1px solid var(--cyan-soft);
  border-radius: 50%;
}
.brand-mark::before { inset: 7px; }
.brand-mark::after { inset: 13px; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.brand-mark span:first-child { width: 3px; height: 3px; left: 1px; top: 15px; background: var(--amber); border: 0; }
.brand-mark span:last-child { width: 3px; height: 3px; right: 1px; top: 15px; background: var(--cyan); border: 0; }
.eyebrow, .panel-code, .telemetry-cell span, .mission-state span, .research-label span {
  font: 9px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-lockup h1 { margin: 3px 0 0; font: 600 17px/1 var(--mono); letter-spacing: 0.11em; color: var(--text-bright); }
.brand-lockup h1 .brand-zh { margin-left: 8px; font: 500 11px/1 var(--sans); letter-spacing: 0.08em; color: var(--muted); }
.debug-letter { position: relative; display: inline-block; }
.debug-letter > button { position: absolute; z-index: 2; left: 10%; top: 28%; width: 80%; height: 46%; padding: 0; border: 0; background: transparent; opacity: 0; cursor: default; }

.header-telemetry { display: flex; height: 100%; }
.telemetry-cell {
  min-width: 112px;
  padding: 15px 18px 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.telemetry-cell:last-child { border-right: 1px solid var(--line); }
.telemetry-cell strong { font: 600 13px/1.2 var(--mono); color: var(--text-bright); letter-spacing: 0.08em; }
.status-online strong { color: var(--green); }
.status-online i, .live-mark i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; background: var(--green); box-shadow: 0 0 8px var(--green); }
.header-actions { justify-self: end; display: flex; gap: 8px; }
.audio-toggle[aria-pressed="true"] { color: var(--muted); border-color: rgba(111,139,145,0.25); }
.header-actions #archive-btn span, .header-actions #log-btn span { min-width: 15px; padding: 2px 4px; background: rgba(114,229,245,0.12); color: var(--text-bright); font-size: 8px; }
.header-actions #archive-btn.has-unread, .header-actions #log-btn.has-unread { position: relative; border-color: rgba(255,101,119,0.42); }
.header-actions #archive-btn.has-unread::after, .header-actions #log-btn.has-unread::after { content: ""; position: absolute; right: -3px; top: -3px; width: 7px; height: 7px; border: 2px solid #050b0e; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }

.btn {
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: rgba(35, 105, 115, 0.08);
  color: var(--cyan);
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}
.btn:hover:not(:disabled) { background: rgba(75, 190, 207, 0.16); border-color: var(--cyan); color: var(--text-bright); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; color: var(--faint); border-color: rgba(104, 148, 155, 0.12); background: rgba(255,255,255,0.015); }
.btn-primary { background: rgba(65, 191, 210, 0.16); border-color: rgba(114, 229, 245, 0.65); color: var(--text-bright); }
.btn-quiet { min-height: 28px; padding: 5px 10px; }
.btn-danger-quiet { min-height: 28px; padding: 5px 10px; color: #c47b85; border-color: rgba(255, 101, 119, 0.22); background: transparent; }
.btn-danger-quiet:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: rgba(255, 101, 119, 0.08); }

.command-grid {
  width: 100%;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 290px) minmax(480px, 1fr) minmax(330px, 380px);
  gap: 12px;
  align-items: start;
}
.center-stack, .right-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.panel {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(10, 24, 30, 0.94), rgba(4, 12, 16, 0.92));
  box-shadow: inset 0 0 40px rgba(31, 104, 114, 0.035), 0 10px 30px rgba(0,0,0,0.2);
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 1px;
  background: var(--cyan);
  opacity: 0.55;
}
.panel::before { left: -1px; top: -1px; }
.panel::after { right: -1px; bottom: -1px; }
.panel-heading {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(98, 198, 213, 0.025);
}
.panel-heading.compact { min-height: 40px; }
.panel-heading > div { display: flex; align-items: center; gap: 9px; }
.panel-heading h2 { margin: 0; font: 600 12px/1 var(--mono); letter-spacing: 0.08em; color: var(--text-bright); }
.panel-index { font: 500 9px/1 var(--mono); color: var(--cyan); padding-right: 8px; border-right: 1px solid var(--line-strong); }

.resource-panel { max-height: calc(100vh - 105px); min-width: 0; overflow-x: hidden; overflow-y: scroll; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.expanded-matter-stack .resource-panel {
  position: sticky;
  top: 84px;
  height: calc(100dvh - 96px);
  max-height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.expanded-matter-stack .resource-panel > .panel-heading { flex: 0 0 auto; }
.expanded-matter-stack .resource-panel > .tier-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}
.expanded-matter-stack .resource-panel .tier-horizon { margin-top: auto; }
.tier-grid { display: flex; flex-direction: column; }
.tier-card {
  --tier-color: var(--cyan);
  position: relative;
  padding: 11px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.012);
  transition: opacity 140ms ease, background 140ms ease, border-color 140ms ease;
  min-width: 0;
}
.tier-card:last-child { border-bottom: 0; }
.tier-card:hover { background: rgba(71, 155, 167, 0.045); }
.tier-card.focused { background: linear-gradient(90deg, rgba(55, 177, 194, 0.11), transparent 70%); box-shadow: inset 2px 0 0 var(--cyan); }
.tier-card.reserved::after { content: "RESERVE"; position: absolute; right: 10px; bottom: 10px; font: 8px/1 var(--mono); color: var(--green); letter-spacing: 0.12em; }
.tier-card.locked { opacity: 0.34; }
.tier-card.researchable { opacity: 0.88; background: linear-gradient(90deg, rgba(255, 184, 77, 0.06), transparent); }
.tier-card.horizon-card { min-height: 53px; }
.tc-head { display: flex; align-items: center; gap: 7px; min-height: 18px; }
.tc-index { width: 20px; font: 8px/1 var(--mono); color: var(--muted); }
.tc-icon { width: 15px; height: 15px; object-fit: contain; filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(1080%) hue-rotate(144deg) brightness(101%) contrast(92%); opacity: 0.82; }
.tc-name { font-size: 12px; color: var(--text-bright); }
.tc-en { margin-left: auto; font: 8px/1 var(--mono); letter-spacing: 0.1em; color: var(--muted); }
.tc-readout { display: flex; align-items: baseline; justify-content: space-between; margin: 7px 0 3px 27px; }
.tc-readout strong { font: 600 22px/1 var(--mono); color: var(--text-bright); }
.tc-readout span { padding: 3px 5px; border: 1px solid var(--line); font: 8px/1 var(--mono); letter-spacing: 0.08em; color: var(--green); }
.tc-readout span.shortage { color: var(--red); border-color: rgba(255,101,119,0.24); }
.tc-readout span.overload { color: var(--amber); border-color: rgba(255,184,77,0.24); }
.tc-bars { margin: 6px 0 4px 27px; }
.tc-bar-row { display: grid; grid-template-columns: 30px 1fr 57px; align-items: center; gap: 5px; margin-top: 3px; }
.tc-bar-label, .tc-bar-val { font: 8px/1 var(--mono); color: var(--muted); }
.tc-bar-val { text-align: right; }
.tc-bar-track { height: 2px; background: rgba(255,255,255,0.055); }
.tc-bar-fill { height: 100%; transition: width 180ms linear; }
.tc-bar-fill.prod { background: var(--green); box-shadow: 0 0 5px rgba(97,230,167,0.5); }
.tc-bar-fill.demand { background: var(--red); }
.prod-text { color: var(--green); }
.demand-text { color: var(--red); }
.tc-net { margin-left: 27px; font: 9px/1 var(--mono); color: var(--muted); }
.tc-net.pos { color: var(--green); }
.tc-net.neg { color: var(--red); }
.tc-modifiers { min-height: 15px; margin: 5px 0 0 27px; display: flex; flex-wrap: wrap; gap: 4px; }
.tc-modifiers:empty { display: none; }
.tc-modifier { padding: 3px 5px; border: 1px solid var(--line); background: rgba(0,0,0,0.18); font: 7px/1 var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.tc-modifier.focus { color: var(--cyan); border-color: rgba(114,229,245,0.28); box-shadow: inset 0 0 10px rgba(114,229,245,0.05); }
.tc-modifier.reserve { color: var(--green); border-color: rgba(97,230,167,0.26); }
.tc-modifier.reverse-pressure { color: #d98a96; border-color: rgba(255,101,119,0.26); background: rgba(255,101,119,0.035); }
.tc-modifier.reverse-gain { color: var(--violet); border-color: rgba(197,148,255,0.28); }
.tc-modifier.reverse-cost { color: var(--red); border-color: rgba(255,101,119,0.25); }
.tc-modifier:is(button) { appearance: none; text-align: left; cursor: pointer; }
.tc-modifier:is(button):hover, .tc-modifier:is(button):focus-visible { border-color: var(--red); color: #ffabb5; outline: 0; }
.tc-modifier i { margin-left: 2px; font-style: normal; color: var(--text-bright); }
.tc-modifier.terminal-whisper { flex-basis: 100%; color: #84969f; border-style: dashed; border-color: rgba(197,148,255,0.18); letter-spacing: 0.02em; line-height: 1.3; }
.tc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 9px 0 0 27px; }
.btn-tier { grid-column: 1 / -1; min-height: 28px; padding: 5px 7px; font-size: 9px; }
.tier-card .btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-micro { min-height: 24px; padding: 4px 6px; font-size: 8px; }
.btn-micro.active { color: var(--text-bright); border-color: var(--green); background: rgba(97,230,167,0.11); }
.tc-locked { margin: 8px 0 0 27px; font: 8px/1.3 var(--mono); letter-spacing: 0.11em; color: var(--faint); }

.mission-strip {
  min-height: 68px;
  display: grid;
  grid-template-columns: 145px 1fr 94px;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: linear-gradient(90deg, rgba(26, 103, 114, 0.12), rgba(7,17,22,0.93));
}
.mission-sequence { padding: 0 14px; }
.mission-sequence > span { display: flex; align-items: center; gap: 7px; font: 9px/1 var(--mono); color: var(--cyan); letter-spacing: 0.08em; }
.mission-sequence > span b { font: inherit; font-weight: 500; }
.mission-sequence img { width: 17px; height: 17px; filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(1080%) hue-rotate(144deg) brightness(101%) contrast(92%); }
.mission-track { height: 2px; margin-top: 8px; background: rgba(255,255,255,0.08); }
.mission-track i { display: block; width: 8%; height: 100%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width 180ms ease; }
.mission-copy { min-width: 0; padding: 7px 15px; border-left: 1px solid var(--line); }
.mission-copy-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.mission-copy-head span { flex: 0 0 auto; font: 8px/1 var(--mono); color: var(--amber); letter-spacing: 0.12em; }
.mission-copy-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px/1.2 var(--sans); color: var(--text-bright); }
.mission-action-progress { display: grid; grid-template-columns: minmax(70px, 1fr) auto; align-items: center; gap: 8px; margin-top: 8px; }
.mission-action-progress > div { height: 3px; overflow: hidden; background: rgba(255,255,255,0.07); }
.mission-action-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--amber), var(--cyan)); box-shadow: 0 0 7px rgba(114,229,245,0.6); transition: width 160ms ease; }
.mission-action-progress span { font: 7px/1 var(--mono); color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; }
.mission-state { appearance: none; align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: rgba(114,229,245,0.025); text-align: left; cursor: pointer; transition: background 140ms ease, box-shadow 140ms ease; }
.mission-state:hover { background: rgba(114,229,245,0.08); }
.mission-state b { margin-top: 5px; font: 600 10px/1 var(--mono); color: var(--green); letter-spacing: 0.1em; }
.mission-state.resting { cursor: default; background: rgba(97,230,167,0.035); }
.mission-state.resting b { color: var(--cyan); font-size: 8px; line-height: 1.25; }
.mission-state.attention { box-shadow: inset 0 -2px 0 var(--amber); }
.mission-state.attention b { color: var(--amber); }
.mission-state.dock-arrival { animation: dockArrival 650ms ease-out; }
.mission-strip.near-complete { border-color: rgba(255,184,77,0.48); background: linear-gradient(90deg, rgba(255,184,77,0.055), var(--panel-strong) 36%); box-shadow: inset 0 0 28px rgba(255,184,77,0.035); }
.mission-strip.near-complete .mission-action-progress i { background: linear-gradient(90deg, var(--amber), #ffe4a2); box-shadow: 0 0 10px rgba(255,184,77,0.8); }
.mission-strip.urgent { animation: missionUrgency 1.15s ease-in-out infinite; }
.mission-strip.urgent .mission-copy-head span, .mission-strip.urgent .mission-action-progress span { color: #ffd591; }

.cosmos-stage {
  position: relative;
  height: clamp(390px, 51vh, 590px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #020609;
  cursor: crosshair;
}
.cosmos-stage::before, .cosmos-stage::after { content: ""; position: absolute; pointer-events: none; z-index: 2; }
.cosmos-stage::before { inset: 11px; border: 1px solid rgba(114,229,245,0.08); clip-path: polygon(0 0, 38px 0, 38px 1px, 1px 1px, 1px 38px, 0 38px, 0 100%, calc(100% - 38px) 100%, calc(100% - 38px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 38px), 100% calc(100% - 38px), 100% 0); }
.cosmos-stage::after { left: 50%; top: 50%; width: 8px; height: 8px; transform: translate(-50%,-50%); border: 1px solid rgba(114,229,245,0.55); }
#cosmos-canvas { display: block; width: 100%; height: 100%; }
.reverse-noise-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: url('../assets/textures/background/reverse-noise.webp') center / 512px 512px repeat;
  mix-blend-mode: screen;
  transition: opacity 900ms ease;
}
.cosmos-stage.reverse-contact .reverse-noise-overlay { opacity: 0.13; }
.canvas-corner { position: absolute; z-index: 3; pointer-events: none; }
.canvas-corner.top-left { top: 20px; left: 22px; }
.canvas-corner.top-right { top: 20px; right: 22px; text-align: right; }
.canvas-corner span { display: block; margin-bottom: 5px; font: 8px/1 var(--mono); letter-spacing: 0.12em; color: var(--muted); }
.canvas-corner b { font: 500 10px/1 var(--mono); color: var(--cyan); letter-spacing: 0.08em; }
.canvas-inspector {
  position: absolute;
  z-index: 10;
  width: min(270px, calc(100% - 24px));
  padding: 10px 11px;
  border: 1px solid rgba(114,229,245,0.42);
  border-left: 2px solid var(--cyan);
  background: rgba(3,12,16,0.97);
  box-shadow: 0 14px 38px rgba(0,0,0,0.52), inset 0 0 24px rgba(114,229,245,0.035);
  cursor: default;
}
.canvas-inspector > span { display: block; font: 8px/1 var(--mono); letter-spacing: 0.1em; color: var(--cyan); }
.canvas-inspector > strong { display: block; margin-top: 7px; font-size: 13px; color: var(--text-bright); }
.canvas-inspector > p { margin: 6px 0 9px; font-size: 11px; line-height: 1.5; color: #9bb0b4; }
.canvas-inspector > button, .inline-lore-link {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(197,148,255,0.35);
  background: rgba(197,148,255,0.065);
  color: #dcc4ff;
  font: 9.5px/1.2 var(--mono);
  cursor: pointer;
}
.canvas-inspector > button:hover, .inline-lore-link:hover { border-color: var(--violet); background: rgba(197,148,255,0.13); color: white; }
.click-hint { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 4; padding: 7px 10px; border: 1px solid var(--line); background: rgba(3,10,13,0.8); color: var(--muted); font: 9px/1 var(--mono); letter-spacing: 0.08em; pointer-events: none; animation: signalPulse 1.8s ease-in-out infinite; }
.click-hint span { color: var(--amber); margin-right: 7px; }
@keyframes signalPulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
.anomaly-overlay { position: absolute; z-index: 5; right: 20px; top: 58px; min-width: 180px; padding: 10px 12px; border-left: 2px solid var(--red); background: rgba(30,6,11,0.82); pointer-events: none; }
.anomaly-overlay span, .anomaly-overlay small { display: block; font: 8px/1.4 var(--mono); letter-spacing: 0.08em; color: #c77e88; }
.anomaly-overlay strong { display: block; margin: 4px 0; font-size: 13px; color: #ffe2e5; }
.era-indicator { position: absolute; z-index: 12; left: 20px; top: 58px; width: min(350px, calc(100% - 40px)); padding: 10px 12px; border: 1px solid rgba(77,171,247,0.28); border-left: 2px solid #4dabf7; background: linear-gradient(110deg, rgba(4,20,27,0.94), rgba(7,10,22,0.9)); box-shadow: inset 0 0 28px rgba(77,171,247,0.035), 0 12px 32px rgba(0,0,0,0.32); }
.era-indicator > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.era-indicator > header span { display: block; font: 8px/1 var(--mono); letter-spacing: 0.11em; color: #79bdff; }
.era-indicator > header button { padding: 3px 6px; border: 1px solid rgba(77,171,247,0.24); background: rgba(77,171,247,0.05); color: #91b9cb; font: 9px/1 var(--mono); cursor: pointer; }
.era-indicator > header button:hover { border-color: #79bdff; color: white; }
.era-indicator > strong { display: block; margin-top: 6px; font-size: 12px; color: var(--text-bright); }
.era-indicator > small { display: block; margin-top: 5px; font: 7px/1.5 var(--mono); color: #819ba6; }
.era-indicator > div { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.era-indicator > div b, .era-indicator > div button { padding: 4px 6px; border: 1px solid rgba(77,171,247,0.16); background: rgba(77,171,247,0.035); font: 8.5px/1 var(--mono); color: #8fb9c8; font-weight: 500; }
.era-indicator > div button { cursor: pointer; }
.era-indicator > div button:hover { border-color: rgba(197,148,255,0.55); color: #e1ceff; }
.cellular-era .cosmos-stage { border-color: rgba(77,171,247,0.27); box-shadow: inset 0 0 54px rgba(77,171,247,0.025); }
.discovery-card { position: absolute; z-index: 8; left: 18px; bottom: 18px; width: min(360px, calc(100% - 36px)); padding: 14px 15px; border: 1px solid rgba(197,148,255,0.4); border-left: 2px solid var(--violet); background: linear-gradient(135deg, rgba(15,9,28,0.96), rgba(3,12,16,0.96)); box-shadow: 0 18px 48px rgba(0,0,0,0.55), inset 0 0 34px rgba(197,148,255,0.045); cursor: default; }
.discovery-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.discovery-card header span { font: 9px/1 var(--mono); color: var(--violet); letter-spacing: 0.1em; }
.discovery-card header button { min-height: 30px; padding: 5px 8px; border: 1px solid rgba(197,148,255,0.25); background: rgba(197,148,255,0.05); color: #d9bdff; font: 9.5px/1 var(--mono); cursor: pointer; }
.discovery-card header button:hover { border-color: var(--violet); background: rgba(197,148,255,0.12); }
.discovery-card > strong { display: block; margin-top: 11px; font-size: 15px; line-height: 1.35; color: var(--text-bright); }
.discovery-card > p { margin: 9px 0; font-size: 12px; line-height: 1.65; color: #a9b8bc; }
.discovery-card > small { font: 9px/1.5 var(--mono); color: var(--muted); }
.discovery-choices { display: grid; gap: 6px; margin: 10px 0; }
.discovery-choices:empty { display: none; }
.discovery-choices button { min-height: 48px; padding: 8px 9px; border: 1px solid var(--line); border-left: 2px solid var(--cyan); background: rgba(255,255,255,0.018); color: inherit; text-align: left; cursor: pointer; }
.discovery-choices button:hover { background: rgba(197,148,255,0.08); border-color: rgba(197,148,255,0.45); }
.discovery-choices button.route-advance { border-left-color: var(--amber); }
.discovery-choices button.route-sustain { border-left-color: var(--green); }
.discovery-choices button.route-inquiry { border-left-color: var(--cyan); }
.discovery-choices button.route-rewrite { border-left-color: var(--violet); }
.discovery-choices b, .discovery-choices small { display: block; }
.discovery-choices b { font: 500 11px/1.25 var(--mono); color: var(--text-bright); }
.discovery-choices small { margin-top: 4px; font: 9px/1.4 var(--mono); color: var(--muted); }
.discovery-card.discovery-enter { animation: discoveryEnter 650ms cubic-bezier(.2,.72,.16,1) both; }

.flow-monitor {
  position: absolute;
  z-index: 7;
  right: 14px;
  bottom: 14px;
  width: min(430px, calc(100% - 28px));
  border: 1px solid rgba(114,229,245,0.25);
  background: rgba(3,10,14,0.9);
  box-shadow: 0 14px 36px rgba(0,0,0,0.44), inset 0 0 26px rgba(57,160,178,0.035);
  cursor: default;
  transition: width 180ms ease, background 180ms ease;
}
.flow-monitor::after { content: ""; position: absolute; right: 6px; top: 6px; width: 22px; height: 1px; background: var(--cyan); opacity: 0.45; }
.flow-monitor-head { min-height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 10px; border-bottom: 1px solid var(--line); }
.flow-monitor-head span, .flow-monitor-head strong { display: block; }
.flow-monitor-head span { margin-bottom: 4px; font: 7px/1 var(--mono); color: var(--muted); letter-spacing: 0.13em; }
.flow-monitor-head strong { font: 500 10px/1 var(--mono); color: var(--text-bright); letter-spacing: 0.08em; }
.flow-monitor-head button { position: relative; z-index: 1; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); background: rgba(114,229,245,0.04); color: var(--cyan); font: 12px/1 var(--mono); cursor: pointer; }
.flow-monitor-head button:hover { border-color: var(--cyan); background: rgba(114,229,245,0.1); }
.flow-monitor-body { padding: 8px 10px 10px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; transition: max-height 180ms ease, opacity 120ms ease, padding 180ms ease; max-height: min(430px, calc(51vh - 54px)); }
.flow-legend { display: flex; align-items: center; gap: 12px; margin-bottom: 7px; padding-bottom: 6px; border-bottom: 1px solid rgba(114,229,245,0.08); }
.flow-legend strong { margin-right: auto; font: 8px/1 var(--mono); color: var(--text-bright); letter-spacing: 0.08em; }
.flow-legend span { position: relative; padding-left: 8px; font: 7px/1 var(--mono); color: var(--muted); }
.flow-legend span::before { content: ""; position: absolute; left: 0; top: 2px; width: 4px; height: 4px; background: currentColor; }
.flow-legend .prod { color: var(--green); }
.flow-legend .demand { color: var(--red); }
.flow-legend .net { color: var(--cyan); }
.flow-chart { display: grid; gap: 5px; }
.flow-row { min-height: 54px; display: grid; grid-template-columns: 82px minmax(132px, 1fr) 84px; align-items: center; gap: 8px; padding: 6px 7px; border: 1px solid rgba(114,229,245,0.09); background: rgba(255,255,255,0.012); }
.flow-row.positive { border-left: 2px solid var(--green); }
.flow-row.negative { border-left: 2px solid var(--red); background: rgba(255,101,119,0.025); }
.flow-row.balanced { border-left: 2px solid var(--muted); }
.flow-identity { display: flex; align-items: center; gap: 7px; min-width: 0; }
.flow-identity img { width: 18px; height: 18px; filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(1080%) hue-rotate(144deg) brightness(101%) contrast(92%); }
.flow-identity span, .flow-identity b, .flow-identity small { display: block; min-width: 0; }
.flow-identity b { font: 600 9px/1 var(--mono); }
.flow-identity small { margin-top: 4px; font: 6.5px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.flow-identity .reverse-flow-impact { max-width: 110px; overflow: hidden; text-overflow: ellipsis; color: #c98592; }
.flow-row.reverse-affected { box-shadow: inset 0 0 18px rgba(255,101,119,0.018); }
.flow-equation { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 9px; }
.flow-equation > span { display: flex; align-items: center; gap: 4px; font: 6.5px/1 var(--mono); color: var(--muted); }
.flow-equation > span b { margin-left: auto; font-weight: 500; color: var(--text); }
.flow-equation i { display: inline-block; width: 4px; height: 4px; }
.flow-equation i.prod { background: var(--green); }
.flow-equation i.demand { background: var(--red); }
.flow-equation > div { grid-column: 1 / -1; position: relative; height: 5px; background: rgba(255,255,255,0.05); }
.flow-equation > div i { position: absolute; left: 0; height: 2px; transition: width 180ms linear; }
.flow-equation > div .prod { top: 0; }
.flow-equation > div .demand { bottom: 0; }
.flow-result { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.flow-result span { padding: 2px 4px; border: 1px solid currentColor; font: 6.5px/1 var(--mono); color: var(--green); }
.flow-row.negative .flow-result span { color: var(--red); }
.flow-row.balanced .flow-result span { color: var(--muted); }
.flow-result b { font: 600 10px/1 var(--mono); color: var(--green); }
.flow-row.negative .flow-result b { color: var(--red); }
.flow-row.balanced .flow-result b { color: var(--muted); }
.flow-result small { font: 6px/1 var(--mono); color: var(--faint); }
.research-trend { min-height: 60px; display: grid; grid-template-columns: 122px 1fr; align-items: center; gap: 8px; margin-top: 7px; padding: 7px; border: 1px solid rgba(197,148,255,0.18); background: linear-gradient(90deg, rgba(197,148,255,0.045), transparent); }
.research-trend-copy span, .research-trend-copy strong, .research-trend-copy small { display: block; }
.research-trend-copy span { font: 6.5px/1 var(--mono); color: var(--muted); }
.research-trend-copy strong { margin-top: 5px; font: 600 11px/1 var(--mono); color: var(--violet); }
.research-trend-copy small { margin-top: 5px; font: 6.5px/1 var(--mono); color: var(--muted); }
.research-trend-copy small.up { color: var(--green); }
.research-trend-copy small.down { color: var(--red); }
.research-trend svg { width: 100%; height: 45px; overflow: visible; background: repeating-linear-gradient(to top, transparent 0 14px, rgba(197,148,255,0.06) 14px 15px); }
.research-trend polyline { fill: none; stroke: var(--violet); stroke-width: 1.4; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 3px rgba(197,148,255,0.65)); }
.research-trend circle { fill: #f1e5ff; stroke: var(--violet); stroke-width: 1; vector-effect: non-scaling-stroke; }
.stability-checklist { margin-bottom: 8px; border: 1px solid rgba(255,184,77,0.28); background: rgba(255,184,77,0.025); }
.stability-checklist header { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px; border-bottom: 1px solid rgba(255,184,77,0.16); }
.stability-checklist header span { grid-column: 1 / -1; font: 6.5px/1 var(--mono); color: var(--amber); letter-spacing: 0.1em; }
.stability-checklist header strong { font: 600 10px/1.2 var(--mono); color: var(--text-bright); }
.stability-checklist header small { font: 7px/1.2 var(--mono); color: var(--muted); }
.stability-rows { display: grid; }
.stability-row { display: grid; grid-template-columns: 17px 1fr auto; align-items: center; gap: 7px; min-height: 39px; padding: 5px 7px; border-bottom: 1px solid rgba(114,229,245,0.06); }
.stability-row > i { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid var(--red); color: var(--red); font: normal 8px/1 var(--mono); }
.stability-row.ok > i { border-color: var(--green); color: var(--green); }
.stability-row span b, .stability-row span small { display: block; }
.stability-row span b { font: 500 8px/1.2 var(--mono); color: var(--text); }
.stability-row span small { margin-top: 3px; font: 6.5px/1.25 var(--mono); color: var(--red); }
.stability-row.ok span small { color: var(--green); }
.stability-row em { font: normal 7px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.stability-timer { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; align-items: center; padding: 7px; }
.stability-timer span, .stability-timer b { font: 7px/1 var(--mono); }
.stability-timer span { color: var(--muted); }
.stability-timer b { justify-self: end; color: var(--cyan); font-weight: 500; }
.stability-timer > div { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,0.06); }
.stability-timer > div i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width 180ms linear; }
.flow-monitor.collapsed { width: 145px; background: rgba(3,10,14,0.78); }
.flow-monitor.collapsed .flow-monitor-head { border-bottom: 0; }
.flow-monitor.collapsed .flow-monitor-body { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.flow-monitor.collapsed .flow-monitor-head button { transform: rotate(90deg); }

.research-bar {
  min-height: 66px;
  display: grid;
  grid-template-columns: 175px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.research-label { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 4px 10px; }
.research-label span { grid-column: 1 / -1; }
.research-label strong { font: 600 21px/1 var(--mono); color: var(--cyan); }
.research-label small { align-self: center; font: 8px/1.2 var(--mono); color: var(--muted); }
.research-progress { min-width: 0; }
.rb-track { height: 4px; background: rgba(255,255,255,0.06); overflow: hidden; }
.rb-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan-soft), var(--cyan)); box-shadow: 0 0 8px var(--cyan); transition: width 180ms linear; }
.research-bar.near-ready { border-color: rgba(197,148,255,0.52); background: radial-gradient(circle at 58% 50%, rgba(197,148,255,0.11), transparent 42%), var(--panel); animation: researchCharge 1.7s ease-in-out infinite; }
.research-bar.near-ready .rb-track i { background: linear-gradient(90deg, var(--cyan), var(--violet), #f2dcff); box-shadow: 0 0 13px rgba(197,148,255,0.9); }
.research-bar.research-ready { border-color: rgba(97,230,167,0.45); }
.research-bar.research-ready .rb-track i { background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 11px rgba(97,230,167,0.72); }
.research-progress > span { display: block; margin-top: 6px; font: 8px/1 var(--mono); color: var(--muted); letter-spacing: 0.05em; }
.research-actions { display: flex; gap: 6px; }
.research-breakdown { grid-column: 1 / -1; padding: 10px 11px 8px; border-top: 1px solid var(--line); background: rgba(0,0,0,0.16); }
.research-console { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(150px, 1fr); gap: 8px; margin-bottom: 9px; padding: 9px; border: 1px solid rgba(197,148,255,0.2); background: radial-gradient(circle at 15% 30%, rgba(197,148,255,0.07), transparent 48%), rgba(1,4,8,0.5); overflow: hidden; }
.research-equation span, .research-equation strong, .research-equation code { display: block; }
.research-equation span { font: 6.5px/1 var(--mono); letter-spacing: 0.12em; color: var(--violet); }
.research-equation strong { margin-top: 8px; font: 500 17px/1.1 var(--mono); color: #eadcff; text-shadow: 0 0 12px rgba(197,148,255,0.45); }
.research-equation code { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 7px/1.4 var(--mono); color: #8da7ad; }
.research-signal { position: relative; min-height: 62px; padding: 5px 6px; border-left: 1px solid rgba(197,148,255,0.14); }
.research-signal > span { display: block; overflow: hidden; font: 5.8px/1 var(--mono); letter-spacing: 0.09em; color: rgba(197,148,255,0.52); white-space: nowrap; }
.research-signal svg { display: block; width: 100%; height: 34px; margin-top: 5px; background: repeating-linear-gradient(to top, transparent 0 10px, rgba(197,148,255,0.055) 10px 11px); }
.research-signal polyline { fill: none; stroke: var(--violet); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.research-signal circle { fill: var(--text-bright); stroke: var(--violet); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.research-signal b { display: block; margin-top: 2px; text-align: right; font: 6.5px/1 var(--mono); color: var(--cyan); }
.research-breakdown-head, .research-breakdown-row { display: grid; grid-template-columns: minmax(60px,1fr) minmax(80px,1fr) auto; align-items: center; gap: 10px; }
.research-breakdown-head { margin-bottom: 7px; padding-bottom: 7px; border-bottom: 1px solid rgba(113,217,235,0.09); }
.research-breakdown-head span, .research-breakdown-head b { font: 8px/1 var(--mono); color: var(--muted); }
.research-breakdown-head b { grid-column: 2 / -1; justify-self: end; color: var(--violet); }
.research-breakdown-row { min-height: 22px; }
.research-breakdown-row span, .research-breakdown-row code, .research-breakdown-row b { font: 8px/1.2 var(--mono); }
.research-breakdown-row code { color: var(--muted); }
.research-breakdown-row b { color: var(--text-bright); text-align: right; }
.research-formula, .research-breakdown-empty { margin: 7px 0 0; padding-top: 7px; border-top: 1px solid rgba(113,217,235,0.08); font: 7px/1.55 var(--mono); color: var(--faint); }

.contact-content { min-height: 124px; padding: 12px; }
.status-chip { padding: 4px 6px; border: 1px solid rgba(255,184,77,0.28); color: var(--amber); font: 8px/1 var(--mono); letter-spacing: 0.08em; }
.status-chip.muted { color: var(--muted); border-color: var(--line); }
.status-chip.danger { color: var(--red); border-color: rgba(255,101,119,0.35); }
.status-chip.safe { color: var(--green); border-color: rgba(97,230,167,0.3); }
.empty-state { min-height: 94px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state.small { min-height: 72px; }
.empty-state p { margin: 8px 0 3px; font-size: 11px; color: #90a8ad; }
.empty-state small { max-width: 380px; font: 8px/1.6 var(--mono); color: var(--faint); }
.reticle-icon { width: 24px; height: 24px; border: 1px solid var(--faint); border-radius: 50%; position: relative; }
.reticle-icon::before, .reticle-icon::after { content: ""; position: absolute; background: var(--faint); }
.reticle-icon::before { left: -5px; right: -5px; top: 11px; height: 1px; }
.reticle-icon::after { top: -5px; bottom: -5px; left: 11px; width: 1px; }

.threat-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; }
.threat-name { display: flex; align-items: start; gap: 9px; }
.threat-symbol { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(255,101,119,0.35); color: var(--red); font: 12px/1 var(--mono); }
.threat-name strong { display: block; font-size: 12px; color: var(--text-bright); }
.threat-name small { font: 8px/1.5 var(--mono); color: var(--muted); }
.threat-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.threat-stat { padding: 7px; border: 1px solid var(--line); background: rgba(0,0,0,0.15); }
.threat-stat span { display: block; font: 7px/1 var(--mono); letter-spacing: 0.08em; color: var(--muted); }
.threat-stat b { display: block; margin-top: 5px; font: 500 10px/1 var(--mono); color: var(--text-bright); }
.progress-block span { display: flex; justify-content: space-between; font: 8px/1 var(--mono); color: var(--muted); }
.progress-block .bar { height: 5px; margin: 7px 0 9px; background: rgba(255,255,255,0.06); }
.progress-block .bar i { display: block; height: 100%; background: var(--amber); transition: width 150ms linear; }
.condition-list { margin: 8px 0; padding: 0; list-style: none; }
.condition-list li { margin: 4px 0; font: 8px/1.4 var(--mono); color: var(--muted); }
.condition-list li.ok { color: var(--green); }
.enemy-overview { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.enemy-method-intro { display: flex; justify-content: space-between; gap: 12px; margin: 11px 0 8px; }
.enemy-method-intro b { font-size: 11px; color: var(--text-bright); }
.enemy-method-intro span { font: 7px/1.4 var(--mono); color: var(--muted); text-align: right; }
.enemy-method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.enemy-method-card { min-width: 0; min-height: 132px; padding: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.014); color: inherit; text-align: left; cursor: pointer; transition: border-color 120ms ease, background 120ms ease, transform 80ms ease; }
.enemy-method-card:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(74,164,178,0.06); }
.enemy-method-card:active:not(:disabled) { transform: translateY(1px); }
.enemy-method-card:disabled { opacity: 0.32; cursor: not-allowed; }
.enemy-method-card p { min-height: 27px; margin: 7px 0; font-size: 9px; line-height: 1.5; color: var(--muted); }
.method-metrics { display: grid; gap: 4px; padding-top: 7px; border-top: 1px solid rgba(113,217,235,0.08); }
.method-metrics span { display: grid; grid-template-columns: 32px 1fr; gap: 5px; font: 7px/1.35 var(--mono); color: #859da2; }
.method-metrics i { color: var(--faint); font-style: normal; }
.enemy-method-card.route-advance .choice-top span { color: var(--amber); }
.enemy-method-card.route-sustain .choice-top span { color: var(--green); }
.enemy-method-card.route-inquiry .choice-top span { color: var(--cyan); }
.enemy-method-card.route-rewrite .choice-top span { color: var(--violet); }
.reverse-atlas > header { display: flex; justify-content: space-between; gap: 12px; align-items: start; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.reverse-atlas > header span, .reverse-atlas > header strong { display: block; }
.reverse-atlas > header span { font: 7px/1 var(--mono); letter-spacing: 0.11em; color: var(--red); }
.reverse-atlas > header strong { margin-top: 5px; font-size: 12px; color: var(--text-bright); }
.reverse-atlas > header > b { padding: 4px 6px; border: 1px solid rgba(255,101,119,0.28); color: #ff9eaa; font: 7px/1 var(--mono); font-weight: 500; }
.reverse-pressure { margin: 9px 0; padding: 8px; border: 1px solid rgba(255,101,119,0.18); background: linear-gradient(90deg, rgba(255,101,119,0.045), transparent); }
.reverse-pressure > span { display: flex; justify-content: space-between; gap: 12px; font: 8px/1 var(--mono); }
.reverse-pressure > span b { color: #ff9eaa; }
.reverse-pressure > span em { color: var(--muted); font-style: normal; }
.reverse-pressure > div { height: 4px; margin-top: 7px; background: rgba(255,255,255,0.055); }
.reverse-pressure > div i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--red)); box-shadow: 0 0 8px rgba(255,101,119,0.5); }
.reverse-pressure > small { display: block; margin-top: 7px; font: 7px/1.45 var(--mono); color: var(--faint); }
.reverse-pressure .inline-lore-link { margin-top: 9px; }
.reverse-object-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.reverse-object-card { min-width: 0; display: grid; grid-template-columns: 29px 1fr; gap: 7px; padding: 7px; border: 1px solid var(--line); background: rgba(255,255,255,0.012); }
.reverse-object-card.pending { border-color: rgba(255,101,119,0.38); background: rgba(255,101,119,0.035); }
.reverse-object-card.hidden { opacity: 0.42; }
.reverse-object-symbol { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid currentColor; color: var(--violet); font: 8px/1 var(--mono); }
.reverse-object-card.pending .reverse-object-symbol { color: var(--red); box-shadow: 0 0 9px rgba(255,101,119,0.25); }
.reverse-object-card b, .reverse-object-card small { display: block; }
.reverse-object-card b { font-size: 9px; color: var(--text-bright); }
.reverse-object-card small { margin-top: 3px; font: 6.5px/1.25 var(--mono); color: var(--muted); }
.reverse-object-card p { margin: 5px 0 0; font-size: 7px; line-height: 1.4; color: var(--faint); }
.reverse-atlas > footer { margin-top: 8px; padding: 8px; border-left: 2px solid var(--violet); background: rgba(197,148,255,0.035); }
.reverse-atlas > footer span, .reverse-atlas > footer strong, .reverse-atlas > footer small { display: block; }
.reverse-atlas > footer span { font: 6.5px/1 var(--mono); color: var(--violet); }
.reverse-atlas > footer strong { margin-top: 5px; font-size: 10px; color: var(--text-bright); }
.reverse-atlas > footer small { margin-top: 4px; font: 7px/1.4 var(--mono); color: var(--muted); }

.directive-panel { min-height: 150px; }
.directive-copy { margin: 0; padding: 15px 14px 10px; font-size: 13px; line-height: 1.65; color: var(--text-bright); }
.directive-hint { margin: 0 14px 14px; padding: 9px 10px; border-left: 1px solid var(--amber); background: rgba(255,184,77,0.035); }
.directive-hint span { display: block; margin-bottom: 5px; font: 8px/1 var(--mono); letter-spacing: 0.08em; color: var(--amber); }
.directive-hint p { margin: 0; font-size: 10px; line-height: 1.55; color: var(--muted); }
.directive-progress { margin: -3px 14px 14px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; }
.directive-progress > span { font: 7px/1 var(--mono); color: var(--faint); letter-spacing: 0.08em; }
.directive-progress > b { justify-self: end; font: 7px/1 var(--mono); color: var(--cyan); font-weight: 500; }
.directive-progress > div { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,0.06); overflow: hidden; }
.directive-progress i { display: block; width: 0; height: 100%; background: var(--cyan); box-shadow: 0 0 7px rgba(114,229,245,0.5); transition: width 160ms ease; }

.event-content { padding: 10px; }
.choice-list { display: grid; gap: 7px; }
.choice-context { margin-bottom: 8px; padding: 9px 10px; border-left: 2px solid var(--cyan); background: rgba(114,229,245,0.035); }
.choice-context b { font: 8px/1 var(--mono); color: var(--cyan); }
.choice-context p { margin: 5px 0 0; font-size: 9px; line-height: 1.5; color: var(--muted); }
.choice-context.reverse-context { border-left-color: var(--red); background: linear-gradient(90deg, rgba(255,101,119,0.055), rgba(197,148,255,0.025)); }
.choice-context.reverse-context b { color: #ff9eaa; }
.decision-hierarchy { border-bottom: 1px solid var(--line); background: rgba(0,0,0,0.12); }
.decision-hierarchy header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 7px 10px 5px; }
.decision-hierarchy header span { font: 6.5px/1 var(--mono); letter-spacing: 0.1em; color: var(--violet); }
.decision-hierarchy header b { font: 6.5px/1.2 var(--mono); color: var(--faint); font-weight: 500; }
.decision-hierarchy ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin: 0; padding: 0 8px 8px; list-style: none; }
.decision-hierarchy li { position: relative; min-width: 0; display: grid; grid-template-columns: 9px minmax(0,1fr); gap: 5px; align-items: start; padding: 5px 4px; border-top: 1px solid var(--line); color: var(--faint); }
.decision-hierarchy li::after { content: "›"; position: absolute; right: 2px; top: 4px; color: var(--faint); font: 8px/1 var(--mono); }
.decision-hierarchy li:nth-child(2n)::after, .decision-hierarchy li:last-child::after { display: none; }
.decision-hierarchy li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.decision-hierarchy li > i { width: 7px; height: 7px; margin-top: 1px; border: 1px solid currentColor; border-radius: 50%; }
.decision-hierarchy li span, .decision-hierarchy li b, .decision-hierarchy li small { display: block; min-width: 0; }
.decision-hierarchy li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 6.5px/1 var(--mono); color: currentColor; }
.decision-hierarchy li small { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 6px/1 var(--mono); color: inherit; opacity: 0.8; }
.decision-hierarchy li.complete { color: var(--green); }
.decision-hierarchy li.complete > i { background: var(--green); box-shadow: 0 0 6px rgba(97,230,167,0.65); }
.decision-hierarchy li.current { color: var(--amber); background: rgba(255,184,77,0.035); }
.decision-hierarchy li.current > i { box-shadow: 0 0 7px rgba(255,184,77,0.65); }
.choice-card { width: 100%; min-height: 72px; padding: 10px; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,0.015); cursor: pointer; color: inherit; transition: background 120ms, border-color 120ms; }
.choice-card:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(70,170,184,0.06); }
.choice-card:disabled { cursor: not-allowed; opacity: 0.36; }
.choice-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.choice-top strong { font: 600 11px/1.2 var(--sans); color: var(--text-bright); }
.choice-top span { font: 8px/1 var(--mono); color: var(--cyan); white-space: nowrap; }
.choice-card p { margin: 7px 0 0; font-size: 9px; line-height: 1.55; color: var(--muted); }
.choice-heading { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 8px; }
.choice-heading > img { width: 23px; height: 23px; filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(1080%) hue-rotate(144deg) brightness(101%) contrast(92%); opacity: 0.82; }
.choice-heading .choice-top { min-width: 0; }
.choice-metrics { display: grid; grid-template-columns: 34px 1fr; gap: 5px 7px; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(113,217,235,0.08); }
.choice-metrics span { font: 7px/1.35 var(--mono); color: var(--faint); }
.choice-metrics b { font: 7px/1.45 var(--mono); color: #8fa7ac; font-weight: 500; }
.choice-card.route-advance .choice-top span { color: var(--amber); }
.choice-card.route-sustain .choice-top span { color: var(--green); }
.choice-card.route-inquiry .choice-top span { color: var(--cyan); }
.choice-card.route-rewrite .choice-top span { color: var(--violet); }
.preparation-active { padding: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.015); }
.preparation-active > p { margin: 8px 0 12px; font-size: 9px; line-height: 1.55; color: var(--muted); }
.preparation-conditions { display: grid; gap: 5px; margin: 9px 0; padding: 0; list-style: none; }
.preparation-conditions li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 7px; border: 1px solid rgba(113,217,235,0.08); font: 8px/1.2 var(--mono); color: var(--muted); }
.preparation-conditions li b { color: var(--text-bright); font-weight: 500; }
.preparation-conditions li.ok { border-color: rgba(97,230,167,0.22); color: var(--green); }
.preparation-conditions li.ok b { color: var(--green); }
.preparation-effect { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 8px; border-left: 2px solid var(--cyan); background: rgba(114,229,245,0.035); }
.preparation-effect span { font: 7px/1.4 var(--mono); color: var(--cyan); }
.preparation-effect b { font-size: 9px; line-height: 1.45; color: var(--text-bright); font-weight: 500; }
.preparation-active.route-advance .choice-top span { color: var(--amber); }
.preparation-active.route-sustain .choice-top span { color: var(--green); }
.preparation-active.route-inquiry .choice-top span { color: var(--cyan); }

.completion-report { padding: 2px; }
.completion-kicker { display: flex; justify-content: space-between; align-items: center; font: 7px/1 var(--mono); letter-spacing: 0.1em; color: var(--green); }
.completion-kicker b { color: var(--text-bright); font-weight: 500; }
.completion-report h3 { margin: 10px 0 9px; font-size: 14px; color: var(--text-bright); }
.completion-signal { display: grid; grid-template-columns: 54px 1fr; gap: 3px 8px; padding: 9px; border: 1px solid rgba(197,148,255,0.24); background: linear-gradient(90deg, rgba(197,148,255,0.075), transparent); }
.completion-signal span { font: 8px/1.3 var(--mono); color: var(--violet); }
.completion-signal strong { font-size: 12px; color: var(--text-bright); }
.completion-signal small { grid-column: 2; font: 8px/1.3 var(--mono); color: var(--muted); }
.completion-records { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 8px 0; background: rgba(113,217,235,0.09); }
.completion-records span { display: grid; gap: 4px; min-height: 43px; padding: 7px; background: var(--panel-strong); font: 7px/1.2 var(--mono); color: var(--faint); }
.completion-records b { font: 500 9px/1.35 var(--sans); color: var(--text); }
.completion-story { padding: 9px 10px; border-left: 2px solid var(--cyan); background: rgba(114,229,245,0.025); }
.completion-story p { margin: 0 0 7px; font-size: 9px; line-height: 1.62; color: #9bb0b4; }
.completion-story p:last-child { margin-bottom: 0; }
.completion-closing { margin: 9px 0; font-size: 8px; line-height: 1.55; color: var(--muted); }
.completion-report > .btn { width: 100%; }
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.civilization-report { padding: 2px; }
.civilization-report > span { font: 7px/1 var(--mono); letter-spacing: 0.11em; color: var(--pink, #f783ac); }
.civilization-report h3 { margin: 9px 0 7px; font-size: 15px; color: var(--text-bright); }
.civilization-report > p { margin: 0 0 9px; font-size: 9px; line-height: 1.6; color: var(--muted); }
.proposal-list { display: grid; gap: 6px; }
.proposal-card { padding: 9px; border: 1px solid var(--line); border-left: 2px solid var(--violet); background: rgba(197,148,255,0.035); }
.proposal-card.route-advance { border-left-color: var(--amber); }
.proposal-card.route-sustain { border-left-color: var(--green); }
.proposal-card.route-inquiry { border-left-color: var(--cyan); }
.proposal-card > span, .proposal-card > strong, .proposal-card > small { display: block; }
.proposal-card > span { font: 7px/1 var(--mono); color: var(--violet); }
.proposal-card > strong { margin-top: 6px; font-size: 12px; color: var(--text-bright); }
.proposal-card > p { margin: 6px 0 0; font-size: 8px; line-height: 1.5; color: #a4b5bb; }
.proposal-card > small { margin-top: 5px; font: 7px/1.45 var(--mono); color: var(--muted); }
.civilization-report > .btn { width: 100%; }

.route-panel { min-height: 240px; }
.route-signals { padding: 10px 12px 4px; display: grid; gap: 7px; }
.route-lead { padding: 9px; border: 1px solid rgba(197,148,255,0.22); border-left: 2px solid var(--violet); background: linear-gradient(90deg, rgba(197,148,255,0.055), transparent); }
.route-lead.route-advance { border-left-color: var(--amber); }
.route-lead.route-sustain { border-left-color: var(--green); }
.route-lead.route-inquiry { border-left-color: var(--cyan); }
.route-lead span, .route-lead strong, .route-lead small { display: block; }
.route-lead span { font: 7px/1 var(--mono); color: var(--violet); }
.route-lead strong { margin-top: 5px; font-size: 9px; line-height: 1.45; color: var(--text-bright); }
.route-lead small { margin-top: 4px; font: 7px/1.4 var(--mono); color: var(--muted); }
.route-row { display: grid; grid-template-columns: 72px 1fr 24px; align-items: center; gap: 7px; padding: 6px 7px; border: 1px solid rgba(113,217,235,0.07); background: rgba(255,255,255,0.01); }
.route-row.dominant { border-color: rgba(197,148,255,0.18); background: rgba(197,148,255,0.025); }
.route-name { display: flex; align-items: center; gap: 6px; }
.route-name span, .route-name b, .route-name small { display: block; }
.route-name b { font: 8px/1 var(--mono); text-align: left; }
.route-name small { margin-top: 3px; font: 6px/1 var(--mono); color: var(--muted); }
.route-name img { width: 13px; height: 13px; filter: brightness(0) invert(1); opacity: 0.72; }
.route-row > b { text-align: right; color: var(--text-bright); font: 9px/1 var(--mono); }
.route-row > p { grid-column: 1 / -1; margin: 0; font: 6.5px/1.4 var(--mono); color: var(--faint); }
.route-meter { height: 3px; background: rgba(255,255,255,0.055); }
.route-meter i { display: block; height: 100%; min-width: 2px; transition: width 180ms ease; }
.route-note { margin: 8px 12px 11px; font-size: 9px; line-height: 1.5; color: var(--faint); }
.route-summary { margin: 6px 12px 12px; padding: 9px; border: 1px solid rgba(197,148,255,0.24); background: rgba(197,148,255,0.04); }
.route-summary span { display: block; font: 8px/1 var(--mono); color: var(--violet); }
.route-summary strong { display: block; margin-top: 5px; color: var(--text-bright); font-size: 11px; }
.route-summary small { display: block; margin-top: 5px; font: 7px/1.4 var(--mono); color: var(--muted); }

.live-mark { font: 8px/1 var(--mono); color: var(--green); }
.observation-log { max-height: 214px; overflow: auto; padding: 8px 11px 12px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.log-entry { display: grid; grid-template-columns: 40px 48px 1fr; gap: 7px; padding: 6px 0; border-bottom: 1px solid rgba(113,217,235,0.06); }
.log-entry:last-child { border-bottom: 0; }
.log-entry time, .log-entry b, .log-entry p { margin: 0; font: 8px/1.45 var(--mono); }
.log-entry time { color: var(--faint); }
.log-entry b { color: var(--cyan-soft); }
.log-entry b.warn { color: var(--red); }
.log-entry p { color: #829da3; }

body.lore-open { overflow: hidden; }
.lore-layer { position: fixed; inset: 0; z-index: 140; }
.lore-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0,5,8,0.76); backdrop-filter: blur(5px) saturate(0.6); cursor: default; }
.lore-drawer { position: absolute; top: 0; right: 0; width: min(650px, calc(100vw - 40px)); height: 100%; overflow-y: auto; border-left: 1px solid var(--line-strong); background: linear-gradient(150deg, rgba(8,22,28,0.99), rgba(2,8,11,0.995)); box-shadow: -24px 0 70px rgba(0,0,0,0.55); scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.lore-drawer::before { content: ""; position: fixed; top: 0; right: 0; width: min(650px, calc(100vw - 40px)); height: 3px; background: linear-gradient(90deg, var(--cyan), var(--violet)); z-index: 1; }
.lore-drawer-head { position: sticky; top: 0; z-index: 2; min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: rgba(5,15,19,0.97); }
.lore-drawer-head span { font: 8px/1 var(--mono); letter-spacing: 0.12em; color: var(--cyan); }
.lore-drawer-head h2 { margin: 6px 0 0; font: 600 17px/1 var(--mono); letter-spacing: 0.08em; color: var(--text-bright); }
.lore-primer { margin: 16px 18px 8px; padding: 11px 12px; border-left: 2px solid var(--amber); background: rgba(255,184,77,0.035); font-size: 10px; line-height: 1.65; color: #8fa5aa; }
.lore-section { margin: 0; padding: 16px 18px 6px; }
.lore-section + .lore-section { border-top: 1px solid var(--line); }
.lore-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.lore-section-head h3 { margin: 0; font: 600 11px/1 var(--mono); letter-spacing: 0.08em; color: var(--text-bright); }
.lore-section-head span { font: 8px/1 var(--mono); color: var(--muted); }
.lore-chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lore-chapter { min-height: 116px; padding: 11px; border: 1px solid var(--line); background: rgba(255,255,255,0.012); }
.lore-chapter span { font: 8px/1 var(--mono); color: var(--amber); }
.lore-chapter p { margin: 8px 0 0; font-size: 10px; line-height: 1.68; color: #8fa6aa; }
.lore-search { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.012); }
.lore-categories { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.lore-categories button { position: relative; min-height: 28px; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); background: rgba(255,255,255,0.012); color: var(--muted); cursor: pointer; }
.lore-categories button:hover, .lore-categories button.active { border-color: var(--cyan); background: rgba(114,229,245,0.07); color: var(--text-bright); }
.lore-categories button span, .lore-categories button b, .lore-categories button i { font: 7px/1 var(--mono); }
.lore-categories button b { color: var(--faint); font-weight: 500; }
.lore-categories button i { min-width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: white; font-style: normal; box-shadow: 0 0 7px rgba(255,101,119,0.5); }
.lore-search span { font: 8px/1 var(--mono); color: var(--muted); }
.lore-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text-bright); font: 10px/1.4 var(--sans); }
.lore-search input::placeholder { color: var(--faint); }
.lore-entries { display: grid; gap: 6px; padding-bottom: 24px; }
.lore-entry { border: 1px solid var(--line); background: rgba(255,255,255,0.012); }
.lore-entry.unread { position: relative; border-color: rgba(255,101,119,0.25); }
.lore-entry.unread::before { content: ""; position: absolute; right: 9px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 7px var(--red); }
.lore-entry[open] { border-color: rgba(114,229,245,0.32); background: rgba(114,229,245,0.025); }
.lore-entry summary { min-height: 49px; display: grid; grid-template-columns: 46px minmax(90px, auto) 1fr 18px; align-items: center; gap: 8px; padding: 8px 10px; list-style: none; cursor: pointer; }
.lore-entry summary::-webkit-details-marker { display: none; }
.lore-entry summary > span { font: 7px/1 var(--mono); color: var(--cyan); }
.lore-entry summary strong { font-size: 11px; color: var(--text-bright); }
.lore-entry summary small { font: 7px/1 var(--mono); letter-spacing: 0.08em; color: var(--faint); }
.lore-entry summary i { justify-self: end; color: var(--cyan); font: normal 12px/1 var(--mono); transition: transform 120ms ease; }
.lore-entry[open] summary i { transform: rotate(45deg); }
.lore-entry > div { padding: 0 10px 10px 64px; }
.lore-entry > div p { margin: 0 0 6px; font-size: 9px; line-height: 1.65; color: #93a9ad; }
.lore-entry > div p:first-child { color: var(--text); }
.lore-entry > div p:last-child { margin-bottom: 0; }
.lore-empty { padding: 20px; border: 1px dashed var(--line); text-align: center; font-size: 10px; color: var(--muted); }

body.log-open { overflow: hidden; }
.log-drawer, .log-drawer::before { width: min(540px, calc(100vw - 40px)); }
.log-drawer::before { background: linear-gradient(90deg, var(--green), var(--cyan)); }
.log-primer { border-left-color: var(--green); background: rgba(97,230,167,0.035); }
.log-drawer-list { max-height: none; padding: 6px 18px 32px; }
.log-drawer-list .log-entry { grid-template-columns: 48px 66px minmax(0, 1fr); gap: 10px; padding: 11px 0; }
.log-drawer-list .log-entry time, .log-drawer-list .log-entry b, .log-drawer-list .log-entry p { font-size: 11px; line-height: 1.55; }
.log-drawer-list .log-entry p { color: #9ab0b5; }

.guide-layer { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.guide-dim { position: fixed; background: rgba(0,5,8,0.66); backdrop-filter: saturate(0.55); transition: top 180ms ease, left 180ms ease, right 180ms ease, bottom 180ms ease, width 180ms ease, height 180ms ease; }
.guide-target-ring { position: fixed; border: 1px solid var(--amber); box-shadow: 0 0 0 4px rgba(255,184,77,0.07), 0 0 24px rgba(255,184,77,0.25), inset 0 0 18px rgba(255,184,77,0.04); transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease; }
.guide-target-ring::before, .guide-target-ring::after { content: ""; position: absolute; width: 18px; height: 1px; background: var(--amber); }
.guide-target-ring::before { left: -7px; top: -1px; }
.guide-target-ring::after { right: -7px; bottom: -1px; }
.guide-callout { position: fixed; z-index: 2; width: min(316px, calc(100vw - 20px)); padding: 12px; border: 1px solid rgba(114,229,245,0.42); background: rgba(4,14,18,0.97); box-shadow: 0 18px 50px rgba(0,0,0,0.56), inset 0 0 34px rgba(53,166,184,0.04); pointer-events: auto; transition: top 180ms ease, left 180ms ease; }
.guide-callout::before { content: ""; position: absolute; left: -1px; top: -1px; width: 44px; height: 2px; background: var(--cyan); box-shadow: 0 0 9px var(--cyan); }
.guide-callout-head { display: flex; justify-content: space-between; align-items: center; }
.guide-callout-head > span { font: 7px/1 var(--mono); letter-spacing: 0.12em; color: var(--cyan); }
.guide-callout-head button { padding: 3px 5px; border: 0; background: transparent; color: var(--muted); font: 8px/1 var(--mono); cursor: pointer; }
.guide-callout-head button:hover { color: var(--text-bright); }
.guide-callout > strong { display: block; margin-top: 10px; font-size: 14px; color: var(--text-bright); }
.guide-callout > p { margin: 8px 0 10px; font-size: 10px; line-height: 1.65; color: #8ba5aa; }
.guide-action { padding: 8px 9px; border-left: 2px solid var(--amber); background: rgba(255,184,77,0.045); }
.guide-action span { display: block; font: 7px/1 var(--mono); letter-spacing: 0.1em; color: var(--amber); }
.guide-action p { margin: 5px 0 0; font-size: 10px; line-height: 1.5; color: var(--text-bright); }
.guide-lore-link { width: 100%; min-height: 32px; margin-top: 8px; padding: 6px 8px; border: 1px solid rgba(197,148,255,0.35); background: rgba(197,148,255,0.06); color: #dac0ff; font: 9px/1.2 var(--mono); cursor: pointer; }
.guide-lore-link:hover { border-color: var(--violet); background: rgba(197,148,255,0.12); color: white; }
.guide-callout-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin-top: 10px; }
.guide-callout-progress > div { height: 3px; background: rgba(255,255,255,0.07); }
.guide-callout-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--amber), var(--cyan)); transition: width 160ms ease; }
.guide-callout-progress b { font: 7px/1 var(--mono); color: var(--cyan); font-weight: 500; }
.guide-return { width: 100%; min-height: 36px; margin-top: 10px; border: 1px solid rgba(255,184,77,0.55); background: rgba(255,184,77,0.1); color: #ffe0a4; font: 500 9px/1.2 var(--mono); letter-spacing: 0.04em; cursor: pointer; }
.guide-return:hover { border-color: var(--amber); background: rgba(255,184,77,0.18); color: white; }
.guide-transfer { position: fixed; z-index: 125; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--amber); background: rgba(4,14,18,0.96); color: var(--amber); font: 9px/1 var(--mono); letter-spacing: 0.1em; pointer-events: none; box-shadow: 0 0 24px rgba(255,184,77,0.24); }

.ui-tooltip { position: fixed; z-index: 110; width: min(260px, calc(100vw - 18px)); padding: 9px 10px; border: 1px solid rgba(114,229,245,0.34); background: rgba(3,11,15,0.98); box-shadow: 0 12px 36px rgba(0,0,0,0.5); pointer-events: none; }
.ui-tooltip strong { display: block; margin-bottom: 5px; font: 500 9px/1 var(--mono); color: var(--cyan); letter-spacing: 0.08em; }
.ui-tooltip p { margin: 0; font-size: 9px; line-height: 1.55; color: #96adb2; }

.system-toast { position: fixed; z-index: 120; left: 50%; top: 86px; width: min(340px, calc(100vw - 24px)); transform: translate(-50%, -14px); padding: 10px 12px; border: 1px solid var(--line-strong); background: rgba(4,15,19,0.96); color: var(--text-bright); font: 10px/1.5 var(--mono); opacity: 0; pointer-events: none; box-shadow: 0 14px 40px rgba(0,0,0,0.5); }
.system-toast.show { animation: toastSignal 1.8s ease both; }
.system-toast.major { border-color: var(--amber); color: #ffe2a8; }
.action-flyout { position: fixed; z-index: 105; transform: translate(-50%, -8px); font: 8px/1 var(--mono); color: var(--cyan); pointer-events: none; text-shadow: 0 0 8px currentColor; animation: actionFly 950ms ease-out both; }
.action-flyout.amber { color: var(--amber); }
.action-flyout.green { color: var(--green); }
.upgrade-pulse { animation: upgradePulse 650ms ease-out; }
.mission-enter { animation: missionEnter 550ms ease-out; }

@keyframes toastSignal { 0% { opacity: 0; transform: translate(-50%,-14px); } 15%,75% { opacity: 1; transform: translate(-50%,0); } 100% { opacity: 0; transform: translate(-50%,-6px); } }
@keyframes actionFly { 0% { opacity: 0; transform: translate(-50%,4px); } 18% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-28px); } }
@keyframes upgradePulse { 0% { box-shadow: inset 0 0 0 rgba(114,229,245,0); } 35% { box-shadow: inset 0 0 34px rgba(114,229,245,0.18), 0 0 16px rgba(114,229,245,0.12); } 100% { box-shadow: inset 0 0 0 rgba(114,229,245,0); } }
@keyframes missionEnter { 0% { border-color: var(--amber); filter: brightness(1.5); } 100% { border-color: var(--line-strong); filter: brightness(1); } }
@keyframes missionUrgency { 0%,100% { box-shadow: inset 0 0 18px rgba(255,184,77,0.035), 0 0 0 rgba(255,184,77,0); } 50% { box-shadow: inset 0 0 32px rgba(255,184,77,0.1), 0 0 12px rgba(255,184,77,0.13); } }
@keyframes researchCharge { 0%,100% { filter: saturate(1); } 50% { filter: saturate(1.25) brightness(1.045); } }
@keyframes dockArrival { 0% { box-shadow: inset 0 0 0 rgba(255,184,77,0); } 35% { box-shadow: inset 0 0 26px rgba(255,184,77,0.26), 0 0 18px rgba(255,184,77,0.18); } 100% { box-shadow: inset 0 0 0 rgba(255,184,77,0); } }
@keyframes discoveryEnter { 0% { opacity: 0; transform: translateX(-24px); filter: blur(3px); } 55% { opacity: 1; transform: translateX(3px); filter: blur(0); } 100% { transform: translateX(0); } }

[hidden] { display: none !important; }

@media (max-width: 1180px) {
  .command-header { grid-template-columns: 1fr auto; }
  .header-telemetry { display: none; }
  .command-grid { grid-template-columns: 250px 1fr; }
  .right-stack { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .command-header { height: auto; min-height: 64px; padding: 10px 12px; gap: 10px; }
  .brand-lockup h1 { font-size: 14px; }
  .brand-lockup h1 .brand-zh, .eyebrow { display: none; }
  .brand-mark { width: 28px; height: 28px; }
  .header-actions .btn { font-size: 8px; padding: 5px 7px; }
  .command-grid { display: flex; flex-direction: column; padding: 8px; }
  .resource-panel { width: 100%; max-height: none; order: 2; overflow: visible; scrollbar-gutter: auto; }
  .expanded-matter-stack .resource-panel {
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    display: block;
    overflow: visible;
  }
  .expanded-matter-stack .resource-panel > .tier-grid { overflow: visible; }
  .center-stack { order: 1; width: 100%; }
  .right-stack { order: 3; width: 100%; display: flex; }
  .mission-strip { grid-template-columns: 82px minmax(0,1fr) 60px; }
  .mission-state { display: flex; padding: 0 6px; text-align: center; align-items: center; }
  .mission-state span { display: none; }
  .mission-state b { margin-top: 0; font-size: 7px; line-height: 1.35; }
  .cosmos-stage { height: 390px; }
  .research-bar { grid-template-columns: 112px 1fr; }
  .research-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .research-breakdown-row, .research-breakdown-head { grid-template-columns: minmax(52px, 1fr) minmax(74px, 1fr) auto; gap: 6px; }
  .research-console { grid-template-columns: 1fr; }
  .research-signal { border-left: 0; border-top: 1px solid rgba(197,148,255,0.14); }
  .research-label small { display: none; }
  .flow-monitor { right: 9px; bottom: 9px; width: min(260px, calc(100% - 18px)); }
  .flow-monitor.collapsed { width: 132px; }
  .flow-row { grid-template-columns: 72px 1fr; }
  .flow-result { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-end; }
  .flow-result small { margin-left: auto; }
  .research-trend { grid-template-columns: 1fr; }
  .stability-row { grid-template-columns: 17px 1fr; }
  .stability-row em { grid-column: 2; }
  .discovery-card { left: 9px; bottom: 9px; width: calc(100% - 18px); }
  .guide-callout { left: 9px !important; right: 9px; bottom: 9px; top: auto !important; width: auto; }
  .guide-dim { background: rgba(0,5,8,0.58); backdrop-filter: none; }
  .enemy-method-grid { grid-template-columns: 1fr; }
  .lore-drawer, .lore-drawer::before { width: 100vw; }
  .lore-chapters { grid-template-columns: 1fr; }
  .lore-entry summary { grid-template-columns: 40px minmax(76px, auto) 1fr 16px; }
  .lore-entry > div { padding-left: 58px; }
}

@media (hover: none) {
  .canvas-inspector { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ── Readability and progressive-onboarding pass ───────────────── */
.copy-en, .brand-en { display: none; }
html[data-locale="en"] .copy-zh,
html[data-locale="en"] .brand-zh { display: none; }
html[data-locale="en"] .copy-en,
html[data-locale="en"] .brand-en { display: inline; }
.tc-en { display: none; }

body { font-size: 15px; }
.header-actions #archive-btn span, .header-actions #log-btn span { font-size: 9px; }
.eyebrow, .panel-code, .telemetry-cell span, .mission-state span, .research-label span { font-size: 10.5px; }
.brand-lockup h1 { font-size: 19px; }
.brand-lockup h1 .brand-zh { margin-left: 0; font-size: 18px; color: var(--text-bright); }
.telemetry-cell strong { font-size: 14px; }
.btn { min-height: 36px; padding: 8px 13px; font-size: 12px; }
.btn-quiet, .btn-danger-quiet { min-height: 34px; }
.panel-heading h2 { font: 600 15px/1.1 var(--sans); letter-spacing: 0.035em; }
.panel-index { font-size: 10px; }
.panel-heading.compact { min-height: 48px; }
.tier-card { padding-top: 13px; padding-bottom: 12px; }
.tc-name { font-size: 14px; font-weight: 600; }
.tc-index { font-size: 10px; }
.tc-icon { width: 18px; height: 18px; }
.tc-readout span, .tc-bar-label, .tc-bar-val, .tc-locked { font-size: 10px; }
.tc-net { font-size: 11px; line-height: 1.3; }
.tc-modifier { font-size: 9px; line-height: 1.25; }
.btn-tier { min-height: 34px; font-size: 11px; }
.btn-micro { min-height: 31px; font-size: 10.5px; }
.mission-copy-head span { font-size: 10px; }
.mission-copy-head strong { font-size: 16px; }
.mission-action-progress { min-width: 0; }
.mission-action-progress span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 9.5px; }
.mission-state b { font-size: 11px; }
.canvas-corner span { font-size: 9.5px; }
.canvas-corner b, .click-hint { font-size: 11px; }
.flow-monitor-head span { font-size: 9px; }
.flow-monitor-head strong { font-size: 12px; }
.flow-legend strong, .flow-legend span { font-size: 9px; }
.flow-identity b { font-size: 11px; }
.flow-identity small, .flow-equation > span, .flow-result span, .flow-result small { font-size: 9.5px; }
.flow-result b { font-size: 11px; }
.research-label small, .research-progress > span { font-size: 10px; }
.research-breakdown-head span, .research-breakdown-head b,
.research-breakdown-row span, .research-breakdown-row code, .research-breakdown-row b { font-size: var(--fs-status); }
.research-formula, .research-breakdown-empty { font-size: var(--fs-status); color: var(--muted); }
.status-chip { font-size: 10px; }
.empty-state p { font-size: 13px; }
.empty-state small { font-size: 10px; color: var(--muted); }
#contact-panel .contact-content { padding: 14px; }
#contact-panel .status-chip { font-size: var(--fs-status); }
#contact-panel .threat-symbol { width: 34px; height: 34px; font-size: 13px; }
#contact-panel .threat-name strong { font-size: var(--fs-heading); line-height: 1.25; }
#contact-panel .threat-name small { font-size: var(--fs-secondary); line-height: 1.5; }
#contact-panel .threat-stat { padding: 9px; }
#contact-panel .threat-stat span { font-size: var(--fs-status); }
#contact-panel .threat-stat b { font-size: var(--fs-secondary); }
#contact-panel .progress-block > span { font-size: var(--fs-secondary); }
#contact-panel .condition-list li { font-size: var(--fs-secondary); line-height: 1.5; }
#contact-panel .enemy-method-intro b { font-size: var(--fs-heading); }
#contact-panel .enemy-method-intro span { max-width: 270px; font-size: var(--fs-secondary); line-height: 1.5; }
#contact-panel .enemy-method-card { min-height: 158px; padding: 12px; }
#contact-panel .enemy-method-card .choice-top strong { font-size: var(--fs-heading); }
#contact-panel .enemy-method-card .choice-top span { font-size: var(--fs-status); }
#contact-panel .enemy-method-card p { min-height: 34px; font-size: var(--fs-secondary); line-height: 1.55; }
#contact-panel .method-metrics span { grid-template-columns: 44px 1fr; font-size: var(--fs-status); line-height: 1.45; }
#contact-panel .reverse-atlas > header span { font-size: var(--fs-status); }
#contact-panel .reverse-atlas > header strong { font-size: var(--fs-heading); line-height: 1.3; }
#contact-panel .reverse-atlas > header > b { font-size: var(--fs-status); }
#contact-panel .reverse-pressure > span { font-size: var(--fs-secondary); line-height: 1.3; }
#contact-panel .reverse-pressure > small { font-size: var(--fs-secondary); line-height: 1.55; color: var(--muted); }
#contact-panel .reverse-object-card { grid-template-columns: 34px 1fr; gap: 9px; padding: 9px; }
#contact-panel .reverse-object-symbol { width: 32px; height: 32px; font-size: var(--fs-status); }
#contact-panel .reverse-object-card b { font-size: var(--fs-secondary); line-height: 1.3; }
#contact-panel .reverse-object-card small { font-size: var(--fs-status); line-height: 1.35; }
#contact-panel .reverse-object-card p { font-size: var(--fs-secondary); line-height: 1.5; color: #849ba0; }
#contact-panel .reverse-atlas > footer span { font-size: var(--fs-status); }
#contact-panel .reverse-atlas > footer strong { font-size: var(--fs-secondary); }
#contact-panel .reverse-atlas > footer small { font-size: var(--fs-status); line-height: 1.45; }
.directive-copy { font-size: 15px; line-height: 1.65; }
.directive-hint span, .directive-progress > span, .directive-progress > b { font-size: 10px; }
.directive-hint p { font-size: 12px; }
.choice-context b { font-size: 10px; }
.choice-context p, .choice-card p { font-size: 11.5px; }
.reverse-object-card p, .completion-closing, .proposal-card > p { font-size: 11.5px; }
.decision-hierarchy header span, .decision-hierarchy header b { font-size: 9.5px; }
.decision-hierarchy li b { font-size: 10.5px; }
.decision-hierarchy li small { font-size: 9.5px; }
.choice-top strong { font-size: 13px; }
.choice-top span { font-size: 10px; }
.choice-metrics span, .choice-metrics b { font-size: 9px; }
.route-lead span { font-size: 10px; }
.route-lead strong { font-size: 12.5px; }
.route-lead small { font-size: 10px; }
.route-name b { font-size: 11px; }
.route-name small, .route-row > p { font-size: 10px; line-height: 1.45; }
.route-note { font-size: 11px; color: var(--muted); }
.mission-state.resting b { font-size: 11px; }
.log-entry time, .log-entry b, .log-entry p { font-size: 10px; }
.lore-primer { font-size: 12px; }
.lore-section-head h3 { font-size: 13px; }
.lore-section-head span, .lore-chapter span, .lore-search span { font-size: 10px; }
.lore-chapter p { font-size: 12px; }
.lore-categories button span, .lore-categories button b, .lore-categories button i { font-size: 9px; }
.lore-search input { font-size: 12px; }
.lore-entry summary > span, .lore-entry summary small { font-size: 9px; }
.lore-entry summary strong { font-size: 13px; }
.lore-entry > div p { font-size: 11.5px; }
.guide-callout-head > span, .guide-callout-head button { font-size: 9.5px; }
.guide-callout > strong { font-size: 17px; }
.guide-callout > p, .guide-action p { font-size: 12px; }
.guide-action span, .guide-callout-progress b { font-size: 9px; }
.ui-tooltip strong, .ui-tooltip p { font-size: 11px; }
.system-toast { font-size: 12px; }

html[data-text-scale="large"] body { font-size: var(--fs-body); }
html[data-text-scale="large"] .panel-heading h2,
html[data-text-scale="large"] .mission-copy-head strong { font-size: 17px; }
html[data-text-scale="large"] .directive-copy { font-size: 17px; }
html[data-text-scale="large"] .choice-top strong,
html[data-text-scale="large"] .lore-entry summary strong { font-size: 14px; }
html[data-text-scale="large"] .choice-card p,
html[data-text-scale="large"] .lore-entry > div p,
html[data-text-scale="large"] .route-note { font-size: 12.5px; }

@media (min-width: 1181px) {
  .command-grid { grid-template-columns: minmax(300px, 320px) minmax(500px, 1fr) minmax(360px, 400px); }
}

.tier-horizon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(197,148,255,0.055), transparent);
}
.tier-horizon span { font: 9px/1 var(--mono); letter-spacing: 0.1em; color: var(--violet); }
.tier-horizon strong { text-align: right; font-size: 11px; line-height: 1.35; color: #9eabb1; font-weight: 500; }

.campaign-goal {
  padding: 15px 15px 14px;
  border-color: rgba(255,184,77,0.34);
  background: linear-gradient(145deg, rgba(35,26,11,0.86), rgba(5,15,19,0.96) 62%);
  box-shadow: inset 3px 0 0 rgba(255,184,77,0.72), 0 12px 32px rgba(0,0,0,0.22);
}
.campaign-goal-kicker { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.campaign-goal-kicker span, .campaign-goal-kicker b { font: 10px/1 var(--mono); letter-spacing: 0.08em; color: var(--amber); }
.campaign-goal-kicker b { color: var(--muted); font-weight: 500; }
.campaign-goal h2 { margin: 12px 0 8px; font-size: 17px; line-height: 1.35; color: var(--text-bright); }
.campaign-goal p { margin: 0; font-size: 12px; line-height: 1.65; color: #9fb0b4; }
.campaign-phases { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 14px 0 0; padding: 0; list-style: none; }
.campaign-phases li { position: relative; min-width: 0; padding-top: 10px; border-top: 2px solid rgba(111,139,145,0.2); color: var(--faint); }
.campaign-phases li::before { content: ""; position: absolute; left: 0; top: -3px; width: 5px; height: 5px; background: currentColor; }
.campaign-phases li span { display: block; font: 9px/1.35 var(--sans); }
.campaign-phases li.complete { border-color: rgba(97,230,167,0.55); color: var(--green); }
.campaign-phases li.current { border-color: var(--amber); color: #ffd48d; }

.modal-open, .lore-open, .log-open, .prologue-open { overflow: hidden; }
.modal-layer { position: fixed; inset: 0; z-index: 210; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,4,6,0.82); backdrop-filter: blur(5px); }
.settings-dialog { position: relative; width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; border: 1px solid var(--line-strong); background: linear-gradient(145deg, rgba(10,25,31,0.99), rgba(3,10,13,0.99)); box-shadow: 0 28px 90px rgba(0,0,0,0.72); }
.settings-head { position: sticky; top: 0; z-index: 2; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: rgba(7,19,24,0.985); }
.settings-head span { font: 9px/1 var(--mono); letter-spacing: 0.11em; color: var(--cyan); }
.settings-head h2 { margin: 6px 0 0; font-size: 20px; color: var(--text-bright); }
.settings-group { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 20px; min-height: 92px; padding: 16px; border-bottom: 1px solid var(--line); }
.settings-group:last-child { border-bottom: 0; }
.settings-group strong, .settings-group small { display: block; }
.settings-group strong { font-size: 14px; color: var(--text-bright); }
.settings-group small { max-width: 340px; margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.segmented-control { display: flex; border: 1px solid var(--line-strong); }
.segmented-control button { min-width: 100px; min-height: 38px; padding: 7px 12px; border: 0; border-right: 1px solid var(--line); background: rgba(114,229,245,0.025); color: var(--muted); font-size: 11px; cursor: pointer; }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button.selected { background: rgba(114,229,245,0.14); color: var(--text-bright); box-shadow: inset 0 -2px 0 var(--cyan); }

.prologue { position: fixed; inset: 0; z-index: 300; overflow: hidden; color: var(--text-bright); background: #010304; }
.prologue-backdrop { position: absolute; inset: 0; background: radial-gradient(circle at 50% 48%, rgba(65,116,128,0.15), transparent 50%), #010304; }
.prologue-frame { position: absolute; inset: 0; overflow: hidden; }
.prologue-art { --scene-a: #72e5f5; --scene-b: #c594ff; position: absolute; inset: 0; overflow: hidden; background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--scene-a) 18%, transparent), transparent 25%), radial-gradient(circle at 52% 46%, color-mix(in srgb, var(--scene-b) 11%, transparent), transparent 46%), #020609; }
.prologue-art[data-scene="collapse"], .prologue-art[data-scene="silence"] { --scene-a: #ff6577; --scene-b: #c594ff; }
.prologue-art[data-scene="quark"], .prologue-art[data-scene="layers"], .prologue-art[data-scene="balance"] { --scene-a: #72e5f5; --scene-b: #ffb84d; }
.prologue-art[data-scene="law"], .prologue-art[data-scene="choice"] { --scene-a: #ffb84d; --scene-b: #61e6a7; }
.prologue-art[data-scene="reverse"], .prologue-art[data-scene="contact"] { --scene-a: #c594ff; --scene-b: #ff6577; }
.prologue-art[data-scene="life"], .prologue-art[data-scene="civilization"], .prologue-art[data-scene="mission"] { --scene-a: #61e6a7; --scene-b: #72e5f5; }
.prologue-art[data-scene^="rebirth-"] { --scene-a: #72e5f5; --scene-b: #c594ff; }
.prologue-art[data-scene="rebirth-collapse"] { --scene-a: #ff6577; --scene-b: #72e5f5; }
.prologue-art[data-scene="rebirth-inheritance"], .prologue-art[data-scene="rebirth-bias"] { --scene-a: #ffb84d; --scene-b: #72e5f5; }
.prologue-art[data-scene="rebirth-horizon"], .prologue-art[data-scene="rebirth-route"] { --scene-a: #c594ff; --scene-b: #ff6577; }
.prologue-art[data-scene="rebirth-mission"] { --scene-a: #61e6a7; --scene-b: #72e5f5; }
.prologue-art[data-scene^="rebirth-"][data-image-state="placeholder"]::after {
  content: "";
  position: absolute;
  inset: 12% 8% 18% 42%;
  opacity: .42;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--scene-a) 28%, transparent) 0 3%, transparent 4%),
    repeating-radial-gradient(ellipse at 50% 50%, transparent 0 9%, color-mix(in srgb, var(--scene-b) 18%, transparent) 9.5% 10%, transparent 10.5% 17%);
  filter: blur(.2px);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.prologue-art img { position: absolute; inset: -2%; width: 104%; height: 104%; object-fit: cover; opacity: 0; transform: scale(1.02); transition: opacity 700ms ease; }
.prologue-art.image-loaded img { opacity: 1; }
.prologue-art.image-loaded .prologue-fallback { opacity: 0; }
.prologue-art-enter img { animation: prologueDrift 9s ease-out both; }
.prologue-fallback { position: absolute; left: 50%; top: 45%; width: min(44vw, 600px); aspect-ratio: 1; transform: translate(-50%,-50%); filter: drop-shadow(0 0 34px color-mix(in srgb, var(--scene-a) 28%, transparent)); opacity: 0.78; }
.prologue-fallback i { position: absolute; inset: 12%; border: 1px solid color-mix(in srgb, var(--scene-a) 60%, transparent); border-radius: 50%; }
.prologue-fallback i:nth-child(2) { inset: 25%; border-color: color-mix(in srgb, var(--scene-b) 62%, transparent); transform: rotateX(64deg) rotateZ(22deg); }
.prologue-fallback i:nth-child(3) { inset: 36%; border-width: 2px; transform: rotateY(64deg) rotateZ(-18deg); }
.prologue-fallback i:nth-child(4) { inset: 45%; border: 0; background: var(--scene-a); box-shadow: 0 0 42px 12px color-mix(in srgb, var(--scene-a) 45%, transparent); }
.prologue-vignette { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(1,4,5,0.93) 0, rgba(1,4,5,0.36) 46%, rgba(1,4,5,0.14) 72%), linear-gradient(0deg, rgba(1,4,5,0.96) 0, transparent 45%), radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.54) 100%); }
.prologue-transition { position: absolute; z-index: 4; inset: -12%; overflow: hidden; opacity: 0; pointer-events: none; transform: translateX(-105%) skewX(-10deg); background: linear-gradient(90deg, transparent 0, rgba(4,13,17,0.94) 18%, rgba(6,24,29,0.99) 48%, rgba(4,13,17,0.94) 82%, transparent 100%); }
.prologue-transition i { position: absolute; top: 0; bottom: 0; width: 1px; background: linear-gradient(180deg, transparent, rgba(114,229,245,0.9), transparent); box-shadow: 0 0 22px rgba(114,229,245,0.65); }
.prologue-transition i:nth-child(1) { left: 30%; }
.prologue-transition i:nth-child(2) { left: 50%; background-color: rgba(255,184,77,0.9); box-shadow: 0 0 24px rgba(255,184,77,0.6); }
.prologue-transition i:nth-child(3) { left: 70%; }
.prologue-transition b { position: absolute; left: 20%; right: 20%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, rgba(216,242,246,0.8), transparent); box-shadow: 0 0 20px rgba(216,242,246,0.38); }
.prologue-transition.is-active { animation: prologuePhaseForward 520ms cubic-bezier(.62,.02,.22,1) both; }
.prologue-transition.is-active[data-direction="prev"] { animation-name: prologuePhaseBackward; }
.prologue-head { position: absolute; z-index: 2; left: clamp(24px, 5vw, 82px); right: clamp(24px, 5vw, 82px); top: clamp(22px, 5vh, 54px); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.prologue-head span { font: 11px/1 var(--mono); letter-spacing: 0.13em; color: var(--cyan); }
.prologue-head button, .prologue-controls button { min-height: 40px; padding: 8px 15px; border: 1px solid rgba(114,229,245,0.32); background: rgba(2,9,12,0.68); color: var(--text); font: 11px/1 var(--sans); cursor: pointer; }
.prologue-head button:hover, .prologue-controls button:hover:not(:disabled) { border-color: var(--cyan); color: white; background: rgba(114,229,245,0.11); }
.prologue-head-actions { display: flex; align-items: center; gap: 10px; }
.prologue-language { display: flex; border: 1px solid rgba(114,229,245,0.32); background: rgba(2,9,12,0.72); }
.prologue-language button { min-width: 52px; min-height: 38px; padding: 7px 10px; border: 0; border-right: 1px solid rgba(114,229,245,0.22); background: transparent; font: 10px/1 var(--mono); color: #8da3a8; }
.prologue-language button:last-child { border-right: 0; }
.prologue-language button.selected { color: #fff; background: rgba(114,229,245,0.15); box-shadow: inset 0 -2px 0 var(--cyan); }
.prologue-copy { position: absolute; z-index: 2; left: clamp(24px, 8vw, 132px); bottom: clamp(112px, 20vh, 210px); width: min(620px, calc(100vw - 48px)); }
.prologue-copy > span { font: 11px/1 var(--mono); letter-spacing: 0.12em; color: var(--amber); }
.prologue-copy h2 { max-width: 580px; margin: 15px 0 12px; font-size: clamp(30px, 4vw, 56px); line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; }
.prologue-copy p { max-width: 570px; margin: 0; font-size: clamp(15px, 1.45vw, 20px); line-height: 1.72; color: #b6c5c8; text-shadow: 0 2px 16px rgba(0,0,0,0.8); }
.prologue-controls { position: absolute; z-index: 2; left: clamp(24px, 8vw, 132px); right: clamp(24px, 8vw, 132px); bottom: clamp(22px, 5vh, 52px); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.prologue-controls > div:last-child { display: flex; gap: 9px; }
.prologue-controls button:disabled { opacity: 0.32; cursor: default; }
.prologue-controls #prologue-next { min-width: 118px; border-color: rgba(255,184,77,0.65); color: #ffe2a8; background: rgba(255,184,77,0.1); }
.prologue-dots { display: flex; align-items: center; gap: 7px; }
.prologue-dots button { width: 18px; min-width: 0; min-height: 3px; height: 3px; padding: 0; border: 0; background: rgba(216,231,234,0.2); }
.prologue-dots button[aria-current="step"] { width: 34px; background: var(--amber); box-shadow: 0 0 8px rgba(255,184,77,0.55); }
@keyframes prologueDrift { from { transform: scale(1.02) translate3d(-0.4%,0.3%,0); } to { transform: scale(1.085) translate3d(0.5%,-0.4%,0); } }
@keyframes prologuePhaseForward { 0% { opacity: 0; transform: translateX(-105%) skewX(-10deg); } 8%,78% { opacity: 1; } 100% { opacity: 0; transform: translateX(105%) skewX(-10deg); } }
@keyframes prologuePhaseBackward { 0% { opacity: 0; transform: translateX(105%) skewX(-10deg); } 8%,78% { opacity: 1; } 100% { opacity: 0; transform: translateX(-105%) skewX(-10deg); } }

@media (max-width: 760px) {
  html:not([data-locale="en"]) .brand-lockup h1 .brand-zh { display: inline; }
  .mission-action-progress { grid-template-columns: minmax(48px, 1fr) minmax(0, 48%); }
  .header-actions { gap: 5px; }
  .header-actions #save-btn { display: none; }
  .header-actions .btn { min-height: 32px; font-size: 9.5px; }
  .campaign-phases li span { font-size: 8.5px; }
  .settings-group { grid-template-columns: 1fr; gap: 12px; }
  .segmented-control { width: 100%; }
  .segmented-control button { flex: 1; min-width: 0; }
  .prologue-head { align-items: stretch; flex-direction: column; gap: 10px; }
  .prologue-head span { max-width: 180px; line-height: 1.4; }
  .prologue-head-actions { justify-content: space-between; }
  .prologue-language button { min-width: 48px; min-height: 34px; padding: 6px 8px; }
  .prologue-head #prologue-skip { min-height: 34px; padding: 6px 10px; }
  .prologue-art { background-position: center; }
  .prologue-art img { object-position: 68% center; }
  .prologue-fallback { width: 86vw; top: 39%; }
  .prologue-vignette { background: linear-gradient(0deg, rgba(1,4,5,0.98) 0, rgba(1,4,5,0.45) 62%, rgba(1,4,5,0.2) 100%), radial-gradient(ellipse at center, transparent 18%, rgba(0,0,0,0.58) 100%); }
  .prologue-copy { bottom: 112px; }
  .prologue-copy h2 { font-size: 30px; }
  .prologue-copy p { font-size: 15px; line-height: 1.58; }
  .prologue-dots { max-width: 45vw; overflow: hidden; gap: 4px; }
  .prologue-controls .prologue-dots button { width: 7px; min-height: 3px; height: 3px; padding: 0; }
  .prologue-controls .prologue-dots button[aria-current="step"] { width: 18px; }
  .prologue-controls button { min-height: 36px; padding: 7px 10px; }
}

/* ── v30 workspaces, goal rail, and readable command hierarchy ─── */
html[data-text-scale="large"] {
  --fs-body: 17px;
  --fs-secondary: 15px;
  --fs-status: 13px;
  --fs-control: 15px;
  --fs-heading: 19px;
  --fs-display: 22px;
  --control-height: 42px;
}

body {
  font-size: var(--fs-body);
}

.screen-noise { opacity: 0.065; }

.workspace-tabs {
  position: relative;
  z-index: 19;
  width: calc(100% - 24px);
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px auto 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(114,229,245,0.035), transparent 42%, rgba(197,148,255,0.035)),
    rgba(3,10,14,0.94);
  box-shadow: inset 0 0 28px rgba(114,229,245,0.025);
}
.workspace-tabs::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 58px;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(114,229,245,0.6);
}
.workspace-tabs button {
  position: relative;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.workspace-tabs button:last-child { border-right: 0; }
.workspace-tabs button strong {
  font: 600 var(--fs-heading)/1.2 var(--sans);
  color: var(--text);
}
.workspace-tabs button span {
  font: var(--fs-secondary)/1.3 var(--sans);
}
.workspace-tabs button:hover {
  background: rgba(114,229,245,0.055);
  color: var(--text);
}
.workspace-tabs button[aria-pressed="true"],
body[data-workspace="evolution"] #workspace-evolution,
body[data-workspace="intervention"] #workspace-intervention {
  color: var(--text-bright);
  background: linear-gradient(180deg, rgba(114,229,245,0.105), rgba(114,229,245,0.025));
  box-shadow: inset 0 -2px 0 var(--cyan);
}
.workspace-tabs button[aria-pressed="true"] strong,
body[data-workspace="evolution"] #workspace-evolution strong,
body[data-workspace="intervention"] #workspace-intervention strong { color: var(--cyan); }
#intervention-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border: 1px solid rgba(255,184,77,0.48);
  border-radius: 50%;
  background: rgba(255,184,77,0.14);
  color: #ffe0a4;
  font: 600 var(--fs-status)/1 var(--mono);
  box-shadow: 0 0 10px rgba(255,184,77,0.18);
}

.goal-rail {
  position: relative;
  z-index: 18;
  width: calc(100% - 24px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, 0.85fr);
  gap: 18px;
  margin: 12px auto 0;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid rgba(255,184,77,0.34);
  background:
    linear-gradient(110deg, rgba(38,27,10,0.88), rgba(6,17,21,0.97) 52%, rgba(9,14,23,0.97)),
    var(--panel);
  box-shadow: inset 3px 0 0 rgba(255,184,77,0.72), 0 12px 32px rgba(0,0,0,0.22);
}
.goal-rail::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber));
  opacity: 0.72;
}
.goal-rail-primary { min-width: 0; }
.campaign-goal-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.campaign-goal-kicker span,
.campaign-goal-kicker b {
  font: var(--fs-status)/1.2 var(--mono);
  letter-spacing: 0.08em;
  color: var(--amber);
}
.campaign-goal-kicker b { color: var(--muted); font-weight: 500; }
.goal-rail h2 {
  margin: 10px 0 6px;
  font-size: var(--fs-display);
  line-height: 1.32;
  color: var(--text-bright);
}
.goal-rail-primary > p {
  margin: 0;
  font-size: var(--fs-secondary);
  line-height: 1.6;
  color: #a8b9bd;
}
.campaign-phases {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}
.campaign-phases li {
  position: relative;
  min-width: 0;
  padding-top: 9px;
  border-top: 2px solid rgba(111,139,145,0.28);
  color: #60777c;
}
.campaign-phases li::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 5px;
  height: 5px;
  background: currentColor;
}
.campaign-phases li span {
  display: block;
  font: var(--fs-status)/1.35 var(--sans);
}
.campaign-phases li.complete { border-color: rgba(97,230,167,0.55); color: var(--green); }
.campaign-phases li.current { border-color: var(--amber); color: #ffd48d; }

.goal-rail-live {
  min-width: 0;
  display: grid;
  align-content: stretch;
  border: 1px solid rgba(114,229,245,0.14);
  background: rgba(0,0,0,0.16);
}
.goal-rail-live > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(114,229,245,0.09);
}
.goal-rail-live > div:last-child { border-bottom: 0; }
.goal-rail-live span {
  font: var(--fs-status)/1.3 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.goal-rail-live strong {
  min-width: 0;
  font-size: var(--fs-secondary);
  line-height: 1.4;
  color: var(--text);
  font-weight: 550;
}
.goal-now { background: linear-gradient(90deg, rgba(255,184,77,0.065), transparent); }
.goal-now span { color: var(--amber); }
.goal-now strong { color: var(--text-bright); }
.goal-now b {
  justify-self: end;
  color: var(--cyan);
  font: 500 var(--fs-status)/1.3 var(--mono);
  white-space: nowrap;
}
.goal-next strong { color: #b8dce2; }
.goal-optional strong { color: #b9afd0; }

.command-grid {
  grid-template-columns: minmax(300px, 320px) minmax(0, 1fr) minmax(360px, 400px);
}
.operation-resource-strip {
  display: none;
  border: 1px solid rgba(255,184,77,0.3);
  background: linear-gradient(90deg, rgba(255,184,77,0.055), rgba(5,15,19,0.96));
  box-shadow: inset 2px 0 0 rgba(255,184,77,0.65);
}
.operation-resource-strip > header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,184,77,0.16);
}
.operation-resource-strip > header span {
  font: var(--fs-status)/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--amber);
}
.operation-resource-strip > header strong {
  font-size: var(--fs-heading);
  color: var(--text-bright);
}
.operation-resource-list {
  min-height: 54px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 7px;
  padding: 9px;
}
.operation-resource-list:empty::after {
  content: "正在读取当前任务所需资源";
  grid-column: 1 / -1;
  align-self: center;
  color: var(--muted);
  font-size: var(--fs-secondary);
  text-align: center;
}
.operation-resource-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(114,229,245,0.14);
  background: rgba(114,229,245,0.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.operation-resource-chip:hover { border-color: rgba(114,229,245,0.42); background: rgba(114,229,245,0.065); }
.operation-resource-chip span {
  display: flex;
  align-items: center;
  gap: 6px;
  font: var(--fs-status)/1.3 var(--mono);
  color: #9cb0b5;
}
.operation-resource-chip span i { width: 6px; height: 6px; box-shadow: 0 0 6px currentColor; }
.operation-resource-chip strong { font: 600 var(--fs-heading)/1.2 var(--mono); color: var(--text-bright); }
.operation-resource-chip small {
  grid-column: 1 / -1;
  font: var(--fs-status)/1.3 var(--mono);
}
.operation-resource-chip small.positive { color: var(--green); }
.operation-resource-chip small.negative { color: var(--red); }

body[data-workspace="evolution"] #event-panel,
body[data-workspace="evolution"] #talent-panel,
body[data-workspace="evolution"] #route-panel,
body[data-workspace="evolution"] #contact-panel {
  display: none !important;
}
body[data-workspace="intervention"] .resource-panel,
body[data-workspace="intervention"] #cosmos-stage,
body[data-workspace="intervention"] #directive-panel,
body[data-workspace="intervention"] #observation-panel {
  display: none !important;
}
body[data-workspace="intervention"] #operation-resource-strip {
  display: block;
}

.flow-monitor {
  position: relative;
  z-index: 1;
  right: auto;
  bottom: auto;
  width: 100%;
  background: rgba(3,10,14,0.94);
}
.flow-monitor-body {
  max-height: min(520px, 58dvh);
}
.flow-monitor.collapsed { width: 100%; }
.flow-monitor.collapsed .flow-monitor-head { border-bottom: 0; }
.flow-monitor-head button {
  width: 36px;
  height: 36px;
  font-size: var(--fs-control);
}

.discovery-card {
  position: relative;
  z-index: 1;
  left: auto;
  bottom: auto;
  width: 100%;
  padding: 15px 17px;
  background:
    linear-gradient(110deg, rgba(21,12,37,0.96), rgba(4,15,19,0.97) 68%),
    var(--panel);
}
.discovery-card header button {
  min-height: var(--control-height);
  font-size: var(--fs-control);
}
.discovery-card > strong { font-size: var(--fs-heading); }
.discovery-card > p { font-size: var(--fs-body); }
.discovery-card > small,
.discovery-choices small { font-size: var(--fs-status); color: var(--muted); }
.discovery-choices b { font-size: var(--fs-control); }
.discovery-choices button { min-height: 52px; }

.observation-content { padding: 12px; }
.observation-telemetry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.observation-telemetry > span {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(114,229,245,0.12);
  background: rgba(114,229,245,0.025);
}
.observation-telemetry small {
  font: var(--fs-status)/1.2 var(--mono);
  color: var(--muted);
}
.observation-telemetry strong {
  overflow-wrap: anywhere;
  font: 600 var(--fs-secondary)/1.3 var(--mono);
  color: var(--cyan);
}
.observation-active,
.observation-result {
  margin-top: 8px;
  padding: 10px 11px;
  border-left: 2px solid var(--violet);
  background: rgba(197,148,255,0.035);
  color: #aebdc1;
  font-size: var(--fs-secondary);
  line-height: 1.55;
}
.observation-result:empty { display: none; }
.observation-options {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}
.observation-options:empty { display: none; }
.observation-options button {
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--violet);
  background: rgba(197,148,255,0.035);
  color: var(--text);
  font-size: var(--fs-control);
  text-align: left;
  cursor: pointer;
}
.observation-options button:disabled { cursor: not-allowed; }
.observation-options button > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.observation-options button b { color: var(--text-bright); font-size: var(--fs-control); }
.observation-options button em {
  color: var(--violet);
  font: normal var(--fs-status)/1.3 var(--mono);
  text-align: right;
}
.observation-options button small {
  display: block;
  margin-top: 5px;
  color: #8fa3a8;
  font-size: var(--fs-status);
  line-height: 1.45;
}

.talent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}
.talent-grid > .empty-state { grid-column: 1 / -1; }
.talent-grid button,
.talent-card {
  min-width: 0;
  min-height: 112px;
  padding: 11px;
  border: 1px solid rgba(197,148,255,0.22);
  background: linear-gradient(145deg, rgba(197,148,255,0.055), rgba(255,255,255,0.01));
  color: var(--text);
  font-size: var(--fs-control);
  text-align: left;
}
.talent-card { cursor: pointer; }
.talent-card:disabled { cursor: not-allowed; }
.talent-card > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.talent-card > span strong { color: var(--text-bright); font-size: var(--fs-control); }
.talent-card > span b { color: var(--violet); font: 500 var(--fs-status)/1.3 var(--mono); }
.talent-card p {
  margin: 8px 0;
  color: #94a7ac;
  font-size: var(--fs-status);
  line-height: 1.5;
}
.talent-card small { color: var(--amber); font: var(--fs-status)/1.3 var(--mono); }
.talent-card:disabled small { color: #789096; }

.panel-heading h2 { font-size: var(--fs-heading); }
.header-actions #archive-btn span,
.header-actions #log-btn span { font-size: var(--fs-status); }
.btn {
  min-height: var(--control-height);
  font-size: var(--fs-control);
}
.btn-quiet,
.btn-danger-quiet { min-height: var(--control-height); }
.btn:disabled {
  opacity: 1;
  color: #789096;
  border-color: rgba(104,148,155,0.2);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.018) 0 5px, transparent 5px 10px),
    rgba(255,255,255,0.01);
}
.choice-card:disabled,
.enemy-method-card:disabled {
  opacity: 1;
  color: #82979c;
  border-color: rgba(104,148,155,0.18);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.018) 0 6px, transparent 6px 12px),
    rgba(255,255,255,0.01);
}
.choice-card:disabled p,
.enemy-method-card:disabled p { color: #789096; }
.tier-card.locked { opacity: 0.58; }

.tc-name { font-size: var(--fs-heading); }
.tc-readout span,
.tc-bar-label,
.tc-bar-val,
.tc-locked,
.tc-modifier { font-size: var(--fs-status); }
.tc-net { font-size: var(--fs-secondary); }
.btn-tier,
.btn-micro { font-size: var(--fs-control); }
.btn-micro { min-height: var(--control-height); }

.mission-copy-head span,
.mission-sequence > span,
.mission-action-progress span,
.mission-state span,
.mission-state b { font-size: var(--fs-status); }
.mission-copy-head strong { font-size: var(--fs-heading); }
.mission-action-progress span { color: #8fa5aa; }
.directive-copy { font-size: var(--fs-body); }
.directive-hint span,
.directive-progress > span,
.directive-progress > b { font-size: var(--fs-status); }
.directive-hint p { font-size: var(--fs-secondary); }

.flow-monitor-head span,
.flow-legend strong,
.flow-legend span { font-size: var(--fs-status); }
.flow-monitor-head strong { font-size: var(--fs-heading); }
.flow-identity b,
.flow-result b { font-size: var(--fs-secondary); }
.flow-identity small,
.flow-equation > span,
.flow-result span,
.flow-result small,
.research-trend-copy span,
.research-trend-copy small { font-size: var(--fs-status); }

.stability-checklist header span {
  font: var(--fs-status)/1.2 var(--mono);
}
.stability-checklist header strong {
  font: 600 var(--fs-heading)/1.3 var(--sans);
}
.stability-checklist header small {
  font: var(--fs-secondary)/1.4 var(--sans);
  color: #9eb0b4;
}
.stability-row {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  min-height: 52px;
  padding: 8px 9px;
}
.stability-row > i {
  width: 21px;
  height: 21px;
  font-size: var(--fs-status);
}
.stability-row span b {
  font: 600 var(--fs-secondary)/1.35 var(--sans);
}
.stability-row span small {
  margin-top: 4px;
  font: var(--fs-secondary)/1.45 var(--sans);
}
.stability-row em {
  font: normal var(--fs-status)/1.3 var(--mono);
  color: #91a8ad;
}
.stability-timer span,
.stability-timer b {
  font: var(--fs-secondary)/1.3 var(--mono);
}

.progress-block > span,
.condition-list li,
.preparation-conditions li {
  font-size: var(--fs-secondary);
  line-height: 1.45;
}
.preparation-active > p,
.preparation-effect b {
  font-size: var(--fs-secondary);
  line-height: 1.55;
}
.preparation-effect span {
  font: var(--fs-status)/1.4 var(--mono);
}
.choice-context b,
.choice-top span,
.choice-metrics span,
.choice-metrics b,
.decision-hierarchy header span,
.decision-hierarchy header b,
.decision-hierarchy li b,
.decision-hierarchy li small {
  font-size: var(--fs-status);
}
.choice-context p,
.choice-card p { font-size: var(--fs-secondary); }
.choice-top strong { font-size: var(--fs-heading); }
.choice-metrics {
  grid-template-columns: 46px 1fr;
  gap: 6px 9px;
}

.completion-kicker,
.completion-records span,
.completion-signal span,
.completion-signal small,
.civilization-report > span,
.proposal-card > span,
.proposal-card > small {
  font-size: var(--fs-status);
  line-height: 1.45;
}
.completion-report h3,
.civilization-report h3 { font-size: var(--fs-display); }
.completion-signal strong,
.completion-records b,
.proposal-card > strong { font-size: var(--fs-secondary); }
.completion-story p,
.completion-closing,
.civilization-report > p,
.proposal-card > p {
  font-size: var(--fs-secondary);
  line-height: 1.62;
}
.route-lead span,
.route-lead small,
.route-name small,
.route-row > p,
.route-summary span,
.route-summary small { font-size: var(--fs-status); }
.route-lead strong,
.route-name b,
.route-summary strong { font-size: var(--fs-secondary); }
.route-row > p { color: var(--muted); }
.route-note { font-size: var(--fs-secondary); }
.reverse-object-card b { font-size: var(--fs-secondary); }
.reverse-object-card small { font-size: var(--fs-status); color: #91a7ac; }
.reverse-object-card p { font-size: var(--fs-secondary); color: #8fa4a9; }
.lore-entry > div p,
.lore-entry > div small,
.lore-entry summary > span,
.lore-entry summary small,
.lore-categories button span,
.lore-categories button b,
.lore-categories button i { font-size: var(--fs-secondary); }

.empty-state p { font-size: var(--fs-secondary); }
.empty-state small { font-size: var(--fs-status); color: var(--muted); }
.status-chip { font-size: var(--fs-status); }
.guide-callout {
  max-height: calc(100dvh - 18px - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.guide-callout-head > span,
.guide-callout-head button,
.guide-action span,
.guide-callout-progress b { font-size: var(--fs-status); }
.guide-callout > strong { font-size: var(--fs-display); }
.guide-callout > p,
.guide-action p { font-size: var(--fs-secondary); }
.ui-tooltip strong,
.ui-tooltip p,
.system-toast { font-size: var(--fs-secondary); }

button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
.tc-modifier:is(button):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.is-primary-action,
.btn.is-primary-action {
  border-color: rgba(255,184,77,0.78);
  color: #ffe3aa;
  background: rgba(255,184,77,0.12);
  box-shadow: 0 0 0 1px rgba(255,184,77,0.08), inset 0 -2px 0 rgba(255,184,77,0.65);
}
.tier-card:has(.is-primary-action) {
  border-left: 2px solid var(--amber);
  background: linear-gradient(90deg, rgba(255,184,77,0.07), transparent 78%);
}
.mission-strip,
.tier-card,
.research-bar,
#contact-panel,
#event-panel,
#talent-panel,
#observation-panel { scroll-margin-top: 96px; }

@media (min-width: 1360px) {
  .command-grid {
    grid-template-columns: minmax(300px, 320px) minmax(540px, 1fr) minmax(360px, 400px);
  }
  body[data-workspace="intervention"] .command-grid {
    grid-template-columns: minmax(560px, 1.45fr) minmax(380px, 0.8fr);
  }
  body[data-workspace="intervention"] .center-stack { grid-column: 1; }
  body[data-workspace="intervention"] .right-stack { grid-column: 2; }
}

@media (min-width: 768px) and (max-width: 1359px) {
  .goal-rail {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.85fr);
  }
  .command-grid {
    display: grid;
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  }
  .resource-panel { grid-column: 1; }
  .center-stack { grid-column: 2; }
  .right-stack {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body[data-workspace="intervention"] .command-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  }
  body[data-workspace="intervention"] .center-stack { grid-column: 1; }
  body[data-workspace="intervention"] .right-stack {
    grid-column: 2;
    display: flex;
  }
}

@media (max-width: 767px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .screen-noise { opacity: 0.045; }
  .command-header {
    min-height: 64px;
    grid-template-columns: minmax(64px, 1fr) auto;
    padding: 8px 10px;
  }
  .brand-mark { display: none; }
  .brand-lockup { gap: 0; }
  .brand-lockup h1 { font-size: 18px; }
  .header-actions { gap: 4px; }
  .header-actions #save-btn { display: none; }
  .header-actions .btn {
    min-height: 40px;
    padding: 5px 6px;
    font-size: var(--fs-control);
  }
  .workspace-tabs {
    position: fixed;
    z-index: 70;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    min-height: 58px;
    margin: 0;
    box-shadow: 0 14px 42px rgba(0,0,0,0.7), inset 0 0 24px rgba(114,229,245,0.035);
  }
  .workspace-tabs button {
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 9px;
  }
  .workspace-tabs button strong { font-size: var(--fs-heading); }
  .workspace-tabs button span { font-size: var(--fs-status); }
  #intervention-badge {
    position: absolute;
    right: 10px;
    top: 8px;
  }

  .goal-rail {
    position: sticky;
    top: 64px;
    z-index: 18;
    width: calc(100% - 16px);
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(110deg, rgba(38,27,10,0.97), rgba(5,15,19,0.985) 70%);
    box-shadow: inset 3px 0 0 rgba(255,184,77,0.72), 0 10px 28px rgba(0,0,0,0.48);
  }
  .campaign-goal-kicker span,
  .campaign-goal-kicker b { font-size: var(--fs-status); }
  .goal-rail h2 {
    margin: 7px 0 0;
    font-size: var(--fs-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .goal-rail-primary > p,
  .campaign-phases,
  .goal-next,
  .goal-optional { display: none !important; }
  .goal-rail-live { border: 0; background: transparent; }
  .goal-rail-live > div {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    padding: 7px 0 0;
    border: 0;
  }
  .goal-now strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .goal-now b { font-size: var(--fs-status); }

  .command-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px;
  }
  .center-stack { order: 1; width: 100%; }
  .resource-panel { order: 2; width: 100%; }
  .right-stack {
    order: 3;
    width: 100%;
    display: flex;
  }
  .mission-strip {
    min-height: 78px;
    grid-template-columns: 70px minmax(0, 1fr) 72px;
  }
  .mission-sequence { padding: 0 9px; }
  .mission-copy { padding: 8px 10px; }
  .mission-copy-head {
    align-items: flex-start;
    gap: 7px;
  }
  .mission-copy-head strong {
    white-space: normal;
    line-height: 1.3;
  }
  .mission-action-progress {
    grid-template-columns: minmax(42px, 1fr) minmax(0, 52%);
  }
  .mission-action-progress span { font-size: var(--fs-status); }
  .mission-state { padding: 0 7px; }

  .cosmos-stage { height: clamp(260px, 42dvh, 390px); }
  .flow-monitor,
  .flow-monitor.collapsed,
  .discovery-card {
    right: auto;
    left: auto;
    bottom: auto;
    width: 100%;
  }
  .flow-monitor-body { max-height: min(480px, 58dvh); }
  .flow-monitor-head button {
    width: 44px;
    height: 44px;
  }
  .discovery-card { padding: 13px 14px; }
  .discovery-card header button { min-height: 44px; }
  .discovery-choices button { min-height: 54px; }

  .stability-row { grid-template-columns: 24px minmax(0, 1fr); }
  .stability-row em {
    grid-column: 2;
    white-space: normal;
  }
  .observation-telemetry,
  .talent-grid { grid-template-columns: 1fr; }
  .talent-grid > .empty-state { grid-column: 1; }
  .guide-callout {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 92px - env(safe-area-inset-bottom, 0px));
  }
}

/* ── v34 discovery signal, modal reading layer, staged teaching ─── */
.discovery-beacon {
  position: absolute;
  z-index: 16;
  left: 20px;
  top: 74px;
  bottom: auto;
  width: min(390px, calc(100% - 40px));
  min-height: 82px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  overflow: hidden;
  border: 1px solid rgba(197,148,255,0.58);
  border-left: 3px solid var(--violet);
  background:
    linear-gradient(105deg, rgba(30,16,49,0.96), rgba(5,18,23,0.96) 72%),
    var(--panel);
  box-shadow:
    0 18px 48px rgba(0,0,0,0.58),
    0 0 0 1px rgba(197,148,255,0.06),
    inset 0 0 34px rgba(197,148,255,0.055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.discovery-beacon[hidden] { display: none; }
.discovery-beacon::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(108deg, transparent 20%, rgba(255,255,255,0.075) 44%, transparent 68%);
  transform: translateX(-115%);
  animation: discoveryScan 3.2s ease-in-out infinite;
}
.discovery-beacon:hover {
  border-color: rgba(220,192,255,0.82);
  background:
    linear-gradient(105deg, rgba(38,20,61,0.98), rgba(6,24,29,0.98) 72%),
    var(--panel);
}
.discovery-beacon:focus-visible { outline-color: var(--violet); }
.discovery-beacon.discovery-enter { animation: discoveryBeaconEnter 620ms cubic-bezier(.2,.72,.16,1) both; }
.discovery-beacon-glyph {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(197,148,255,0.44);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(197,148,255,0.08), 0 0 18px rgba(197,148,255,0.12);
}
.discovery-beacon-glyph::before,
.discovery-beacon-glyph::after,
.discovery-beacon-glyph i {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.discovery-beacon-glyph::before {
  inset: 8px;
  border: 1px dashed rgba(114,229,245,0.5);
  animation: discoveryOrbit 7s linear infinite;
}
.discovery-beacon-glyph::after {
  inset: 17px;
  background: var(--violet);
  box-shadow: 0 0 15px rgba(197,148,255,0.9);
}
.discovery-beacon-glyph i {
  inset: 3px;
  border: 1px solid rgba(197,148,255,0.16);
  animation: discoveryPulse 1.8s ease-out infinite;
}
.discovery-beacon-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.discovery-beacon-copy small {
  color: var(--violet);
  font: var(--fs-status)/1.15 var(--mono);
  letter-spacing: 0.1em;
}
.discovery-beacon-copy strong {
  overflow: hidden;
  color: var(--text-bright);
  font-size: var(--fs-heading);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discovery-beacon-copy em {
  color: #9aadb2;
  font: normal var(--fs-status)/1.3 var(--sans);
}
.discovery-beacon > b {
  position: relative;
  z-index: 1;
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid rgba(197,148,255,0.45);
  border-radius: 999px;
  background: rgba(197,148,255,0.12);
  color: #eadcff;
  font: 600 var(--fs-status)/1 var(--mono);
}

.discovery-layer { z-index: 230; }
.discovery-layer[hidden] { display: none; }
.discovery-layer .modal-backdrop {
  background:
    radial-gradient(circle at 42% 45%, rgba(197,148,255,0.1), transparent 36%),
    rgba(0,4,7,0.86);
}
.discovery-layer .discovery-card {
  position: relative;
  z-index: 1;
  left: auto;
  bottom: auto;
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(197,148,255,0.52);
  border-left: 3px solid var(--violet);
  background:
    linear-gradient(135deg, rgba(23,13,39,0.995), rgba(4,15,20,0.995) 68%),
    var(--panel);
  box-shadow: 0 30px 100px rgba(0,0,0,0.78), inset 0 0 60px rgba(197,148,255,0.045);
}
.discovery-card-head {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(197,148,255,0.18);
  background: rgba(197,148,255,0.025);
}
.discovery-card-head > div { min-width: 0; }
.discovery-card-head > div span,
.discovery-card-head > div small {
  display: block;
  font: var(--fs-status)/1.3 var(--mono);
}
.discovery-card-head > div span {
  overflow: hidden;
  color: var(--violet);
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discovery-card-head > div small {
  margin-top: 6px;
  color: var(--muted);
}
.discovery-card-head .btn {
  flex: 0 0 auto;
  min-height: var(--control-height);
  font-size: var(--fs-control);
}
.discovery-card-body {
  min-height: 0;
  padding: clamp(20px, 4vw, 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.discovery-dialog-kicker {
  display: block;
  color: var(--cyan);
  font: var(--fs-status)/1.2 var(--mono);
  letter-spacing: 0.12em;
}
.discovery-card-body > strong {
  display: block;
  margin-top: 12px;
  color: var(--text-bright);
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.2;
  text-wrap: balance;
}
.discovery-card-body > p {
  max-width: 62ch;
  margin: 16px 0 0;
  color: #b6c5c9;
  font-size: var(--fs-body);
  line-height: 1.75;
}
.discovery-card-body > small {
  display: block;
  margin-top: 18px;
  color: #91a4a9;
  font: var(--fs-status)/1.55 var(--mono);
}
.discovery-layer .discovery-choices {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
  margin: 20px 0 0;
}
.discovery-layer .discovery-choices button {
  min-height: 76px;
  padding: 12px;
  font-size: var(--fs-control);
}
.discovery-layer .discovery-choices b {
  color: var(--text-bright);
  font: 600 var(--fs-control)/1.35 var(--sans);
}
.discovery-layer .discovery-choices small {
  margin-top: 7px;
  color: #91a5aa;
  font: var(--fs-status)/1.5 var(--sans);
}
.discovery-card-actions {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid rgba(197,148,255,0.18);
  background: rgba(0,0,0,0.16);
}
.discovery-card-actions p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-secondary);
  line-height: 1.45;
}
.discovery-card-actions .btn {
  flex: 0 0 auto;
  min-width: 126px;
  min-height: var(--control-height);
  font-size: var(--fs-control);
}

.system-intro {
  margin: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(255,184,77,0.25);
  border-left: 3px solid var(--amber);
  background: linear-gradient(100deg, rgba(255,184,77,0.075), rgba(255,255,255,0.012));
}
.system-intro[hidden] { display: none; }
.observation-content > .system-intro { margin: 0 0 10px; }
.system-intro span,
.system-intro strong,
.system-intro p { display: block; }
.system-intro span {
  color: var(--amber);
  font: var(--fs-status)/1.2 var(--mono);
  letter-spacing: 0.08em;
}
.system-intro strong {
  margin-top: 7px;
  color: var(--text-bright);
  font-size: var(--fs-heading);
  line-height: 1.3;
}
.system-intro p {
  margin: 6px 0 0;
  color: #9eb1b5;
  font-size: var(--fs-secondary);
  line-height: 1.55;
}
#workspace-intervention.is-primary-action,
#workspace-intervention.system-unread,
#workspace-evolution.system-unread {
  border-color: rgba(255,184,77,0.42);
  box-shadow: inset 0 -2px 0 var(--amber), inset 0 0 24px rgba(255,184,77,0.055);
}
#workspace-evolution.system-unread {
  position: relative;
}
#workspace-evolution.system-unread::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 10px rgba(197,148,255,0.84);
}

body.loop-sealed .goal-rail {
  border-color: rgba(197,148,255,0.42);
  background:
    linear-gradient(110deg, rgba(31,15,47,0.94), rgba(7,15,20,0.98) 58%, rgba(18,8,15,0.98)),
    var(--panel);
  box-shadow: inset 3px 0 0 rgba(197,148,255,0.72), 0 12px 32px rgba(0,0,0,0.3);
}
body.loop-sealed .campaign-goal-kicker span,
body.loop-sealed .goal-now span { color: var(--violet); }
body.loop-sealed #cosmos-canvas {
  pointer-events: none;
  filter: saturate(.62) brightness(.78);
}
body.loop-sealed .cosmos-stage { cursor: default; }
body.loop-sealed .click-hint { display: none; }
body.loop-sealed #guide-dock {
  cursor: default;
  color: var(--violet);
  background: rgba(197,148,255,0.045);
}
body.loop-sealed .status-online strong { color: var(--violet); }
body.loop-sealed .status-online i {
  background: var(--violet);
  box-shadow: 0 0 7px rgba(197,148,255,0.72);
}
body.loop-sealed .round-two-report.is-sealed {
  border-left: 3px solid var(--violet);
  background: linear-gradient(110deg, rgba(197,148,255,0.055), transparent 62%);
}
body[data-loop-number="2"][data-mission-step="11"] #event-panel {
  order: -2;
}
body[data-loop-number="2"][data-mission-step="11"] #decision-hierarchy {
  display: none;
}

@keyframes discoveryBeaconEnter {
  from { opacity: 0; transform: translate3d(-22px, 8px, 0); filter: blur(3px); }
  to { opacity: 1; transform: translate3d(0,0,0); filter: blur(0); }
}
@keyframes discoveryScan {
  0%, 55% { transform: translateX(-115%); }
  82%, 100% { transform: translateX(115%); }
}
@keyframes discoveryOrbit { to { transform: rotate(360deg); } }
@keyframes discoveryPulse {
  0% { opacity: .72; transform: scale(.74); }
  82%, 100% { opacity: 0; transform: scale(1.2); }
}

@media (max-width: 767px) {
  body.single-workspace { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .discovery-beacon {
    left: 12px;
    top: 70px;
    bottom: auto;
    width: calc(100% - 24px);
    min-height: 74px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 9px 10px;
  }
  .discovery-beacon-glyph { width: 38px; height: 38px; }
  .discovery-beacon-glyph::before { inset: 6px; }
  .discovery-beacon-glyph::after { inset: 14px; }
  .discovery-beacon-copy em { display: none; }
  .discovery-layer {
    align-items: end;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .discovery-layer .discovery-card {
    width: 100%;
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom, 0px));
  }
  .discovery-card-head { min-height: 66px; padding: 10px 12px; }
  .discovery-card-body { padding: 21px 16px; }
  .discovery-card-body > strong { font-size: 25px; }
  .discovery-card-body > p { font-size: var(--fs-body); }
  .discovery-layer .discovery-choices { grid-template-columns: 1fr; }
  .discovery-card-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 11px 12px;
  }
  .discovery-card-actions .btn { width: 100%; }
}

/* ── v35 English copy and compact viewport fitting ───────────── */
html[data-locale="en"] .choice-top {
  align-items: flex-start;
}
html[data-locale="en"] .choice-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
html[data-locale="en"] .choice-top span {
  flex: 0 1 46%;
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}
html[data-locale="en"] .decision-hierarchy header > * {
  min-width: 0;
  overflow-wrap: anywhere;
}
html[data-locale="en"] .decision-hierarchy header b {
  max-width: 62%;
  line-height: 1.4;
  text-align: right;
}
html[data-locale="en"] .preparation-conditions li,
html[data-locale="en"] .progress-block > span {
  align-items: flex-start;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  html[data-locale="en"] .goal-rail-live > div {
    grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  }
  html[data-locale="en"] .goal-now b {
    grid-column: 2;
    justify-self: start;
    white-space: normal;
  }
}

@media (min-width: 768px) and (max-height: 620px) {
  .prologue-head {
    top: 18px;
  }
  .prologue-copy {
    bottom: 84px;
    width: min(590px, calc(100vw - 48px));
  }
  .prologue-copy h2 {
    margin: 9px 0 7px;
    font-size: clamp(25px, 3.4vw, 38px);
    line-height: 1.12;
  }
  .prologue-copy p {
    max-width: 590px;
    font-size: 14px;
    line-height: 1.48;
  }
  .prologue-controls {
    bottom: 16px;
  }
  .prologue-dots {
    gap: 4px;
  }
  .prologue-dots button {
    width: 12px;
  }
  .prologue-dots button[aria-current="step"] {
    width: 24px;
  }
  .settings-head {
    min-height: 62px;
    padding-block: 10px;
  }
  .settings-group {
    min-height: 72px;
    padding-block: 11px;
  }
}

@media (max-width: 560px) {
  html[data-locale="en"] .command-header {
    gap: 6px;
    padding-inline: 8px;
  }
  html[data-locale="en"] .brand-lockup h1 {
    font-size: 14px;
    letter-spacing: 0.045em;
  }
  html[data-locale="en"] .header-actions .btn {
    min-height: 36px;
    padding-inline: 5px;
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  html[data-locale="en"] .command-header {
    grid-template-columns: 1fr;
  }
  html[data-locale="en"] .brand-lockup {
    display: none;
  }
  html[data-locale="en"] .header-actions {
    justify-self: center;
  }
}


/* ── Fun & Quality Overhaul: Batch Synth, Resonance, Constants, Portrait, Codex, Offline & Ergonomics ── */
.panel-heading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.synth-batch-control {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: rgba(6, 17, 22, 0.85);
}
.synth-batch-control button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: 600 10px/1 var(--mono);
  padding: 4px 7px;
  cursor: pointer;
}
.synth-batch-control button:last-child { border-right: 0; }
.synth-batch-control button.active {
  background: rgba(114, 229, 245, 0.2);
  color: var(--text-bright);
}
.tc-modifier.afterglow {
  color: var(--amber);
  border-color: rgba(255, 184, 77, 0.4);
  background: rgba(255, 184, 77, 0.09);
}

.resonance-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.res-chip {
  flex: 1 1 220px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: rgba(7, 20, 26, 0.9);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.res-chip span {
  font: 600 10px/1.1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.res-chip b {
  font: 600 12px/1.3 var(--sans);
  color: var(--text-bright);
}
.res-chip small {
  font: 500 11px/1.35 var(--sans);
  color: var(--muted);
}
.res-chip.active.harmonic {
  border-color: rgba(97, 230, 167, 0.6);
  background: rgba(97, 230, 167, 0.1);
}
.res-chip.active.cascade {
  border-color: rgba(255, 184, 77, 0.65);
  background: rgba(255, 184, 77, 0.1);
}
.res-chip.phase-good { border-color: rgba(97, 230, 167, 0.45); }
.res-chip.phase-warn { border-color: rgba(255, 101, 119, 0.45); background: rgba(255, 101, 119, 0.08); }
.res-chip.harvest {
  cursor: pointer;
  border-color: rgba(255, 212, 59, 0.72);
  background: rgba(255, 212, 59, 0.14);
  transition: transform 100ms ease, background 120ms ease;
}
.res-chip.harvest:hover {
  transform: translateY(-1px);
  background: rgba(255, 212, 59, 0.24);
}
.res-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 2px;
}
.res-bar i {
  display: block;
  height: 100%;
  background: var(--green);
}
.res-chip.active.cascade .res-bar i { background: var(--amber); }

.constants-content {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.const-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.const-row strong { display: block; font-size: 13px; color: var(--text-bright); }
.const-row small { display: block; font: 500 11px/1.3 var(--mono); color: var(--cyan); margin-top: 2px; }
.const-ctrls { display: flex; align-items: center; gap: 6px; }
.const-ctrls b { min-width: 24px; text-align: center; font: 600 13px/1 var(--mono); color: var(--text-bright); }
.const-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}
.const-footer small { font-size: 11px; color: var(--muted); }

.portrait-box {
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid rgba(114, 229, 245, 0.35);
  background: linear-gradient(135deg, rgba(16, 42, 50, 0.65), rgba(6, 16, 22, 0.85));
}
.portrait-box > span {
  display: block;
  font: 600 11px/1.2 var(--mono);
  color: var(--cyan);
  letter-spacing: 0.06em;
}
.portrait-box > strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 14px;
  color: var(--text-bright);
}
.portrait-box p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.codex-box {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(5, 14, 19, 0.85);
}
.codex-box header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.codex-box header span { font: 600 9px/1 var(--mono); color: var(--muted); letter-spacing: 0.1em; }
.codex-box header strong { font-size: 13px; color: var(--text-bright); }
.codex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.codex-chip {
  padding: 6px 8px;
  border: 1px solid var(--line);
  font: 500 12px/1.2 var(--sans);
  color: var(--muted);
  opacity: 0.55;
}
.codex-chip.unlocked {
  opacity: 1;
  color: var(--text-bright);
  border-color: rgba(97, 230, 167, 0.55);
  background: rgba(97, 230, 167, 0.1);
}

.lore-visuals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.lore-visual-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 26, 0.85);
  cursor: pointer;
  text-align: left;
}
.lore-visual-card:hover:not(:disabled) { border-color: var(--cyan); }
.lore-visual-card.locked { opacity: 0.45; cursor: not-allowed; }
.lore-visual-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.lore-visual-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  font: 600 10px/1 var(--mono);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.lore-visual-card small {
  font-size: 11px;
  line-height: 1.25;
  color: var(--text);
}

.offline-dialog .offline-body { padding: 14px 18px 8px; }
.offline-lead { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.offline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.offline-row {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.offline-row b { font: 600 13px/1 var(--mono); color: var(--text-bright); }
.offline-sub { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.offline-actions {
  padding: 10px 18px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.settings-btn-pair { display: flex; gap: 6px; flex-wrap: wrap; }

/* Compact visual noise reduction: keep the Cosmos Canvas dominant on desktop & compact viewports */
@media (min-width: 960px) {
  .goal-rail { padding-block: 8px; }
  .goal-rail-primary p { display: none; }
  body[data-workspace="evolution"] #directive-panel { display: none; }
}
@media (min-width: 1380px) {
  /* Wide desktops show Observation + Intervention comfortably without forcing tab flips */
  body[data-workspace="evolution"] #event-panel:not([hidden]),
  body[data-workspace="evolution"] #contact-panel:not([hidden]) {
    display: block;
  }
}
