/* ============================================================
   《仙途》主样式
   风格：宣纸古卷 + 水墨。暖色纸底、墨色文字、朱砂点睛。
   所有颜色走 CSS 变量，便于后续换肤。
   ============================================================ */

:root {
  /* 纸与墨 */
  --bg-main: #efe2c4;
  --bg-panel: #f7eeda;
  --bg-deep: #e2d2ac;
  --bg-sunken: #faf3e2;
  --paper-line: #e6d9ba;

  --border-main: #5d3a1a;
  --border-light: #a98a58;
  --border-dark: #3d2b1f;

  --text-main: #2c1810;
  --text-light: #4a3520;
  --text-muted: #7d6544;

  /* 点睛色 */
  --accent: #b22222;
  --accent-dark: #8b1a1a;
  --gold: #c4922a;
  --gold-light: #ddb459;
  --jade: #2d6b4f;
  --jade-dark: #1d5a3a;
  --violet: #6b5d8b;

  /* 品阶 */
  --q-fan: #8b6b3d;
  --q-ling: #2d6b4f;
  --q-xian: #8b5d7b;
  --q-shen: #5d4a8b;
  --q-sheng: #b22222;

  /* 按钮 */
  --btn-bg: #e8d9b5;
  --btn-hover: #dcc99e;
  --btn-active: #ceb98c;

  --font-serif: "KaiTi", "楷体", "STKaiti", "华文楷体", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-display: "STKaiti", "KaiTi", "楷体", "华文楷体", "Noto Serif SC", serif;
  --font-num: "Georgia", "Times New Roman", var(--font-serif);

  --radius: 3px;
  --shadow-panel: 0 1px 0 rgba(93, 58, 26, 0.08);
}

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

body {
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(196, 146, 42, 0.06) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  font-family: var(--font-serif);
  color: var(--text-main);
  min-height: 100vh;
  padding: 10px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* ==================== 布局 ==================== */

.app {
  max-width: 1280px;
  margin: 0 auto;
  background-color: var(--bg-panel);
  border: 3px solid var(--border-main);
  outline: 2px solid var(--border-light);
  outline-offset: -6px;
  border-radius: var(--radius);
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 12px;
  background-color: var(--bg-deep);
  border: 2px solid var(--border-dark);
  border-radius: var(--radius);
  position: relative;
}
.topbar::before, .topbar::after {
  content: "◆";
  color: var(--accent);
  font-size: 11px;
  opacity: 0.7;
}
.topbar::before { margin-right: -8px; }
.topbar::after { margin-left: -8px; }

.topbar-brand { display: flex; align-items: baseline; gap: 10px; }
.brand-title {
  font-family: var(--font-display);
  font-size: 1.7em;
  letter-spacing: 8px;
  font-weight: bold;
  text-shadow: 1px 1px 0 var(--gold-light);
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.72em;
  color: var(--text-muted);
  letter-spacing: 2px;
  white-space: nowrap;
}

.topbar-stats {
  display: flex;
  gap: 18px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
}
.ts-item { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.ts-label { font-size: 0.66em; color: var(--text-muted); letter-spacing: 2px; }
.ts-value {
  font-family: var(--font-num);
  font-size: 0.95em;
  font-weight: bold;
  color: var(--accent-dark);
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* ==================== 面板 ==================== */

.panel {
  background-color: var(--bg-sunken);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 11px;
  box-shadow: var(--shadow-panel);
  position: relative;
  min-width: 0;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 0.98em;
  font-weight: bold;
  color: var(--accent-dark);
  letter-spacing: 3px;
  padding-bottom: 5px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.panel-title::before { content: "❖ "; color: var(--gold); font-size: 0.85em; }
.panel-title .pt-extra {
  font-family: var(--font-serif);
  font-size: 0.7em;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: normal;
}
.panel-grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.sub-title {
  font-size: 0.82em;
  font-weight: bold;
  color: var(--text-light);
  letter-spacing: 2px;
  margin: 8px 0 5px;
  padding-left: 7px;
  border-left: 3px solid var(--gold);
}
.sub-title:first-child { margin-top: 0; }

/* ==================== 信息行 ==================== */

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82em;
  padding: 3px 0;
  border-bottom: 1px dotted var(--border-light);
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); letter-spacing: 1px; white-space: nowrap; }
.info-row .value { font-family: var(--font-num); font-weight: bold; text-align: right; }
.info-row .value.highlight { color: var(--accent); }
.info-row .value.jade { color: var(--jade); }
.info-row .value.gold { color: var(--gold); }

/* ==================== 进度条 ==================== */

.bar {
  width: 100%;
  height: 15px;
  background-color: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0;
  position: relative;
}
.bar-fill {
  height: 100%;
  width: 0;
  background-color: var(--jade);
  border-right: 1px solid var(--border-dark);
  transition: width 0.35s ease-out;
}
.bar-fill.hp { background-color: #a83232; }
.bar-fill.mp { background-color: #3a6ea8; }
.bar-fill.full { background-color: var(--gold); animation: pulseGold 1.6s ease-in-out infinite; }
.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 0.64em;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 3px rgba(250, 243, 226, 0.9);
}

@keyframes pulseGold {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 13px;
  background-color: var(--btn-bg);
  border: 1px solid var(--border-light);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 0.83em;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background-color: var(--btn-hover); border-color: var(--border-main); }
.btn:active:not(:disabled) { background-color: var(--btn-active); transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background-color: var(--accent); border-color: var(--accent-dark); color: #f7eeda; }
.btn-primary:hover:not(:disabled) { background-color: var(--accent-dark); }
.btn-jade { background-color: var(--jade); border-color: var(--jade-dark); color: #f7eeda; }
.btn-jade:hover:not(:disabled) { background-color: var(--jade-dark); }
.btn-gold { background-color: var(--gold); border-color: #9a6f18; color: #2c1810; }
.btn-gold:hover:not(:disabled) { background-color: var(--gold-light); }
.btn-violet { background-color: var(--violet); border-color: #4a3f63; color: #f7eeda; }
.btn-sm { padding: 3px 9px; font-size: 0.74em; }
.btn-block { display: flex; width: 100%; margin: 5px 0; }
.btn-ghost { background-color: transparent; }

/* ==================== 标签页 ==================== */

.tabs {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  padding: 4px;
  background-color: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.tab {
  padding: 5px 11px;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 0.8em;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  user-select: none;
  transition: background-color 0.15s;
  position: relative;
}
.tab:hover:not(.active) { background-color: var(--btn-hover); }
.tab.active {
  background-color: var(--accent);
  border-color: var(--accent-dark);
  color: #f7eeda;
  font-weight: bold;
}
.tab .tab-dot {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--gold);
  box-shadow: 0 0 4px var(--gold);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.18s ease-out; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: none; }
}

/* ==================== 列表 ==================== */

.list {
  max-height: 420px;
  overflow-y: auto;
  font-size: 0.8em;
}
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 5px;
  border-bottom: 1px dotted var(--border-light);
  transition: background-color 0.12s;
}
.list-item:hover { background-color: rgba(196, 146, 42, 0.07); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-name {
  font-weight: bold;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.list-item .li-desc {
  color: var(--text-muted);
  font-size: 0.86em;
  line-height: 1.45;
  margin-top: 2px;
}
.list-item .li-num { font-family: var(--font-num); color: var(--text-muted); }
.list-item .li-actions { display: flex; gap: 4px; flex-shrink: 0; }
.list-item.equipped { background-color: rgba(45, 107, 79, 0.1); border-left: 3px solid var(--jade); }
.list-item.locked { opacity: 0.55; }
.list-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 18px 10px;
  font-size: 0.85em;
  letter-spacing: 1px;
}

/* ==================== 品阶徽记 ==================== */

.q {
  display: inline-block;
  font-size: 0.72em;
  padding: 0 5px;
  border-radius: 2px;
  letter-spacing: 1px;
  border: 1px solid;
  line-height: 1.5;
  white-space: nowrap;
}
.quality-fan { color: var(--q-fan); border-color: var(--q-fan); background-color: rgba(139, 107, 61, 0.1); }
.quality-ling { color: var(--q-ling); border-color: var(--q-ling); background-color: rgba(45, 107, 79, 0.1); }
.quality-xian { color: var(--q-xian); border-color: var(--q-xian); background-color: rgba(139, 93, 123, 0.1); }
.quality-shen { color: var(--q-shen); border-color: var(--q-shen); background-color: rgba(93, 74, 139, 0.12); }
.quality-sheng { color: var(--q-sheng); border-color: var(--q-sheng); background-color: rgba(178, 34, 34, 0.12); font-weight: bold; }

.tag {
  display: inline-block;
  font-size: 0.7em;
  padding: 0 5px;
  border-radius: 2px;
  background-color: var(--bg-deep);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  letter-spacing: 1px;
}
.tag-jade { background-color: rgba(45, 107, 79, 0.14); border-color: var(--jade); color: var(--jade); }
.tag-gold { background-color: rgba(196, 146, 42, 0.14); border-color: var(--gold); color: #8a6414; }
.tag-accent { background-color: rgba(178, 34, 34, 0.12); border-color: var(--accent); color: var(--accent-dark); }

/* ==================== 日志 ==================== */

.log-scroll {
  flex: 1;
  min-height: 200px;
  max-height: 460px;
  overflow-y: auto;
  background-color: #fcf6e8;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 7px;
  font-size: 0.79em;
}
.log-entry {
  padding: 3px 0;
  border-bottom: 1px dotted var(--paper-line);
  color: var(--text-light);
  line-height: 1.55;
}
.log-entry .log-time {
  color: var(--text-muted);
  font-family: var(--font-num);
  font-size: 0.85em;
  margin-right: 5px;
}
.event-good { color: var(--jade); }
.event-bad { color: var(--accent); }
.event-special { color: #9a6f18; font-weight: bold; }
.event-battle { color: #4a5a7a; }
.event-breakthrough {
  color: var(--accent-dark);
  font-weight: bold;
  text-align: center;
  letter-spacing: 2px;
  padding: 5px;
  margin: 5px 0;
  background-color: rgba(196, 146, 42, 0.12);
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.event-tribulation {
  color: #4a3f8b;
  font-weight: bold;
  letter-spacing: 1.5px;
  padding: 3px 0;
  text-shadow: 0 0 6px rgba(107, 93, 139, 0.3);
}

/* ==================== 弹窗 ==================== */

.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.modal-mask {
  position: fixed;
  inset: 0;
  background-color: rgba(30, 20, 10, 0.62);
  backdrop-filter: blur(1.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: auto;
  animation: fadeIn 0.2s ease-out;
}
.modal-box {
  background-color: var(--bg-sunken);
  border: 3px solid var(--border-main);
  outline: 2px solid var(--border-light);
  outline-offset: -6px;
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  animation: modalIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-box.wide { max-width: 720px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.2em;
  font-weight: bold;
  color: var(--accent-dark);
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 12px;
}
.modal-body { font-size: 0.87em; line-height: 1.75; }
.modal-desc {
  color: var(--text-light);
  padding: 10px 12px;
  background-color: #fcf6e8;
  border-left: 3px solid var(--gold);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.modal-choices { display: flex; flex-direction: column; gap: 7px; }
.modal-choices .btn { justify-content: flex-start; text-align: left; padding: 9px 13px; }
.modal-choices .btn .choice-hint {
  display: block;
  font-size: 0.8em;
  opacity: 0.75;
  letter-spacing: 0;
  margin-top: 1px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.modal-art { text-align: center; margin-bottom: 10px; }
.modal-art svg { max-width: 100%; height: auto; }

/* ==================== 飘字 ==================== */

.toast-root {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.toast {
  font-size: 0.9em;
  font-weight: bold;
  letter-spacing: 1.5px;
  padding: 5px 15px;
  border-radius: 20px;
  background-color: rgba(250, 243, 226, 0.96);
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(61, 43, 31, 0.2);
  animation: toastFloat 2.1s ease-out forwards;
  white-space: nowrap;
}
.toast.good { color: var(--jade); border-color: var(--jade); }
.toast.bad { color: var(--accent); border-color: var(--accent); }
.toast.special { color: #9a6f18; border-color: var(--gold); }
.toast.reward { color: var(--accent-dark); background-color: rgba(221, 180, 89, 0.95); border-color: var(--gold); }

@keyframes toastFloat {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  12% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; transform: translateY(-6px); }
  100% { opacity: 0; transform: translateY(-26px); }
}

/* ==================== 特效 ==================== */

.flash-breakthrough { animation: btFlash 1.6s ease-in-out 2; }
@keyframes btFlash {
  0%, 100% { box-shadow: 0 0 0 rgba(178, 34, 34, 0); }
  50% { box-shadow: 0 0 26px rgba(178, 34, 34, 0.55); }
}
.flash-tribulation { animation: tjFlash 0.5s ease-in-out 6; }
@keyframes tjFlash {
  0%, 100% { box-shadow: 0 0 0 rgba(107, 93, 139, 0); }
  50% { box-shadow: 0 0 30px rgba(107, 93, 139, 0.7); }
}

/* ==================== 工具类 ==================== */

.row { display: flex; align-items: center; gap: 6px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.col-stack { display: flex; flex-direction: column; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.num { font-family: var(--font-num); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.small { font-size: 0.74em; letter-spacing: 1px; }
.hidden { display: none !important; }
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 9px 0;
  text-align: center;
  line-height: 0;
}
.divider::after {
  content: "◆";
  background-color: var(--bg-sunken);
  color: var(--gold);
  font-size: 0.6em;
  padding: 0 7px;
  position: relative;
  top: -1px;
}

/* ==================== 滚动条 ==================== */

.list::-webkit-scrollbar, .log-scroll::-webkit-scrollbar, .modal-box::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-track, .log-scroll::-webkit-scrollbar-track { background: var(--bg-deep); border-radius: 3px; }
.list::-webkit-scrollbar-thumb, .log-scroll::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
.list::-webkit-scrollbar-thumb:hover, .log-scroll::-webkit-scrollbar-thumb:hover { background: var(--border-main); }

/* ==================== 移动端导航 ==================== */

.mobile-nav { display: none; }

/* ==================== 响应式 ==================== */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .col-right { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  body { padding: 5px; }
  .app { padding: 8px; border-width: 2px; }
  .layout { grid-template-columns: 1fr; }
  .col-left, .col-right { grid-column: auto; }
  .col-center { order: -1; }
  .brand-title { font-size: 1.3em; letter-spacing: 4px; }
  .brand-sub { display: none; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar-stats { gap: 10px; }
  .ts-value { font-size: 0.85em; }
  .log-scroll { max-height: 300px; }

  /* 窄屏改用底部固定导航 */
  .tabs { display: none; }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 150;
    background-color: var(--bg-deep);
    border-top: 2px solid var(--border-main);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
    overflow-x: auto;
    gap: 2px;
  }
  .mobile-nav .tab { flex: 0 0 auto; font-size: 0.72em; padding: 5px 9px; }
  body { padding-bottom: 58px; }
  .toast-root { top: auto; bottom: 70px; }
}

/* ==================== 轻量引导提示条 ==================== */

#guideBar { margin-bottom: 8px; }
.guide-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background-color: rgba(196, 146, 42, 0.10);
  border: 1px solid var(--gold);
  border-left-width: 4px;
  border-radius: var(--radius);
  font-size: 0.82em;
  line-height: 1.6;
  animation: fadeIn 0.25s ease-out;
}
.guide-mark { color: var(--gold); font-size: 0.9em; }
.guide-body { flex: 1; min-width: 0; color: var(--text-light); }
.guide-body b { color: var(--accent-dark); letter-spacing: 1px; }
.guide-close { flex-shrink: 0; }

/* ==================== 真结局演出 ==================== */

/*
  基调：宣纸上的墨。整场戏只有纸色、墨色和一个朱砂印，
  不引入新颜色——结局不该看起来像另一个游戏。
*/
.modal-box.modal-ending {
  max-width: 620px;
  background-color: var(--bg-panel);
  border-color: var(--border-main);
  padding: 26px 24px 20px;
  /* 演出期间不要出现滚动条：滚动条会破坏"卷轴"的感觉 */
  overflow: hidden;
}

.ending-wrap { display: flex; flex-direction: column; }

.ending-art {
  text-align: center;
  color: var(--accent-dark);
  opacity: 0.85;
  margin-bottom: 6px;
  animation: endArtIn 1.6s ease-out;
}
@keyframes endArtIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.9); }
  to   { opacity: 0.85; transform: none; }
}

/* 进度点：让玩家知道这场戏有多长，而不是无穷无尽地翻 */
.ending-progress {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-bottom: 16px;
}
.ending-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background-color: var(--border-light);
  opacity: 0.4;
  transition: opacity 0.3s, background-color 0.3s;
}
.ending-dot.on { background-color: var(--accent); opacity: 1; }

.ending-stage { min-height: 240px; }

.ending-scene-title {
  font-family: var(--font-display);
  font-size: 0.95em;
  letter-spacing: 6px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 18px;
  animation: fadeIn 0.6s ease-out;
}

.ending-lines { display: flex; flex-direction: column; gap: 11px; }

/*
  逐行淡入。
  animation-delay 由 JS 按行号写在内联样式上——**不要用定时器**，
  见 ui/endingScene.js 的说明（后台切回会错位、还要处理清理）。
*/
.ending-line {
  font-family: var(--font-display);
  font-size: 1.02em;
  line-height: 1.9;
  color: var(--text-main);
  letter-spacing: 1px;
  opacity: 0;
  animation: endLineIn 0.7s ease-out forwards;
}
@keyframes endLineIn {
  from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* 揭示句：整场戏的重音，用朱砂点出来，且比正文稍重 */
.ending-line.reveal {
  color: var(--accent-dark);
  font-weight: bold;
  letter-spacing: 2px;
}

.ending-sign {
  margin-top: 22px;
  text-align: right;
  font-family: var(--font-display);
  font-size: 0.85em;
  color: var(--text-muted);
  letter-spacing: 2px;
  opacity: 0;
  animation: endLineIn 0.7s ease-out forwards;
}

/* 落款：整场戏的收尾，给一个视觉句号 */
.ending-finale {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 6px 0;
}
.ending-finale .ending-line.reveal {
  font-size: 1.7em;
  letter-spacing: 12px;
  color: var(--accent);
}

.ending-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 12px 10px;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  animation: endLineIn 0.7s ease-out 0.3s forwards;
  opacity: 0;
}
.ending-stat { display: flex; align-items: baseline; gap: 5px; font-size: 0.82em; }
.ending-stat .k { color: var(--text-muted); letter-spacing: 1px; }
.ending-stat .v { color: var(--jade); font-weight: bold; }

/* 按钮：未洗完字之前是禁用的，避免玩家眼睛还在读、手已经点下去 */
.ending-next {
  align-self: center;
  margin-top: 18px;
  min-width: 190px;
  letter-spacing: 3px;
  transition: opacity 0.35s;
}
.ending-next:disabled { opacity: 0.35; cursor: default; }
.ending-next.ready { animation: fadeIn 0.45s ease-out; }

.ending-skip {
  align-self: center;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75em;
  letter-spacing: 1px;
  cursor: pointer;
  opacity: 0.6;
  font-family: inherit;
}
.ending-skip:hover { opacity: 1; text-decoration: underline; }

/* 尊重系统的"减少动态效果"设置——眩晕敏感玩家不该被强制看一整套淡入 */
@media (prefers-reduced-motion: reduce) {
  .ending-line, .ending-sign, .ending-stats, .ending-art {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
}

/* ==================== 飞升演出 ==================== */

/*
  与结局演出同源，但更克制：
  结局是"讲明白"，可以铺陈；飞升是"送走这一世"，每世都要播，必须干净利落。
  所以复用同一套墨色 + 朱砂，但尺寸更小、节奏更快。
*/
.modal-box.modal-ascension {
  max-width: 520px;
  background-color: var(--bg-sunken);
  padding: 22px 22px 18px;
  overflow: hidden;
}

.ascension-wrap { display: flex; flex-direction: column; }

.ascension-art {
  text-align: center;
  color: var(--accent-dark);
  opacity: 0.8;
  animation: endArtIn 1.2s ease-out;
}

.ascension-title {
  font-family: var(--font-display);
  font-size: 1.15em;
  font-weight: bold;
  letter-spacing: 8px;
  color: var(--accent-dark);
  text-align: center;
  margin: 6px 0 4px;
  animation: fadeIn 0.6s ease-out;
}

.ascension-note {
  text-align: center;
  font-size: 0.76em;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 14px;
  animation: fadeIn 0.7s ease-out 0.2s backwards;
}

.ascension-stage { display: flex; flex-direction: column; }
.ascension-lines { display: flex; flex-direction: column; gap: 8px; }

.ascension-line {
  font-family: var(--font-display);
  font-size: 0.98em;
  line-height: 1.85;
  color: var(--text-main);
  letter-spacing: 1px;
  opacity: 0;
  animation: endLineIn 0.55s ease-out forwards;
}
.ascension-line.reveal {
  color: var(--accent-dark);
  font-weight: bold;
  letter-spacing: 2px;
}

/* 这一世的结算，夹在开场与送别之间 */
.ascension-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  padding: 10px 8px;
  margin: 14px 0;
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  opacity: 0;
  animation: endLineIn 0.6s ease-out forwards;
}
.ascension-stat { display: flex; align-items: baseline; gap: 5px; font-size: 0.8em; }
.ascension-stat .k { color: var(--text-muted); letter-spacing: 1px; }
.ascension-stat .v { color: var(--jade); font-weight: bold; }

@media (prefers-reduced-motion: reduce) {
  .ascension-line, .ascension-stats, .ascension-art, .ascension-note {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
  .ascension-line, .ascension-stats { opacity: 1; }
}

/* ==================== 破关横幅（V5.0 突破分层） ==================== */

/*
  刻意做成**不拦截操作**的：大境界一世要走九次，
  每次都弹个要点掉的窗，九次之后就是打断而不是高潮了。
*/
.realm-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  z-index: 180;                 /* 低于弹窗(200)：天劫弹窗开着时不该被横幅压住 */
  pointer-events: none;         /* 永不挡点击 */
  width: min(460px, calc(100vw - 32px));
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15), opacity 0.42s ease-out;
}
.realm-banner.on { transform: translateX(-50%) translateY(0); opacity: 1; }

.realm-banner .rb-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background-color: var(--bg-panel);
  border: 2px solid var(--border-main);
  outline: 1px solid var(--border-light);
  outline-offset: -5px;
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(61, 43, 31, 0.26);
}
.realm-banner.major .rb-inner { border-color: var(--gold); }

/* 朱砂印：一个方章，比图标更贴古卷气质 */
.rb-seal {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.05em;
  font-weight: bold;
  color: #fff;
  background-color: var(--accent);
  border-radius: 3px;
  letter-spacing: 0;
}
.realm-banner.major .rb-seal { background-color: var(--gold); }

.rb-body { min-width: 0; flex: 1; }
.rb-title {
  font-family: var(--font-display);
  font-size: 1.1em;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--accent-dark);
  line-height: 1.25;
}
.realm-banner.major .rb-title { color: var(--gold); }
.rb-sub {
  font-size: 0.78em;
  color: var(--text-light);
  letter-spacing: 1px;
}
.rb-desc {
  font-size: 0.72em;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .realm-banner { transition: opacity 0.15s ease-out; transform: translateX(-50%); }
  .realm-banner.on { transform: translateX(-50%); }
}
