/* ============================================================
   wudics · 存档点
   磁带蓝黑 × CRT 琥珀磷光 —— 老游戏存档界面 × 开发者档案
   ============================================================ */

@font-face {
  font-family: 'Fusion Pixel 12px SC';
  src: url('../fonts/fusion-pixel-12px-sc.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #131A24;          /* 磁带蓝黑底 */
  --bg-raise: #1A2330;    /* 面板浮起 */
  --bg-deep: #0D1219;     /* 屏幕内陷 */
  --line: #2A3547;        /* 结构线 */
  --ink: #D8E0EC;         /* 正文 */
  --ink-dim: #8A97AB;     /* 次级文字 */
  --amber: #FFB000;       /* CRT 琥珀主色 */
  --amber-dim: #B87C00;
  --red: #FF3B30;         /* 成就红 */
  --green: #3EDC81;       /* 复制成功 */
  --font-px: 'Fusion Pixel 12px SC', 'PingFang SC', 'Microsoft YaHei', monospace;
  --font-ui: system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --shadow-hard: 8px 8px 0 rgba(0, 0, 0, .35);
  --shadow-pixel: 4px 4px 0 rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: auto;
}

/* 极淡 CRT 扫描线 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, .025) 0 1px,
    transparent 1px 3px
  );
}

::selection { background: var(--amber); color: var(--bg-deep); }

:focus-visible {
  outline: 3px dashed var(--amber);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: var(--amber-dim); }

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

h1, h2, h3 { font-weight: 400; }

.ico { width: 1em; height: 1em; vertical-align: -0.12em; fill: currentColor; }

/* ============ 存档读取 ============ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
}
.boot.is-done {
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s steps(4, end), visibility 0s .35s;
}
.boot-box { width: min(360px, 82vw); }
.boot-logo {
  font-family: var(--font-px);
  font-size: 28px;
  letter-spacing: .18em;
  color: var(--amber);
}
.boot-dot { animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.boot-file {
  margin-top: 6px;
  font-family: var(--font-px);
  font-size: 12px;
  color: var(--ink-dim);
}
.boot-bar {
  margin-top: 14px;
  height: 14px;
  border: 2px solid var(--line);
  background: var(--bg);
  padding: 2px;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--amber);
}
.boot-pct {
  margin-top: 8px;
  font-family: var(--font-px);
  font-size: 12px;
  color: var(--ink-dim);
  text-align: right;
}

/* ============ 布局 ============ */
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 26px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 60px;
  align-items: start;
}

/* ============ 左栏：角色面板 ============ */
.panel {
  position: sticky;
  top: 26px;
  border: 3px solid var(--line);
  background: var(--bg-raise);
  box-shadow: var(--shadow-hard);
  padding: 22px 20px;
}

.avatar-frame {
  position: relative;
  width: 168px;
  margin: 0 auto;
  border: 3px solid var(--amber);
  background: var(--bg-deep);
  box-shadow: var(--shadow-pixel);
}
.avatar { display: block; width: 100%; height: auto; image-rendering: auto; }
.avatar-crest::before,
.avatar-crest::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--amber);
}
.avatar-crest::before { left: -8px; top: -8px; box-shadow: 165px 0 0 var(--amber); }
.avatar-crest::after { left: -8px; bottom: -8px; box-shadow: 165px 0 0 var(--amber); }

.identity { margin-top: 18px; text-align: center; }
.name {
  font-family: var(--font-px);
  font-size: 26px;
  letter-spacing: .1em;
  color: var(--amber);
}
.job { margin-top: 2px; color: var(--ink); font-size: 14px; }
.loc { margin-top: 6px; font-size: 13px; color: var(--ink-dim); }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.badge {
  font-family: var(--font-px);
  font-size: 12px;
  padding: 3px 8px;
  border: 2px solid var(--line);
  color: var(--ink-dim);
  background: var(--bg-deep);
}
.badge--gold {
  border-color: var(--amber);
  color: var(--bg-deep);
  background: var(--amber);
}

.stats { margin-top: 18px; display: grid; gap: 9px; }
.stat { display: grid; grid-template-columns: 4.8em 1fr; align-items: center; gap: 10px; }
.stat-k { font-family: var(--font-px); font-size: 12px; color: var(--ink-dim); }
.stat-bar {
  height: 12px;
  border: 2px solid var(--line);
  background: var(--bg-deep);
  padding: 2px;
}
.stat-bar i { display: block; height: 100%; width: var(--v); background: var(--amber); }
.stat:last-child .stat-bar i { background: var(--red); }

.contact { margin-top: 18px; display: grid; gap: 10px; }
.wechat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-px);
  font-size: 13px;
  color: var(--amber);
  background: var(--bg-deep);
  border: 2px solid var(--amber);
  cursor: pointer;
  box-shadow: var(--shadow-pixel);
  transition: transform .12s steps(2, end), box-shadow .12s steps(2, end);
}
.wechat:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(0,0,0,.4); }
.wechat:active { transform: translate(0, 0); box-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.wechat-id { font-weight: 400; margin-left: auto; }
.wechat-tip { font-style: normal; color: var(--ink-dim); }
.wechat.is-copied { border-color: var(--green); color: var(--green); }
.wechat.is-copied .wechat-tip { color: var(--green); }

.contact-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-family: var(--font-px);
  font-size: 13px;
  color: var(--ink);
  border: 2px solid var(--line);
  background: var(--bg-deep);
}
.contact-link:hover { color: var(--amber); border-color: var(--amber); text-decoration: none; }
.contact-link .ico { color: var(--ink-dim); }
.contact-link:hover .ico { color: var(--amber); }

.chapters {
  margin-top: 20px;
  display: grid;
  gap: 4px;
}
.chapter-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  font-family: var(--font-px);
  font-size: 14px;
  color: var(--ink-dim);
  border: 2px solid transparent;
}
.chapter-link b { font-weight: 400; font-size: 12px; color: var(--amber-dim); }
.chapter-link:hover { color: var(--ink); text-decoration: none; }
.chapter-link.is-active {
  color: var(--amber);
  border-color: var(--line);
  background: var(--bg-deep);
}
.chapter-link.is-active b { color: var(--amber); }

/* ============ 右栏：章节流 ============ */
.flow { min-width: 0; }

.chapter {
  border: 3px solid var(--line);
  background: var(--bg-raise);
  box-shadow: var(--shadow-hard);
  padding: 22px 24px;
  margin-bottom: 30px;
}

.chapter-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.slot {
  font-family: var(--font-px);
  font-size: 12px;
  color: var(--bg-deep);
  background: var(--amber);
  padding: 2px 8px;
}
.chapter-head h2 {
  font-family: var(--font-px);
  font-size: 22px;
  letter-spacing: .08em;
  color: var(--ink);
}

.chapter-note { color: var(--ink-dim); font-size: 14px; margin-bottom: 18px; max-width: 72ch; }
.chapter-note b { color: var(--amber); font-weight: 400; font-family: var(--font-px); }
.inline-link { white-space: nowrap; }

/* SAVE 01 档案 */
.bio p { margin-bottom: 12px; max-width: 72ch; }
.bio b { color: var(--amber); font-weight: 400; }
.vitals {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--line);
  background: var(--bg-deep);
}
.vitals > div {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--line);
}
.vitals > div:nth-last-child(-n+2) { border-bottom: none; }
.vitals dt { font-family: var(--font-px); font-size: 12px; color: var(--amber-dim); white-space: nowrap; }
.vitals dd { font-size: 14px; color: var(--ink); }

/* SAVE 02 游戏库 */
.cartridges {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.cart {
  border: 2px solid var(--line);
  background: var(--bg-deep);
  padding: 16px 12px 14px;
  text-align: center;
  transition: transform .12s steps(2, end), border-color .12s, box-shadow .12s steps(2, end);
}
.cart:hover {
  transform: translate(-2px, -2px);
  border-color: var(--amber);
  box-shadow: var(--shadow-pixel);
}
.cart-ico { width: 30px; height: 30px; fill: var(--amber); }
.cart h3 { margin-top: 10px; font-family: var(--font-px); font-size: 14px; color: var(--ink); }
.cart p { margin-top: 4px; font-size: 12px; color: var(--ink-dim); line-height: 1.6; }

/* SAVE 03 地图工坊 */
.maps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.map-card a {
  display: block;
  border: 2px solid var(--line);
  background: var(--bg-deep);
  transition: transform .12s steps(2, end), border-color .12s, box-shadow .12s steps(2, end);
}
.map-card a:hover {
  transform: translate(-2px, -2px);
  border-color: var(--amber);
  box-shadow: var(--shadow-pixel);
  text-decoration: none;
}
.map-card img {
  display: block;
  width: 100%;
  aspect-ratio: 53 / 31;
  object-fit: cover;
  background: var(--bg);
}
.map-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-top: 2px solid var(--line);
}
.map-meta b { font-family: var(--font-px); font-weight: 400; font-size: 13px; color: var(--ink); }
.map-card a:hover .map-meta b { color: var(--amber); }
.map-meta i { font-style: normal; font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.map-card--wide { grid-column: span 2; }

/* SAVE 04 代码仓库 */
.repos { list-style: none; display: grid; gap: 12px; }
.repo {
  border: 2px solid var(--line);
  border-left: 6px solid var(--amber);
  background: var(--bg-deep);
  padding: 13px 16px;
  transition: border-color .12s;
}
.repo:hover { border-color: var(--amber); }
.repo:hover h3 a { color: var(--amber); }
.repo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.repo h3 { font-family: var(--font-px); font-size: 16px; }
.repo h3 a { color: var(--ink); }
.lang {
  font-family: var(--font-px);
  font-size: 12px;
  color: var(--ink-dim);
  border: 2px solid var(--line);
  padding: 1px 7px;
  white-space: nowrap;
}
.repo p { margin-top: 4px; font-size: 14px; color: var(--ink-dim); }

/* SAVE 05 坐标与航线 */
.map-shell {
  position: relative;
  height: 420px;
  border: 3px solid var(--line);
  background: var(--bg-deep);
  box-shadow: var(--shadow-pixel);
}
.amap { width: 100%; height: 100%; }
.map-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.map-hint::before {
  content: attr(data-text);
  font-family: var(--font-px);
  font-size: 13px;
  color: var(--amber);
  background: rgba(13, 18, 25, .85);
  border: 2px solid var(--amber);
  padding: 8px 16px;
}
.map-hint.is-hidden { display: none; }
.amap-pin {
  font-family: var(--font-px);
  font-size: 12px;
  color: var(--bg-deep);
  background: var(--amber);
  border: 2px solid var(--bg-deep);
  padding: 2px 8px;
  white-space: nowrap;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4);
}
.amap-pin--home { background: var(--red); color: #fff; }
.stops {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-dim);
}
.stops b { font-family: var(--font-px); font-weight: 400; font-size: 12px; color: var(--amber); }

/* 页脚 */
.colophon {
  padding: 6px 4px 0;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 2;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  z-index: 110;
  font-family: var(--font-px);
  font-size: 13px;
  color: var(--bg-deep);
  background: var(--amber);
  border: 3px solid var(--bg-deep);
  box-shadow: var(--shadow-pixel);
  padding: 10px 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s steps(3, end), transform .2s steps(3, end), visibility 0s .2s;
}
.toast.is-show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity .2s steps(3, end), transform .2s steps(3, end);
}

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 14px 12px 40px;
    gap: 18px;
  }
  .panel { position: static; }
  .chapters {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .avatar-frame { width: 136px; }
  .avatar-crest::before { box-shadow: 133px 0 0 var(--amber); }
  .avatar-crest::after { box-shadow: 133px 0 0 var(--amber); }
  .chapter { padding: 18px 16px; }
  .map-card--wide { grid-column: auto; }
  .vitals { grid-template-columns: 1fr; }
  .vitals > div:nth-last-child(-n+2) { border-bottom: 2px solid var(--line); }
  .vitals > div:last-child { border-bottom: none; }
  .map-shell { height: 320px; }
}

/* ============ 动效克制 ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boot { display: none; }
  .boot-dot { animation: none; }
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}
