:root {
  --bg: #110b0c;
  --surface: #1a1213;
  --surface-2: #221819;
  --line: rgba(239, 226, 224, 0.08);
  --line-strong: rgba(239, 226, 224, 0.14);
  --text: #efe2e0;
  --text-2: #b8a3a0;
  --text-3: #85706d;
  --gold: #c9a24a;
  --gold-text: #d9b45e;
  --gold-fg: #1a1408;
  --blood: #ef7a72;
  --blood-soft: rgba(184, 52, 58, 0.16);
  --ok: #a9c98a;
  --radius: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans: "Noto Sans TC", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-text); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--text); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.num, td.n, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.top {
  position: sticky; top: 0; z-index: 10;
  height: 64px;
  display: flex; align-items: center; gap: 24px;
  padding: 0 32px;
  background: rgba(17, 11, 12, 0.92);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-weight: 500; font-size: 16px; letter-spacing: 0.01em; }
.brand span { color: var(--text-3); font-weight: 400; margin-left: 8px; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 24px; font-size: 15px; }
.top nav a.quiet { color: var(--text-2); }
.top nav a.quiet:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 20px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 500;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--gold); color: var(--gold-fg); }
.btn-primary:hover { background: #d6b05a; color: var(--gold-fg); }
.btn-ghost { color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
  padding: 64px 32px;
  max-width: 1280px;
  margin: 0 auto;
}
.hero.has-scene {
  max-width: none;
  padding: 64px max(32px, calc((100vw - 1216px) / 2));
  background: var(--bg) var(--scene) center / cover no-repeat;
}
.hero.has-scene::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(17, 11, 12, 0.86) 0%, rgba(17, 11, 12, 0.5) 45%, rgba(17, 11, 12, 0.12) 100%), linear-gradient(0deg, rgba(17, 11, 12, 0.9) 0%, rgba(17, 11, 12, 0) 30%);
}
.hero > * { position: relative; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--text-3); margin: 0 0 16px; }
.hero h1 { font-size: 52px; line-height: 1.15; font-weight: 500; margin: 0 0 20px; letter-spacing: -0.01em; }
.hero .lede { font-size: 18px; color: var(--text-2); margin: 0 0 32px; max-width: 520px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.join-code { margin-top: 20px; font-size: 14px; color: var(--text-3); }
.join-code b { font-family: var(--mono); font-weight: 400; color: var(--text-2); }

.dossier {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.dossier-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; }
.dossier-head h2 { font-size: 16px; font-weight: 500; margin: 0; }
.dossier-head span { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.threat { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.threat:first-of-type { border-top: 0; padding-top: 0; }
.threat .name { font-size: 15px; }
.threat .hp { font-family: var(--mono); font-size: 14px; color: var(--text-2); text-align: right; }
.threat .meta { grid-column: 1 / -1; font-size: 13px; color: var(--text-3); }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: #5c4644; }
.threat.peak .bar i { background: var(--blood); }
.threat.peak .hp { color: var(--blood); }
.dossier-foot { margin-top: 16px; font-size: 13px; color: var(--text-3); }

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 56px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 32px 48px 96px;
}
main { min-width: 0; }
main p, main ol, main ul, .sec-lede { max-width: 760px; }

.rail { position: sticky; top: 96px; align-self: start; display: grid; gap: 16px; max-height: calc(100vh - 120px); overflow-y: auto; }
.rail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; }
.rail-card h2 { font-size: 13px; font-weight: 400; color: var(--text-3); margin: 0 0 8px; }
.rail-card dl { margin: 0; font-size: 14px; }
.rail-card dt { color: var(--text-3); margin-top: 8px; }
.rail-card dt:first-child { margin-top: 0; }
.rail-card dd { margin: 0; color: var(--text); }
.rail-card dl.rows { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.rail-card dl.rows dt { margin: 0; color: var(--text-2); }
.rail-card dl.rows dd { text-align: right; color: var(--text); }
.rail-card .big { font-size: 20px; margin: 0 0 4px; color: var(--gold-text); }
.rail-card .small { font-size: 13px; margin: 0; }
.rail-card .tips { margin: 0; padding-left: 16px; font-size: 14px; color: var(--text-2); }
.rail-card .tips li { margin-bottom: 6px; }
.rail-search input {
  width: 100%; height: 40px; padding: 0 12px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px;
  transition: border-color 0.15s var(--ease);
}
.rail-search input:focus { outline: none; border-color: var(--gold); }

@media (min-width: 1800px) {
  body { font-size: 17px; }
  .layout { grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 72px; max-width: 1840px; }
  main p, main ol, main ul, .sec-lede { max-width: 820px; }
  .hero { max-width: 1600px; }
  .hero.has-scene { padding-left: max(48px, calc((100vw - 1600px) / 2)); padding-right: max(48px, calc((100vw - 1600px) / 2)); }
  .hero h1 { font-size: 64px; }
}

@media (max-width: 1360px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); gap: 56px; padding: 32px 32px 96px; }
  .rail { display: none; }
}
.toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc p { font-size: 13px; color: var(--text-3); margin: 0 0 8px 12px; }
.toc a {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 12px; margin-bottom: 2px;
  border-radius: 8px;
  color: var(--text-2); font-size: 15px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.toc a span { font-family: var(--mono); font-size: 12px; color: var(--text-3); width: 20px; }
.toc a:hover { background: var(--surface); color: var(--text); }
.toc a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--gold); }

.toc-mobile { display: none; }

section { padding-top: 64px; }
section:first-child { padding-top: 32px; }
.tag {
  display: inline-block;
  font-family: var(--mono); font-size: 12px; line-height: 1;
  color: var(--gold-text);
  border: 1px solid rgba(201, 162, 74, 0.4);
  border-radius: 4px;
  padding: 4px 6px;
  margin-bottom: 12px;
}
h2.sec { font-size: 32px; line-height: 1.3; font-weight: 500; margin: 0 0 12px; }
.sec-lede { color: var(--text-2); margin: 0 0 32px; }
h3 { font-size: 20px; font-weight: 500; margin: 40px 0 12px; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 20px; margin: 0 0 16px; }
li { margin-bottom: 4px; }
li::marker { color: var(--text-3); }
.muted { color: var(--text-3); }
strong { font-weight: 500; color: var(--text); }

.note {
  border-left: 2px solid var(--gold);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 0 0 24px;
  color: var(--text-2);
}
.note.warn { border-left-color: var(--blood); }
.note strong { color: var(--text); }

.table-wrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 12px 16px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-weight: 400; color: var(--text-3); font-size: 13px; background: var(--surface); white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; }
tbody tr:hover { background: rgba(239, 226, 224, 0.02); }
td .sub { display: block; font-size: 13px; color: var(--text-3); }
.hot { color: var(--blood); }

.cards { display: grid; gap: 16px; margin: 0 0 24px; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.card h4 { font-size: 17px; font-weight: 500; margin: 0 0 4px; }
.card .code { font-family: var(--mono); font-size: 12px; color: var(--text-3); margin: 0 0 12px; }
.card dl { margin: 0; }
.card dt { font-size: 13px; color: var(--text-3); margin-top: 12px; }
.card dd { margin: 2px 0 0; font-size: 15px; color: var(--text-2); }
.card dd b { color: var(--text); font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; }
.stat .label { font-size: 13px; color: var(--text-3); }
.stat .fig { font-family: var(--mono); font-size: 24px; line-height: 1.4; }
.stat .fig small { font-size: 14px; color: var(--text-3); margin-left: 4px; }

.ranges { display: grid; gap: 8px; margin: 0 0 24px; }
.range { display: grid; grid-template-columns: 112px 1fr 64px; align-items: center; gap: 16px; font-size: 15px; }
.range .track { height: 6px; background: var(--surface-2); border-radius: 3px; }
.range .track i { display: block; height: 100%; background: #5c4644; border-radius: 3px; }
.range.loud .track i { background: var(--blood); }
.range .m { font-family: var(--mono); font-size: 14px; color: var(--text-2); text-align: right; }

kbd {
  display: inline-block; min-width: 24px;
  padding: 2px 6px;
  font-family: var(--mono); font-size: 13px; line-height: 1.5; text-align: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
}
code { font-family: var(--mono); font-size: 14px; color: var(--text); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

footer { border-top: 1px solid var(--line); padding: 32px; text-align: center; font-size: 14px; color: var(--text-3); }

@media (max-width: 1024px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; gap: 40px; padding: 48px 24px; }
  .hero.has-scene { padding: 48px 24px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 24px 64px; }
  .toc { display: none; }
  .toc-mobile { display: block; margin: 24px 0 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .toc-mobile summary { cursor: pointer; padding: 12px 16px; font-size: 15px; color: var(--text-2); list-style: none; }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 0 8px 12px; }
  .toc-mobile a { padding: 6px 8px; color: var(--text-2); font-size: 15px; }
  .toc-mobile a span { font-family: var(--mono); font-size: 12px; color: var(--text-3); margin-right: 8px; }
  .cards.three { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .top { padding: 0 16px; gap: 12px; }
  .brand span { display: none; }
  .top nav a.quiet { display: none; }
  .hero { padding: 32px 16px; }
  .hero.has-scene { padding: 32px 16px; }
  .hero h1 { font-size: 32px; }
  .hero .lede { font-size: 16px; }
  .layout { padding: 0 16px 48px; }
  h2.sec { font-size: 26px; }
  .cards.two { grid-template-columns: 1fr; }
  .range { grid-template-columns: 88px 1fr 56px; gap: 12px; font-size: 14px; }
  th, td { padding: 10px 12px; font-size: 14px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy, .dossier { animation: rise 0.5s var(--ease) both; }
  .dossier { animation-delay: 0.08s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

.shot { margin: 0 0 32px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 7; object-fit: cover; }

.finder { position: sticky; top: 64px; z-index: 2; background: var(--bg); padding: 12px 0; margin-bottom: 8px; }
.finder input {
  width: 100%; height: 48px; padding: 0 16px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color 0.15s var(--ease);
}
.finder input::placeholder { color: var(--text-3); }
.finder input:focus { outline: none; border-color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips button {
  height: 32px; padding: 0 12px;
  font: inherit; font-size: 14px; color: var(--text-2);
  background: transparent; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.chips button:hover { background: var(--surface-2); color: var(--text); }
.items { display: grid; gap: 16px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.item header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.item header img, .item .noimg { width: 48px; height: 48px; object-fit: contain; flex: none; border-radius: 8px; background: var(--surface-2); padding: 4px; }
.item h4 { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.4; }
.item code { background: none; padding: 0; font-size: 12px; color: var(--text-3); }
.item .table-wrap { margin: 0; border-radius: var(--radius); }
.item td { padding: 8px 12px; font-size: 14px; }
.item tr:first-child td { border-top: 0; }
.item td.kind { width: 64px; color: var(--text-3); white-space: nowrap; }
.item td.n { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.item .none { margin: 0; color: var(--blood); }
.item .uses { margin: 12px 0 0; font-size: 14px; color: var(--text-2); }
.item .uses span { color: var(--text-3); margin-right: 12px; }

@media (max-width: 640px) {
  .finder { position: static; }
  .item { padding: 16px; }
}

@media (min-width: 2200px) {
  body { font-size: 18px; }
  .layout { grid-template-columns: 300px minmax(0, 1fr) 360px; gap: 88px; max-width: 2240px; }
  main p, main ol, main ul, .sec-lede { max-width: 900px; }
  .toc a { height: 40px; font-size: 16px; }
  .hero { max-width: 1960px; }
  .hero.has-scene { padding-left: max(48px, calc((100vw - 1960px) / 2)); padding-right: max(48px, calc((100vw - 1960px) / 2)); }
  .hero h1 { font-size: 72px; }
  .hero .lede { font-size: 20px; max-width: 600px; }
}
