/* ==========================================================================
   心法衍心模拟器 · 界面样式表
   设计语言：夜墨蓝底 + 暖金描边 + 青玉点缀，参考天涯明月刀心法界面的质感。
   结构：1 设计变量 / 2 基础重置 / 3 通用控件 / 4 顶栏 / 5 衍心工作台
        6 结果预览 / 7 心法库 / 8 修习穴位 / 9 消耗与记录 / 10 弹窗
        11 纸面选择弹窗 / 12 提示与加载 / 13 响应式 / 14 动效降级
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  color-scheme: dark;

  /* 底层 */
  --bg: #0b1019;
  --bg-deep: #070b12;
  --panel: #17202e;
  --panel-2: #1e2836;
  --panel-3: #243146;
  --panel-glass: rgba(23, 32, 46, .72);
  --line: #33415a;
  --line-soft: rgba(120, 142, 178, .18);
  --line-strong: rgba(160, 182, 214, .32);

  /* 文字 */
  --ink: #eef1f5;
  --ink-2: #c3ccd9;
  --muted: #93a0b2;
  --muted-2: #76839a;

  /* 强调色 */
  --gold: #e6c477;
  --gold-soft: #cdae74;
  --gold-dim: rgba(230, 196, 119, .18);
  --gold-deep: #a98b4e;
  --cyan: #62d2e6;
  --jade: #6fe0a3;
  --danger: #f0837b;
  --q0: #d167c5;
  --q1: #f0d267;
  --q2: #ffa42a;

  /* 形状与动效 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --frame: 1px solid var(--line-soft);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 10px 28px -12px rgba(0, 0, 0, .65);
  --shadow-3: 0 26px 70px -22px rgba(0, 0, 0, .8);
  --glow-gold: 0 0 0 1px rgba(230, 196, 119, .35), 0 6px 24px -10px rgba(230, 196, 119, .45);
  --ease: cubic-bezier(.32, .72, .28, 1);

  --serif: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', serif;
  --sans: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;

  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 12% -10%, rgba(64, 104, 156, .30), transparent 60%),
    radial-gradient(90% 60% at 100% 0%, rgba(120, 92, 40, .16), transparent 55%),
    radial-gradient(100% 80% at 50% 120%, rgba(24, 46, 76, .45), transparent 70%),
    linear-gradient(160deg, #0f1624 0%, var(--bg) 45%, var(--bg-deep) 100%);
  background-attachment: fixed;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

/* 极淡的网格纹理，增加“纸面／绢面”的层次，不依赖任何图片 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(rgba(150, 175, 215, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 175, 215, .045) 1px, transparent 1px);
  background-size: 46px 46px, 46px 46px;
  mask-image: radial-gradient(110% 90% at 50% 0%, #000 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(110% 90% at 50% 0%, #000 20%, transparent 80%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .02em; }
h1, h2, h3 { font-family: var(--serif); }
p { margin: 0; line-height: 1.75; }
img { max-width: 100%; }

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color .16s var(--ease);
}
a:hover { color: #9ee7f5; }

small, .mini { font-size: .8125rem; color: var(--muted); line-height: 1.65; }
.mini { display: block; }

::selection { background: rgba(230, 196, 119, .28); color: #fff8e6; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1720px;
  margin: 0 auto;
  padding: 20px 26px 0;
}

/* ---------- 3. 通用控件 ---------- */
button, input, select, textarea { font: inherit; color: inherit; }

button {
  position: relative;
  cursor: pointer;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #27344a, #1f2b3d);
  box-shadow: var(--shadow-1);
  transition: border-color .18s var(--ease), background .18s var(--ease),
              color .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
button:hover:not(:disabled) {
  border-color: rgba(230, 196, 119, .55);
  background: linear-gradient(180deg, #2f4059, #243149);
  box-shadow: 0 4px 18px -8px rgba(230, 196, 119, .5);
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }

input, select, textarea {
  min-height: 40px;
  min-width: 0;
  padding: .55rem .7rem;
  color: var(--ink);
  background: rgba(10, 16, 26, .72);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(230, 196, 119, .6);
  background: rgba(10, 16, 26, .9);
  box-shadow: 0 0 0 3px rgba(230, 196, 119, .13);
}
input::placeholder { color: var(--muted-2); }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 51%, calc(100% - 10px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type=search]::-webkit-search-cancel-button { filter: invert(.7); }

/* 主按钮 */
.blue-button, .gold-button {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .08em;
  min-height: 44px;
  padding: 8px 24px;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.blue-button {
  color: #e9f6ff;
  border-color: #4d7fa3;
  background: linear-gradient(180deg, #35698f, #1d4562);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), var(--shadow-2);
}
.blue-button:hover:not(:disabled) {
  border-color: #8dd8f2;
  background: linear-gradient(180deg, #3d7ba6, #215072);
  color: #f4fbff;
}
.gold-button {
  color: #3a2a10;
  border-color: #ecd38a;
  background: linear-gradient(100deg, #b78e3c, #efdb8b 52%, #c9a354);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 26px -14px rgba(230, 196, 119, .9);
}
.gold-button:hover:not(:disabled) {
  border-color: #fff0bd;
  background: linear-gradient(100deg, #d2a94f, #ffe9a3 52%, #d8b76a);
  color: #2c1f0c;
}

/* 危险操作（清空存档）：与蓝／金按钮同形，改用暗红底 */
.danger-button {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .08em;
  min-height: 44px;
  padding: 8px 24px;
  border-radius: var(--r-sm);
  overflow: hidden;
  color: #ffeceb;
  border-color: #a4554f;
  background: linear-gradient(180deg, #7d3a34, #57241f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--shadow-2);
}
.danger-button:hover:not(:disabled) {
  border-color: #ff9d92;
  background: linear-gradient(180deg, #96463d, #6b2c25);
  color: #fff6f5;
}
.clear-list { margin: 14px 0; padding-left: 1.35em; }
.clear-list li { margin: 8px 0; font-size: .9375rem; line-height: 1.7; color: #c5d0dc; }
.clear-list b { color: #ecd89d; font-weight: 600; font-variant-numeric: tabular-nums; }

.quiet, .text-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: .875rem;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  letter-spacing: .04em;
}
.quiet:hover:not(:disabled), .text-button:hover:not(:disabled) {
  color: var(--gold);
  background: rgba(230, 196, 119, .08);
  border-color: rgba(230, 196, 119, .22);
  box-shadow: none;
}
.text-button { text-decoration: none; }
.text-button.danger { color: var(--danger); }
.text-button.danger:hover:not(:disabled) {
  color: #ff9f97;
  background: rgba(240, 131, 123, .1);
  border-color: rgba(240, 131, 123, .32);
}

.help {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #7691a6;
  background: rgba(21, 47, 64, .9);
  color: #7fe6ff;
  font-family: var(--sans);
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.help:hover:not(:disabled) {
  border-color: #a9ecff;
  background: #1b3a4e;
  box-shadow: 0 0 0 4px rgba(127, 230, 255, .12);
}

/* 品质与语义色 */
.q0 { color: var(--q0) !important; }
.q1 { color: var(--q1) !important; }
.q2 { color: var(--q2) !important; }
.green { color: var(--jade); }
.cyan { color: var(--cyan); }
.danger { color: var(--danger); }
.align-right { text-align: right; }

.eyebrow {
  display: inline-block;
  color: var(--gold);
  font-size: .75rem;
  letter-spacing: .38em;
  text-transform: none;
}
.eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: linear-gradient(90deg, transparent, var(--gold));
}

/* 选中态：统一的金色描边描光 */
.selected {
  border-color: rgba(230, 196, 119, .85) !important;
  box-shadow: 0 0 0 1px rgba(230, 196, 119, .45), 0 12px 30px -16px rgba(230, 196, 119, .8) !important;
}

.book-icon {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid rgba(180, 196, 220, .18);
  background: #0e1622;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .8);
}

/* ---------- 4. 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 78px;
  padding: 10px 22px;
  border: 1px solid var(--line-soft);
  border-top: 2px solid transparent;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background:
    linear-gradient(180deg, rgba(34, 46, 64, .92), rgba(19, 27, 40, .88)),
    var(--panel);
  background-clip: padding-box;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow-2);
}
/* 顶部金线用伪元素实现渐变，避免 border-image 与圆角冲突 */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, transparent, var(--gold-deep) 18%, #f3dc9f 50%, var(--gold-deep) 82%, transparent);
  opacity: .85;
}

.brand { display: flex; align-items: center; gap: 14px; margin-right: 22px; flex-shrink: 0; }
.brand-brush {
  position: relative;
  font-family: var(--serif);
  font-size: 2.05rem;
  font-weight: 900;
  letter-spacing: .14em;
  color: #f2dda6;
  text-shadow: 0 0 26px rgba(230, 196, 119, .35), 0 1px 0 rgba(0, 0, 0, .6);
}
.brand-brush::after {
  content: '';
  position: absolute;
  left: .16em;
  right: .04em;
  bottom: -5px;
  height: 2px;
  background: linear-gradient(90deg, rgba(230, 196, 119, .8), transparent);
  border-radius: 2px;
}
.brand-small {
  font-family: var(--sans);
  font-size: .8125rem;
  letter-spacing: .24em;
  color: var(--muted);
  padding-left: 14px;
  border-left: 1px solid var(--line-soft);
  align-self: center;
}

.topbar nav { display: flex; gap: 4px; align-self: stretch; align-items: center; }
.nav {
  min-height: 42px;
  padding: 8px 20px;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  box-shadow: none;
  white-space: nowrap;
}
.nav:hover:not(:disabled) {
  color: #f2dfae;
  background: rgba(230, 196, 119, .07);
  border-color: rgba(230, 196, 119, .2);
  box-shadow: none;
}
.nav.active {
  color: #ffeec2;
  background: linear-gradient(180deg, rgba(230, 196, 119, .2), rgba(230, 196, 119, .06));
  border-color: rgba(230, 196, 119, .5);
  box-shadow: inset 0 -2px 0 rgba(240, 212, 138, .9), 0 8px 20px -14px rgba(230, 196, 119, .9);
}
.nav span {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: .6875rem;
  font-weight: 700;
  line-height: 18px;
  color: #2a2110;
  background: linear-gradient(180deg, #e8cd86, #c2a054);
}

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-actions #save-status {
  position: relative;
  padding: 4px 12px 4px 22px;
  margin-right: 4px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(10, 16, 26, .5);
  font-size: .75rem;
  letter-spacing: .06em;
  color: #a9c0bb;
  white-space: nowrap;
}
.top-actions #save-status::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 8px rgba(111, 224, 163, .85);
}
body.saving .top-actions #save-status::before {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(230, 196, 119, .9);
  animation: pulse 1s ease-in-out infinite;
}

/* ---------- 5. 衍心工作台 ---------- */
.workbench {
  display: grid;
  grid-template-columns: 218px minmax(280px, 1fr) 412px;
  gap: 18px;
  min-height: 780px;
  padding: 26px 20px 22px;
  border: 1px solid var(--line-soft);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background:
    radial-gradient(80% 60% at 48% 58%, rgba(46, 72, 112, .5), transparent 62%),
    linear-gradient(180deg, rgba(15, 22, 34, .8), rgba(11, 17, 27, .92));
  box-shadow: var(--shadow-3);
}

.milestones { align-self: start; z-index: 1; display: flex; flex-direction: column; gap: 18px; }

.milestone {
  position: relative;
  padding: 18px 15px 15px;
  border: 1px solid rgba(190, 156, 92, .42);
  border-radius: var(--r-md);
  background:
    linear-gradient(150deg, rgba(104, 86, 54, .34), rgba(20, 28, 42, .92) 58%),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-2);
  color: var(--ink);
  overflow: hidden;
}
/* 角落描金：用四角伪元素替代旧版的方形凸点 */
.milestone::before,
.milestone::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(226, 194, 128, .75);
  pointer-events: none;
}
.milestone::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.milestone::after { right: 6px; bottom: 6px; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }
.milestone.q2 {
  background:
    linear-gradient(150deg, rgba(126, 78, 30, .4), rgba(20, 28, 42, .92) 58%),
    var(--panel);
  border-color: rgba(226, 152, 66, .48);
}
.milestone h3 {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 194, 128, .22);
  font-size: 1.05rem;
  letter-spacing: .14em;
  text-align: center;
  color: #eddcae;
}
.milestone.q2 h3 { color: #ffc879; border-bottom-color: rgba(226, 152, 66, .3); }

.pity {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: .8125rem;
  color: var(--ink-2);
}
.pity b {
  font-family: var(--sans);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #e8e3d6;
}
.pity small { color: var(--muted-2); }

.milestone-line {
  height: 1px;
  margin: 14px 0 12px;
  background: linear-gradient(90deg, transparent, rgba(226, 194, 128, .38), transparent);
}
.milestone p { margin-bottom: 8px; font-size: .8125rem; color: #a9bed3; }

.reward-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reward-row strong {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f7dc92;
}
.reward-row strong small { font-size: .8125rem; color: var(--muted); }
.reward-icon {
  width: 52px;
  height: 52px;
  min-height: 0;
  padding: 2px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(226, 194, 128, .55);
  background: rgba(8, 13, 21, .85);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .7);
}
.reward-icon img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 3px; padding: 2px; }
.reward-icon:hover:not(:disabled) { border-color: #ffe9b4; box-shadow: 0 0 0 3px rgba(230, 196, 119, .16); }

.progress {
  height: 6px;
  margin: 13px 0;
  border-radius: 999px;
  background: rgba(8, 13, 21, .8);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b08b45, #f4dc9b);
  box-shadow: 0 0 12px rgba(240, 210, 140, .55);
  transition: width .5s var(--ease);
}

.claim {
  width: 100%;
  min-height: 34px;
  margin-bottom: 8px;
  font-size: .8125rem;
  letter-spacing: .06em;
  background: rgba(38, 53, 72, .7);
}
.claim.ready {
  color: #fff3c9;
  border-color: rgba(240, 212, 138, .7);
  background: linear-gradient(180deg, #a2762a, #7d5717);
  box-shadow: 0 8px 22px -14px rgba(240, 210, 140, .95);
}
.claim.ready:hover:not(:disabled) { background: linear-gradient(180deg, #bb8b34, #8d6319); }

.rules-link {
  min-height: 40px;
  font-size: .875rem;
  letter-spacing: .08em;
}

/* 仪式区（中央） */
.ritual {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  border-radius: var(--r-md);
  overflow: hidden;
}
.ritual::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 7px),
    linear-gradient(0deg, rgba(15, 22, 34, .96), rgba(15, 22, 34, 0) 26%, rgba(15, 22, 34, 0) 74%, rgba(15, 22, 34, .96)),
    radial-gradient(60% 50% at 50% 50%, rgba(60, 96, 148, .35), transparent 70%),
    var(--moon-scene, none) center center / cover;
  opacity: .92;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
/* 顶部/底部渐隐，让仪式区与工作台自然衔接 */
.ritual::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  box-shadow: inset 0 0 90px 20px rgba(7, 11, 18, .75);
}

.ritual-caption {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  text-align: center;
  text-shadow: 0 2px 14px rgba(3, 8, 16, .9);
}
.ritual-caption span {
  font-family: var(--serif);
  font-size: .8125rem;
  letter-spacing: .5em;
  color: #d3c3a1;
}
.ritual-caption h1 {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 2.35rem;
  font-weight: 500;
  letter-spacing: .28em;
  /* 金色渐变填充（不支持时回退到色值与描边柔光） */
  color: #f6e8c4;
  text-shadow: 0 0 42px rgba(230, 196, 119, .32), 0 3px 18px rgba(3, 8, 16, .95);
}
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .ritual-caption h1 {
    background: linear-gradient(100deg, #d8bd82 0%, #fff3d0 42%, #e6c477 68%, #fff0c8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 16px rgba(3, 8, 16, .95)) drop-shadow(0 0 30px rgba(230, 196, 119, .28));
  }
}

.ritual-ring {
  position: absolute;
  top: calc(50% - 165px);
  left: calc(50% - 165px);
  width: 330px;
  height: 330px;
  border: 1px solid rgba(223, 193, 127, .42);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(78, 147, 198, .28), inset 0 0 48px rgba(234, 199, 109, .16);
  z-index: -1;
}
.ritual-ring::after {
  content: '';
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(216, 183, 125, .38);
  border-radius: 50%;
  animation: orbit 90s linear infinite;
}

.input-slots { display: flex; justify-content: space-between; gap: 14px; padding: 0 10px; }

.ritual-slot {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  text-align: center;
  text-shadow: 0 2px 10px rgba(2, 6, 12, .95);
}
.ritual-slot:hover:not(:disabled) { box-shadow: none !important; }
.ritual-slot > span {
  display: block;
  margin-bottom: 20px;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: .12em;
  color: #dceaf8;
}

.slot-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 106px;
  height: 106px;
  margin: 0 auto 16px;
  border: 1px solid rgba(223, 194, 127, .8);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(36, 62, 96, .95), rgba(12, 20, 32, .95));
  box-shadow: 0 0 0 8px rgba(168, 147, 86, .16), 0 0 0 1px rgba(255, 255, 255, .06),
              inset 0 0 34px rgba(3, 9, 29, .85), 0 18px 40px -22px rgba(0, 0, 0, .95);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.ritual-slot:hover .slot-frame {
  transform: translateY(-2px);
  box-shadow: 0 0 0 8px rgba(214, 182, 108, .26), 0 0 0 1px rgba(255, 255, 255, .1),
              inset 0 0 34px rgba(3, 9, 29, .8), 0 22px 44px -22px rgba(230, 196, 119, .55);
}
.slot-frame .book-icon { width: 78px; height: 78px; border-radius: 4px; }
.slot-frame i {
  position: absolute;
  right: 2px;
  top: 4px;
  width: 26px;
  height: 26px;
  border: 1px solid #8aa6bb;
  border-radius: 50%;
  background: linear-gradient(180deg, #24405a, #16293d);
  color: #bde9fb;
  font-style: normal;
  font-size: 1rem;
  line-height: 23px;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .9);
}
.slot-frame.scroll img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border: 0;
  border-radius: 4px;
}
/* 普通衍心卷的旧美术自带深色底，需要自己压暗；承武凝心卷是透明底资源。 */
.slot-frame.scroll img[src*="scroll-1.webp"], .slot-frame.scroll img[src*="scroll-2.webp"] {
  object-fit: cover;
  border: 1px solid rgba(211, 188, 123, .85);
  background: #0e1622;
}
.ritual-slot strong {
  display: block;
  min-height: 52px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.65;
}

.ritual-bottom {
  position: absolute;
  bottom: 68px;
  left: 14px;
  right: 14px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(2, 6, 12, .95);
}
.ritual-bottom p { font-family: var(--serif); font-size: 1.03rem; letter-spacing: .06em; color: #eedfbb; }
.ritual-bottom span { display: block; margin-top: 10px; font-size: .8125rem; color: #adbdce; }

/* ---------- 6. 结果预览侧栏 ---------- */
.preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 720px;
  padding: 16px 6px 8px 20px;
  border-left: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(24, 34, 50, .42), rgba(14, 21, 33, .18));
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, .03);
}
.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.side-title h2 { font-size: 1.15rem; letter-spacing: .16em; color: #e9dcbd; }

.preview-name {
  margin-bottom: 18px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: center;
}
.power-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(230, 196, 119, .06), transparent);
}
.power-preview span { color: var(--muted); font-size: .875rem; }
.power-preview b { font-size: 1.2rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.power-preview strong {
  color: var(--jade);
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(111, 224, 163, .35);
}
.power-preview .chevron { font-size: 1.5rem; color: var(--muted-2); }

.upgrade-note {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 2px solid rgba(111, 224, 163, .6);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(111, 224, 163, .07);
  font-size: .875rem;
  color: var(--ink-2);
}
.upgrade-note b { color: var(--jade); font-weight: 600; font-variant-numeric: tabular-nums; }
.upgrade-note span { font-size: .75rem; color: var(--muted-2); }

.preview-attrs { display: grid; grid-template-columns: 1fr; gap: 0; }
.preview-attrs > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line-soft);
  font-size: .875rem;
  color: var(--ink-2);
}
.preview-attrs > div > span:last-child { color: var(--jade); font-variant-numeric: tabular-nums; }
.preview-attrs b { color: var(--jade); font-weight: 600; }
.preview-attrs i { margin: 0 6px; font-style: normal; color: var(--muted-2); }

.preview-rule { margin-top: 16px; }
.preview-rule h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1rem;
  color: #e0c479;
  letter-spacing: .08em;
}
.preview-rule p { margin-bottom: 6px; font-size: .875rem; color: #a9b8cb; }
.preview-rule > div { font-size: .8125rem; line-height: 2; }

.tier-text { white-space: nowrap; }

/* 功力明细账本 */
.power-ledger {
  margin-bottom: 16px;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(36, 50, 70, .55), rgba(14, 21, 33, .75));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.power-ledger-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.power-ledger-title span { font-size: .8125rem; letter-spacing: .22em; color: var(--muted); }
.power-ledger-title b {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f4dd9e;
}
.power-ledger dl { display: grid; gap: 6px; margin: 0; }
.power-ledger dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: .8125rem;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.power-ledger dl > div:hover { background: rgba(230, 196, 119, .08); }
.power-ledger dt { color: var(--muted); }
.power-ledger dt::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: rgba(230, 196, 119, .55);
}
.power-ledger dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}
.power-ledger p { margin-top: 10px; font-size: .75rem; color: var(--gold-soft); }
.power-ledger p + p { margin-top: 4px; }

.draw-actions { margin-top: auto; padding-top: 26px; }
.draw-cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  font-size: .8125rem;
  color: #a9b8c9;
}
.draw-cost b { font-weight: 500; color: #d9cba0; }
.draw-buttons { display: flex; gap: 10px; }
.draw-buttons button { flex: 1; padding-left: 10px; padding-right: 10px; }
.draw-actions > .mini { margin-top: 10px; text-align: right; }

/* 心法／衍心卷选择器 */
.segmented { display: flex; gap: 6px; margin-bottom: 14px; padding: 4px; border-radius: var(--r-sm); background: rgba(10, 16, 26, .55); border: 1px solid var(--line-soft); }
.segmented button {
  flex: 1;
  min-height: 34px;
  padding: 5px 8px;
  font-size: .8125rem;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}
.segmented button:not(.selected):hover:not(:disabled) { color: #eef1f5; background: rgba(230, 196, 119, .1); box-shadow: none; }
.segmented button.selected,
.segmented button.selected:hover:not(:disabled),
.segmented button.selected:focus-visible,
.segmented button.selected:active {
  color: #2b2110;
  background: linear-gradient(180deg, #e3c882, #c3a25a);
  border-color: rgba(255, 236, 186, .6);
  box-shadow: none !important;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  /* Rows must retain their content height inside the bounded scroll area. */
  grid-auto-rows: minmax(9.75rem, max-content);
  align-content: start;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 10px;
  max-height: 430px;
  padding: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 9.75rem;
  height: auto;
  padding: 12px 5px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, rgba(41, 55, 74, .75), rgba(24, 34, 48, .75));
}
.picker-card:hover:not(:disabled) { transform: translateY(-2px); }
.picker-card .book-icon { width: 50px; height: 50px; flex: 0 0 50px; }
.picker-card b { font-size: .8125rem; font-weight: 500; line-height: 1.6; min-height: 3.2em; max-width: 100%; overflow-wrap: anywhere; flex-shrink: 0; }
.picker-card > span { font-size: .75rem; color: var(--muted-2); line-height: 1.45; max-width: 100%; overflow-wrap: anywhere; flex-shrink: 0; }

.picker-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
}
.picker-bottom .mini { font-size: .75rem; }
.picker-bottom button { min-width: 84px; padding: 6px 15px; }

.scroll-options { display: flex; flex-direction: column; gap: 14px; }
.scroll-card {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 6px 16px;
  padding: 16px;
  border-radius: var(--r-md);
  background: linear-gradient(125deg, rgba(96, 74, 48, .5), rgba(30, 43, 63, .85));
  text-align: left;
}
.scroll-card img { grid-row: span 2; width: 64px; height: 64px; object-fit: contain; border-radius: 5px; background: rgba(8, 13, 21, .5); border: 1px solid var(--line-soft); }
.scroll-card img[src*="scroll-1.webp"], .scroll-card img[src*="scroll-2.webp"] { object-fit: cover; border-color: rgba(190, 160, 100, .45); }
.scroll-card strong { font-family: var(--serif); font-size: 1rem; letter-spacing: .04em; }
.scroll-card span { font-size: .8125rem; color: #b8c2cf; }

.inset-note {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 2px solid var(--gold-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: linear-gradient(90deg, rgba(180, 154, 79, .12), rgba(180, 154, 79, .02));
  font-size: .875rem;
  line-height: 1.85;
  color: #c8d3e0;
}
.section-label {
  margin: 22px 0 12px;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: .12em;
  color: #dfe3e7;
}
.exchange {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: rgba(28, 40, 57, .6);
  font-size: .875rem;
}
.exchange img { width: 46px; height: 46px; object-fit: cover; border-radius: 4px; }

.unrecorded { padding: 26px 10px; text-align: center; color: #aebccd; }
.unrecorded img { margin: 0 auto 15px; }
.unrecorded p { font-size: .9375rem; }
.unrecorded span { font-size: .8125rem; }

/* ---------- 7. 心法库 ---------- */
.library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 26px;
  min-height: 800px;
  padding: 26px 20px;
  border: 1px solid var(--line-soft);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background:
    radial-gradient(70% 50% at 20% 0%, rgba(48, 74, 112, .28), transparent 60%),
    linear-gradient(180deg, rgba(14, 21, 33, .82), rgba(10, 16, 25, .92));
  box-shadow: var(--shadow-3);
}
.library-main { min-width: 0; }

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.library-toolbar h1 { font-size: 1.45rem; letter-spacing: .12em; white-space: nowrap; }
.library-toolbar h1 small { font-family: var(--sans); font-weight: 400; letter-spacing: 0; color: var(--muted); }
.library-toolbar > div { display: flex; gap: 8px; }
.library-toolbar input { width: 180px; }
.library-toolbar select { font-size: .875rem; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 16px 14px;
  align-content: start;
}
.library-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 232px;
  padding: 16px 9px 11px;
  border: 1px solid rgba(94, 116, 152, .35);
  border-radius: var(--r-md);
  background: linear-gradient(158deg, rgba(44, 60, 84, .92), rgba(22, 31, 44, .95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-2);
  text-align: center;
  transition: transform .22s var(--ease), border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.library-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: linear-gradient(90deg, transparent, rgba(180, 200, 230, .35), transparent);
  opacity: .8;
}
.library-card:hover {
  transform: translateY(-3px);
  border-color: rgba(230, 196, 119, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 22px 40px -24px rgba(0, 0, 0, .95);
}
.library-card:hover::before { background: linear-gradient(90deg, transparent, rgba(230, 196, 119, .7), transparent); }
.library-card.selected {
  background: linear-gradient(150deg, rgba(96, 84, 54, .8), rgba(30, 43, 63, .95) 62%);
}
.library-card.selected::before { background: linear-gradient(90deg, transparent, rgba(255, 233, 178, .9), transparent); }

.card-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
}
.card-select:hover:not(:disabled) { background: none !important; box-shadow: none !important; }
.card-icon { position: relative; width: 72px; margin: 8px auto 18px; }
.card-select .card-icon { margin: 8px 0 14px; }
.library-card:hover .book-icon { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(230, 196, 119, .7); }
.library-card .book-icon { transition: box-shadow .22s var(--ease), transform .22s var(--ease); }

.tier-dots { display: flex; justify-content: center; gap: 9px; }
.card-icon .tier-dots { position: absolute; left: 0; right: 0; bottom: -7px; }
.tier-dot {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 18px;
  background: rgba(150, 160, 175, .55);
  clip-path: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  transition: transform .22s var(--ease);
}
.tier-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: #131c29;
  clip-path: inherit;
}
.tier-dot.filled { background: var(--tier); filter: drop-shadow(0 0 5px var(--tier)); }
.tier-dot.filled::after { background: color-mix(in srgb, var(--tier) 45%, #101a2a); }
.library-card:hover .tier-dot.filled, .result-card:hover .tier-dot.filled { transform: translateY(-1px) scale(1.08); }

.pending-dot {
  position: absolute;
  right: -3px;
  top: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5c45;
  box-shadow: 0 0 0 2px rgba(12, 18, 28, .9), 0 0 10px rgba(255, 92, 69, .8);
  animation: pulse 1.6s ease-in-out infinite;
}

.library-card strong {
  display: block;
  min-height: 26px;
  font-family: var(--serif);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.6;
}
.library-card span:not(.tier-dot):not(.pending-dot) { font-size: .8125rem; color: #a4b1c3; }
.library-card small { font-size: .75rem; color: #8291a6; }
.card-power { font-variant-numeric: tabular-nums; color: #d8c794 !important; }

.card-controls {
  display: flex;
  gap: 5px;
  width: 100%;
  margin-top: auto;
  padding-top: 14px;
}
.card-controls button {
  flex: 1;
  min-height: 30px;
  padding: 2px 0;
  font-size: .75rem;
  border-color: rgba(82, 112, 137, .6);
  background: linear-gradient(180deg, #2f5670, #22394f);
}
.card-controls button:hover:not(:disabled) {
  border-color: rgba(230, 196, 119, .55);
  background: linear-gradient(180deg, #3a6584, #294359);
}

.original > span, .original > small { display: block; margin-top: 10px; }
.original > .blue-button {
  width: 100%;
  min-height: 32px;
  margin-top: auto;
  padding: 5px;
  font-size: .8125rem;
  letter-spacing: .06em;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: .8125rem;
}
.pagination > span { margin-right: auto; color: #9aa9bc; }
.pagination b { font-weight: 500; font-variant-numeric: tabular-nums; color: #dccfa4; }

/* 库右侧详情 */
.library-detail { min-width: 0; padding-left: 24px; border-left: 1px solid var(--line-soft); }

.detail-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 12px;
  border: 1px solid rgba(120, 146, 184, .28);
  border-radius: var(--r-md);
  background: linear-gradient(114deg, rgba(112, 88, 50, .42), rgba(32, 45, 66, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow-2);
}
.detail-header img { width: 62px; height: 62px; }
.detail-header h2 { margin-bottom: 8px; font-size: 1.1rem; letter-spacing: .05em; }
.detail-header span { font-size: .8125rem; color: #9dacbd; }
.detail-header p { margin-top: 5px; font-size: .875rem; color: #b6c0cc; }
.detail-header b { color: #f0dfae; font-variant-numeric: tabular-nums; }

.lock-button {
  position: absolute;
  right: 8px;
  top: 6px;
  min-height: 26px;
  padding: 0 7px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #a8afba;
  font-size: 1rem;
}
.lock-button:hover:not(:disabled) { color: var(--gold); background: rgba(230, 196, 119, .12) !important; }

.detail-tabs { display: flex; gap: 6px; margin-top: 16px; padding: 4px; border-radius: var(--r-sm); background: rgba(10, 16, 26, .5); border: 1px solid var(--line-soft); }
.detail-tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ink-2);
}
.detail-tabs button:hover:not(:disabled) { background: rgba(230, 196, 119, .1); }
.detail-tabs button.active {
  color: #eaf8ff;
  background: linear-gradient(180deg, #2b6c8c, #1d4c68);
  box-shadow: inset 0 0 0 1px rgba(140, 217, 244, .5), 0 8px 20px -14px rgba(80, 200, 240, .9);
}

.affinity-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.affinity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: rgba(33, 46, 65, .6);
  text-align: left;
}
.affinity:hover:not(:disabled) { border-color: rgba(230, 196, 119, .5); background: rgba(44, 60, 82, .8); }
.affinity:disabled { opacity: 1; cursor: default; box-shadow: none; }
.affinity .tier-text { font-size: .875rem; font-weight: 600; }
.affinity small { display: block; margin-top: 6px; font-size: .75rem; color: var(--muted); }

.training-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0;
  font-size: .8125rem;
  color: #bcc6d2;
}
.training-title select { min-height: 30px; padding: 3px 26px 3px 8px; font-size: .8125rem; }
.training-title b { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 8. 修习穴位 ---------- */
.acupoint-rows { display: flex; flex-direction: column; gap: 10px; }
.acupoint-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 100px;
  padding: 12px 14px;
  border: 1px solid rgba(80, 116, 154, .38);
  border-radius: var(--r-md);
  background: linear-gradient(105deg, rgba(62, 86, 109, .5), rgba(24, 35, 53, .9) 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.acupoint-row.row-1 { background: linear-gradient(105deg, rgba(39, 106, 158, .55), rgba(26, 37, 58, .9) 42%); border-color: rgba(90, 156, 205, .35); }
.acupoint-row.row-2 { background: linear-gradient(105deg, rgba(150, 119, 57, .5), rgba(30, 42, 62, .9) 42%); border-color: rgba(190, 156, 92, .35); }

.row-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 4px;
  border-right: 1px solid rgba(150, 175, 210, .16);
}
.row-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .22em;
  writing-mode: vertical-rl;
  color: #e6f6ff;
  text-shadow: 0 0 12px rgba(124, 206, 239, .8);
}
.row-icon {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  background: radial-gradient(circle at 50% 35%, rgba(120, 170, 220, .28), rgba(10, 18, 30, .55));
  border: 1px solid rgba(150, 190, 225, .35);
  padding: 2px;
  box-shadow: 0 0 14px -4px rgba(124, 206, 239, .6);
}
.row-1 .row-icon { background: radial-gradient(circle at 50% 35%, rgba(120, 180, 235, .3), rgba(10, 18, 30, .55)); }
.row-2 .row-icon {
  background: radial-gradient(circle at 50% 35%, rgba(220, 180, 100, .3), rgba(20, 16, 8, .55));
  border-color: rgba(226, 194, 128, .45);
  box-shadow: 0 0 14px -4px rgba(230, 196, 119, .65);
}
.row-2 .row-name { color: #fff2c8; text-shadow: 0 0 12px rgba(227, 198, 120, .85); }

.node-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}
.node-track::before {
  content: '';
  position: absolute;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(204, 216, 221, .38), transparent);
}
.node {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 2px;
  border: 1px solid rgba(120, 134, 150, .55);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #4b5c72, #1b2536);
  box-shadow: 0 0 0 3px rgba(10, 20, 34, .55), var(--shadow-1);
  font-family: var(--serif);
  font-size: .8125rem;
  color: #93a0ad;
  transform: translateY(var(--offset));
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              border-color .2s var(--ease), color .2s var(--ease);
}
.node:hover:not(:disabled) { transform: translateY(var(--offset)) scale(1.12); border-color: rgba(230, 196, 119, .75); color: #f3e4b8; }
.node.available { border-color: rgba(208, 183, 118, .85); color: #decf9c; }
.node.activated {
  color: #fff6cd;
  border-color: #ecd68f;
  background: radial-gradient(circle at 40% 32%, #c8ab6c, #4a4229);
  box-shadow: 0 0 0 3px rgba(10, 20, 34, .5), 0 0 16px -2px rgba(211, 176, 110, .75);
}
.node.selected { box-shadow: 0 0 0 2px rgba(235, 209, 146, .55), 0 0 18px -2px rgba(235, 209, 146, .8) !important; }

.acupoint-tip {
  min-height: 162px;
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(9, 16, 27, .9), rgba(7, 13, 22, .95));
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .5);
  font-size: .875rem;
  line-height: 1.85;
}
.acupoint-tip b { font-weight: 600; }
.tip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-soft);
}
.tip-title > b { font-size: 1rem; color: var(--cyan); }
/* 研习部位名（立身／应势／见微）：绝品与镇派共用同一套，显示在每个穴位的提示与悬停标题里 */
.tip-title > .node-part {
  margin-left: 2px;
  padding: 2px 8px;
  border: 1px solid rgba(230, 196, 119, .45);
  border-radius: 999px;
  background: rgba(230, 196, 119, .1);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: #ecd79b;
  white-space: nowrap;
}
.tip-title > span:last-child { margin-left: auto; }
.acupoint-tip p { margin: 7px 0 3px; }
.acupoint-tip > div:not(.tip-title) { color: #b8c5d5; }
.acupoint-tip > div:not(.tip-title) b { color: #eedd9c; }
.acupoint-tip .mini { margin-top: 8px; }

/* 素材条目：有图标时显示图标 + 名称的小标签 */
.material-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
  white-space: nowrap;
}
.material-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 5px;
  background: rgba(10, 18, 30, .55);
  border: 1px solid rgba(150, 190, 225, .3);
  padding: 1px;
}
.material-cost { color: #eedd9c; font-weight: 600; }
.material-cost .material-icon { width: 24px; height: 24px; margin-right: 2px; }
td .material-chip { color: var(--ink-2); }
td .material-icon { width: 24px; height: 24px; border-color: rgba(160, 180, 210, .28); background: rgba(10, 18, 30, .45); }

.training-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.training-controls .gold-button { min-width: 100px; }

.detail-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.detail-bottom .text-button { font-size: .8125rem; }

.attribute-detail { min-height: 470px; padding: 20px 2px; }
.attribute-detail h3 {
  margin: 18px 0 12px;
  padding-left: 12px;
  border-left: 2px solid rgba(230, 196, 119, .65);
  font-size: 1.05rem;
  letter-spacing: .1em;
  color: #ddcd9e;
}
.attribute-detail h3:first-child { margin-top: 4px; }
.attribute-detail p { margin-bottom: 10px; font-size: .875rem; color: #c2cdda; }
.attribute-detail dl { margin: 12px 0; }
.attribute-detail dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line-soft);
  font-size: .875rem;
}
.attribute-detail dt { color: #a9b8ca; }
.attribute-detail dd { margin: 0; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 560px;
  padding: 30px;
  color: #a8b8c9;
  text-align: center;
}
.empty h1, .empty h2 { font-size: 1.5rem; color: #d6dae2; letter-spacing: .1em; }
.empty p { max-width: 500px; font-size: .9375rem; }
.empty-glyph {
  font-family: var(--serif);
  font-size: 4rem;
  line-height: 1.3;
  color: rgba(196, 170, 110, .45);
  text-shadow: 0 0 40px rgba(230, 196, 119, .25);
}
.empty.compact { min-height: 520px; }

/* ---------- 9. 消耗与记录 ---------- */
.stats-page {
  padding: 34px 30px;
  border: 1px solid var(--line-soft);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: linear-gradient(180deg, rgba(14, 21, 33, .82), rgba(10, 16, 25, .92));
  box-shadow: var(--shadow-3);
}
.stats-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.stats-heading h1 { margin-top: 8px; font-size: 1.65rem; font-weight: 500; letter-spacing: .16em; }

.stats-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stats-summary > div {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(150deg, rgba(46, 62, 84, .85), rgba(24, 34, 49, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), var(--shadow-2);
  overflow: hidden;
}
.stats-summary > div::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-deep), rgba(240, 212, 138, .9), transparent);
}
.stats-summary span { font-size: .8125rem; letter-spacing: .1em; color: #bcc7d3; }
.stats-summary b {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #f5e0a4;
  text-shadow: 0 0 26px rgba(230, 196, 119, .3);
}
.stats-summary small { font-size: .8125rem; }

.stats-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.stat-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(24, 35, 51, .82), rgba(17, 26, 38, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), var(--shadow-2);
}
.stat-panel h2 {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 1.15rem;
  letter-spacing: .12em;
}
.stat-panel h3 { margin: 16px 0 8px; font-size: 1rem; letter-spacing: .08em; }
.stat-panel h2 small { margin-left: 8px; font-family: var(--sans); font-size: .75rem; font-weight: 400; color: var(--muted-2); }
.log-panel { margin-top: 22px; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .875rem;
  line-height: 1.6;
  text-align: left;
}
th {
  padding: 10px;
  font-weight: 500;
  font-size: .8125rem;
  letter-spacing: .08em;
  color: #bcc8d5;
  background: rgba(44, 60, 82, .45);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
th:first-child { border-radius: var(--r-sm) 0 0 0; }
th:last-child { border-radius: 0 var(--r-sm) 0 0; }
td, th { padding: 10px; border-bottom: 1px solid rgba(90, 110, 140, .18); vertical-align: middle; }
tbody tr { transition: background .16s var(--ease); }
tbody tr:hover { background: rgba(230, 196, 119, .05); }
td:not(:first-child) { font-variant-numeric: tabular-nums; }
table small { display: block; }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 6px;
  color: var(--muted-2);
  font-size: .75rem;
  letter-spacing: .06em;
}
footer .text-button { min-height: 28px; padding: 3px 6px; font-size: .75rem; color: #8d9aad; }

/* ---------- 10. 弹窗（深色） ---------- */
dialog {
  width: min(880px, 94vw);
  max-width: none;
  max-height: 90vh;
  padding: 30px;
  border: 1px solid rgba(196, 166, 104, .45);
  border-radius: var(--r-lg);
  color: var(--ink);
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(70, 96, 130, .35), transparent 60%),
    linear-gradient(180deg, #182335, #121b29);
  box-shadow: var(--shadow-3);
  overflow: auto;
}
dialog[open] { animation: dialogIn .28s var(--ease) both; }
dialog::backdrop { background: rgba(3, 7, 14, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(170, 150, 110, .55);
  border-radius: 50%;
  background: rgba(72, 68, 60, .85);
  color: #f2e7cd;
  font-size: 1.4rem;
  line-height: 1;
}
.dialog-close:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(110, 92, 58, .95);
  transform: rotate(90deg);
}

.info-dialog { padding: 38px; }
.info-dialog h2 {
  margin: 0 34px 20px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 1.45rem;
  letter-spacing: .1em;
  color: #ecd79b;
}
.info-dialog h3 {
  margin: 24px 0 12px;
  padding-left: 12px;
  border-left: 2px solid rgba(230, 196, 119, .6);
  font-size: 1.0625rem;
  letter-spacing: .08em;
  color: #dcc794;
}
.info-dialog p { margin: 12px 0; font-size: .9375rem; color: #c5d0dc; }
.info-dialog .mini { font-size: .8125rem; color: #9aa9bd; }
.info-dialog table { margin: 14px 0; }
.info-dialog .inset-note { margin-top: 0; }

/* 首页公告：沿用规则说明的深色卡片，正文由后台富文本生成 */
.announcement-body {
  font-size: .9375rem;
  line-height: 1.9;
  color: #c5d0dc;
}
.announcement-body > :first-child { margin-top: 0; }
.announcement-body p { margin: 12px 0; }
.announcement-body h2 { margin: 22px 0 12px; font-size: 1.25rem; letter-spacing: .08em; color: #ecd79b; }
.announcement-body h3 {
  margin: 22px 0 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(230, 196, 119, .6);
  font-size: 1.0625rem;
  letter-spacing: .08em;
  color: #dcc794;
}
.announcement-body h4 { margin: 18px 0 8px; font-size: .9688rem; letter-spacing: .06em; color: #cdbd94; }
.announcement-body ul, .announcement-body ol { margin: 12px 0; padding-left: 1.5em; }
.announcement-body li { margin: 6px 0; }
.announcement-body blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 2px solid rgba(230, 196, 119, .45);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(12, 20, 32, .5);
  color: #b9c6d6;
}
.announcement-body hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line-soft); }
.announcement-body table { margin: 14px 0; }
.announcement-body b, .announcement-body strong { font-weight: 700; }
.announcement-body span[style*="background-color"] { padding: 0 2px; border-radius: 3px; }

.modal-actions { display: flex; justify-content: center; gap: 18px; margin-top: 28px; }

/* 衍心结果 */
.result-dialog {
  width: min(1040px, 95vw);
  padding: 34px;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(90, 126, 172, .4), transparent 62%),
    linear-gradient(180deg, #182335, #121b29);
}
.result-heading { margin-bottom: 28px; text-align: center; }
.result-heading h2 {
  margin: 12px 0;
  font-size: 2.15rem;
  font-weight: 500;
  letter-spacing: .3em;
  color: #f2e2b6;
  text-shadow: 0 0 46px rgba(230, 196, 119, .35);
}
.result-heading p { font-size: .875rem; color: #bccbdb; }

.result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; }
.result-grid.single { grid-template-columns: 240px; justify-content: center; }
.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 296px;
  padding: 20px 10px;
  border: 1px solid rgba(150, 126, 78, .5);
  border-radius: var(--r-md);
  background: linear-gradient(150deg, rgba(66, 78, 100, .95), rgba(20, 32, 50, .95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow-2);
  animation: reveal .5s var(--ease) both;
  transition: transform .22s var(--ease), border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.result-card:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: rgba(240, 212, 138, .8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 26px 50px -26px rgba(230, 196, 119, .7);
}
.result-card:nth-child(2) { animation-delay: .06s; }
.result-card:nth-child(3) { animation-delay: .12s; }
.result-card:nth-child(4) { animation-delay: .18s; }
.result-card:nth-child(5) { animation-delay: .24s; }
.result-card img { width: 80px; height: 80px; }
.result-card h3 { min-height: 46px; margin: 9px 0; font-size: 1rem; line-height: 1.6; }
.result-card > div:not(.tier-dots) { font-size: .875rem; }
.result-card .mini { margin-top: auto; font-size: .75rem; }
.result-power { display: flex; flex-direction: column; gap: 2px; font-size: .8125rem; color: var(--muted); }
.result-power b { font-size: 1rem; color: var(--jade); font-variant-numeric: tabular-nums; }
.result-power small { font-size: .75rem; color: var(--muted-2); }

.double-label {
  position: absolute;
  right: -3px;
  top: -12px;
  padding: 3px 11px;
  border: 1px solid rgba(229, 188, 115, .9);
  border-radius: 999px;
  background: linear-gradient(100deg, #d39d46, #ffe59c);
  color: #312212;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .12em;
  box-shadow: 0 8px 20px -10px rgba(240, 210, 140, .95);
}

.reward-description { display: flex; align-items: center; gap: 22px; margin: 20px 0; }
.reward-description img { width: 100px; height: 100px; object-fit: cover; border: 1px solid rgba(197, 162, 96, .6); border-radius: var(--r-sm); }

.backup-details {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: rgba(30, 43, 61, .7);
}
.backup-details span { font-size: .9375rem; color: #aebed2; }
.backup-details b { color: #ecd89d; font-weight: 600; font-variant-numeric: tabular-nums; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }

.potential-label { display: flex; align-items: center; gap: 20px; }
.potential-label input { width: 110px; }

/* ---------- 11. 纸面选择弹窗（凝心／承武） ---------- */
.paper-dialog {
  width: min(1250px, 96vw);
  height: min(740px, 92vh);
  max-height: 92vh;
  padding: 10px;
  color: #57452d;
  background: #d9d8d2;
  border: 6px solid #3f4046;
  border-radius: var(--r-md);
  outline: 2px solid #a98f68;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px rgba(214, 185, 131, .8), 0 30px 90px rgba(0, 0, 0, .75);
  overflow: hidden;
  color-scheme: light;
}
.paper-dialog #dialog-content { height: 100%; }
.paper-layout {
  display: grid;
  grid-template-columns: 78px minmax(240px, 36%) minmax(0, 1fr);
  gap: 18px;
  height: 100%;
  padding: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 106, 84, .07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(120, 106, 84, .07) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at 0 8%, rgba(228, 213, 188, .8), transparent 46%),
    radial-gradient(ellipse at 100% 100%, rgba(206, 200, 186, .7), transparent 50%),
    linear-gradient(130deg, #cbcac6, #e6e3dc 55%, #cccac4);
}

.paper-title {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px 6px;
  border-right: 2px solid #ece0bd;
  background: linear-gradient(180deg, rgba(184, 161, 120, .72), rgba(199, 185, 145, .6), rgba(187, 169, 132, .72));
  font-family: var(--serif);
  font-size: 2.7rem;
  letter-spacing: .22em;
  writing-mode: vertical-rl;
  color: #fbf0d5;
  text-shadow: 0 1px 10px rgba(196, 171, 125, .9);
}
.paper-title .help {
  writing-mode: horizontal-tb;
  flex-shrink: 0;
  border-color: #a2916f;
  background: #6f6754;
  color: #f0e4c6;
}

.paper-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  align-self: center;
  padding: 12px 5px;
  text-align: center;
}
.paper-identity > .book-icon { width: 86px; height: 86px; border-radius: 4px; box-shadow: 0 0 0 1px #a38b4c, 0 8px 26px rgba(101, 86, 59, .28); }
.paper-identity h3 {
  padding: 5px 12px;
  border-top: 1px solid #b9aa87;
  border-bottom: 1px solid #b9aa87;
  background: #ded9ce;
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: .06em;
}
.paper-tier {
  width: 90%;
  margin-top: 32px;
  padding: 24px 12px 5px;
  border-top: 1px solid #a79c81;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}
.paper-identity p { max-width: 95%; font-size: .9375rem; color: #837e73; }

.source-slot {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  margin: 22px auto 0;
  border: 1px solid #b5a788;
  background: rgba(202, 189, 152, .32);
  box-shadow: 0 0 0 16px rgba(185, 170, 132, .14);
}
.source-slot > span { font-size: 3rem; font-weight: 300; color: #fbf3df; text-shadow: 0 1px 6px rgba(85, 69, 47, .5); }
.source-slot img { width: 74px; height: 74px; }

.paper-choices { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 22px 8px; }
.paper-choices h2 {
  margin-right: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #a69c85;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.7;
  color: #726d60;
}
.paper-sub { margin: 12px 0; font-size: .8125rem; color: #8f826b; }

.attribute-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  align-content: start;
  max-height: 470px;
  padding: 3px;
  overflow: auto;
}
.attribute-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid #c4b795;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #cbc8bf, #c1beb5);
  color: #6a5130;
  font-size: 1rem;
  line-height: 1.4;
  text-align: left;
}
.attribute-choice:hover:not(:disabled) { background: linear-gradient(180deg, #d6cfbf, #cac3b4); color: #5f4314; }
.attribute-choice.selected {
  border-color: #fff1c7 !important;
  box-shadow: 0 0 0 2px #fff2ce, 0 0 0 4px #d9b468 !important;
}
.diamond { font-size: 1.5rem; line-height: 1; color: #a08a63; }
.attribute-choice.selected .diamond { color: #a58140; }
.attribute-choice small { display: block; font-size: .75rem; color: #8a785e; }

.source-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
  min-height: 0;
  padding: 4px;
  overflow: auto;
}
.source-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 168px;
  padding: 14px 6px;
  border: 1px solid #aaa087;
  border-radius: var(--r-sm);
  background: linear-gradient(150deg, #ded3b7, #cbc7bc);
  color: #6b5538;
}
.source-choice:hover:not(:disabled) { background: #e6dabb; }
.source-choice img { width: 64px; height: 64px; }
.source-choice b { font-size: .875rem; font-weight: 500; line-height: 1.5; }
.source-choice span { font-size: .75rem; color: #89795d; }
.source-choice .source-power { color: #927032 !important; font-size: .875rem; font-weight: 500; }

.paper-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 20px;
}
.paper-confirm p { max-width: 70%; font-size: .8125rem; line-height: 1.7; color: #b62f23; }
.paper-confirm .gold-button { min-width: 100px; padding: 8px 16px; }

/* 宽屏时词条自动分栏，减少纵向滚动 */
@media (min-width: 1251px) {
  .attribute-choices { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ---------- 12. 提示、加载与滚动条 ---------- */
#toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  z-index: 120;
  max-width: 90vw;
  padding: 14px 26px;
  border: 1px solid rgba(190, 160, 100, .6);
  border-radius: 999px;
  background: rgba(30, 43, 62, .96);
  color: #f5e3b8;
  box-shadow: 0 6px 34px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: .9375rem;
  line-height: 1.6;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(.98);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
#toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  height: 70vh;
  color: #c9ba91;
  border: 1px solid var(--line-soft);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: linear-gradient(180deg, rgba(14, 21, 33, .8), rgba(10, 16, 25, .9));
}
.loading-orbit {
  position: relative;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(167, 151, 117, .45);
  border-top-color: #ffe6aa;
  border-radius: 50%;
  animation: orbit 1.6s linear infinite;
}
.loading-orbit::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(167, 151, 117, .3);
  border-bottom-color: rgba(127, 230, 255, .8);
  border-radius: 50%;
  animation: orbit 2.4s linear infinite reverse;
}

body.saving #main { cursor: progress; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(80, 98, 121, .12); border-radius: 999px; }
::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(140, 158, 182, .55), rgba(96, 114, 138, .55));
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgba(196, 176, 124, .8), rgba(150, 130, 88, .8)); background-clip: padding-box; }
* { scrollbar-color: rgba(140, 158, 182, .5) transparent; scrollbar-width: thin; }

.paper-dialog ::-webkit-scrollbar-thumb { background: rgba(150, 140, 120, .75); background-clip: padding-box; }
.paper-dialog ::-webkit-scrollbar-track { background: rgba(174, 170, 160, .2); }
.paper-dialog * { scrollbar-color: rgba(150, 140, 120, .7) transparent; }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes reveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ---------- 13. 响应式 ---------- */
@media (min-width: 1600px) {
  .workbench { grid-template-columns: 226px minmax(380px, 1fr) 462px; }
  .preview-attrs { grid-template-columns: 1fr 1fr; gap: 0 20px; }
  .preview-attrs > div { flex-wrap: wrap; }
  .preview-panel { padding-left: 26px; }
  .library-layout { grid-template-columns: minmax(0, 1fr) 476px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); }
  .node { width: 38px; height: 38px; min-height: 38px; }
}

@media (max-width: 1250px) {
  .app-shell { padding: 14px 18px 0; }
  .topbar { gap: 14px; padding: 8px 16px; }
  .brand { gap: 10px; margin-right: 6px; }
  .brand-brush { font-size: 1.85rem; }
  .brand-small { display: none; }
  .nav { padding: 8px 15px; font-size: 1rem; }
  .workbench { grid-template-columns: 196px minmax(240px, 1fr) 368px; gap: 14px; padding: 22px 14px; }
  .milestone { padding: 16px 12px; }
  .milestone h3 { font-size: 1rem; }
  .pity { font-size: .75rem; }
  .ritual-slot strong { font-size: .875rem; }
  .ritual-caption h1 { font-size: 1.9rem; }
  .slot-frame { width: 92px; height: 92px; }
  .slot-frame .book-icon, .slot-frame.scroll img { width: 64px; height: 64px; }
  .preview-panel { padding-left: 14px; }
  .library-layout { grid-template-columns: minmax(0, 1fr) 384px; gap: 18px; padding: 24px 14px; }
  .library-detail { padding-left: 16px; }
  .library-toolbar { flex-wrap: wrap; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 14px 12px; }
  .library-card { padding: 14px 6px 10px; }
  .acupoint-row { gap: 10px; padding: 10px; }
  .node { width: 31px; height: 31px; min-height: 31px; }
  .node-track { gap: 2px; }
  .stats-page { padding: 28px 18px; }
  .stats-summary > div { padding: 18px; }
  .paper-layout { grid-template-columns: 62px minmax(200px, 31%) minmax(0, 1fr); gap: 12px; }
  .paper-title { font-size: 2.3rem; }
  .paper-choices { padding: 22px 5px; }
  .source-choice { min-height: 150px; }
  .attribute-choice { padding: 10px; font-size: .9375rem; }
}

@media (max-width: 1000px) {
  .workbench {
    grid-template-columns: 196px minmax(0, 1fr);
    grid-template-areas: 'ritual preview' 'milestones preview';
    min-height: 0;
  }
  .ritual { grid-area: ritual; min-height: 330px; }
  .milestones { grid-area: milestones; margin-top: 4px; }
  .preview-panel { grid-area: preview; min-height: 0; }
  .ritual-caption { top: 16px; }
  .ritual-caption h1 { font-size: 1.45rem; }
  .ritual-caption span { font-size: .75rem; }
  .ritual-ring { width: 190px; height: 190px; top: calc(50% - 95px); left: calc(50% - 95px); }
  .input-slots { flex-direction: column; align-items: center; gap: 12px; padding: 56px 0 0; }
  .ritual-slot { display: flex; align-items: center; gap: 14px; width: 100%; padding: 6px 0; }
  .ritual-slot > span { display: none; }
  .slot-frame { width: 64px; height: 64px; margin: 0; }
  .slot-frame .book-icon, .slot-frame.scroll img { width: 44px; height: 44px; }
  .slot-frame i { width: 20px; height: 20px; font-size: .75rem; line-height: 17px; }
  .ritual-slot strong { min-height: 0; font-size: .8125rem; line-height: 1.7; text-align: left; }
  .ritual-bottom { display: none; }
  .library-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .library-toolbar > div { width: 100%; }
  .library-toolbar input { width: 100%; }
  .library-toolbar select { max-width: 128px; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .pagination > span { flex-basis: 100%; text-align: center; }
  .stats-summary { grid-template-columns: 1fr 1fr; }
  .stats-columns { grid-template-columns: 1fr; }
  .stat-panel { padding: 18px; }
  .paper-layout { grid-template-columns: 48px minmax(150px, 27%) minmax(0, 1fr); gap: 10px; padding: 10px; }
  .paper-title { font-size: 1.9rem; padding: 16px 2px; }
  .paper-identity h3 { font-size: .875rem; }
  .paper-identity p { font-size: .8125rem; }
  .paper-tier { margin-top: 14px; padding: 18px 0 5px; font-size: 1.05rem; }
  .source-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attribute-choices { grid-template-columns: 1fr; }
  .paper-dialog { height: 86vh; }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .top-actions #save-status { display: none; }
}

@media (max-width: 650px) {
  .app-shell { padding: 0 8px; }
  .topbar { flex-wrap: wrap; gap: 6px; min-height: 0; padding: 12px 10px; }
  .brand { order: 0; }
  .brand-brush { font-size: 1.65rem; }
  .top-actions { order: 1; }
  .topbar nav { order: 2; width: 100%; gap: 4px; }
  .nav { flex: 1; padding: 10px 6px; font-size: .9375rem; letter-spacing: .04em; }
  .top-actions .quiet { font-size: .8125rem; padding: 6px 8px; }

  .workbench { display: flex; flex-direction: column; gap: 16px; padding: 14px 10px; }
  .ritual { order: 0; min-height: 300px; }
  .ritual::before { background-size: 100% auto; background-position: center 42%; opacity: .85; }
  .ritual-caption { top: 16px; }
  .ritual-caption h1 { font-size: 1.6rem; letter-spacing: .2em; }
  .ritual-ring { width: 216px; height: 216px; top: calc(50% - 92px); left: calc(50% - 108px); }
  .input-slots { flex-direction: row; justify-content: space-around; gap: 28px; padding: 82px 8px 12px; }
  .ritual-slot { flex-direction: column; align-items: center; width: auto; gap: 10px; }
  .ritual-slot > span { display: block; margin: 0; font-size: .8125rem; }
  .slot-frame { width: 78px; height: 78px; }
  .slot-frame .book-icon, .slot-frame.scroll img { width: 56px; height: 56px; }
  .ritual-slot strong { max-width: 130px; font-size: .875rem; text-align: center; }

  .preview-panel { order: 1; min-height: 0; padding: 8px 0 0; border-left: 0; }
  .preview-name { font-size: 1.2rem; }
  .preview-attrs { grid-template-columns: 1fr 1fr; gap: 0 15px; }
  .preview-attrs > div { flex-direction: column; gap: 2px; font-size: .8125rem; line-height: 1.7; }
  .preview-rule { margin-top: 14px; }
  .preview-rule p { font-size: .8125rem; }
  .draw-actions { margin-bottom: 6px; padding-top: 20px; }
  .draw-buttons button { min-height: 48px; font-size: 1.05rem; }

  .milestones { order: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 18px; }
  .milestone { padding: 14px 10px; }
  .milestone h3 { font-size: 1rem; }
  .pity { font-size: .75rem; }
  .milestone p { font-size: .75rem; }
  .rules-link { grid-column: span 2; }
  .reward-row strong { font-size: .875rem; }
  .reward-icon { width: 44px; height: 44px; }
  .claim { font-size: .75rem; }

  .library-layout { display: flex; flex-direction: column; gap: 24px; padding: 18px 10px; }
  .library-toolbar { margin-bottom: 16px; }
  .library-toolbar h1 { font-size: 1.3rem; }
  .library-toolbar select { max-width: none; }
  .library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px 8px; }
  .library-card { min-height: 220px; padding: 12px 5px 10px; }
  .library-card .book-icon, .card-icon { width: 58px; }
  .library-card .book-icon { height: 58px; }
  .library-card strong { min-height: 42px; font-size: .8125rem; }
  .card-controls { flex-wrap: wrap; }
  .card-controls button { min-height: 30px; }
  .card-controls button:first-child { flex-basis: 100%; }
  .library-detail { padding: 18px 0 0; border-top: 1px solid var(--line-soft); border-left: 0; }
  .node { width: 34px; height: 34px; min-height: 34px; }
  .row-label { gap: 6px; padding-right: 2px; }
  .row-name { font-size: 1rem; letter-spacing: .12em; }
  .row-icon { width: 26px; height: 26px; padding: 1px; }
  .acupoint-row { gap: 8px; padding: 10px 8px; }
  .acupoint-row { gap: 12px; padding: 10px 12px; }
  .acupoint-tip { font-size: .875rem; }
  .affinity-panel { gap: 8px; }

  .stats-page { padding: 22px 12px; }
  .stats-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
  .stats-heading h1 { font-size: 1.4rem; }
  .stats-summary { gap: 12px; }
  .stats-summary > div { padding: 16px 12px; }
  .stats-summary b { font-size: 1.4rem; }
  .stats-summary span { font-size: .8125rem; }
  .stat-panel { padding: 16px 12px; }
  .stat-panel h2 small { display: block; margin: 6px 0 0; }
  .log-panel table { min-width: 640px; }
  td, th { padding: 9px 6px; }

  .info-dialog { padding: 30px 20px; }
  .info-dialog h2 { font-size: 1.25rem; }
  .info-dialog p { font-size: .875rem; }
  .announcement-body { font-size: .875rem; line-height: 1.8; }
  .announcement-body h2 { font-size: 1.125rem; }
  .announcement-body h3 { font-size: 1rem; }
  .result-dialog { padding: 28px 16px; }
  .result-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .result-grid.single { grid-template-columns: minmax(0, 220px); }
  .result-card { min-height: 258px; padding: 18px 8px; }
  .result-card h3 { font-size: .9375rem; }
  .result-heading h2 { font-size: 1.75rem; letter-spacing: .22em; }

  .paper-dialog { width: 97vw; height: 92vh; max-height: 92vh; padding: 5px; border-width: 4px; overflow: auto; }
  .paper-layout { position: relative; display: flex; flex-direction: column; gap: 10px; height: auto; min-height: 100%; padding: 12px; }
  .paper-title {
    width: 100%;
    min-height: 46px;
    padding: 8px 14px;
    border-right: 0;
    font-size: 1.55rem;
    letter-spacing: .18em;
    writing-mode: horizontal-tb;
    justify-content: flex-start;
    gap: 18px;
  }
  .paper-title .help { margin-left: auto; }
  .paper-identity { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 10px; width: 100%; padding: 8px; }
  .paper-identity > .book-icon { width: 54px; height: 54px; }
  .paper-identity h3 { max-width: 62%; font-size: .9375rem; text-align: left; }
  .paper-tier { width: auto; margin: 0; padding: 0; border: 0; font-size: 1rem; }
  .paper-identity p { flex-basis: 100%; text-align: left; }
  .source-slot { width: 64px; height: 64px; margin: 6px 10px; box-shadow: 0 0 0 6px rgba(185, 170, 132, .14); }
  .source-slot img { width: 50px; height: 50px; }
  .source-slot > span { font-size: 2rem; }
  .paper-choices { min-height: 320px; padding: 0; overflow: visible; }
  .paper-choices h2 { margin-right: 0; padding-bottom: 10px; font-size: .875rem; }
  .paper-sub { margin: 9px 0; font-size: .75rem; }
  .attribute-choices { grid-template-columns: 1fr 1fr; gap: 12px 10px; max-height: none; overflow: visible; }
  .attribute-choice { min-height: 56px; padding: 10px 8px; font-size: .875rem; gap: 6px; }
  .diamond { font-size: 1.1rem; }
  .source-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; max-height: 360px; }
  .source-choice { min-height: 130px; padding: 10px 4px; gap: 8px; }
  .source-choice img { width: 48px; height: 48px; }
  .source-choice b, .source-choice span { font-size: .75rem; }
  .paper-confirm { padding-top: 22px; gap: 10px; }
  .paper-confirm p { max-width: 65%; font-size: .75rem; }
  .paper-confirm .gold-button { min-width: 88px; padding: 8px; font-size: 1rem; }

  .backup-actions { flex-direction: column; }
  .backup-details { gap: 12px; padding: 14px; font-size: .875rem; }
  .reward-description { gap: 14px; }
  .reward-description img { width: 76px; height: 76px; }
  .empty { min-height: 380px; padding: 20px; }
  .empty.compact { min-height: 200px; }
  .modal-actions { flex-direction: column; gap: 10px; }
  .modal-actions button { width: 100%; }
  footer { flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 18px 0; }
  footer > span:last-child { flex-basis: 100%; text-align: center; }
  #toast { bottom: 24px; padding: 12px 18px; border-radius: var(--r-md); font-size: .875rem; }
}

/* ---------- 14. 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: #b6c1d0; --line-soft: rgba(150, 172, 205, .4); }
  .library-card, .stat-panel, .milestone { border-color: rgba(190, 206, 232, .5); }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, footer, .ritual, .draw-actions { display: none; }
  .workbench, .library-layout, .stats-page { border: 0; background: #fff; box-shadow: none; }
}

/* Five primary tabs: bounded horizontal navigation instead of squeezing labels. */
.topbar nav { min-width:0; overflow-x:auto; flex-shrink:1; }
.topbar nav .nav { flex-shrink:0; white-space:nowrap; }

/* Milestone quantities remain readable above every supplied reward icon. */
.counted-reward{position:relative;overflow:visible;flex-shrink:0;}
.counted-reward .reward-count{position:absolute;right:0;bottom:0;z-index:1;min-width:24px;padding:2px 5px;border-radius:3px;background:rgba(4,9,16,.94);color:#fff7d1;font:700 16px/1.25 var(--sans);text-align:right;text-shadow:0 1px 2px #000;pointer-events:none;}
.milestone-reward-name{font-size:13px;line-height:1.6;color:#e8d59c;overflow-wrap:anywhere;}
.fragment-shop{margin-top:18px;padding:16px;border:1px solid #34455e;border-radius:4px;}
.fragment-balance{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.fragment-balance>b{color:#edd78b;}
.fragment-shop label{display:block;margin:12px 0 8px;font-size:14px;color:#c2ccda;}
.fragment-shop input{display:block;width:100%;box-sizing:border-box;margin-top:6px;padding:9px;border:1px solid #40526c;border-radius:4px;background:#101b2b;color:#eef2f7;font:inherit;}
.fragment-shop button{width:100%;}
.scroll-options{max-height:400px;overflow-y:auto;}
.scroll-options .scroll-card{flex-shrink:0;min-height:110px;height:auto;}

.batch-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0;}
.batch-toolbar>span{margin-left:auto;color:var(--gold);}
.batch-list{max-height:48vh;overflow:auto;border-top:1px solid #34455e;}
.batch-row{display:flex;align-items:center;gap:12px;padding:12px 4px;border-bottom:1px solid #34455e;cursor:pointer;}
.batch-row input{width:18px;height:18px;accent-color:#dbbd74;flex-shrink:0;}
.batch-row .book-icon{width:42px;height:42px;flex-shrink:0;}
.batch-row>span:nth-last-child(2){flex:1;min-width:0;}
.batch-row small{display:block;color:#a7b4c8;font-size:12px;margin-top:4px;}
.batch-row.is-locked{opacity:.55;cursor:default;}
.batch-row:has(input:checked){background:#b69a4919;}
@media(max-width:650px){.batch-row{gap:8px;}.batch-row b{font-size:14px;}.batch-row .tier-text{font-size:12px;}}

.batch-tier-filters{display:flex;gap:20px;flex-wrap:wrap;margin:16px 0;}
.batch-tier-filters label{display:flex;align-items:center;gap:6px;}
.batch-tier-filters select{min-width:100px;}
