/* main.css —— 《灵山掌门》水墨风定稿样式：宣纸米白 / 墨黑 / 黛青 / 朱砂 */

:root {
  --paper: #f5f0e6;
  --ink: #2b2b2b;
  --cyan: #3d5a6c;
  --cinnabar: #a83232;
  --gold: #b8860b;
  --paper-dim: #ece5d4;
  --ink-soft: rgba(43, 43, 43, .55);
  --ink-mute: #616055;   /* 停用态文字（技能冷却中）：对卡面约 5.3:1 */
}

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

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "SimSun", serif;
  overflow: hidden;
}

/* 宣纸质感：feTurbulence 噪点（零图片资源） */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.17 0 0 0 0 0.17 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ── 山色四时：季节与昼夜色调层（纯 CSS 变量叠色，零 rAF） ── */
#tint-season, #tint-day {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  transition: background 2.5s ease;
}
#tint-day.moon::after {
  content: ""; position: absolute; right: 10%; top: 7%;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, rgba(245,240,230,.98), rgba(245,240,230,.35) 66%, transparent 72%);
  box-shadow: 0 0 46px rgba(245,240,230,.4), 0 0 110px rgba(245,240,230,.18);
}

/* ── 夜色主题：入夜整页换夜行水墨（html.night body 切换 CSS 变量） ── */
html.night body {
  --paper: #343b47;
  --ink: #e8e2d2;
  --paper-dim: #2b313b;
  --ink-soft: rgba(232, 226, 210, .55);
  --cyan: #8fadc0;
  --cinnabar: #d0685a;
  --gold: #d4a94e;
  --ink-mute: #b4b1a6;   /* 停用态文字（夜里）：对卡面约 5.4:1 */
}
html.night body .panel { background: #3a4150; }
html.night body .b-card { background: rgba(255, 255, 255, .06); }
html.night body .b-icon { stroke: var(--ink); }
html.night body .ev-option { background: rgba(255, 255, 255, .07); }
html.night body #btn-breath { box-shadow: 0 4px 24px rgba(0,0,0,.4), inset 0 0 30px rgba(143,173,192,.12); }
html.night body #xp-bar { background: var(--paper-dim); }
html.night body .toast { background: #e8e2d2; color: #343b47; }

/* ── 魔道主题：仅换色，不改布局 ── */
html.xie body {
  --paper: #1b1113;
  --ink: #f4e8e2;
  --paper-dim: #2b191d;
  --ink-soft: rgba(244, 232, 226, .68);
  --cyan: #c98c86;
  --cinnabar: #c43b35;
  --gold: #d7ad68;
  --ink-mute: #b9a7a5;
  background: #160d0f;
}
html.xie body::before { opacity: .3; }
html.xie body .panel {
  background: #26171a;
  border-color: rgba(196, 59, 53, .58);
  box-shadow: 0 3px 18px rgba(5, 0, 1, .42), inset 0 1px rgba(255, 230, 220, .025);
}
html.xie body #center { background: #211316; }
html.xie body .panel-title { border-bottom-color: rgba(213, 100, 91, .46); }
html.xie body .b-card,
html.xie body .ev-option,
html.xie body .bc-side,
html.xie body .rebirth-item { border-color: rgba(201, 93, 86, .35); }
html.xie body .b-card,
html.xie body .ev-option { background: #321e22; }
html.xie body .b-card:hover { box-shadow: 0 4px 16px rgba(4, 0, 1, .5); }
html.xie body .btn-primary {
  color: #fff7f2;
  background: #a92b29;
  border: 1px solid #d5544c;
  box-shadow: inset 0 1px rgba(255, 235, 225, .12), 0 2px 8px rgba(5, 0, 1, .28);
}
html.xie body .btn-primary:hover:not(:disabled) { background: #c23a33; border-color: #e36d63; }
html.xie body .btn-primary:focus-visible,
html.xie body .icon-btn:focus-visible { outline: 2px solid #f0b58d; outline-offset: 2px; }
html.xie body .btn-primary:disabled,
html.xie body .b-buy:disabled { color: #c0b2b2; background: #493b3e; border-color: #645255; box-shadow: none; }
html.xie body .icon-btn {
  color: #f1ddd7;
  background: #321d21;
  border-color: #8d4a49;
}
html.xie body .icon-btn:hover:not(:disabled) { color: #fff8f4; background: #4a2428; border-color: #d05a54; }
html.xie body .icon-btn:disabled { color: #908183; background: #2b2526; border-color: #574a4c; }
html.xie body .b-buy,
html.xie body .b-ability { color: #fff3ee; background: #842521; border: 1px solid #c14c45; }
html.xie body .b-buy:hover:not(:disabled),
html.xie body .b-ability:hover:not(:disabled) { background: #a8322c; }
html.xie body #btn-breath {
  color: #f8e9e2;
  background: #211316;
  border-color: #bd4942;
  box-shadow: 0 5px 28px rgba(2, 0, 0, .55), inset 0 0 34px rgba(171, 31, 31, .18);
}
html.xie body #btn-breath:hover { box-shadow: 0 7px 34px rgba(151, 25, 25, .42), inset 0 0 40px rgba(190, 42, 36, .24); }
html.xie body #xp-fill { background: linear-gradient(90deg, #761b1c, #d4483e); }
html.xie body .modal-mask { background: rgba(8, 1, 2, .76); }
html.xie body .modal-card { background: #241519; border-color: #b5423d; box-shadow: 0 12px 48px rgba(0, 0, 0, .62); }
html.xie body .set-textarea { color: var(--ink); background: #170e10; border-color: #75403f; }
html.xie body .hand-card,
html.xie body .deck-card,
html.xie body .senior-tier { color: #f3e5df; background: linear-gradient(180deg, #3a2024, #211316); border-color: #75403f; }
html.xie body .deck-card-on {
  color: #fff8f3;
  background: linear-gradient(180deg, #8d2927, #54191c);
  border-color: #e2a45f;
  box-shadow: inset 0 0 0 1px rgba(255, 221, 184, .14), 0 0 10px rgba(196, 59, 53, .38);
}
html.xie body .battle-log { background: #160d0f; border-color: #603638; }
html.xie body .battle-intent { color: #f0cf9c; background: #3c211e; border-color: #ad7454; }
html.xie body .toast { background: #f1dfd7; color: #251316; border: 1px solid #bd5b54; }
html.xie body #tint-season { opacity: .2; }
html.xie body #tint-day { opacity: .36; }

#app {
  position: relative; z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-areas: "header header header" "left center right";
  grid-template-rows: auto 1fr;
  grid-template-columns: 300px 1fr 320px;
  gap: 10px;
  padding: 10px;
}

.panel {
  background: var(--paper);
  border: 1px solid rgba(43, 43, 43, .35);
  border-radius: 4px;
  box-shadow: 0 2px 14px rgba(43, 43, 43, .08);
  position: relative; z-index: 1;
}

#topbar { grid-area: header; display: flex; align-items: center; gap: 16px; padding: 8px 14px; flex-wrap: wrap; }
#left-panel { grid-area: left; padding: 10px; overflow-y: auto; }
#center { grid-area: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
#right-panel { grid-area: right; padding: 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }

.panel-title {
  font-size: 15px; color: var(--ink); letter-spacing: 4px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 4px; margin-bottom: 8px;
}
hr.brush { border: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--ink-soft), transparent); }

/* ── 顶栏资源 ── */
#res-bar { display: flex; flex:1 1 auto; min-width:0; gap: 18px; flex-wrap: wrap; align-items: center; }
.res-row { display: flex; align-items: baseline; gap: 5px; min-width: 110px; }
.res-name { color: var(--ink-soft); }
.res-val { font-size: 17px; font-weight: bold; min-width: 3em; transition: background .18s; }
.res-rate { color: var(--cyan); font-size: 11px; }
.tick-flash { background: rgba(184, 134, 11, .25); border-radius: 3px; }
.equip-row { display:flex; align-items:baseline; gap:5px; min-width:150px; max-width:220px; padding-left:12px; border-left:1px solid rgba(43,43,43,.18); }
.equip-name { flex:0 0 auto; color:var(--ink-soft); }
.equip-val { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--gold); font-weight:700; }

#btn-pill { margin-left: 6px; }
#buff-bar { display: flex; min-width:0; gap: 8px; }
.buff-chip { font-family:inherit; font-size: 12px; color: var(--cinnabar); border: 1px solid var(--cinnabar); border-radius: 10px; padding: 1px 8px; background:transparent; cursor:pointer; white-space:nowrap; }

#top-right { margin-left: auto; min-width:0; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dot { width: 10px; min-width: 10px; max-width: 10px; height: 10px; min-height: 10px; max-height: 10px; flex: 0 0 10px; aspect-ratio: 1 / 1; border-radius: 50%; display: inline-block; }
.dot.ok { background: #3a7d44; box-shadow: 0 0 6px #3a7d44; }
.dot.degraded { background: #c9a227; box-shadow: 0 0 6px #c9a227; }
.dot.off { background: #999; }
.icon-btn { box-sizing: border-box; flex: 0 0 auto; white-space: nowrap; background: none; border: 1px solid var(--ink-soft); border-radius: 4px; color: var(--ink); padding: 6px 12px; cursor: pointer; font-family: inherit; }

/* ── 按钮体系 ── */
button { font-family: inherit; min-height: 30px; }
.btn-primary { background: var(--cinnabar); color: var(--paper); border: none; border-radius: 4px; padding: 8px 18px; cursor: pointer; letter-spacing: 2px; }
.btn-primary:disabled { background: #b9a9a9; cursor: not-allowed; }
button:not(:disabled):active { transform: translateY(1px); }

#btn-breath {
  width: 180px; height: 180px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink);
  font-size: 40px; letter-spacing: 8px; color: var(--ink);
  cursor: pointer; position: relative; user-select: none;
  box-shadow: 0 4px 24px rgba(43, 43, 43, .18), inset 0 0 30px rgba(61, 90, 108, .08);
  transition: box-shadow .2s;
}
#btn-breath:hover { box-shadow: 0 6px 30px rgba(168, 50, 50, .25), inset 0 0 30px rgba(61, 90, 108, .12); }
#breath-wrap { position: relative; margin-top: 26px; }
.ripple {
  position: absolute; left: 50%; top: 50%; width: 180px; height: 180px; margin: -90px 0 0 -90px;
  border: 2px solid var(--ink-soft); border-radius: 50%; pointer-events: none;
  animation: ripple .7s ease-out forwards;
}
@keyframes ripple { from { transform: scale(1); opacity: .7; } to { transform: scale(1.55); opacity: 0; } }

/* ── 吐纳钮呼吸光晕：待机时缓缓明灭，按住时收紧 ── */
#btn-breath { animation: breathGlow 4.5s ease-in-out infinite; }
#btn-breath:active { animation-play-state: paused; box-shadow: 0 2px 12px rgba(168,50,50,.3), inset 0 0 24px rgba(61,90,108,.2); }
@keyframes breathGlow {
  0%, 100% { box-shadow: 0 4px 24px rgba(43,43,43,.18), inset 0 0 30px rgba(61,90,108,.08); }
  50% { box-shadow: 0 6px 34px rgba(61,90,108,.32), inset 0 0 44px rgba(61,90,108,.16); }
}
/* 灵气双星：绕吐纳钮缓慢环绕 */
#breath-wrap::before, #breath-wrap::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; border-radius: 50%; margin: -3.5px;
  background: radial-gradient(circle, rgba(184,134,11,.9), rgba(184,134,11,0) 70%);
  animation: orbitA 9s linear infinite;
}
#breath-wrap::after { width: 5px; height: 5px; margin: -2.5px; animation: orbitB 14s linear infinite reverse; }
@keyframes orbitA { from { transform: rotate(0) translateX(112px); } to { transform: rotate(360deg) translateX(112px); } }
@keyframes orbitB { from { transform: rotate(180deg) translateX(128px); } to { transform: rotate(540deg) translateX(128px); } }

/* 炼丹炉烟：图标内青烟上升 */
.smoke { animation: smokeRise 2.8s ease-in-out infinite; }
@keyframes smokeRise { 0% { transform: translateY(0); opacity: .55; } 70% { opacity: .25; } 100% { transform: translateY(-4px); opacity: 0; } }

#btn-break {
  background: var(--gold); color: #fff; border: none; border-radius: 6px;
  font-size: 22px; letter-spacing: 10px; padding: 12px 44px; cursor: pointer;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 6px var(--gold); } 50% { box-shadow: 0 0 22px var(--gold); } }

#game-date { font-size: 15px; letter-spacing: 3px; color: var(--cyan); }
#real-time { font-size: 11px; color: var(--ink-soft); letter-spacing: 1px; }
#dao-heart { font-size: 12px; color: var(--cinnabar); letter-spacing: 2px; }
#realm-name { font-size: 34px; letter-spacing: 12px; }

/* ── 奇遇选项效果徽章（只给方向不给数值） ── */
.ev-badge {
  display: inline-block; min-width: 18px; padding: 0 4px; margin-right: 4px;
  border: 1px solid currentColor; border-radius: 3px; font-size: 11px; line-height: 16px;
  vertical-align: middle; opacity: .85;
}
.ev-badge-good { color: #3a7d44; }   /* 益 / 仁 */
.ev-badge-bad { color: var(--cinnabar); } /* 耗 / 贪 / 异 */
.ev-badge-buff { color: var(--cyan); }    /* 势 */
.ev-badge-perm { color: var(--gold); }    /* 恒 */
.ev-badge-chain { color: #7a5ba6; }       /* 缘 */

/* ── 突破策略行 ── */
.tactic-row { text-align: left; }
.tactic-sel { border-color: var(--cinnabar) !important; color: var(--cinnabar); background: rgba(168, 50, 50, .06); }

/* ── 图鉴 ── */
.codex-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 10px; }
.codex-cell {
  border: 1px dashed var(--ink-soft); border-radius: 3px; text-align: center;
  font-size: 11px; padding: 4px 2px; color: var(--ink-soft); overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.codex-cell.seen { border-style: solid; color: var(--ink); background: rgba(255, 255, 255, .45); }
.codex-cell.seen.rarity-仙 { box-shadow: 0 0 6px rgba(168, 50, 50, .4); }
.codex-cell.seen.rarity-珍 { box-shadow: 0 0 6px rgba(184, 134, 11, .35); }
.codex-chain { font-size: 13px; padding: 3px 0; border-bottom: 1px dashed rgba(43, 43, 43, .15); }

/* ── 建筑主动技能按钮 ── */
.b-ability {
  margin-top: 4px; width: 100%; padding: 4px; cursor: pointer;
  background: none; border: 1px solid var(--cyan); color: var(--cyan);
  border-radius: 3px; font-size: 12px; font-family: inherit;
}
.b-ability:disabled { border-color: var(--ink-mute); color: var(--ink-mute); cursor: not-allowed; }

#xp-bar {
  width: 60%; height: 22px; border: 1px solid var(--ink-soft); border-radius: 11px;
  position: relative; background: var(--paper-dim); overflow: visible;
}
#xp-fill {
  height: 100%; width: 0%; border-radius: 10px;
  background: linear-gradient(90deg, var(--cyan), rgba(61, 90, 108, .6));
  transition: width .25s;
  position: relative; overflow: hidden;
}
/* ── A4 进度条：境界色填充 + 莫比乌斯环式流转（双向柔和光带循环往复；按住吐纳加速） ── */
#xp-fill::before, #xp-fill::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
#xp-fill::before {
  background: linear-gradient(90deg, transparent 5%, rgba(245,240,230,.42) 32%, rgba(245,240,230,.06) 55%, transparent 85%);
  background-size: 200% 100%;
  animation: mobiusA 3.6s linear infinite;
}
#xp-fill::after {
  background: linear-gradient(90deg, transparent 10%, rgba(220,235,255,.26) 45%, transparent 80%);
  background-size: 260% 100%;
  animation: mobiusB 5.4s linear infinite;
}
#xp-fill.fast::before { animation-duration: 1.2s; }
#xp-fill.fast::after { animation-duration: 1.8s; }
@keyframes mobiusA { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes mobiusB { from { background-position: -200% 0; } to { background-position: 200% 0; } }

/* ── Q 版太极小人：站在进度条最前端，随进度右移 ── */
#taichi-monk {
  position: absolute; top: -26px; left: 0; width: 34px; height: 38px;
  margin-left: -17px; pointer-events: none; z-index: 3;
  transition: left .25s ease;
}
.monk-svg {
  width: 100%; height: 100%;
  stroke: var(--ink); fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  animation: monkFloat 2.4s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 3px rgba(43,43,43,.3));
}
.monk-svg .seal { fill: var(--cinnabar); stroke: none; }
@keyframes monkFloat { from { transform: translateY(0); } to { transform: translateY(-3px); } }
/* 云手：双臂交替大幅揉球（肉眼可见的太极动作） */
.taichi-arm { transform-box: view-box; transform-origin: 50% 46%; animation: armTop 2.2s ease-in-out infinite alternate; }
.taichi-arm-top { transform-origin: 50% 40%; }
.taichi-arm-low { animation-name: armLow; }
@keyframes armTop { from { transform: rotate(-16deg); } to { transform: rotate(12deg); } }
@keyframes armLow { from { transform: rotate(14deg); } to { transform: rotate(-12deg); } }
/* 修为满：小人收势金光 */
#xp-bar.full #xp-fill { background: linear-gradient(90deg, var(--gold), rgba(184,134,11,.7)); }
#xp-bar.full .monk-svg { stroke: var(--gold); filter: drop-shadow(0 0 6px rgba(184,134,11,.55)); }

/* ── 小人境界排面：境界越高特效越华丽（练气/筑基素体） ── */
#taichi-monk .fx { position: absolute; pointer-events: none; display: none; }
/* 金丹+：脚下地光环 */
#taichi-monk[data-realm="2"] .fx-halo, #taichi-monk[data-realm="3"] .fx-halo,
#taichi-monk[data-realm="4"] .fx-halo, #taichi-monk[data-realm="5"] .fx-halo,
#taichi-monk[data-realm="6"] .fx-halo, #taichi-monk[data-realm="7"] .fx-halo,
#taichi-monk[data-realm="8"] .fx-halo, #taichi-monk[data-realm="9"] .fx-halo {
  display: block; left: 50%; bottom: -4px; width: 34px; height: 9px; margin-left: -17px;
  border: 1.5px solid rgba(184,134,11,.45); border-radius: 50%;
  animation: haloBreath 3s ease-in-out infinite alternate;
}
@keyframes haloBreath { from { opacity: .4; } to { opacity: .9; } }
/* 元婴+：两颗灵星绕身 */
#taichi-monk[data-realm="3"] .fx-star.s1, #taichi-monk[data-realm="4"] .fx-star.s1,
#taichi-monk[data-realm="5"] .fx-star.s1, #taichi-monk[data-realm="6"] .fx-star.s1,
#taichi-monk[data-realm="7"] .fx-star.s1, #taichi-monk[data-realm="8"] .fx-star.s1,
#taichi-monk[data-realm="9"] .fx-star.s1,
#taichi-monk[data-realm="3"] .fx-star.s2, #taichi-monk[data-realm="4"] .fx-star.s2,
#taichi-monk[data-realm="5"] .fx-star.s2, #taichi-monk[data-realm="6"] .fx-star.s2,
#taichi-monk[data-realm="7"] .fx-star.s2, #taichi-monk[data-realm="8"] .fx-star.s2,
#taichi-monk[data-realm="9"] .fx-star.s2 {
  display: block; left: 50%; top: 55%; width: 4px; height: 4px; margin: -2px;
  border-radius: 50%; background: radial-gradient(circle, rgba(143,173,192,.95), rgba(143,173,192,0) 70%);
  animation: starOrbit 5s linear infinite;
}
#taichi-monk .fx-star.s2 { animation-duration: 8s; animation-direction: reverse; }
@keyframes starOrbit { from { transform: rotate(0) translateX(22px); } to { transform: rotate(360deg) translateX(22px); } }
/* 化神+：淡青气旋 */
#taichi-monk[data-realm="4"] .fx-aura, #taichi-monk[data-realm="5"] .fx-aura,
#taichi-monk[data-realm="6"] .fx-aura, #taichi-monk[data-realm="7"] .fx-aura,
#taichi-monk[data-realm="8"] .fx-aura, #taichi-monk[data-realm="9"] .fx-aura {
  display: block; inset: -6px -8px;
  background: radial-gradient(ellipse at 50% 60%, rgba(61,90,108,.22), transparent 68%);
  filter: blur(2px);
  animation: auraSpin 7s linear infinite;
}
@keyframes auraSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
/* 合体+：第三颗灵星 */
#taichi-monk[data-realm="6"] .fx-star.s3, #taichi-monk[data-realm="7"] .fx-star.s3,
#taichi-monk[data-realm="8"] .fx-star.s3, #taichi-monk[data-realm="9"] .fx-star.s3 {
  display: block; left: 50%; top: 55%; width: 3.4px; height: 3.4px; margin: -1.7px;
  border-radius: 50%; background: radial-gradient(circle, rgba(184,134,11,.9), rgba(184,134,11,0) 70%);
  animation: starOrbit 6.5s linear infinite;
}
/* 大乘+：金身 */
#taichi-monk[data-realm="7"] .monk-svg, #taichi-monk[data-realm="8"] .monk-svg,
#taichi-monk[data-realm="9"] .monk-svg {
  stroke: #8a6d1d;
  filter: drop-shadow(0 0 5px rgba(184,134,11,.5));
}
/* 渡劫+：第四颗灵星（电白） */
#taichi-monk[data-realm="8"] .fx-star.s4, #taichi-monk[data-realm="9"] .fx-star.s4 {
  display: block; left: 50%; top: 55%; width: 3px; height: 3px; margin: -1.5px;
  border-radius: 50%; background: radial-gradient(circle, rgba(245,240,230,.95), rgba(245,240,230,0) 70%);
  animation: starOrbit 4.2s linear infinite;
}
/* 飞升：背后禅光圆相 */
#taichi-monk[data-realm="9"] .fx-zen {
  display: block; inset: -10px -14px;
  border: 1.5px solid rgba(184,134,11,.35); border-radius: 50%;
  background: radial-gradient(circle, rgba(184,134,11,.10), transparent 70%);
  animation: haloBreath 4s ease-in-out infinite alternate;
}

/* ── 中咒邪相：debuff 时小人染邪、黑雾缭绕（盖过灵光） ── */
#taichi-monk.cursed .monk-svg { stroke: #453a44; filter: drop-shadow(0 0 4px rgba(60,30,50,.65)); }
#taichi-monk.cursed .fx-halo, #taichi-monk.cursed .fx-star,
#taichi-monk.cursed .fx-aura, #taichi-monk.cursed .fx-zen { display: none !important; }
#taichi-monk .fx-curse {
  display: none; inset: -8px -10px;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(45,25,45,.4), transparent 55%),
    radial-gradient(ellipse at 70% 65%, rgba(45,25,45,.32), transparent 55%);
  filter: blur(1.5px);
  animation: curseSwirl 6s ease-in-out infinite alternate;
}
#taichi-monk.cursed .fx-curse { display: block; }
@keyframes curseSwirl { from { transform: rotate(-8deg) scale(1); opacity: .75; } to { transform: rotate(10deg) scale(1.08); opacity: .95; } }

#forewarn { box-sizing: border-box; color: var(--cinnabar); background: rgba(184, 62, 62, .06); border: 1px solid currentColor; border-radius: 999px; padding: 4px 12px; min-height: 30px; font: inherit; font-size: 13px; letter-spacing: 2px; cursor: pointer; white-space: nowrap; animation: pulse 2s infinite; }
#forewarn:hover { background: rgba(184, 62, 62, .14); }
.hidden { display: none !important; }

/* ── 建筑卡 ── */
.b-card {
  border: 1px solid rgba(43, 43, 43, .3); border-radius: 4px;
  padding: 8px 10px; margin-bottom: 8px; background: rgba(255, 255, 255, .35);
  position: relative;
}
.b-card.locked { opacity: .45; filter: grayscale(1); }
.b-head { display: flex; justify-content: space-between; align-items: baseline; }
.b-name { font-size: 15px; }
.b-lv { color: var(--cyan); font-size: 12px; }
.b-desc { font-size: 11px; color: var(--ink-soft); margin: 2px 0; }
.b-rate { font-size: 12px; color: var(--cyan); }
.b-buy {
  margin-top: 5px; width: 100%; padding: 6px; cursor: pointer;
  background: var(--cyan); color: var(--paper); border: none; border-radius: 3px; font-size: 13px;
}
.b-buy:disabled { background: #b8b8b0; cursor: not-allowed; }
.b-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(43,43,43,.16); transition: transform .15s, box-shadow .15s; }
.b-card:hover .b-icon { opacity: 1; filter: drop-shadow(0 0 4px rgba(61,90,108,.4)); }
.b-card .new-badge {
  position: absolute; top: -6px; right: -6px; background: var(--cinnabar); color: var(--paper);
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
}
.b-icon {
  width: 30px; height: 30px; margin-right: 8px; vertical-align: -8px;
  stroke: var(--ink); fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 1;
  filter: drop-shadow(0 1px 1px rgba(43,43,43,.25));
}
.b-icon .seal { fill: var(--cinnabar); stroke: none; }

/* ── 隔世重逢前缀行 ── */
.past-life-line { font-size: 12px; color: #7a5ba6; margin-bottom: 8px; letter-spacing: 1px; }

/* ── 碑林 ── */
.stele { border: 1px solid rgba(43,43,43,.3); border-radius: 4px; padding: 8px 10px; margin: 6px 0; background: rgba(255,255,255,.4); }
.stele-title { font-weight: bold; letter-spacing: 2px; margin-bottom: 4px; color: var(--ink); }
.stele-body { font-size: 12px; line-height: 1.8; color: var(--ink-soft); white-space: pre-wrap; font-family: inherit; margin: 0 0 4px; }

/* ── 见闻 / 福泽 ── */
#log-list { min-height: 120px; max-height: 32vh; overflow-y: auto; font-size: 12px; }
.log-item { border-bottom: 1px dashed rgba(43, 43, 43, .2); padding: 4px 0; }
.log-title { color: var(--ink); }
.log-choice { color: var(--cyan); }
.log-gain { color: var(--cinnabar); }
#perm-list { font-size: 12px; color: var(--ink-soft); min-height: 40px; }
.perm-total { font-size: 15px; color: var(--cinnabar); }
.perm-item { padding: 2px 0; }
.wen-actions { gap:6px; }
#right-panel .wen-btn { flex:1 1 0; min-width:0; min-height:34px; padding:6px 5px; font-size:12px; white-space:nowrap; }
#right-panel .wen-tool-btn { min-height:0; padding:2px 8px; font-size:11px; }

/* ── Tooltip ── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 115%; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 7px 10px; border-radius: 4px;
  max-width: 260px; width: max-content; font-size: 12px; line-height: 1.5; white-space: pre-line;
  z-index: 60; pointer-events: none; box-shadow: 0 3px 12px rgba(0,0,0,.3);
}
[data-tip].tip-below:hover::after { bottom: auto; top: 115%; }

/* ── 弹窗 ── */
.modal-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 20, 20, .55);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease-out;
}
.modal-card {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px;
  max-width: 560px; width: 92%; max-height: 84vh; overflow-y: auto;
  padding: 22px 26px; position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4);
  animation: riseUp .2s ease-out;
}
/* 斗法弹窗加宽：手牌要放得下「费用圆点 + 招名 + 效果」且不挤压 */
body:has(#battle-hands) .modal-card { max-width: 680px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-size: 22px; letter-spacing: 4px; margin-bottom: 10px; }
.modal-desc { font-size: 14px; line-height: 1.9; color: var(--ink); margin-bottom: 16px; }
.modal-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink-soft); }

.ev-option {
  display: block; width: 100%; margin: 8px 0; padding: 12px;
  border: 1px solid var(--ink-soft); background: rgba(255, 255, 255, .4);
  border-radius: 4px; font-size: 15px; cursor: pointer; text-align: center; font-family: inherit;
}
.ev-option.is-locked-choice { border-style:dashed; opacity:.72; }
.ev-option.is-locked-choice small { display:block; margin-top:4px; color:var(--cinnabar); font-size:11px; }
.ev-option:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.ev-leave { color: var(--ink-soft); border-style: dashed; }
.ev-countdown { position: absolute; top: 10px; right: 46px; color: var(--ink-soft); font-size: 13px; }

/* 稀有度边框 */
.rarity-凡 { border-color: #b0a89a !important; }
.rarity-灵 { border-color: var(--cyan) !important; box-shadow: 0 0 10px rgba(61, 90, 108, .35); }
.rarity-珍 { border-color: var(--gold) !important; box-shadow: 0 0 12px rgba(184, 134, 11, .4); }
.rarity-仙 { border-color: var(--cinnabar) !important; box-shadow: 0 0 16px rgba(168, 50, 50, .5); }
.rarity-tag { font-size: 11px; padding: 1px 8px; border: 1px solid currentColor; border-radius: 3px; margin-right: 8px; }

/* 离线卷轴 */
.offline-scroll { text-align: center; }
.offline-gain-row { display: flex; justify-content: space-between; font-size: 15px; margin: 6px 12px; }
.offline-capped { color: var(--cinnabar); font-size: 13px; margin-top: 8px; }

/* 破境过场 */
#breakthrough-overlay {
  position: fixed; inset: 0; z-index: 70; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; animation: fadeIn .3s;
}
#breakthrough-overlay .bt-text { font-size: 22px; line-height: 2.2; letter-spacing: 3px; max-width: 640px; text-align: center; padding: 0 30px; }
#breakthrough-overlay .bt-hint { margin-top: 30px; font-size: 12px; color: var(--ink-soft); }
.ink-splash {
  position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(43,43,43,.25), transparent 70%);
  animation: inkSpread 1.4s ease-out forwards;
}
@keyframes inkSpread { from { transform: scale(.1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }

/* 设置面板 */
.set-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; gap: 10px; }
.set-row label { font-size: 14px; }
.set-textarea { width: 100%; height: 70px; font-size: 11px; font-family: monospace; margin: 4px 0; border: 1px solid var(--ink-soft); border-radius: 3px; background: rgba(255,255,255,.5); }
.set-input { flex: 1; padding: 6px; border: 1px solid var(--ink-soft); border-radius: 3px; font-family: inherit; }
.set-llm-status { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.danger-zone { border-top: 1px dashed var(--cinnabar); margin-top: 12px; padding-top: 10px; }
#btn-reset { background: none; border: 1px solid var(--cinnabar); color: var(--cinnabar); border-radius: 4px; position: relative; overflow: hidden; padding: 8px 16px; cursor: pointer; }
#btn-reset .hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(168, 50, 50, .35); }

/* 转生面板 */
.rebirth-item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed rgba(43,43,43,.2); padding: 6px 0; gap: 8px; }
.rebirth-item.bought { opacity: .95; }
.rebirth-item .stamp {
  border: 2px solid var(--cinnabar); color: var(--cinnabar); font-size: 11px;
  padding: 1px 6px; border-radius: 3px; transform: rotate(-6deg); display: inline-block;
}
.rebirth-item button { padding: 4px 10px; }

/* toast */
/* ── 版本号水印（右下角淡墨） ── */
#version-mark {
  position: fixed; right: 12px; bottom: 6px; z-index: 2;
  font-size: 11px; letter-spacing: 1px;
  color: var(--ink-soft); opacity: .4;
  pointer-events: none; user-select: none;
}
html.night body #version-mark { opacity: .3; }

#toast-root { position: fixed; top: 90px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--paper); padding: 8px 20px; border-radius: 4px;
  font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.3); animation: riseUp .25s ease-out;
  box-sizing:border-box; max-width:calc(100vw - 24px); text-align:center;
  white-space:normal; overflow-wrap:anywhere; word-break:break-word;
}
.quest-card { width:min(760px,94vw); max-width:760px; max-height:min(88vh,820px); overflow-y:auto; overscroll-behavior:contain; }

/* 遮罩报错 */
#fatal-overlay {
  position: fixed; inset: 0; z-index: 99; background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--cinnabar); text-align: center; padding: 40px; line-height: 2;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* 窄窗降级单列 */
/* ── A1 云雾：静态墨团 + 透明度呼吸（不做左右位移） ── */
.cloud-band {
  position: fixed; left: 0; z-index: 0; pointer-events: none;
  width: 200vw; height: 300px;
  animation: cloudBreath 26s ease-in-out infinite alternate;
}
.cloud-far { top: 18%; opacity: .22; }
.cloud-near { top: 38%; opacity: .32; animation-duration: 34s; }
@keyframes cloudBreath { from { opacity: .16; } to { opacity: .38; } }

/* ── A4 飘字：圈正上方生成、上浮 46px、缓慢淡出消散 ── */
.float-num {
  position: absolute; left: 50%; top: -6px;
  transform: translateX(-50%);
  font-size: 14px; color: var(--cyan); text-shadow: 0 0 6px rgba(61,90,108,.35);
  pointer-events: none; white-space: nowrap; z-index: 5;
  animation: floatFade 1.1s ease-out forwards;
}
.float-num.gold { color: var(--gold); text-shadow: 0 0 6px rgba(184,134,11,.35); }
@keyframes floatFade {
  0%   { transform: translate(-50%, 0) scale(.9); opacity: 0; }
  15%  { transform: translate(-50%, -10px) scale(1.05); opacity: .95; }
  70%  { opacity: .8; }
  100% { transform: translate(-50%, -46px) scale(.96); opacity: 0; }
}

/* ── A4 进度条流光：已由莫比乌斯流转（#xp-fill::before/::after）取代，此处仅保留降级 ── */
@media (prefers-reduced-motion: reduce) {
  #xp-fill::before, #xp-fill::after { animation: none !important; opacity: .5; }
}

/* ── A4 数字弹跳 ── */
.num-pop { animation: numPop .2s ease; }
@keyframes numPop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ── A6 卷轴初展 ── */
.modal-mask.scroll-open .modal-card {
  clip-path: inset(0 0);
  animation: scrollOpen .4s ease-out;
}
.modal-mask.scroll-open .modal-card::before,
.modal-mask.scroll-open .modal-card::after {
  content: ""; position: absolute; left: -6px; right: -6px; height: 10px;
  background: linear-gradient(180deg, #4a3b2a, #2b2117);
  border-radius: 5px; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.modal-mask.scroll-open .modal-card::before { top: -8px; }
.modal-mask.scroll-open .modal-card::after { bottom: -8px; }
.modal-mask.scroll-open .modal-card .cinnabar-sweep {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(168,50,50,.45), transparent);
  animation: sweepLine .45s ease-out forwards;
}
@keyframes sweepLine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes scrollOpen { from { clip-path: inset(48% 0); opacity: .6; } to { clip-path: inset(0 0); opacity: 1; } }

/* ── A5 一笔通玄：凌空大字与朱印 ── */
.br-char { font-size: 96px; color: var(--paper); }
.br-char.cinnabar { color: #e8b9b0; }
/* 突破雷光：横向亮线扫过（金丹起） */
.bt-lightning {
  position: absolute; left: 0; right: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(220,235,255,.95), transparent);
  box-shadow: 0 0 18px rgba(200,225,255,.8);
  animation: btSweep .45s ease-out forwards;
}
@keyframes btSweep { from { transform: translateX(-100%); opacity: 0; } 30% { opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
/* 大字笔势揭示 */
.br-write { display: inline-block; clip-path: inset(0 100% 0 0); animation: charWrite .6s steps(10) forwards; }
@keyframes charWrite { to { clip-path: inset(0 0 0 0); } }
.br-seal {
  display: inline-block; margin-left: 14px; padding: 4px 8px;
  border: 3px solid rgba(168,50,50,.9); color: rgba(168,50,50,.95);
  font-size: 18px; border-radius: 3px;
  animation: sealDown .3s ease-out .45s backwards;
}
@keyframes sealDown { from { transform: scale(1.5) rotate(-7deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }

/* ── reduced-motion：全部环境动画降级为静止 ── */
@media (prefers-reduced-motion: reduce) {
  .cloud-band { animation: none; opacity: .26; }
  #xp-fill { animation: none !important; background-image: none !important; }
  #btn-break { animation: none !important; box-shadow: 0 0 10px var(--gold); }
  #btn-breath { animation: none !important; }
  .ripple, .ink-splash { display: none !important; }
  .float-num { animation: none !important; opacity: .9; }
  .modal-mask.scroll-open .modal-card { animation: fadeIn .2s ease-out; }
  .br-seal { animation: none; }
}

/* ── 渡劫天劫：闪电劈小人（成功升级 / 失败跪地吐血后爬起） ── */
.tribulation {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: rgba(10, 10, 18, .55);
  transition: background .2s;
}
.tribulation .bolt {
  position: absolute; transform-origin: top center;
  filter: drop-shadow(0 0 12px rgba(200,225,255,.9));
}
.tribulation.flash { background: rgba(235,242,255,.92); }
.tribulation.flash .bolt { opacity: 1; }
@keyframes boltFlicker { 0%,100% { opacity: .2; } 8%,14%,30% { opacity: 1; } 11%,22% { opacity: .35; } }
.tribulation .bolt { animation: boltFlicker 1s steps(1) 1.4; }
.monk-svg .blood { stroke: #a83232; fill: #a83232; stroke-width: 2; }
#taichi-monk.kneel .monk-svg use { href: url(#taichi-monk-kneel); }
#taichi-monk.kneel { animation: kneelShake .5s ease-out; }
@keyframes kneelShake { 0% { transform: translateY(0); } 30% { transform: translateY(4px); } 60% { transform: translateY(1px); } 100% { transform: translateY(0); } }
.blood-drop {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #a83232, rgba(168,50,50,.3) 75%);
  pointer-events: none; animation: bloodDrop .8s ease-in forwards;
}
@keyframes bloodDrop { from { transform: translateY(0) scale(1); opacity: .95; } to { transform: translateY(26px) scale(.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tribulation .bolt { animation: none; opacity: 1; }
  #taichi-monk.kneel { animation: none; }
  .blood-drop { animation: none; opacity: .8; }
}

@media (max-width: 1100px) {
  body { overflow: auto; }
  #app {
    grid-template-areas: "header" "center" "left" "right";
    grid-template-columns: 1fr; grid-template-rows: auto auto auto auto;
    height: auto;
  }
  #left-panel, #right-panel { max-height: none; }
}

@media (min-width: 1101px) {
  #topbar { flex-wrap:nowrap; gap:10px; padding:7px 10px; }
  #res-bar { flex:1 1 auto; flex-wrap:nowrap; gap:clamp(6px,.65vw,11px); overflow:visible; }
  #res-bar .res-row { flex:0 0 auto; min-width:0; gap:3px; overflow:visible; white-space:nowrap; }
  #res-bar .res-name { flex:0 0 auto; }
  #res-bar .res-val { flex:0 0 auto; min-width:0; overflow:visible; white-space:nowrap; font-size:17px; font-variant-numeric:tabular-nums; }
  #res-bar .res-rate { display:none; }
  #res-bar .res-row[data-res="danyao"] { flex:0 0 auto; }
  #res-bar #btn-pill { margin-left:2px; }
  #res-bar #btn-pill,#res-bar #btn-pillhouse { min-height:27px; padding:2px 6px; font-size:11px; }
  #res-bar .equip-row { flex:1 1 105px; min-width:72px; max-width:150px; gap:3px; padding-left:6px; overflow:hidden; }
  #buff-bar { flex:0 1 auto; max-width:min(28vw,320px); flex-wrap:nowrap; white-space:nowrap; overflow-x:auto; }
  #buff-bar .buff-chip { flex:0 0 auto; }
  #top-right { flex:0 0 auto; flex-wrap:nowrap; }
}

@media (min-width: 1500px) {
  #res-bar .res-rate { display:inline; flex:0 0 auto; white-space:nowrap; font-size:11px; }
}

/* ── 斗法（回合制选牌） ── */
.battle-card-row { display:flex; align-items:stretch; gap:10px; margin:8px 0; }
.bc-side { flex:1; background:rgba(0,0,0,.18); border:1px solid var(--ink-soft,#7a6a55); border-radius:8px; padding:10px 12px; }
.bc-dao { font-size:15px; margin-bottom:6px; color:var(--ink,#e8dcc8); }
.bc-line { font-size:12px; color:var(--ink-soft,#a6987f); line-height:1.7; }
.bc-vs { align-self:center; font-size:20px; color:var(--cinnabar,#c0392b); padding:0 2px; }
.battle-hp-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.bh-side { flex:1; font-size:13px; }
.bh-vs { font-size:18px; color:var(--cinnabar,#c0392b); }
.bh-hp { height:10px; background:rgba(255,255,255,.08); border:1px solid rgba(122,106,85,.6); border-radius:5px; overflow:hidden; margin:4px 0 2px; }
.bh-fill { height:100%; width:100%; background:linear-gradient(90deg,#3f7d4e,#69a06a); transition:width .35s ease; }
.bh-fill.op { background:linear-gradient(90deg,#8c3b2e,#c0654a); }
.bh-shield { display:inline-block; margin-left:4px; padding:0 6px; border:1px solid #b8a25a; border-radius:8px; color:#d8c878; font-size:11px; }
.battle-intent { margin:6px 0; padding:7px 10px; text-align:center; font-size:13px; color:#e8c98a; background:rgba(120,80,20,.18); border:1px dashed #b8a25a; border-radius:8px; }
.battle-log { height:132px; overflow-y:auto; background:rgba(0,0,0,.22); border:1px solid rgba(122,106,85,.4); border-radius:8px; padding:8px 10px; margin-bottom:8px; }
.battle-line { font-size:12.5px; line-height:1.8; color:var(--ink,#d8ccb4); }
.battle-qi { text-align:center; font-size:12px; color:var(--ink-soft,#a6987f); margin-bottom:6px; }
.qi-dot { color:#4a4438; margin:0 2px; font-size:13px; }
.qi-dot.on { color:#e8c34a; text-shadow:0 0 6px rgba(232,195,74,.55); }
/* 手牌区固定两行高（8 张正好两行）：手牌数随余点变，若用 min-height 弹窗会跟着一涨一缩；
   窄屏放不下时在本区内滚动，弹窗尺寸始终不变 */
.battle-hands { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; align-content:flex-start; margin-bottom:10px; padding:12px 12px 0; height:242px; overflow-y:auto; overflow-x:hidden; }
.hand-card { position:relative; width:144px; min-height:110px; padding:22px 8px 8px; background:linear-gradient(180deg,rgba(58,50,38,.9),rgba(30,26,20,.9)); border:1px solid #7a6a55; border-radius:9px; color:var(--ink,#e8dcc8); cursor:pointer; text-align:center; transition:transform .12s ease, border-color .12s ease; font-size:13px; }
.hand-card:hover:not(:disabled) { transform:translateY(-4px); border-color:var(--cinnabar,#c0392b); }
.hand-card:disabled { cursor:not-allowed; opacity:.38; filter:grayscale(.6); }
.hand-card[aria-disabled="true"] { cursor:not-allowed; opacity:.48; filter:grayscale(.5); }
.hand-card b { display:block; font-size:16px; margin-bottom:4px; }
.hc-cost { position:absolute; top:-9px; left:-9px; width:28px; height:28px; line-height:26px; border-radius:50%; background:radial-gradient(circle at 35% 35%,#f0d878,#b8912e); color:#2a2008; font-weight:700; font-size:14px; border:1px solid #6b5316; }
.hc-el { display:block; font-size:12px; color:#8fb4c8; }
.hc-eff { display:block; margin-top:4px; font-size:12.5px; color:#c8a86a; }
#battle-hands { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); gap:6px; align-content:stretch; height:174px; padding:9px; overflow:hidden; }
#battle-hands .hand-card { width:100%; min-width:0; min-height:0; height:100%; padding:17px 5px 5px; font-size:11px; }
#battle-hands .hand-card b { margin-bottom:2px; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#battle-hands .hc-el { font-size:10.5px; }
#battle-hands .hc-eff { margin-top:2px; font-size:10.5px; line-height:1.25; }
#battle-hands .hc-cost { top:-6px; left:-6px; width:22px; height:22px; line-height:20px; font-size:11px; }
.battle-disciple-skills { height:auto; min-height:88px; max-height:176px; padding:6px 8px 8px; display:flex; justify-content:center; align-items:stretch; align-content:flex-start; overflow-y:auto; }
.battle-disciple-skills .hand-card { flex:0 1 190px; width:190px; min-height:82px; padding:10px 8px 7px; }
.battle-disciple-skills .hand-card b { font-size:13px; margin-bottom:3px; }
.battle-disciple-skills .disciple-skill-desc { display:block; font-size:11px; line-height:1.35; color:var(--ink,#e8dcc8); }
.battle-disciple-skills .hc-eff { font-size:10px; margin-top:4px; }
.battle-rest-wrap { text-align:center; }
.battle-rest-wrap #battle-end { min-width:148px; }

/* 矮屏回落（≤860 高）：卡与舞台各收一档，保证弹窗不超 84vh、圆点仍不裁 */
@media (max-height:860px){
  body:has(#battle-hands) .modal-card { max-width: 660px; }
  .battle-hands { height:220px; padding:11px 11px 0; }
  .hand-card { width:132px; min-height:94px; padding:20px 7px 7px; }
  .hand-card b { font-size:15px; }
  .hc-cost { width:25px; height:25px; line-height:23px; font-size:13px; top:-8px; left:-8px; }
  .battle-stage { height:172px; }
}

/* ── 卡组整备（皇室战争式四类构筑） ── */
.deck-editor-card { width:min(720px,94vw); height:min(90vh,780px); max-height:min(90vh,780px); overflow:hidden; display:flex; flex-direction:column; }
.deck-editor-card > .modal-title,
.deck-editor-card > .modal-desc,
.deck-editor-card > .deck-order,
.deck-editor-card > .deck-actions,
.deck-editor-card > .deck-login-actions { flex:0 0 auto; }
.deck-editor-card > .deck-row { flex:1 1 auto; min-height:112px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:9px; border:1px solid rgba(122,106,85,.35); border-radius:6px; align-content:flex-start; }
.deck-editor-card > .deck-order { max-height:min(30vh,260px); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.deck-row { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.deck-col { flex:1; min-width:118px; max-width:150px; }
.deck-kind { text-align:center; font-size:12px; letter-spacing:3px; color:var(--cinnabar,#c0392b); border-bottom:1px solid rgba(122,106,85,.5); padding-bottom:4px; margin-bottom:6px; }
.deck-card { display:block; width:100%; min-height:58px; margin-bottom:6px; padding:7px 6px 8px; background:linear-gradient(180deg,rgba(58,50,38,.9),rgba(30,26,20,.9)); border:1px solid #5d5142; border-radius:8px; color:var(--ink,#e8dcc8); cursor:pointer; text-align:center; font-size:12px; transition:border-color .12s ease,background .12s ease,box-shadow .12s ease,transform .12s ease; }
.deck-card:hover { border-color:var(--cinnabar,#c0392b); transform:translateY(-2px); }
.deck-card:active { transform:translateY(0); }
.deck-card b { display:block; font-size:12.5px; margin-bottom:2px; }
.deck-card span { display:block; font-size:10.5px; }
.deck-card .deck-card-meta { min-height:16px; color:#c8a86a; }
.deck-card-off { background:linear-gradient(180deg,rgba(58,50,38,.82),rgba(30,26,20,.88)); border-color:#5d5142; }
.deck-card-on { background:linear-gradient(180deg,rgba(42,91,78,.96),rgba(24,54,48,.96)); border-color:#e8c34a; box-shadow:inset 0 0 0 1px rgba(232,195,74,.18),0 0 9px rgba(232,195,74,.3); color:#fff8e8; }
.deck-card-on .deck-card-meta { color:#f0d88b; }
.deck-card:focus-visible { outline:2px solid var(--cinnabar,#c0392b); outline-offset:2px; }
.deck-card-locked { opacity:.42; filter:grayscale(.7); cursor:not-allowed; }
.deck-order { margin:0 0 14px; padding:10px; border:1px dashed rgba(122,106,85,.5); border-radius:6px; }
.deck-order-title { margin-bottom:7px; text-align:center; color:var(--cinnabar,#c0392b); font-size:12px; letter-spacing:3px; }
.deck-order-item { display:grid; grid-template-columns:26px minmax(0,1fr) 42px 32px 32px 32px; align-items:center; gap:5px; min-height:34px; border-top:1px solid rgba(122,106,85,.18); }
.deck-order-item:first-of-type { border-top:0; }
.deck-order-item b { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.deck-order-index { width:22px; height:22px; line-height:22px; border-radius:50%; background:var(--cinnabar,#c0392b); color:#fff; text-align:center; font-size:11px; }
.deck-order-kind { color:var(--ink-soft); font-size:10px; text-align:center; }
.deck-move { width:32px; min-width:32px; height:30px; padding:0; font-size:16px; }
.deck-remove { color:var(--cinnabar,#c0392b); }
.deck-order-empty { padding:7px; text-align:center; color:var(--ink-soft); font-size:12px; }
.deck-actions { display:flex; justify-content:center; gap:8px; margin-top:8px; }
.deck-actions #dk-save { padding:7px 26px; }
.deck-login-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; padding-top:10px; border-top:1px dashed rgba(122,106,85,.45); }
.deck-login-actions label { display:flex; align-items:center; gap:5px; min-width:0; font-size:12px; cursor:pointer; }
.deck-login-actions input { flex:0 0 auto; }
.deck-login-actions small { color:var(--ink-soft); font-size:10px; }

@media (max-width:480px) {
  .deck-editor-card { width:94vw; height:92vh; max-height:92vh; padding:14px 13px; }
  .deck-editor-card > .modal-desc { font-size:11px; line-height:1.45; margin-bottom:7px; }
  .deck-editor-card > .deck-order { margin-bottom:8px; padding:7px; }
  .deck-editor-card > .deck-row { min-height:96px; padding:7px 5px; }
  .deck-editor-card { contain:layout paint; }
  .deck-editor-card > .deck-order { max-height:29vh; }
  .deck-editor-card .deck-col { min-width:112px; }
}

/* ── 大师兄档位选择 ── */
.senior-row { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:10px; }
.senior-tier { flex:1; min-width:150px; max-width:190px; padding:14px 10px; background:linear-gradient(180deg,#fffdf7,#ece3d1); border:1px solid #9b8b72; border-radius:8px; color:var(--ink,#2b2b2b); cursor:pointer; text-align:center; transition:border-color .12s ease, background .12s ease, box-shadow .12s ease, transform .12s ease; }
.senior-tier:hover { border-color:var(--cinnabar,#c0392b); transform:translateY(-3px); }
.senior-tier b { display:block; font-size:15px; letter-spacing:2px; margin-bottom:5px; }
.st-rel { display:block; font-size:11.5px; color:var(--gold,#e8c34a); margin-bottom:5px; }
.st-desc { display:block; font-size:11px; color:#514c42; line-height:1.6; }
.disciple-recruit-option { position:relative; display:block; cursor:pointer; padding-top:18px; }
.disciple-recruit-option input { position:absolute; top:9px; left:10px; width:16px; height:16px; accent-color:var(--cinnabar,#a83232); }
.disciple-recruit-option:has(input:checked) { background:#fff4dd; border-color:var(--cinnabar,#a83232); box-shadow:inset 0 0 0 1px rgba(168,50,50,.18),0 3px 12px rgba(80,55,30,.14); }
.disciple-manager-card { width:min(920px,94vw); height:min(88vh,780px); max-width:920px; max-height:min(88vh,780px); overflow:hidden; display:flex; flex-direction:column; }
.disciple-manager-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 11px; border:1px solid rgba(122,106,85,.38); border-radius:6px; background:rgba(255,255,255,.2); }
.disciple-manager-head > div { display:flex; align-items:baseline; gap:12px; min-width:0; }
.disciple-manager-head b { color:var(--cinnabar); font-size:15px; }
.disciple-manager-head span { color:var(--ink-soft); font-size:11px; }
.disciple-generation { flex:0 0 auto; margin:7px 0; font-size:11.5px; }
.disciple-list { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding:2px 5px 8px 1px; align-content:start; }
.disciple-card { min-width:0; padding:10px; border:1px solid rgba(122,106,85,.35); border-radius:6px; background:rgba(255,255,255,.16); }
.disciple-card.is-battle { border-color:var(--cinnabar); box-shadow:inset 3px 0 0 var(--cinnabar); }
.disciple-name { display:flex; align-items:center; gap:5px; min-width:0; }
.disciple-name > b { font-size:15px; margin-right:auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.disciple-battle-config { display:grid; grid-template-columns:auto minmax(110px,1fr); gap:7px; align-items:center; margin-top:7px; padding-top:7px; border-top:1px dashed rgba(122,106,85,.3); }
.disciple-battle-config label { display:flex; align-items:center; gap:4px; font-size:12px; white-space:nowrap; }
.disciple-battle-config input { accent-color:var(--cinnabar); }
.disciple-battle-config select { min-width:0; width:100%; padding:5px 6px; border:1px solid var(--ink-soft); border-radius:4px; color:var(--ink); background:var(--paper); font-family:inherit; }
.disciple-card-actions { display:flex; gap:5px; flex-wrap:wrap; margin-top:7px; }
.disciple-card-actions .icon-btn { min-height:28px; padding:3px 8px; font-size:11px; }
.disciple-route-grid,.disciple-exam-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.disciple-route,.disciple-exam { min-width:0; padding:12px 10px; border:1px solid rgba(122,106,85,.5); border-radius:6px; color:var(--ink); background:rgba(255,255,255,.22); text-align:left; cursor:pointer; }
.disciple-route b,.disciple-exam b { display:block; margin-bottom:4px; font-size:14px; color:var(--cinnabar); }
.disciple-route span,.disciple-exam span { display:block; font-size:11px; line-height:1.55; color:var(--ink-soft); }
.disciple-route:hover { border-color:var(--cinnabar); }
.disciple-exam-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.disciple-exam { position:relative; padding-left:36px; }
.disciple-exam input { position:absolute; left:11px; top:14px; width:16px; height:16px; accent-color:var(--cinnabar); }
.disciple-exam:has(input:checked) { border-color:var(--cinnabar); background:rgba(168,50,50,.08); }
.disciple-modal-actions { display:flex; justify-content:center; gap:8px; margin-top:12px; }
.disciple-recruit-card { max-width:760px; }
html.night body .senior-tier { color:var(--ink); background:linear-gradient(180deg,#3b4350,#292f39); border-color:#697485; }
html.night body .st-desc { color:#d8d0c0; }
html.night body .disciple-recruit-option:has(input:checked) { background:#463d34; border-color:var(--cinnabar); box-shadow:inset 0 0 0 1px rgba(208,104,90,.24); }
html.xie body .senior-tier { color:#f3e5df; background:linear-gradient(180deg,#3a2024,#211316); border-color:#75403f; }
html.xie body .st-desc { color:#dfcbc5; }
html.xie body .disciple-recruit-option:has(input:checked) { background:#522529; border-color:#d5544c; box-shadow:inset 0 0 0 1px rgba(255,221,184,.16); }

@media (max-width:640px) {
  .disciple-manager-card { width:95vw; height:92vh; max-height:92vh; padding:14px 12px; }
  .disciple-manager-card .modal-title { font-size:17px; letter-spacing:2px; }
  .disciple-manager-head { align-items:stretch; }
  .disciple-manager-head > div { display:block; }
  .disciple-manager-head span { display:block; margin-top:2px; }
  .disciple-manager-head .btn-primary { padding:6px 9px; font-size:11px; }
  .disciple-list { grid-template-columns:1fr; }
  .disciple-route-grid { grid-template-columns:1fr; }
  .disciple-exam-grid { grid-template-columns:1fr; }
  .disciple-recruit-card .senior-row { flex-direction:column; flex-wrap:nowrap; }
  .disciple-recruit-card .senior-tier { max-width:none; width:100%; box-sizing:border-box; }
}

@media (hover:none), (pointer:coarse) {
  button, .map-spot, .hand-card, .senior-tier { touch-action:manipulation; }
  button:not(:disabled) { min-height:36px; }
  .hand-card { min-height:0; }
  .hand-card:hover:not(:disabled), .senior-tier:hover { transform:none; }
  .quest-card { width:94vw; max-height:90vh; padding:15px 12px; }
  .quest-card .quest-ch-hd { min-height:38px; }
  .quest-card .rebirth-item { align-items:flex-start; padding:9px 2px; }
  .quest-card .rebirth-item button { min-height:36px; padding:6px 13px !important; flex:0 0 auto; }
}

/* 移动端最多三名出战弟子：技能固定一行显示，不再产生第二个纵向滚动区。 */
@media (max-width:640px) {
  .battle-disciple-skills {
    display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px;
    height:82px; min-height:82px; max-height:82px; overflow:hidden; padding:5px 6px;
  }
  .battle-disciple-skills .hand-card {
    width:100%; min-width:0; min-height:0; height:72px; padding:7px 4px 5px;
  }
  .battle-disciple-skills .hand-card b { font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .battle-disciple-skills .disciple-skill-desc {
    font-size:9px; line-height:1.25; display:-webkit-box; -webkit-box-orient:vertical;
    -webkit-line-clamp:2; overflow:hidden;
  }
  .battle-disciple-skills .hc-eff { font-size:8.5px; line-height:1.15; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}

/* ── 体系一览弹窗 & 更新公告 ── */
.codexpage-card { width:min(860px, 94vw); }
.codexpage-frame { width:100%; height:min(66vh, 560px); border:1px solid var(--ink-soft,#7a6a55); border-radius:8px; background:#15130f; }
.update-center { width:min(780px,94vw); max-height:min(82vh,720px); padding:20px; overflow:hidden; }
.update-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding-bottom:12px; border-bottom:1px solid rgba(122,106,85,.42); }
.update-head .modal-title { margin:0; }
.update-tabs { display:flex; align-items:center; gap:4px; }
.update-tab { min-height:34px; padding:6px 16px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--ink-soft,#7a6a55); font-family:inherit; font-size:15px; letter-spacing:2px; cursor:pointer; }
.update-tab:hover,.update-tab.is-active { color:var(--cinnabar,#9d392c); border-bottom-color:var(--cinnabar,#9d392c); }
.update-current { margin-top:4px; font-size:11px; color:var(--ink-soft,#7a6a55); }
.update-close { width:34px; min-width:34px; height:34px; padding:0; }
.update-layout { display:grid; grid-template-columns:132px minmax(0,1fr); min-height:0; height:min(58vh,480px); }
.update-layout-notice { display:block; }
.update-layout-notice .update-article { height:100%; padding-left:4px; }
.update-versions { padding:12px 10px 12px 0; border-right:1px solid rgba(122,106,85,.32); overflow-y:auto; }
.update-version { position:relative; display:flex; flex-direction:column; width:100%; min-height:54px; padding:9px 28px 8px 10px; border:0; border-left:2px solid transparent; background:transparent; color:var(--ink-soft,#7a6a55); text-align:left; cursor:pointer; }
.update-version:hover,.update-version.is-active { color:var(--ink,#292b29); border-left-color:var(--cinnabar,#9d392c); background:rgba(122,106,85,.08); }
.update-version span { font-size:13px; font-weight:700; }
.update-version small { margin-top:3px; font-size:10px; }
.update-version i { position:absolute; right:7px; top:9px; min-width:18px; height:18px; border-radius:9px; background:var(--cinnabar,#9d392c); color:#fff7e8; font:normal 10px/18px sans-serif; text-align:center; }
.update-article { min-width:0; padding:16px 4px 10px 20px; overflow-y:auto; }
.update-article-head { padding-bottom:10px; border-bottom:1px dashed rgba(122,106,85,.32); }
.update-article-head h2 { margin:3px 0 5px; font-size:20px; letter-spacing:2px; }
.update-article-head p { margin:0; color:var(--ink-soft,#7a6a55); font-size:12px; line-height:1.65; }
.update-date { font-size:10px; color:var(--cinnabar,#9d392c); }
.update-notes { overflow:visible; }
.update-section { padding:12px 0 3px; }
.update-section h3 { margin:0 0 5px; font-size:13px; letter-spacing:1px; color:var(--cinnabar,#9d392c); }
.update-section ul { margin:0; padding-left:1.4em; }
.update-section li { margin:5px 0; font-size:12.5px; line-height:1.7; color:var(--ink,#292b29); }
.update-actions { display:flex; justify-content:flex-end; align-items:center; gap:8px; padding-top:12px; border-top:1px solid rgba(122,106,85,.32); }
.update-unread-count { display:inline-block; margin-left:8px; padding:2px 6px; border-radius:8px; background:var(--cinnabar,#9d392c); color:#fff7e8; font-size:10px; line-height:1.2; }
.un-line { font-size:13px; line-height:1.9; padding:7px 4px 7px 2px; border-bottom:1px dashed rgba(122,106,85,.35); color:var(--ink,#292b29); }
.un-line:last-child { border-bottom:none; }

@media (max-width:600px) {
  .update-center { width:94vw; max-height:88vh; padding:14px 12px; }
  .update-head { padding-bottom:9px; }
  .update-layout { display:flex; flex-direction:column; height:min(66vh,560px); }
  .update-versions { display:flex; flex:0 0 auto; gap:6px; padding:9px 0; border-right:0; border-bottom:1px solid rgba(122,106,85,.32); overflow-x:auto; overflow-y:hidden; }
  .update-version { flex:0 0 104px; width:104px; min-height:46px; padding:7px 24px 6px 8px; border-left:0; border-bottom:2px solid transparent; }
  .update-version:hover,.update-version.is-active { border-left-color:transparent; border-bottom-color:var(--cinnabar,#9d392c); }
  .update-article { flex:1; padding:13px 3px 8px; }
  .update-article-head h2 { font-size:17px; }
  .update-section { padding-top:10px; }
  .update-section li { font-size:12px; line-height:1.65; }
  .update-actions { justify-content:space-between; }
}

/* ═══ v0.21 批一：仙侠背景三层 + 移动端手感修复 ═══ */
/* 全局：去除触摸高亮/长按选中/长按菜单 */
* { -webkit-tap-highlight-color: transparent; }
body {
  touch-action: manipulation;
  background:
    radial-gradient(ellipse 90% 55% at 85% 108%, rgba(90,110,125,.34), transparent 62%),
    radial-gradient(ellipse 80% 50% at 8% 106%, rgba(70,92,110,.30), transparent 60%),
    linear-gradient(180deg, rgba(58,74,88,.16) 0%, rgba(96,118,132,.10) 26%, rgba(150,168,178,.16) 58%, rgba(96,116,130,.26) 100%),
    linear-gradient(180deg, #f3ead8 0%, #efe4d0 55%, #e7dbc6 100%);
  position: relative;
}
/* 远山剪影两道（左上/右中，贴边不抢正文） */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 58% 26% at -6% 4%, rgba(52,74,92,.22), transparent 66%),
    radial-gradient(ellipse 64% 30% at 106% 22%, rgba(58,80,98,.18), transparent 64%),
    radial-gradient(ellipse 50% 20% at 110% 78%, rgba(48,68,86,.16), transparent 62%);
}
/* 云雾带两条 + 宣纸细丝纹 */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 16%, rgba(255,255,255,.10) 19%, transparent 23%),
    linear-gradient(180deg, transparent 58%, rgba(255,255,255,.08) 61%, transparent 65%),
    repeating-linear-gradient(45deg, rgba(120,100,70,.028) 0 1px, transparent 1px 3px);
}
/* 夜色主题换变量：远山改墨黑、云雾改月白 */
html.night body {
  background:
    radial-gradient(ellipse 90% 55% at 85% 108%, rgba(6,10,16,.5), transparent 62%),
    radial-gradient(ellipse 80% 50% at 8% 106%, rgba(4,8,14,.46), transparent 60%),
    linear-gradient(180deg, rgba(2,4,8,.4) 0%, rgba(8,14,22,.28) 30%, rgba(14,22,34,.34) 100%),
    linear-gradient(180deg, #12151c 0%, #0e1117 55%, #0a0d13 100%);
}
html.night body::before {
  background:
    radial-gradient(ellipse 58% 26% at -6% 4%, rgba(0,0,0,.4), transparent 66%),
    radial-gradient(ellipse 64% 30% at 106% 22%, rgba(0,0,0,.34), transparent 64%),
    radial-gradient(ellipse 50% 20% at 110% 78%, rgba(0,0,0,.3), transparent 62%);
}
html.night body::after {
  background:
    linear-gradient(180deg, transparent 16%, rgba(200,214,235,.05) 19%, transparent 23%),
    linear-gradient(180deg, transparent 58%, rgba(200,214,235,.04) 61%, transparent 65%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 1px, transparent 1px 3px);
}
/* 顶部状态卡与主面板：半透明玉白 + 黛青描边，层次分明 */
body > .panel, #status-bar, .top-card {
  background: rgba(248,242,228,.92) !important;
  border: 1px solid rgba(96,116,130,.35);
  box-shadow: 0 2px 10px rgba(40,56,70,.10);
}
html.night body > .panel, html.night #status-bar, html.night .top-card {
  background: rgba(18,22,30,.92) !important;
  border: 1px solid rgba(90,110,130,.3);
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
/* 按钮与可点元素禁长按选中 */
button, .hand-card, .deck-card, .rebirth-item, .set-input {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
