/* ==================== 暗黑档案/手札风主题变量 ==================== */
:root {
  --bg-deep: #0b0c0f;
  --bg-panel: #13151b;
  --bg-card: #1a1d26;
  --bg-card-hover: #222633;
  --border-subtle: #2a2f3d;
  --border-accent: #454d63;

  --text-main: #e6dfd1;
  --text-muted: #989286;
  --text-dim: #66625a;

  --crimson: #b83232;
  --crimson-bright: #e04848;
  --crimson-bg: rgba(184, 50, 50, 0.14);

  --teal: #3f9c8e;
  --teal-bright: #5bc2b3;
  --teal-bg: rgba(63, 156, 142, 0.14);

  --gold: #c9a24b;
  --gold-bg: rgba(201, 162, 75, 0.14);

  --paper-bg: #1e1c18;
  --paper-border: #3d372c;

  --font-serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

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

body {
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 50% 0%, #191c26 0%, var(--bg-deep) 65%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
  transition: filter 0.6s ease;
}

.mono {
  font-family: var(--font-mono);
}

/* ==================== 低 SAN 视觉氛围特效 ==================== */
.vignette-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.55) 100%);
  transition: background 0.8s ease;
}

body.san-shaken .vignette-overlay {
  background: radial-gradient(circle at center, transparent 45%, rgba(40, 8, 12, 0.68) 100%);
}

body.san-critical .vignette-overlay {
  background: radial-gradient(circle at center, transparent 35%, rgba(90, 10, 15, 0.82) 100%);
  animation: pulseVignette 3.5s infinite ease-in-out;
}

@keyframes pulseVignette {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

body.san-critical .event-text-current {
  animation: subtleJitter 4s infinite;
}

@keyframes subtleJitter {
  0%, 92%, 100% { transform: translate(0, 0); }
  94% { transform: translate(-1px, 0.5px); }
  96% { transform: translate(1px, -0.5px); }
  98% { transform: translate(-0.5px, 0); }
}

/* ==================== 顶部栏 ==================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(15, 17, 23, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--crimson-bright);
  border: 1px solid var(--crimson);
  padding: 2px 6px;
  letter-spacing: 0.08em;
  background: var(--crimson-bg);
}

.brand h1 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand h1 small {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.journey-progress-wrap {
  flex: 1;
  max-width: 420px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 5px;
}

.region-badge {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(201, 162, 75, 0.35);
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.progress-text {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.progress-track {
  height: 6px;
  background: #202430;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.45s ease;
}

.top-actions {
  display: flex;
  gap: 10px;
}

/* ==================== 按钮 ==================== */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 13px;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.codex-count {
  font-family: var(--font-mono);
  color: var(--gold);
  margin-left: 4px;
}

.btn-primary {
  background: linear-gradient(135deg, #9c2828, #6d1818);
  color: #f6efe2;
  border: 1px solid #c94646;
  padding: 10px 22px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b83232, #821e1e);
  box-shadow: 0 0 18px rgba(184, 50, 50, 0.35);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
}

/* ==================== 主布局 ==================== */
.main-layout {
  flex: 1;
  padding: 20px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ==================== 建角界面 ==================== */
.creation-screen {
  display: flex;
  justify-content: center;
  padding: 12px 0 40px;
}

.dossier-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 28px 32px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  width: 100%;
  max-width: 980px;
}

.dossier-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.stamp-red {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--crimson-bright);
  border: 1px solid var(--crimson);
  background: var(--crimson-bg);
  padding: 2px 8px;
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

.dossier-header h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.creation-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
}

.creation-section h3 {
  font-family: var(--font-serif);
  font-size: 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.creation-section h3 small {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
}

.points-left {
  font-size: 13px;
  color: var(--text-muted);
}

.points-left strong {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 16px;
}

.trait-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.trait-option {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.trait-option:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.trait-option.selected {
  border-color: var(--gold);
  background: rgba(201, 162, 75, 0.08);
  box-shadow: 0 0 0 1px rgba(201, 162, 75, 0.35);
}

.trait-option-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.trait-option-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.stat-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-alloc-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px 14px 12px;
}

/* V7.21：上面一行是名称、说明和数值，下面一行是 − / 刻度 / + */
.stat-alloc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stat-alloc-info strong {
  display: block;
  font-size: 15px;
}

.stat-alloc-info span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
}

.stat-val {
  flex: none;
  font-family: var(--font-mono);
  color: var(--gold);
  line-height: 1;
  white-space: nowrap;
}
.stat-val b { font-size: 26px; font-weight: 700; }
.stat-val small { font-size: 12px; margin-left: 2px; opacity: 0.85; }

.stat-alloc-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.btn-step {
  flex: none;
  width: 44px;
  height: 38px;
  border-radius: 6px;
  background: #252a38;
  color: var(--text-main);
  border: 1px solid var(--border-accent);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-step:hover:not(:disabled) { background: #333a4d; }
.btn-step:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.btn-step:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  opacity: 0.55;
}

.stat-pips {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  min-width: 0;
}
.stat-pip {
  height: 22px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid var(--border-accent);
  background: transparent;
  cursor: pointer;
}
.stat-pip.pip-base { background: var(--text-dim); border-color: var(--text-dim); cursor: default; }
.stat-pip.pip-added { background: var(--gold); border-color: var(--gold); }
.stat-pip.pip-empty:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.stat-pip:disabled { border-style: dashed; opacity: 0.5; cursor: not-allowed; }
.stat-pip:focus-visible, .btn-step:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.alloc-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.creation-footer {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

/* ==================== 游戏三栏界面 ==================== */
.game-screen {
  display: grid;
  grid-template-columns: 300px 1fr 295px;
  gap: 18px;
  align-items: stretch;
  height: calc(100vh - 96px);
  height: calc(100dvh - 96px);
  min-height: 540px;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
}

.panel-left {
  overflow-y: auto;
  max-height: 100%;
}

.panel-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel-center {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.panel-center.in-combat .story-log {
  display: none;
}

.panel-center.in-combat .scene-banner {
  height: 105px;
  margin-bottom: 10px;
}

.panel-center.in-combat .combat-stage {
  margin-top: 0;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0 8px;
}

.sub-title small {
  color: var(--text-dim);
  text-transform: none;
}

/* 状态条 */
.bars-block {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.san-tag {
  font-style: normal;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  background: var(--teal-bg);
  color: var(--teal-bright);
}

.san-tag.shaken {
  background: var(--gold-bg);
  color: var(--gold);
}

.san-tag.critical {
  background: var(--crimson-bg);
  color: var(--crimson-bright);
}

.bar-track {
  height: 8px;
  background: #1f232e;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.35s ease;
}

.bar-hp {
  background: linear-gradient(90deg, #9c2828, #d94141);
}

.bar-san {
  background: linear-gradient(90deg, #2d7a6e, #4ec4b2);
}

.bar-enemy {
  background: linear-gradient(90deg, #6e2d7a, #b8429e);
}

.align-track {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg, #6e2424 0%, #2a2f3d 50%, #3a7a6f 100%);
  border-radius: 4px;
}

.align-center-mark {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 2px;
  height: 12px;
  background: var(--text-muted);
  transform: translateX(-50%);
}

.align-marker {
  position: absolute;
  top: -3px;
  width: 10px;
  height: 14px;
  background: var(--gold);
  border: 1px solid #fff;
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.35s ease;
}

.align-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* 资源 */
.resource-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.resource-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
}

.res-label {
  font-size: 11px;
  color: var(--text-muted);
}

.resource-chip strong {
  font-size: 16px;
  color: var(--gold);
}

/* 属性网格 */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 6px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.stat-chip strong {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-size: 14px;
}

.stat-chip small {
  color: var(--teal-bright);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* 特质卡片 */
.active-trait-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
}

.active-trait-card.evolved {
  border-color: var(--gold);
  background: rgba(201, 162, 75, 0.08);
}

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

.trait-card-header strong {
  font-family: var(--font-serif);
  font-size: 14px;
}

.evolved-badge {
  font-size: 10px;
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 1px 5px;
  border-radius: 3px;
}

/* 装备槽与背包 */
.equip-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equip-slot {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 12px;
}

.equip-slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slot-label {
  font-size: 11px;
  color: var(--text-dim);
}

.item-culture {
  font-size: 10px;
  color: var(--gold);
  background: var(--gold-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.equip-item-name {
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

.equip-item-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inv-item {
  background: #171a22;
  border: 1px dashed var(--border-accent);
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 12px;
  cursor: pointer;
}

.inv-item:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
}

/* ==================== 中栏：事件流与交互 ==================== */
.story-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.log-entry {
  padding: 14px 16px;
  border-radius: 6px;
  background: var(--bg-card);
  border-left: 3px solid var(--border-accent);
  animation: fadeInUp 0.25s ease;
}

.log-entry.entry-event {
  border-left-color: var(--gold);
}

.log-entry.entry-outcome {
  background: #161922;
  border-left-color: var(--teal);
  font-size: 14px;
}

.log-entry.entry-danger {
  background: rgba(120, 25, 25, 0.16);
  border-left-color: var(--crimson-bright);
}

.log-entry.entry-system {
  background: rgba(201, 162, 75, 0.08);
  border-left-color: var(--gold);
  font-size: 13px;
  color: var(--gold);
}

.entry-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.entry-title {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: 8px;
  color: #f3ece0;
}

.entry-body {
  font-size: 14.5px;
  color: var(--text-main);
  white-space: pre-line;
}

.delta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.delta-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: #232836;
  color: var(--text-main);
}

.delta-tag.pos {
  background: var(--teal-bg);
  color: var(--teal-bright);
}

.delta-tag.neg {
  background: var(--crimson-bg);
  color: var(--crimson-bright);
}

.delta-tag.gold {
  background: var(--gold-bg);
  color: var(--gold);
}

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

/* 骰子检定框 */
.dice-box {
  margin-top: 14px;
  padding: 12px 16px;
  background: #12151e;
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dice-visual {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #252b3b, #141822);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.dice-visual.crit-success {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
  box-shadow: 0 0 14px rgba(91, 194, 179, 0.4);
}

.dice-visual.crit-fail {
  border-color: var(--crimson-bright);
  color: var(--crimson-bright);
  box-shadow: 0 0 14px rgba(224, 72, 72, 0.4);
}

.dice-title {
  font-size: 13px;
  color: var(--text-muted);
}

.dice-formula {
  font-size: 14px;
  margin: 2px 0;
}

.dice-result {
  font-size: 13px;
  font-weight: 600;
}

.dice-result.success { color: var(--teal-bright); }
.dice-result.fail { color: var(--crimson-bright); }

/* 战斗舞台 */
.combat-stage {
  margin-top: 14px;
  background: #151218;
  border: 1px solid #59262c;
  border-radius: 8px;
  padding: 14px 16px;
}

.combat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.combat-badge {
  color: var(--crimson-bright);
  font-weight: 600;
  font-size: 14px;
}

.combat-round {
  font-size: 12px;
  color: var(--text-muted);
}

.combatants {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.combatant {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px;
}

.combatant-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
}

.combatant-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.combat-vs {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--crimson-bright);
  font-size: 16px;
}

.small-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.combat-log {
  background: #0d0e12;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 9px 10px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.combat-line.hit-player { color: #e87474; }
.combat-line.hit-enemy { color: #7ad8c9; }
.combat-line.sys { color: var(--gold); }

.combat-controls {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 选项区 */
.choices-area {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  padding: 11px 15px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.choice-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--gold);
  transform: translateX(3px);
}

.choice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice-btn.choice-combat {
  border-color: rgba(184, 50, 50, 0.55);
}

.choice-btn.choice-combat:hover {
  border-color: var(--crimson-bright);
  background: rgba(184, 50, 50, 0.12);
}

.choice-btn.choice-corrupted {
  border-color: #7d1b28;
  background: rgba(110, 15, 25, 0.22);
  color: #f0b6bc;
  font-style: italic;
}

.choice-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #232836;
  color: var(--gold);
  white-space: nowrap;
}

.choice-tag.tag-combat {
  background: var(--crimson-bg);
  color: var(--crimson-bright);
}

.choice-tag.tag-shop {
  background: var(--gold-bg);
  color: var(--gold);
}

.whisper-bar {
  margin-top: 10px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 12px;
  color: rgba(224, 72, 72, 0.72);
  letter-spacing: 0.12em;
  font-style: italic;
}

/* ==================== 右栏：《残破守则手札》 ==================== */
.rules-intro {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.rule-count {
  font-size: 12px;
  color: var(--gold);
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.rule-card {
  background: var(--paper-bg);
  border: 1px solid var(--paper-border);
  border-left: 3px solid var(--gold);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 12.5px;
}

.rule-card.rule-suspect {
  border-left-color: var(--crimson-bright);
  background: rgba(85, 22, 22, 0.22);
}

.rule-region {
  font-size: 10.5px;
  color: var(--gold);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.rule-text {
  font-family: var(--font-serif);
  color: #e9e2d2;
  line-height: 1.55;
}

.rule-suspect-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--crimson-bright);
  border-top: 1px dashed rgba(224, 72, 72, 0.35);
  padding-top: 4px;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 20px 8px;
}

/* ==================== 结局界面 ==================== */
.ending-screen {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.ending-card {
  max-width: 720px;
  position: relative;
}

.ending-stamp {
  position: absolute;
  top: 24px;
  right: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 12px;
  border: 2px solid var(--crimson-bright);
  color: var(--crimson-bright);
  transform: rotate(6deg);
  letter-spacing: 0.1em;
}

.ending-stamp.good {
  border-color: var(--teal-bright);
  color: var(--teal-bright);
}

.ending-stamp.true-end {
  border-color: var(--gold);
  color: var(--gold);
}

.ending-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ending-card h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 14px;
}

.ending-desc {
  font-family: var(--font-serif);
  font-size: 15.5px;
  color: #e4ddd0;
  line-height: 1.8;
  margin-bottom: 22px;
  white-space: pre-line;
}

.ending-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 24px;
  text-align: center;
}

.summary-cell span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.summary-cell strong {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--gold);
}

.ending-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ==================== 图鉴弹窗 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 26px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 20px;
}

.btn-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
}

.btn-close:hover { color: var(--text-main); }

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.codex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.codex-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 13px;
}

.codex-item.unlocked {
  border-color: var(--gold);
}

.codex-item.locked {
  opacity: 0.55;
}

.codex-item-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.codex-item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== 响应式 ==================== */
@media (max-width: 1080px) {
  .game-screen {
    grid-template-columns: 1fr;
    height: auto;
  }
  .panel-left,
  .panel-right,
  .panel-center {
    max-height: none;
    height: auto;
    overflow: visible;
  }
  .story-log {
    max-height: 420px;
  }
  .creation-grid {
    grid-template-columns: 1fr;
  }
  .trait-grid, .codex-grid {
    grid-template-columns: 1fr;
  }
  .ending-summary {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==================== V2 微恐演出、诅咒与手札篡改样式 ==================== */
@keyframes screenFlicker {
  0% { filter: brightness(1); }
  15% { filter: brightness(0.25) contrast(1.6); }
  28% { filter: brightness(1.08); }
  45% { filter: brightness(0.18) contrast(1.8); }
  65% { filter: brightness(0.95); }
  100% { filter: brightness(1); }
}

body.screen-flicker {
  animation: screenFlicker 0.52s ease;
}

.curse-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.curse-chip {
  background: rgba(145, 22, 22, 0.22);
  border: 1px solid var(--crimson);
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11.5px;
}

.curse-chip strong {
  color: var(--crimson-bright);
  display: block;
  margin-bottom: 2px;
}

.curse-chip span {
  color: #d6b6b6;
}

.rule-card.rule-mutated {
  border-color: var(--crimson);
  border-left-color: var(--crimson-bright);
  background: rgba(95, 16, 20, 0.28);
}

.rule-card.rule-mutated .rule-text {
  color: #f2a2a8;
  letter-spacing: 0.06em;
  animation: subtleJitter 3.2s infinite;
}

.rule-subtle-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px dashed rgba(152, 146, 134, 0.3);
  padding-top: 4px;
}

.choice-btn.choice-item {
  border-color: rgba(91, 194, 179, 0.55);
  background: rgba(63, 156, 142, 0.1);
}

.choice-btn.choice-item:hover {
  border-color: var(--teal-bright);
  background: rgba(63, 156, 142, 0.2);
}

.choice-tag.tag-item {
  background: var(--teal-bg);
  color: var(--teal-bright);
}

.typewriter-hint {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

/* ==================== 动态暗黑场景横幅 ==================== */
.scene-banner {
  position: relative;
  height: 150px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  background: #0a0b0e;
}

.scene-art {
  width: 100%;
  height: 100%;
  transition: filter 0.5s ease;
}

.scene-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

body.san-critical .scene-art {
  filter: contrast(1.25) saturate(1.3) hue-rotate(-8deg);
}

.scene-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(11, 12, 15, 0.88) 0%, transparent 45%, rgba(0, 0, 0, 0.35) 100%);
}

.scene-caption {
  position: absolute;
  left: 12px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scene-caption-region {
  font-family: var(--font-serif);
  font-size: 13px;
  color: #efe7d8;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* ==================== V4 手动战术战斗、震屏飘字、限时倒计时与肉鸽三选一 ==================== */
.combatant {
  position: relative;
}

.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 15;
}

.float-num {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  animation: floatUpPop 0.95s ease-out forwards;
}

.float-num.dmg-enemy { color: #6ef0dc; }
.float-num.dmg-crit { color: #ffd466; font-size: 20px; }
.float-num.dmg-player { color: #ff5c5c; }
.float-num.heal { color: #58e69a; }

@keyframes floatUpPop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(0.95); }
}

@keyframes combatShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(6px, -2px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(4px, -1px); }
}

.combat-shake {
  animation: combatShake 0.34s ease;
}

.enemy-intent-badge {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 4px;
  background: rgba(224, 72, 72, 0.16);
  border: 1px solid rgba(224, 72, 72, 0.45);
  color: #ff9c9c;
}

.enemy-intent-badge.intent-charge {
  background: rgba(255, 165, 0, 0.2);
  border-color: #ffae42;
  color: #ffd085;
  animation: pulseVignette 1.2s infinite;
}

.combat-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.combat-act-btn {
  background: #1c202c;
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  padding: 9px 11px;
  text-align: left;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.combat-act-btn:hover:not(:disabled) {
  background: #272d3d;
  border-color: var(--gold);
  transform: translateY(-1px);
}

.combat-act-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.combat-act-btn.act-burn {
  border-color: rgba(224, 72, 72, 0.6);
  background: rgba(140, 26, 30, 0.22);
}

.combat-act-btn.act-burn:hover:not(:disabled) {
  border-color: var(--crimson-bright);
  background: rgba(175, 32, 38, 0.32);
}

.combat-act-btn strong {
  font-size: 13px;
}

.combat-act-btn small {
  font-size: 11px;
  color: var(--text-muted);
}

/* 限时心跳倒计时 */
.panic-timer-wrap {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(130, 18, 24, 0.25);
  border: 1px solid var(--crimson-bright);
  border-radius: 6px;
}

.panic-timer-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #ffb0b0;
  margin-bottom: 5px;
}

.panic-track {
  height: 7px;
  background: #241014;
  border-radius: 4px;
  overflow: hidden;
}

.panic-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff3b3b, #ff9940);
  transition: width 0.1s linear;
}

/* 流派羁绊与强化列表 */
.synergy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.synergy-chip {
  background: rgba(63, 156, 142, 0.12);
  border: 1px solid rgba(91, 194, 179, 0.45);
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11.5px;
}

.synergy-chip.synergy-mad {
  background: rgba(184, 50, 50, 0.16);
  border-color: var(--crimson-bright);
}

.synergy-chip strong {
  color: var(--teal-bright);
  display: block;
}

.synergy-chip.synergy-mad strong {
  color: #ff8c8c;
}

.synergy-chip span {
  color: var(--text-muted);
}

/* 过站肉鸽三选一弹窗 */
.boon-modal-card {
  max-width: 820px;
}

.boon-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 8px;
}

.boon-card {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.boon-card:hover {
  border-color: var(--gold);
  background: rgba(201, 162, 75, 0.1);
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.boon-icon {
  font-size: 26px;
}

.boon-arch {
  font-size: 11px;
  color: var(--gold);
  background: var(--gold-bg);
  padding: 2px 7px;
  border-radius: 3px;
  align-self: flex-start;
}

.boon-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #f5eee0;
}

.boon-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 820px) {
  .boon-cards-grid,
  .combat-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== 暗黑档案风细滚动条 ==================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(12, 14, 18, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #343b4e;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4e5873;
}

/* 双刃剑边界异变卡片收益/代价样式 */
.boon-gain {
  font-size: 12.5px;
  color: #7ee8d4;
  line-height: 1.45;
}

.boon-cost {
  font-size: 12px;
  color: #ff8e8e;
  background: rgba(184, 50, 50, 0.14);
  border-left: 2px solid var(--crimson-bright);
  padding: 5px 8px;
  border-radius: 3px;
  line-height: 1.4;
}

.boon-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
}

/* 结局构筑战绩卡与背包熔炼按钮 */
.ending-build-card {
  background: #141720;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 13px 16px;
  margin-bottom: 22px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.build-row-label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 72px;
}

.build-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text-main);
}

.build-pill.gold {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-scrap {
  margin-top: 5px;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(201, 162, 75, 0.14);
  color: var(--gold);
  border: 1px solid rgba(201, 162, 75, 0.4);
}

.btn-scrap:hover {
  background: rgba(201, 162, 75, 0.28);
}

/* ==================== V6.0 新增：建角读档、选项多标签、护符替换 ==================== */
.creation-footer {
  gap: 12px;
  flex-wrap: wrap;
}

.choice-tags {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inv-swap-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.btn-swap {
  text-align: left;
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--teal-bg);
  color: var(--teal-bright);
  border: 1px solid rgba(63, 156, 142, 0.45);
}

.btn-swap:hover {
  background: rgba(63, 156, 142, 0.28);
}

/* ==================== V6.0 新增：同伴艾琳对话气泡 ==================== */
.eileen-bubble {
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 4px;
  padding: 10px 13px;
  background: linear-gradient(90deg, rgba(201, 162, 75, 0.12), rgba(26, 29, 38, 0.92));
  border: 1px solid rgba(201, 162, 75, 0.45);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
  opacity: 0;
  transform: translateY(6px);
}

.eileen-bubble.show {
  animation: eileenIn 0.35s ease-out forwards;
}

@keyframes eileenIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eileen-avatar {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--bg-deep);
  background: var(--gold);
  border-radius: 3px;
  padding: 2px 6px;
  margin-top: 2px;
}

body.san-critical .eileen-line {
  filter: blur(0.3px);
}

/* ==================== V6.0 新增：手机竖屏底部三 Tab ==================== */
.mobile-tabbar {
  display: none;
}

@media (max-width: 820px) {
  .game-screen {
    padding-bottom: 66px;
  }

  .game-screen.mobile-tab-story .panel-left,
  .game-screen.mobile-tab-story .panel-right,
  .game-screen.mobile-tab-dossier .panel-center,
  .game-screen.mobile-tab-dossier .panel-right,
  .game-screen.mobile-tab-rules .panel-left,
  .game-screen.mobile-tab-rules .panel-center {
    display: none;
  }

  .story-log {
    max-height: 52vh;
  }

  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(11, 12, 15, 0.97);
    border-top: 1px solid var(--border-accent);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .mobile-tab-btn {
    position: relative;
    padding: 10px 4px;
    font-size: 14px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
  }

  .mobile-tab-btn.active {
    color: var(--gold);
    background: var(--gold-bg);
    border-color: rgba(201, 162, 75, 0.45);
  }

  .tab-dot {
    display: none;
    position: absolute;
    top: 7px;
    margin-left: 3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--crimson-bright);
  }

  /* 顶栏改为两行：品牌 + 按钮一行，进度条独占一行 */
  .top-bar {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 12px;
  }
  .brand {
    gap: 8px;
    min-width: 0;
  }
  .brand-stamp {
    display: none;
  }
  .brand h1 {
    font-size: 16px;
    white-space: nowrap;
  }
  .brand h1 small {
    display: none;
  }
  .journey-progress-wrap {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .top-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .top-bar .top-actions .btn-ghost {
    padding: 5px 7px;
    font-size: 12px;
    white-space: nowrap;
  }
}

/* ---------- V7.9 真相碎片栏 ---------- */
.clue-section { margin-top: 18px; }
.clue-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.clue-intro { font-size: 12.5px; line-height: 1.6; opacity: 0.85; margin: 0 0 8px; }
.clue-list { display: flex; flex-direction: column; gap: 8px; }
.clue-card { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; background: rgba(255, 255, 255, 0.04); }
.clue-no { font-size: 12px; opacity: 0.7; padding-top: 2px; }
.clue-region { font-size: 11.5px; opacity: 0.7; margin-bottom: 2px; }
.clue-text { font-size: 13px; line-height: 1.55; }
.clue-done { color: var(--teal-bright, #5fd3c0); }
.clue-goal { margin-left: 4px; font-size: 12px; opacity: 0.6; }

.clue-value { display: flex; align-items: baseline; gap: 2px; }
.clue-value strong { display: inline; }

/* ---------- V7.10.2 手札分页：守则 / 真相碎片 ---------- */
.notebook-tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex: none; }
.nb-tab { flex: 1; position: relative; padding: 7px 8px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px; opacity: 0.7; }
.nb-tab.active { opacity: 1; background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.nb-tab:focus-visible { outline: 2px solid var(--teal-bright, #5fd3c0); outline-offset: 2px; }
.nb-tab .tab-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #d64535; }
.panel-right .clue-section { display: none; }
.panel-right.nb-clues .clue-section { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 0; }
.panel-right.nb-clues .clue-list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.panel-right.nb-clues .rules-list,
.panel-right.nb-clues .rules-intro { display: none; }
.panel-right.nb-clues .clue-head { display: none; }

/* ---------- V7.10.2 左栏折叠小节 ---------- */
.dossier-sec { margin: 0; }
.dossier-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; user-select: none; }
.dossier-sec > summary::-webkit-details-marker { display: none; }
.dossier-sec > summary > span:first-child::before { content: '▸'; display: inline-block; width: 1em; transition: transform 0.15s ease; }
.dossier-sec[open] > summary > span:first-child::before { transform: rotate(90deg); }
.dossier-sec > summary:focus-visible { outline: 2px solid var(--teal-bright, #5fd3c0); outline-offset: 2px; }
.sec-sum { font-size: 12px; opacity: 0.75; font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.dossier-sec[open] > summary .sec-sum { opacity: 0.45; }
.sec-teal { color: var(--teal-bright); }
.sec-crimson { color: var(--crimson-bright); }
.inv-hint { font-size: 12px; opacity: 0.6; margin: -2px 0 6px; }
@media (prefers-reduced-motion: reduce) { .dossier-sec > summary > span:first-child::before { transition: none; } }

/* ---------- V7.10.2 手机迷你状态栏（只在手机剧情页显示） ---------- */
.mini-hud { display: none; }
@media (max-width: 820px) {
  .game-screen.mobile-tab-story .mini-hud {
    display: flex; justify-content: space-between; gap: 6px;
    position: sticky; top: var(--topbar-h, 56px); z-index: 40;
    margin: -4px -4px 10px; padding: 7px 10px;
    font-size: 12.5px; background: rgba(15, 17, 23, 0.94); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px;
  }
  .mini-hud b { font-weight: 600; }
  .mini-hud.hud-san-low span:nth-child(2) b,
  .mini-hud.hud-hp-low span:nth-child(1) b { color: #ff6b5b; }
}

@media (max-width: 820px) {
  .game-screen.mobile-tab-story .mini-hud { position: relative; top: auto; }
  .game-screen.mobile-tab-story .mini-hud.floating { position: fixed; top: 0; left: 10px; right: 10px; margin: 0; z-index: 60; }
}

/* ---------- V7.11 进化 / 异变 / 退化 ---------- */
.trait-hint { margin-top: 6px; font-size: 12px; opacity: 0.75; }
.trait-option-evo { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.mutated-badge { background: #7a1f1a !important; color: #f3d9d2 !important; border-color: #a33 !important; }
.active-trait-card.mutated { border-color: rgba(160, 40, 30, 0.6); }

/* ---------- V7.11.1 手机隐藏滚动条 ----------
   部分安卓 WebView（如 Claude App 的网页查看器）会显示占宽度的滚动条，
   滚动条时有时无时，整个面板宽度会跳动、文字换行位置改变。手机用手指滑动，不需要滚动条。 */
@media (max-width: 820px) {
  html,
  body,
  .panel,
  .panel-center,
  .clue-list,
  .rules-list {
    scrollbar-width: none;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .panel::-webkit-scrollbar,
  .panel-center::-webkit-scrollbar,
  .clue-list::-webkit-scrollbar,
  .rules-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}

/* ---------- V7.12 战斗打击感 ---------- */
/* 排版：标题与回合同一行，敌方意图单独一行 */
.combat-header { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; }
.combat-header .enemy-intent-badge { grid-column: 1 / -1; justify-self: start; }
.combatant-meta { font-size: 12px; line-height: 1.4; }

/* 血条残影：实条立刻扣，残影慢慢追上 */
.combatant .bar-track { position: relative; overflow: hidden; }
.combatant .bar-ghost { position: absolute; inset: 0 auto 0 0; background: rgba(255, 236, 200, 0.55); transition: width 0.55s ease-out; }
.combatant .bar-fill { position: relative; z-index: 1; transition: width 0.12s ease-out; }

/* 受击 */
@keyframes cardHit {
  0% { transform: translateX(0); box-shadow: 0 0 0 rgba(220, 50, 40, 0); }
  20% { transform: translateX(-6px); box-shadow: 0 0 0 2px rgba(220, 50, 40, 0.8), 0 0 18px rgba(220, 50, 40, 0.55); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
  100% { transform: translateX(0); box-shadow: 0 0 0 rgba(220, 50, 40, 0); }
}
@keyframes cardHitCrit {
  0% { transform: scale(1); filter: none; }
  15% { transform: scale(1.04) translateX(-8px); filter: brightness(1.8) saturate(0.4); box-shadow: 0 0 0 3px rgba(255, 210, 90, 0.9), 0 0 26px rgba(255, 120, 40, 0.7); }
  40% { transform: scale(1) translateX(7px); filter: none; }
  65% { transform: translateX(-4px); }
  100% { transform: translateX(0); box-shadow: none; }
}
.combatant.card-hit { animation: cardHit 0.38s ease; }
.combatant.card-hit-crit { animation: cardHitCrit 0.52s ease; }

/* 伤害数字：盖章 */
.float-num { --tilt: 0deg; animation: stampThump 1.05s ease-out forwards !important; }
@keyframes stampThump {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(var(--tilt)) scale(1.9); }
  14% { opacity: 1; transform: translate(-50%, 0) rotate(var(--tilt)) scale(0.94); }
  22% { transform: translate(-50%, 0) rotate(var(--tilt)) scale(1.04); }
  70% { opacity: 1; transform: translate(-50%, -10px) rotate(var(--tilt)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) rotate(var(--tilt)) scale(1); }
}

/* 掷骰小牌 */
.dice-chip { margin-top: 6px; min-height: 20px; font-size: 12px; opacity: 0; }
.dice-chip.rolling { opacity: 0.85; filter: blur(0.4px); }
.dice-chip.shown { opacity: 1; animation: diceSettle 0.25s ease-out; }
.dice-chip.crit { color: #ffd466; font-weight: 700; }
.dice-chip.fumble { color: #ff6b5b; font-weight: 700; }
@keyframes diceSettle { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* 敌人倒下：像照片被烧掉 */
.combatant.card-burn { animation: cardBurn 1.4s ease-in forwards; overflow: hidden; }
.combatant.card-burn::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(10, 6, 4, 0.95) 0%, rgba(10, 6, 4, 0.95) 40%, rgba(255, 120, 30, 0.85) 48%, rgba(255, 200, 90, 0.4) 54%, transparent 62%);
  background-size: 100% 260%; background-position: 0 -160%;
  animation: burnSweep 1.4s ease-in forwards;
}
@keyframes cardBurn {
  0% { filter: none; transform: none; opacity: 1; }
  30% { filter: sepia(0.9) contrast(1.25) brightness(1.05); }
  100% { filter: sepia(1) brightness(0.45) blur(0.6px); transform: rotate(-2.5deg) scale(0.94); opacity: 0.35; }
}
@keyframes burnSweep { 0% { background-position: 0 -160%; } 100% { background-position: 0 100%; } }

/* 敌方意图带精神伤害：战斗区边缘泛暗红 */
@keyframes mindPulse { 0%, 100% { box-shadow: inset 0 0 0 rgba(160, 30, 30, 0); } 50% { box-shadow: inset 0 0 38px rgba(160, 30, 30, 0.45); } }
.combat-stage.intent-mind { animation: mindPulse 1.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .combatant.card-hit, .combatant.card-hit-crit, .combat-stage.intent-mind, .dice-chip.shown { animation: none; }
  .float-num { animation: none !important; opacity: 1; }
  .combatant.card-burn { animation: none; opacity: 0.35; filter: sepia(1) brightness(0.5); }
  .combatant.card-burn::after { animation: none; display: none; }
  .combatant .bar-ghost, .combatant .bar-fill { transition: none; }
}

/* ---------- V7.13 设置菜单 ---------- */
.settings-wrap { position: relative; }
.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 168px;
  padding: 8px;
  background: var(--bg-panel, #161a24);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}
.settings-menu[hidden] { display: none; }
.settings-menu .btn-ghost { width: 100%; text-align: left; white-space: nowrap; }
.settings-menu .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
body.skin-archive .settings-menu {
  background: #e9dfc4;
  border-color: #b9a77c;
  box-shadow: 0 2px 0 #c8b88e, 0 14px 30px rgba(0, 0, 0, 0.6);
}
@media (max-width: 820px) {
  .top-actions { flex-wrap: nowrap; }
}
body.skin-archive .settings-menu .btn-ghost {
  color: var(--ink, #2a2118);
  background: rgba(255, 252, 240, 0.7);
  border: 1px solid rgba(60, 40, 15, 0.3);
}
body.skin-archive .settings-menu .btn-ghost:hover:not(:disabled) { background: #fffaf0; }
/* 手机：菜单贴着顶栏右边展开，不跟着按钮位置走，避免超出屏幕 */
@media (max-width: 820px) {
  .settings-wrap { position: static; }
  .settings-menu { right: 8px; top: 100%; }
}

/* V7.13 归档进剧情记录的艾琳台词：比当前便条小一号、颜色淡一点，可以回看 */
.eileen-bubble.eileen-note {
  display: flex;
  cursor: default;
  margin: 6px 0 10px;
  padding: 7px 12px;
  font-size: 13px;
  opacity: 0.82;
  animation: none;
  transform: none;
}
.eileen-note .eileen-avatar { font-size: 10px; }
body.skin-archive .eileen-bubble.eileen-note {
  font-size: 15px;
  transform: rotate(-0.4deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
body.lang-en.skin-archive .eileen-bubble.eileen-note { font-size: 1.05em; }

/* ---------- V7.16 新手提示卡 ---------- */
.tip-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border-accent);
  border-radius: 6px;
  background: rgba(201, 162, 75, 0.08);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.6;
  animation: tipIn 0.3s ease-out;
}
.tip-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--gold);
  color: var(--bg-deep);
  white-space: nowrap;
}
.tip-body small { display: block; margin-top: 4px; font-size: 12px; opacity: 0.8; }
.tip-ok {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--border-accent);
  background: transparent;
  color: var(--text-main);
  white-space: nowrap;
}
.tip-ok:hover { background: rgba(255, 255, 255, 0.06); }
@keyframes tipIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 档案皮肤：系统提示 = 打字卡；艾琳的提示 = 她的手写便条 */
body.skin-archive .tip-card {
  border: none;
  border-left: 3px solid var(--seal);
  border-radius: 1px;
  background: #ece3cb;
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
body.skin-archive .tip-badge { background: transparent; color: var(--seal); border: 1.5px solid var(--seal); font-family: var(--print); }
body.skin-archive .tip-card.tip-eileen {
  border-left-color: #22324a;
  background: #f1ead7;
  color: #22324a;
  font-family: var(--hand);
  font-size: 16px;
  transform: rotate(-0.4deg);
}
body.skin-archive .tip-card.tip-eileen .tip-badge { border-radius: 50%; padding: 3px 5px; transform: rotate(-8deg); }
body.skin-archive .tip-card.tip-eileen small { font-family: var(--print); font-size: 12.5px; color: #3c4a60; }
body.skin-archive .tip-ok { color: var(--ink); border-color: rgba(60, 40, 15, 0.4); font-family: var(--print); }
body.lang-en.skin-archive .tip-card.tip-eileen { font-size: 1.1em; }
@media (max-width: 820px) {
  .tip-card { grid-template-columns: auto 1fr; }
  .tip-ok { grid-column: 2; justify-self: end; }
}

/* 手机：提示去看手札时，分页按钮闪几下 */
@keyframes tipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 75, 0); }
  50% { box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.75); }
}
.mobile-tab-btn.tip-pulse { animation: tipPulse 1.1s ease-in-out 5; }
@media (prefers-reduced-motion: reduce) {
  .tip-card, .mobile-tab-btn.tip-pulse { animation: none; }
}

/* ---------- V7.18 手机：底部导航的 ⚙️ 与设置面板 ---------- */
.mobile-settings-btn, .mobile-sheet { display: none; }
@media (max-width: 820px) {
  .mobile-tabbar { grid-template-columns: repeat(3, 1fr) 48px; }
  .mobile-settings-btn {
    display: block;
    padding: 10px 0;
    font-size: 17px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
  }
  .mobile-sheet:not([hidden]) {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 120;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.55);
  }
  .mobile-sheet-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    background: var(--bg-panel, #161a24);
    border-top: 1px solid var(--border-accent);
    border-radius: 12px 12px 0 0;
    animation: sheetUp 0.22s ease-out;
  }
  .mobile-sheet-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 2px; }
  .mobile-sheet-close { background: transparent; border: none; color: var(--text-muted); font-size: 18px; padding: 4px 8px; }
  .mobile-sheet-panel .btn-ghost { width: 100%; text-align: left; padding: 12px 14px; font-size: 15px; }
  .mobile-sheet-panel .btn-ghost:disabled { opacity: 0.45; }
  body.skin-archive .mobile-settings-btn { color: #c9b48d; }
  body.skin-archive .mobile-sheet-panel {
    background: var(--manila);
    background-image: var(--grain), linear-gradient(172deg, #d0b37d, var(--manila) 40%, #b0915f);
    color: var(--ink);
    border-top: none;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  }
  body.skin-archive .mobile-sheet-close { color: var(--ink); }
  body.skin-archive .mobile-sheet-panel .btn-ghost { color: var(--ink); background: var(--paper-2); border: 1px solid rgba(60, 40, 15, 0.3); }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .mobile-sheet-panel { animation: none; } }

/* ---------- V7.19 怪物证物照 ---------- */
.enemy-photo {
  position: relative;
  width: min(100%, 190px);
  margin: 2px auto 10px;
  padding: 6px 6px 22px;
  background: #e9e1cc;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.2deg);
}
/* 胶带 */
.enemy-photo::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  width: 54px;
  height: 16px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(233, 222, 190, 0.75);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  z-index: 2;
}
.enemy-photo img,
.enemy-photo-blank {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.enemy-photo.has-photo .enemy-photo-blank { display: none; }
.enemy-photo img { filter: sepia(0.25) contrast(1.05); }
/* 曝光不足的底片：几乎全黑，只剩一个看不清的高瘦轮廓 */
.enemy-photo-blank {
  position: relative;
  background:
    radial-gradient(ellipse 18% 34% at 52% 46%, rgba(120, 130, 110, 0.35), transparent 70%),
    radial-gradient(ellipse 9% 7% at 52% 22%, rgba(150, 155, 135, 0.35), transparent 75%),
    radial-gradient(ellipse 80% 60% at 50% 40%, #2b2d26, #0c0d0b 75%);
  overflow: hidden;
}
.enemy-photo-blank::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .8  0 0 0 0 .8  0 0 0 0 .7  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: screen;
  opacity: 0.6;
}
.enemy-photo-blank span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(220, 210, 180, 0.55);
  z-index: 1;
}
.enemy-photo figcaption {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 4px;
  font-size: 10.5px;
  color: #5a4a38;
  text-align: right;
}
@media (max-width: 820px) {
  .enemy-photo { width: min(100%, 150px); padding: 5px 5px 18px; }
  .enemy-photo figcaption { font-size: 9.5px; bottom: 3px; }
}
.enemy-photo img[hidden] { display: none; }

/* ---------- V7.20 限时条浮在屏幕顶部 ---------- */
.panic-timer-wrap.panic-floating,
body.skin-archive .panic-timer-wrap.panic-floating {
  position: fixed;
  z-index: 95;
  margin: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
body.skin-archive .panic-timer-wrap.panic-floating { background: rgba(58, 21, 18, 0.94); }
.panic-floating .panic-timer-meta { font-size: 13px; }
.panic-floating .panic-timer-meta strong { font-size: 15px; }

/* ---------- V7.20 新纸条：钉进手札的守则，在剧情里显示成一张黄便签 ---------- */
.only-mobile { display: none; }
@media (max-width: 820px) {
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
}
.log-entry.entry-rule {
  position: relative;
  background: #f3e3a0;
  background-image: repeating-linear-gradient(180deg, transparent 0 25px, rgba(120, 95, 40, 0.18) 25px 26px);
  border-left: none;
  border-top: 4px solid #c9a227;
  color: #2b2414;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.log-entry.entry-rule::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 18px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a7a, #b3261e 60%, #6e140f);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.log-entry.entry-rule .entry-title {
  color: #8c1c13;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.log-entry.entry-rule .entry-body { color: #2b2414; }
.rule-pin-hint {
  margin-top: 8px;
  font-size: 12.5px;
  color: #5b4a22;
}
.rule-goto {
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 3px;
  border: 1px solid #8c1c13;
  background: #fff6cf;
  color: #8c1c13;
  font-weight: 600;
}
body.skin-archive .log-entry.entry-rule {
  margin-left: 26px;
  background-color: #f3e3a0;
  transform: rotate(0.6deg);
  box-shadow: 0 2px 0 #d8c47d, 0 10px 18px rgba(0, 0, 0, 0.5);
}
body.skin-archive .log-entry.entry-rule .entry-title { font-family: var(--print); }
body.skin-archive .log-entry.entry-rule .entry-body { font-family: var(--hand); font-size: 1.08em; color: #23314a; }
body.lang-en.skin-archive .log-entry.entry-rule .entry-body { font-family: inherit; }
@media (max-width: 820px) {
  body.skin-archive .log-entry.entry-rule { margin-left: 10px; }
}

/* ==================== V7.28 WebGL 画面层 ==================== */
.fx-desk {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: none;
}
body.fx-gl .fx-desk { display: block; }
.creation-screen,
.ending-screen { position: relative; z-index: 1; }
.fx-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.enemy-photo-gl {
  position: absolute;
  left: 6px;
  top: 6px;
  width: calc(100% - 12px);
  aspect-ratio: 3 / 4;
  display: none;
  pointer-events: none;
}
.enemy-photo.gl-photo.has-photo .enemy-photo-gl { display: block; }
.enemy-photo.gl-photo.has-photo img { opacity: 0; }
@media (max-width: 820px) {
  .enemy-photo-gl { left: 5px; top: 5px; width: calc(100% - 10px); }
}
/* 扫光层在纸张上面、顶栏下面；只加亮，不挡点击 */
.fx-sweep {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  display: none;
}
body.fx-gl .fx-sweep { display: block; }
