/* ============================================================
   VESPER-9 · 黄昏九号站 — 数据档案界面
   暗色 · 档案终端美学 · 冷蓝 + 琥珀
   ============================================================ */

:root {
  --bg: #07090d;
  --bg2: #0b0e14;
  --panel: #10141c;
  --panel2: #141a24;
  --line: #1e2733;
  --line2: #2a3646;
  --ink: #c8d2dd;
  --ink-dim: #7a8796;
  --ink-faint: #4a5563;
  --blue: #5aa7e0;
  --blue-dim: #3a6e9e;
  --amber: #d8a24a;
  --amber-dim: #a5762e;
  --red: #c05252;
  --mono: "SFMono-Regular", "Roboto Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: #8fc4ec; }
::selection { background: var(--blue-dim); color: #eaf2f9; }

/* ---------- 背景噪点 ---------- */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(90,167,224,0.06), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(216,162,74,0.04), transparent 55%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 1;
}

/* ---------- 引导屏 ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: #04060a;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .8s ease;
}
#boot.hide { opacity: 0; pointer-events: none; }
.boot-inner { max-width: 680px; width: 92%; font-family: var(--mono); }
.boot-term {
  border: 1px solid var(--line2);
  background: #05070c;
  padding: 26px 26px 22px;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(90,167,224,0.08), inset 0 0 40px rgba(0,0,0,0.6);
  position: relative;
}
.boot-term::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
}
.boot-title {
  color: var(--blue); font-size: 15px; letter-spacing: .28em;
  margin: 0 0 4px; font-weight: 600;
}
.boot-sub { color: var(--ink-dim); font-size: 12px; letter-spacing: .08em; margin: 0 0 18px; }
.boot-lines { min-height: 140px; font-size: 12.5px; color: var(--ink-dim); }
.boot-lines .ln { margin: 2px 0; }
.boot-lines .ln b { color: var(--amber); font-weight: 400; }
.boot-lines .ln .ok { color: var(--blue); }
.boot-input-row {
  margin-top: 16px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink);
}
.boot-input-row .cursor { color: var(--amber); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.boot-access {
  margin-top: 18px; width: 100%;
  background: transparent; border: 1px solid var(--blue-dim);
  color: var(--blue); font-family: var(--mono); font-size: 13px;
  letter-spacing: .2em; padding: 12px; cursor: pointer;
  border-radius: 4px; transition: all .25s;
}
.boot-access:hover { background: rgba(90,167,224,0.1); border-color: var(--blue); }
.boot-access:disabled { opacity: .35; cursor: wait; }
.boot-status { margin-top: 12px; font-size: 11px; color: var(--ink-faint); font-family: var(--mono); min-height: 15px; }

/* ---------- 布局 ---------- */
#app { position: relative; z-index: 2; display: none; }
#app.show { display: block; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,9,13,0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.topbar .brand .name { font-family: var(--mono); font-size: 14px; letter-spacing: .18em; color: var(--ink); font-weight: 600; }
.topbar .brand .name span { color: var(--blue); }
.topbar .brand .tag { font-size: 11px; color: var(--ink-faint); font-family: var(--mono); letter-spacing: .1em; }
.topbar .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.topbar .meta .dot { color: var(--amber); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }

/* ---------- 侧栏 / 导航 ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; }
nav.side {
  position: sticky; top: 76px; align-self: start;
  height: calc(100vh - 96px); overflow: auto;
  padding-right: 8px;
}
nav.side .nav-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .25em;
  color: var(--ink-faint); margin: 18px 0 8px; padding-left: 4px;
}
nav.side a.nav-link {
  display: block; padding: 8px 12px; border-radius: 5px;
  color: var(--ink-dim); font-size: 13.5px; border-left: 2px solid transparent;
  transition: all .2s; margin: 2px 0;
}
nav.side a.nav-link:hover { color: var(--ink); background: rgba(255,255,255,0.03); }
nav.side a.nav-link.active {
  color: var(--ink); border-left-color: var(--amber);
  background: linear-gradient(90deg, rgba(216,162,74,0.08), transparent);
}
nav.side a.nav-link .idx { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-right: 8px; }
nav.side a.nav-link.locked { color: var(--ink-faint); }
nav.side a.nav-link.locked::after { content: "🔒"; font-size: 11px; margin-left: 6px; opacity: .7; }

main.content { min-width: 0; }

/* ---------- 章节标题 ---------- */
section.chapter { margin-bottom: 56px; }
.sec-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 24px; }
.sec-head .kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .3em;
  color: var(--amber); text-transform: uppercase;
}
.sec-head h2 { margin: 6px 0 0; font-size: 24px; font-weight: 600; letter-spacing: .04em; color: var(--ink); }
.sec-head .sub { margin-top: 6px; color: var(--ink-dim); font-size: 13px; }

/* ---------- 总览卡 ---------- */
.overview-hero {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 24px;
}
.overview-hero img { width: 100%; height: 340px; object-fit: cover; display: block; opacity: .85; }
.overview-hero .ov-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 40px 22px 18px;
  background: linear-gradient(transparent, rgba(4,6,10,0.95));
  font-family: var(--mono);
}
.overview-hero .ov-label .n1 { font-size: 19px; letter-spacing: .2em; color: #eaf2f9; }
.overview-hero .ov-label .n2 { font-size: 11px; letter-spacing: .14em; color: var(--ink-dim); margin-top: 4px; }

.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  margin-bottom: 24px;
}
.kv-grid .kv { background: var(--panel); padding: 14px 16px; }
.kv-grid .kv .k { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--ink-faint); text-transform: uppercase; }
.kv-grid .kv .v { font-size: 14px; color: var(--ink); margin-top: 6px; line-height: 1.5; }

.summary-body p { margin: 0 0 18px; color: #b6c1cd; font-size: 15px; }
.summary-body p:first-child::first-letter {
  color: var(--amber); font-size: 42px; float: left; line-height: .9; margin: 2px 10px 0 0;
  font-family: var(--serif);
}

/* ---------- 人员档案 ---------- */
.person-card {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px; margin-bottom: 18px;
}
.person-card .person-photo { border-radius: 6px; overflow: hidden; align-self: start; }
.person-card .person-photo img { width: 100%; display: block; aspect-ratio: 1/1; object-fit: cover; opacity: .92; }
.person-info { min-width: 0; }
.person-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.person-name { font-size: 19px; color: var(--ink); font-weight: 600; letter-spacing: .02em; }
.person-status {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--red); border: 1px solid rgba(192,82,82,0.4); border-radius: 10px; padding: 2px 10px;
}
.person-role { color: var(--amber); font-size: 13px; margin-top: 2px; }
.person-code { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); margin: 4px 0 12px; letter-spacing: .04em; }
.person-bio p { margin: 0 0 10px; font-size: 13.5px; color: #aeb9c5; line-height: 1.8; }
.person-bio p:last-child { margin-bottom: 0; }
@media (max-width: 620px) {
  .person-card { grid-template-columns: 1fr; }
  .person-card .person-photo { max-width: 180px; }
}

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px;
  background: linear-gradient(var(--blue-dim), var(--line));
}
.tl-item { position: relative; margin-bottom: 20px; }
.tl-item::before {
  content: ""; position: absolute; left: -24px; top: 8px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg2); border: 2px solid var(--blue-dim);
}
.tl-item.crit::before { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 12px rgba(216,162,74,0.5); }
.tl-item .tl-time { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); letter-spacing: .05em; }
.tl-item .tl-time .tag {
  display: inline-block; font-size: 10px; padding: 1px 8px; border-radius: 10px;
  margin-left: 8px; border: 1px solid var(--line2); color: var(--blue); letter-spacing: .1em;
}
.tl-item.crit .tl-time .tag { color: var(--amber); border-color: var(--amber-dim); }
.tl-item .tl-title { font-size: 15px; color: var(--ink); margin: 4px 0; font-weight: 600; }
.tl-item .tl-body { font-size: 13.5px; color: var(--ink-dim); margin: 0; line-height: 1.7; }

/* ---------- 文件 / 日志 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 16px; overflow: hidden;
}
.card-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer;
  transition: background .2s;
}
.card-header:hover { background: var(--panel2); }
.card-header .file-id {
  font-family: var(--mono); font-size: 11px; color: var(--amber); letter-spacing: .1em;
  flex-shrink: 0; min-width: 46px;
}
.card-header .file-title { flex: 1; font-size: 14px; color: var(--ink); font-weight: 500; line-height: 1.4; }
.card-header .file-date { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); flex-shrink: 0; }
.card-header .chev { color: var(--ink-faint); transition: transform .25s; font-size: 12px; }
.card.open .card-header .chev { transform: rotate(90deg); }
.card-body { padding: 0 18px 18px; max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.card.open .card-body { max-height: 4000px; }
.card-body p { margin: 0 0 12px; font-size: 13.5px; color: #aeb9c5; line-height: 1.8; white-space: pre-wrap; }
.card-body p:last-child { margin-bottom: 0; }
.card-body .note {
  border-left: 2px solid var(--blue-dim); padding: 6px 12px; margin: 8px 0;
  background: rgba(90,167,224,0.05); color: var(--ink-dim); font-size: 12.5px;
}

/* 日志卡 */
.log-card .log-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); margin-bottom: 8px; }
.log-card .log-author { color: var(--blue); font-size: 12px; }
.log-card .log-date { letter-spacing: .05em; }
.log-card .log-tone {
  font-size: 10px; letter-spacing: .12em; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line2);
}
.log-card.tone-unease .log-tone { color: var(--amber); border-color: var(--amber-dim); }
.log-card.tone-dread .log-tone { color: var(--red); border-color: var(--red); }
.log-card.tone-fear .log-tone, .log-card.tone-final .log-tone { color: var(--red); border-color: var(--red); background: rgba(192,82,82,0.1); }
.log-card.tone-final { border-color: var(--line2); }

/* ---------- 传输信号 ---------- */
.trans-item { padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; background: var(--panel); }
.trans-item .tr-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.trans-item .tr-meta .lbl { color: var(--blue); letter-spacing: .12em; }
.trans-item .tr-meta .freq { color: var(--amber-dim); }
.trans-item .tr-body { font-family: var(--mono); font-size: 13px; color: #b9c4d0; line-height: 1.7; white-space: pre-wrap; }
.trans-item .tr-note { margin-top: 8px; font-size: 12px; color: var(--ink-faint); border-left: 2px solid var(--line2); padding-left: 10px; }

/* ---------- 物证 ---------- */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ev-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.ev-item.wide { grid-column: span 2; }
.ev-item img { width: 100%; display: block; aspect-ratio: 1/1; object-fit: cover; opacity: .9; transition: transform .4s, opacity .4s; }
.ev-item:hover img { transform: scale(1.04); opacity: 1; }
.ev-item .ev-cap { padding: 10px 12px; font-size: 12px; color: var(--ink-dim); line-height: 1.55; }
.ev-item.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(3,4,7,0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 30px; cursor: zoom-out; }
.ev-item.lightbox img { max-width: 92vw; max-height: 78vh; width: auto; aspect-ratio: auto; }
.ev-item.lightbox .ev-cap { color: var(--ink-dim); text-align: center; max-width: 640px; }

/* ---------- 解密终端 ---------- */
.terminal {
  background: #05070c; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden;
  font-family: var(--mono); box-shadow: 0 0 50px rgba(90,167,224,0.05);
}
.terminal .term-bar {
  background: var(--panel2); padding: 8px 14px; display: flex; gap: 6px; align-items: center;
  border-bottom: 1px solid var(--line);
}
.terminal .term-bar .tdot { width: 10px; height: 10px; border-radius: 50%; }
.terminal .term-bar .tdot.r { background: #c05252; }
.terminal .term-bar .tdot.y { background: #d8a24a; }
.terminal .term-bar .tdot.g { background: #5aa7e0; }
.terminal .term-bar .ttitle { margin-left: 10px; font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; }
.terminal .term-body { padding: 20px; font-size: 13px; color: var(--ink-dim); }
.terminal .term-body .line { margin: 6px 0; }
.terminal .term-body .line .p { color: var(--blue); }
.terminal .term-body .ct { color: var(--amber); letter-spacing: .1em; word-break: break-all; }
.terminal .term-input { display: flex; gap: 8px; margin-top: 16px; }
.terminal .term-input input {
  flex: 1; background: var(--panel); border: 1px solid var(--line2); color: var(--ink);
  padding: 10px 12px; font-family: var(--mono); font-size: 14px; letter-spacing: .2em;
  border-radius: 4px; outline: none; text-transform: uppercase;
}
.terminal .term-input input:focus { border-color: var(--blue-dim); }
.terminal .term-input button {
  background: var(--blue); border: none; color: #04060a; font-family: var(--mono);
  font-size: 12px; letter-spacing: .12em; padding: 0 18px; border-radius: 4px; cursor: pointer; font-weight: 600;
}
.terminal .term-input button:hover { background: #7cbce8; }
.term-out { margin-top: 14px; font-size: 12.5px; }
.term-out .dec { color: var(--amber); letter-spacing: .12em; }
.term-out .err { color: var(--red); }
.term-out .good { color: var(--blue); }

/* ---------- 结语 ---------- */
.conclusion-locked {
  text-align: center; padding: 60px 20px; border: 1px dashed var(--line2); border-radius: 8px;
  color: var(--ink-faint); font-family: var(--mono);
}
.conclusion-unlocked { display: none; }
#conclusion.unlocked .conclusion-locked { display: none; }
#conclusion.unlocked .conclusion-unlocked { display: block; }
.conclusion-unlocked h3 { font-family: var(--serif); font-size: 30px; color: var(--amber); margin: 10px 0 4px; font-weight: 400; }
.conclusion-unlocked .en { font-family: var(--mono); font-size: 12px; letter-spacing: .4em; color: var(--ink-faint); margin-bottom: 30px; }
.conclusion-unlocked p { font-size: 15px; color: #b6c1cd; margin: 0 0 20px; line-height: 1.9; }
.conclusion-unlocked p.em { font-family: var(--serif); font-style: italic; color: var(--amber); font-size: 17px; }
.appendix {
  margin-top: 34px; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--panel); padding: 22px 24px;
}
.appendix .ap-title {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em; color: var(--blue);
  margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.appendix p { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); line-height: 1.9; }
.appendix p:nth-child(odd) { color: #b9c4d0; }

/* ---------- 页脚 ---------- */
footer { border-top: 1px solid var(--line); padding: 26px 20px; text-align: center; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing: .1em; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #354253; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  nav.side {
    position: static; height: auto; display: flex; flex-wrap: wrap; gap: 6px;
    border-bottom: 1px solid var(--line); padding-bottom: 14px; overflow: visible;
  }
  nav.side .nav-label { display: none; }
  nav.side a.nav-link { border-left: none; border-bottom: 2px solid transparent; padding: 6px 10px; border-radius: 0; }
  nav.side a.nav-link.active { border-bottom-color: var(--amber); background: none; }
  .overview-hero img { height: 220px; }
  .ev-item.wide { grid-column: span 1; }
}
@media (max-width: 520px) {
  .topbar .meta { display: none; }
  .sec-head h2 { font-size: 20px; }
}
