/* ══════════════════════════════════════════════════════════
   无光之海：旧神航线 — UI v3
   深墨、黄铜、羊皮纸、航海图
   ══════════════════════════════════════════════════════════ */

:root {
  --ink: #06090d;
  --ink-2: #0a0f15;
  --panel: #0e151d;
  --panel-2: #0a1016;
  --line: rgba(201, 160, 90, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --brass: #c9a05a;
  --brass-2: #e8c98d;
  --parchment: #e9e0cc;
  --text: #d8d3c8;
  --dim: #a2a8b0;
  --faint: #6b747e;
  --blood: #a8544a;
  --sea: #6f9b96;
  --violet: #8f7aa8;
  --ok: #7fa07a;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", "Courier New", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -12%, rgba(54, 84, 104, 0.24) 0%, transparent 56%),
    radial-gradient(ellipse at 50% 118%, rgba(98, 72, 32, 0.12) 0%, transparent 58%),
    linear-gradient(180deg, #070b10 0%, #05080c 100%);
}

/* 航海图网格 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(201, 160, 90, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 160, 90, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 28%, #000 0%, transparent 76%);
  mask-image: radial-gradient(ellipse at 50% 28%, #000 0%, transparent 76%);
}

/* 纸纹 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.045;
  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='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.screen {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 620px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ═══ 通用按钮 ═══ */

.btn-primary {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 13px 18px;
  background: linear-gradient(180deg, rgba(201, 160, 90, 0.12), rgba(201, 160, 90, 0.025));
  border: 1px solid rgba(201, 160, 90, 0.55);
  color: var(--brass-2);
  font-size: 13.5px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.12s ease;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 160, 90, 0.12);
  pointer-events: none;
}

.btn-primary small {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.26em;
  text-indent: 0;
  color: var(--faint);
}

.btn-primary:active {
  transform: translateY(1px);
  background: rgba(201, 160, 90, 0.14);
  box-shadow: 0 0 26px rgba(201, 160, 90, 0.16);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════
   标题
   ══════════════════════════════════════════════════════════ */

#screen-title {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 34%, rgba(201, 160, 90, 0.09) 0%, transparent 34%),
    radial-gradient(circle at 50% 50%, transparent 42%, rgba(0, 0, 0, 0.66) 122%);
}

.title-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 1s ease both;
}

.compass {
  width: 146px;
  height: 146px;
  margin-bottom: 4px;
  color: var(--brass);
  filter: drop-shadow(0 0 20px rgba(201, 160, 90, 0.14));
}

.c-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.2;
}

.c-ring-dash {
  opacity: 0.32;
  stroke-dasharray: 2 7;
  transform-box: view-box;
  transform-origin: center;
  animation: spin 100s linear infinite;
}

.c-ring-inner { opacity: 0.14; }

.c-rose path { fill: currentColor; }
.c-n { opacity: 0.95; }
.c-e, .c-s, .c-w { opacity: 0.55; }
.c-minor { opacity: 0.22; }
.c-center { fill: var(--brass-2); }

.c-letters text {
  fill: currentColor;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-anchor: middle;
  opacity: 0.62;
}

.title-overline {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--faint);
}

.title-inner h1 {
  margin-top: 12px;
  font-size: clamp(44px, 12.5vw, 60px);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--parchment);
  text-shadow: 0 0 40px rgba(201, 160, 90, 0.14);
}

.subtitle {
  margin-top: 7px;
  font-size: 11.5px;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--brass);
}

.title-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 176px;
  margin: 20px 0 18px;
  color: var(--brass);
}

.title-rule i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 160, 90, 0.5));
}

.title-rule i:last-child {
  background: linear-gradient(90deg, rgba(201, 160, 90, 0.5), transparent);
}

.title-rule span {
  font-size: 9px;
  opacity: 0.75;
}

.quote {
  margin-bottom: 26px;
  font-size: 13.5px;
  line-height: 2.05;
  color: var(--dim);
  letter-spacing: 0.03em;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 320px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-grid div {
  padding: 9px 4px 10px;
  border-left: 1px solid var(--line);
}

.meta-grid div:first-child { border-left: none; }

.meta-grid b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  color: var(--parchment);
  font-variant-numeric: tabular-nums;
}

.meta-grid span {
  display: block;
  margin-top: 2px;
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

/* ══════════════════════════════════════════════════════════
   设置页
   ══════════════════════════════════════════════════════════ */

.setup-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 22px calc(env(safe-area-inset-bottom, 0px) + 32px);
  overflow-y: auto;
  animation: fadeUp 0.65s ease both;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 160, 90, 0.2) transparent;
}

.step-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
}

.step-rail i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.step-rail i.done { background: rgba(201, 160, 90, 0.42); }
.step-rail i.on {
  background: var(--brass);
  box-shadow: 0 0 8px rgba(201, 160, 90, 0.35);
}

.step-rail span {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  white-space: nowrap;
}

.kicker {
  margin-bottom: 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--brass);
  opacity: 0.72;
}

.setup-inner h2 {
  margin-bottom: 8px;
  font-size: 29px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--parchment);
}

.note {
  margin-bottom: 20px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--dim);
}

.card-list {
  counter-reset: card;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.setup-card {
  counter-increment: card;
  position: relative;
  width: 100%;
  padding: 15px 34px 15px 52px;
  text-align: left;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  border: 1px solid var(--line-soft);
  color: var(--text);
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.12s ease;
}

.setup-card::before {
  content: counter(card, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 17px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--brass);
  opacity: 0.7;
}

.setup-card::after {
  content: "›";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 17px;
  opacity: 0.7;
}

.setup-card:active {
  transform: scale(0.995);
  border-color: rgba(201, 160, 90, 0.5);
  background: rgba(201, 160, 90, 0.06);
}

.setup-card h3 {
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--parchment);
}

.setup-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}

.setup-card .tags span,
.t-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(201, 160, 90, 0.16);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: rgba(201, 160, 90, 0.75);
}

.setup-card .desc {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--dim);
}

.setup-foot {
  margin-top: 18px;
  text-align: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

/* 天赋 */

.talent-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  color: var(--faint);
}

.talent-summary b { color: var(--brass); font-weight: 400; }

.talent-grid {
  counter-reset: talent;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.talent-card {
  counter-increment: talent;
  position: relative;
  min-height: 116px;
  padding: 13px 12px 11px;
  text-align: left;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.006));
  border: 1px solid var(--line-soft);
  color: var(--text);
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.12s ease;
}

.talent-card::before {
  content: "0" counter(talent);
  position: absolute;
  top: 9px;
  right: 9px;
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--faint);
  opacity: 0.7;
}

.talent-card h3 {
  margin-bottom: 4px;
  padding-right: 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--brass-2);
}

.talent-card p {
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--dim);
}

.talent-card .t-tag { margin-top: 7px; }

.talent-card.selected {
  border-color: var(--brass);
  background: rgba(201, 160, 90, 0.09);
  box-shadow: inset 0 0 0 1px rgba(201, 160, 90, 0.18);
}

.talent-card.selected::after {
  content: "✓";
  position: absolute;
  right: 9px;
  bottom: 8px;
  color: var(--brass);
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════
   游戏 HUD
   ══════════════════════════════════════════════════════════ */

#screen-game { padding: 0 14px; }

#hud {
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 9px) 2px 7px;
  border-bottom: 1px solid var(--line);
}

.hud-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}

.hud-age span {
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--parchment);
  font-variant-numeric: tabular-nums;
}

.hud-age small,
.hud-coin small {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
}

.hud-job {
  min-width: 0;
  text-align: center;
}

#job-label {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid rgba(201, 160, 90, 0.28);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--brass-2);
  white-space: nowrap;
}

#origin-label {
  display: block;
  max-width: 156px;
  margin: 3px auto 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.03em;
  color: var(--faint);
}

.hud-coin { text-align: right; }

#coin-label {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--brass-2);
  font-variant-numeric: tabular-nums;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.stat {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  grid-template-rows: auto 2px;
  gap: 2px 4px;
  min-width: 0;
  padding: 5px 6px 4px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.s-icon {
  grid-row: 1;
  align-self: center;
  width: 12px;
  height: 12px;
}

.s-icon svg { display: block; width: 12px; height: 12px; }

.s-life { color: var(--blood); }
.s-san { color: var(--brass); }
.s-ins { color: var(--sea); }
.s-luck { color: var(--violet); }

.s-name {
  grid-row: 1;
  overflow: hidden;
  white-space: nowrap;
  font-size: 8.5px;
  letter-spacing: 0.03em;
  color: var(--faint);
}

.s-val {
  grid-row: 1;
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bar {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 2px;
  overflow: hidden;
  background: #1a2028;
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.4s ease;
}

#bar-life { background: var(--blood); }
#bar-san { background: var(--brass); }
#bar-ins { background: var(--sea); }
#bar-luck { background: var(--violet); }

.ship-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
}

.ship-name {
  font-family: var(--serif);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--parchment);
}

.ship-strip b {
  color: var(--dim);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

#goal-line {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}

#goal-line.done { color: var(--ok); }

.goal-track {
  height: 2px;
  margin-top: 3px;
  overflow: hidden;
  background: #1a2028;
}

.goal-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(201, 160, 90, 0.55), var(--brass-2));
  transition: width 0.5s ease;
}

/* ═══ 目标条 ═══ */

#objective {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  color: var(--brass);
}

.obj-mark {
  font-size: 7px;
  opacity: 0.7;
}

/* ═══ 履历流 ═══ */

#feed-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 2px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
}

#feed-count {
  color: rgba(201, 160, 90, 0.65);
  letter-spacing: 0.04em;
}

#feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 160, 90, 0.22) transparent;
}

#feed::-webkit-scrollbar { width: 3px; }
#feed::-webkit-scrollbar-thumb { background: rgba(201, 160, 90, 0.22); }

.feed-empty {
  padding: 22px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.feed-entry {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  padding: 9px 0;
  animation: feedIn 0.35s ease both;
}

.fe-rail {
  position: relative;
  padding-right: 9px;
  border-right: 1px solid rgba(201, 160, 90, 0.14);
  text-align: right;
}

.fe-rail::after {
  content: "";
  position: absolute;
  top: 4px;
  right: -3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 6px rgba(201, 160, 90, 0.4);
}

.fe-age {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.01em;
  color: rgba(201, 160, 90, 0.75);
  white-space: nowrap;
}

.fe-body { min-width: 0; }

.fe-title {
  margin-bottom: 2px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--parchment);
}

.fe-text {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.fe-delta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 8px;
}

.fe-delta span {
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.018);
}

.fe-delta .up { color: var(--ok); border-color: rgba(127, 160, 122, 0.24); }
.fe-delta .down { color: var(--blood); border-color: rgba(168, 84, 74, 0.24); }

/* ═══ 当前事件卡 ═══ */

#event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  max-height: 60dvh;
  overflow: hidden;
  padding: 10px 13px 9px;
  background: linear-gradient(180deg, rgba(16, 24, 33, 0.985), rgba(7, 12, 17, 0.985));
  border: 1px solid rgba(201, 160, 90, 0.18);
  border-bottom: none;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 160, 90, 0.22) transparent;
}

.card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 160, 90, 0.22) transparent;
}

.card-body::-webkit-scrollbar { width: 3px; }
.card-body::-webkit-scrollbar-thumb { background: rgba(201, 160, 90, 0.22); }

#event-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 160, 90, 0.7), transparent);
}

#event-card.card-in {
  animation: cardIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

#event-kicker {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.24em;
  color: var(--brass);
  opacity: 0.72;
}

.card-glyph {
  font-size: 8px;
  color: rgba(201, 160, 90, 0.42);
}

#event-title {
  margin-bottom: 5px;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--parchment);
}

#event-text {
  font-size: 14.5px;
  line-height: 1.82;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

#event-rules {
  margin-top: 8px;
  padding: 7px 10px;
  border-left: 2px solid rgba(168, 84, 74, 0.55);
  background: rgba(168, 84, 74, 0.05);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--dim);
  white-space: pre-wrap;
}

#options {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  padding-bottom: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  text-align: left;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}

.opt-index {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border: 1px solid rgba(201, 160, 90, 0.22);
  font-family: var(--mono);
  font-size: 7.5px;
  color: rgba(201, 160, 90, 0.75);
}

.opt-body { flex: 1; min-width: 0; }

.opt-text {
  display: block;
  font-size: 13.5px;
  line-height: 1.55;
}

.opt-hint {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

.opt:active {
  transform: scale(0.997);
  border-color: rgba(201, 160, 90, 0.5);
  background: rgba(201, 160, 90, 0.07);
}

.opt.danger { border-color: rgba(168, 84, 74, 0.3); }
.opt.danger .opt-index { border-color: rgba(168, 84, 74, 0.35); color: var(--blood); }
.opt.special { border-color: rgba(201, 160, 90, 0.28); background: rgba(201, 160, 90, 0.04); }

/* ═══ 底部按钮 ═══ */

#foot {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(7, 10, 14, 0.92);
}

.foot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.1em;
  transition: color 0.2s ease, background 0.2s ease;
}

.foot-btn:first-child { border-left: none; }

.foot-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foot-btn:active {
  color: var(--brass-2);
  background: rgba(201, 160, 90, 0.05);
}

/* ══════════════════════════════════════════════════════════
   结局
   ══════════════════════════════════════════════════════════ */

#screen-ending { overflow-y: auto; }

.ending-inner {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 36px) 24px calc(env(safe-area-inset-bottom, 0px) + 36px);
  text-align: center;
  animation: fadeUp 0.8s ease both;
}

.ending-seal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 16px;
  border: 1px solid rgba(201, 160, 90, 0.5);
  border-radius: 50%;
  color: var(--brass);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.ending-seal::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(201, 160, 90, 0.18);
  border-radius: 50%;
}

.ending-seal b {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.ending-kicker {
  margin-bottom: 9px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.28em;
  color: var(--faint);
}

#ending-title {
  margin-bottom: 16px;
  font-size: 29px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--parchment);
}

#ending-text {
  margin-bottom: 22px;
  text-align: left;
  font-size: 14px;
  line-height: 2;
  color: var(--dim);
  white-space: pre-wrap;
}

.ending-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.06);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ending-stats div {
  padding: 8px 4px 9px;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  color: var(--faint);
}

.ending-stats b {
  display: block;
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
}

.ending-reward {
  display: inline-block;
  margin-bottom: 22px;
  padding: 5px 10px;
  border: 1px solid rgba(201, 160, 90, 0.24);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--brass);
  white-space: pre-wrap;
}

/* ══════════════════════════════════════════════════════════
   抽屉
   ══════════════════════════════════════════════════════════ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 4, 7, 0.7);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.24s ease both;
}

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  max-height: 78dvh;
  margin: 0 auto;
  background: linear-gradient(180deg, #0e151d, #070b10);
  border-top: 1px solid rgba(201, 160, 90, 0.35);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.7);
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-kicker {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.24em;
  color: var(--faint);
}

.drawer-title {
  font-size: 16px;
  letter-spacing: 0.1em;
  color: var(--parchment);
}

.drawer-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--dim);
  font-size: 13px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.drawer-close:active { border-color: var(--brass); color: var(--brass-2); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 160, 90, 0.2) transparent;
}

.talent-row {
  display: flex;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.tr-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1px solid rgba(201, 160, 90, 0.22);
  color: var(--brass);
  font-size: 8px;
}

.tr-body h4 {
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--parchment);
}

.tr-body p {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--dim);
}

.log-entry {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 12px;
  line-height: 1.7;
  color: var(--dim);
}

.log-entry b {
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 400;
  color: var(--brass);
}

/* ═══ Toast ═══ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 70px);
  z-index: 80;
  padding: 8px 14px;
  background: rgba(9, 14, 20, 0.96);
  border: 1px solid rgba(201, 160, 90, 0.35);
  color: var(--brass-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════
   动效
   ══════════════════════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes feedIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══ 桌面悬停 ═══ */

@media (hover: hover) {
  .btn-primary:hover {
    background: rgba(201, 160, 90, 0.12);
    box-shadow: 0 0 26px rgba(201, 160, 90, 0.12);
  }
  .setup-card:hover {
    transform: translateY(-1px);
    border-color: rgba(201, 160, 90, 0.42);
    background: rgba(201, 160, 90, 0.04);
  }
  .talent-card:hover { border-color: rgba(201, 160, 90, 0.34); }
  .opt:hover {
    border-color: rgba(201, 160, 90, 0.42);
    background: rgba(201, 160, 90, 0.05);
  }
  .foot-btn:hover { color: var(--brass); }
  .drawer-close:hover { border-color: var(--brass); color: var(--brass-2); }
}

/* ═══ 小屏 / 矮屏 ═══ */

@media (max-width: 360px) {
  .stats { gap: 4px; }
  .stat { grid-template-columns: 1fr auto; padding: 4px 5px 3px; }
  .s-icon { display: none; }
  .s-name { font-size: 7.5px; }
  .s-val { font-size: 9px; }
  .talent-grid { grid-template-columns: 1fr; }
  .talent-card { min-height: 96px; }
}

@media (max-height: 720px) {
  .compass { width: 112px; height: 112px; }
  .title-inner h1 { font-size: 42px; }
  .quote { margin-bottom: 18px; font-size: 12.5px; }
  .meta-grid { margin-top: 18px; }
  #event-card { max-height: 52dvh; }
  #event-title { font-size: 18px; }
  #event-text { font-size: 14px; line-height: 1.85; }
  .ending-inner { padding-top: 24px; }
}

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