/* ============================================================
 * 修仙模拟器 · 样式（移动优先，兼容电脑 480px 容器）
 * 主题：轻山绿水 + 流金仙气 · 明亮配色
 * 背景使用纯色（长列表滚动不出现上下分层）
 * ============================================================ */
[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: #eaf6ef;
  color: #24402f;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100%;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #eaf6ef;
  position: relative;
}
/* 四角柔光，仙气飘散（fixed，不参与滚动） */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 50%;
  width: 480px; max-width: 100%;
  height: 100%;
  transform: translateX(-50%);
  background: radial-gradient(120% 80% at 50% 30%, rgba(255,255,255,.65) 0%, rgba(255,255,255,0) 45%, rgba(143,168,107,.16) 100%);
  pointer-events: none;
  z-index: 0;
}

.view {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid #bcdfcb;
  background: linear-gradient(180deg, #ffffff, #f1faf4);
  color: #2f5540;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 6px rgba(79,140,109,.10);
}
.btn:active { transform: scale(.97); filter: brightness(1.03); }
.btn-primary {
  border: 1px solid #2f8f6a;
  background: linear-gradient(180deg, #6fd0a2, #2f8f6a);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(47,143,106,.28);
}
.btn-big { width: 100%; padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.btn-danger { border-color: #e0b8b0; color: #b4553f; }
.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #bcdfcb;
  background: linear-gradient(180deg, #ffffff, #f1faf4);
  color: #2f5540;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 首页 ---------- */
#view-home { justify-content: center; gap: 12px; }
.home-hero { text-align: center; margin-top: -16px; }
.home-title {
  margin: 0;
  font-size: 34px;
  letter-spacing: 4px;
  white-space: nowrap;
  background: linear-gradient(180deg, #7bd8ab, #2f8f6a 55%, #1c6b4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(111,208,162,.35);
}
.home-sub { color: #6d8474; font-size: 13px; margin-top: 4px; letter-spacing: 1px; }
.home-count {
  background: rgba(47,143,106,.08);
  border: 1px solid rgba(47,143,106,.22);
  border-radius: 20px;
  padding: 8px 14px;
  color: #2f8f6a;
  font-size: 12px;
  white-space: nowrap;
}
.home-count b { font-size: 13px; }
.home-lv {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(79,140,109,.08);
}
.lv-head { display: flex; align-items: center; gap: 8px; }
.lv-name { color: #6d8474; font-size: 13px; }
.lv-lv { color: #1f6b4a; font-size: 16px; font-weight: 700; }
.lv-bonus { color: #b8860b; font-size: 11px; white-space: nowrap; margin-left: 4px; }
.lv-exp-line { margin-top: 7px; color: #7d9487; font-size: 12px; text-align: center; }
/* 经验条：轨道比卡片底色更暗，能看出「满」在哪 */
.lv-bar {
  height: 10px;
  background: #e2f0e7;
  border: 1px solid #cfe6d8;
  border-radius: 5px;
  box-shadow: inset 0 1px 3px rgba(79,140,109,.18);
  overflow: hidden;
  margin-top: 8px;
}
.lv-bar-fill { height: 100%; background: linear-gradient(90deg, #8fdcb4, #2f8f6a); border-radius: 5px; width: 0%; transition: width .3s; }
.home-btns { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.home-link-btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-link-btns3 { grid-template-columns: 1fr 1fr 1fr; }
.home-link-btns3 .btn-big { padding: 12px 4px; font-size: 15px; }
.settings-body { width: 100%; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.set-card { background: #ffffff; border: 1px solid #cfe6d8; border-radius: 12px; padding: 12px 14px; box-shadow: 0 2px 8px rgba(79,140,109,.07); }
.set-card .set-row { justify-content: space-between; }
.set-card .speed-label { margin-bottom: 4px; }
.about-body { width: 100%; padding: 14px; }
.about-text {
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 2;
  color: #3f5a4b;
}
.about-text b { color: #1f6b4a; }
.home-sound { width: 100%; display: flex; justify-content: center; margin-top: 4px; }
.btn-sound {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid #bcdfcb;
  background: linear-gradient(180deg, #ffffff, #f1faf4);
  color: #2f5540;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-sound:active { transform: scale(.92); filter: brightness(1.05); }
.home-speed {
  width: 100%;
  max-width: 260px;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 8px 14px;
}
.speed-label { display: flex; justify-content: space-between; align-items: center; color: #6d8474; font-size: 13px; }
.speed-label b { color: #2f8f6a; }
.speed-range { width: 100%; margin-top: 6px; accent-color: #2f8f6a; }
.home-tip {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
}
.tip-title { color: #2f8f6a; font-size: 13px; margin-bottom: 6px; letter-spacing: 2px; text-align: center; }
.tip-text { color: #6d8474; font-size: 12px; line-height: 1.8; text-align: left; }
.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: #7d9487; font-size: 12.5px; margin-bottom: 6px; }
.qr-img { width: 132px; height: 132px; border-radius: 10px; background: #fff; padding: 5px; }

/* ---------- 开关 ---------- */
.set-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.set-label { font-size: 15px; color: #3f5a4b; }
.set-label2 { font-size: 15px; color: #3f5a4b; margin-bottom: 8px; }
.set-select {
  width: 100%;
  background: #f6fcf8;
  color: #2f5540;
  border: 1px solid #cfe6d8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7d9487 50%), linear-gradient(135deg, #7d9487 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.set-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.set-switch input { opacity: 0; width: 0; height: 0; }
.track {
  position: absolute; inset: 0;
  background: #e2f0e7;
  border: 1px solid #cfe6d8;
  border-radius: 13px;
  transition: background .2s;
}
.track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #9db8a8;
  transition: transform .2s, background .2s;
}
.set-switch input:checked + .track { background: #6fd0a2; border-color: #2f8f6a; }
.set-switch input:checked + .track::after { transform: translateX(22px); background: #ffffff; }

/* ---------- 游戏 ---------- */
#view-game { padding-top: 0; padding-bottom: 20px; }
.game-top {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px 4px;
}
.game-title {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  letter-spacing: 3px;
  color: #1f6b4a;
  font-weight: 700;
  white-space: nowrap;
  padding: 0 46px;
  overflow: hidden;
  text-align: center;
}
.btn-pause {
  position: absolute;
  right: 4px; top: 10px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid #bcdfcb;
  background: linear-gradient(180deg, #ffffff, #f1faf4);
  color: #2f5540;
  font-size: 17px;
  cursor: pointer;
}
.btn-pause:active { transform: scale(.94); }

.attr-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.attr-span2 { grid-column: span 2; }
.attr-card {
  background: linear-gradient(180deg, #ffffff, #f7fcf9);
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  box-shadow: 0 2px 6px rgba(79,140,109,.07);
}
.attr-name { color: #6d8474; font-size: 11.5px; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-rank { color: #2f8f6a; font-weight: 700; font-size: 12px; }
.attr-val { color: #1f6b4a; font-size: 24px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.attr-coef { color: #1f6b4a; font-size: 19px; }
.attr-sub { color: #7d9487; font-size: 12px; }

/* 命格栏 / 机缘栏 / 法宝栏（游戏页属性区下） */
.huan-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,.86);
  border: 1px solid #cfe6d8;
  border-radius: 10px;
  min-height: 20px;
  max-height: 96px;
  overflow-y: auto;
}
.huan-label { color: #7d9487; font-size: 12px; margin-right: 2px; }
.huan-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  font-size: 10px; font-weight: 700; padding: 0 6px; line-height: 1;
}
/* 档位配色：练气级→渡劫级 由苔青渐入流金 */
.hc-t1  { background: #dfeae2; color: #4a6152; }                              /* 练气级 */
.hc-t2  { background: #c9e6d5; color: #2f6b4e; }                              /* 筑基级 */
.hc-t3  { background: #b3e0d0; color: #1f6b5a; }                              /* 金丹级 */
.hc-t4  { background: #a8dcea; color: #1d5f73; }                              /* 结婴级 */
.hc-t5  { background: #b6cdea; color: #2a4c78; }                              /* 化神级 */
.hc-t6  { background: #c8c2ea; color: #463a78; }                              /* 出窍级 */
.hc-t7  { background: #e6d2ae; color: #7a5a1e; }                              /* 反虚级 */
.hc-t8  { background: #f0d68a; color: #6b4a05; }                              /* 合体级 */
.hc-t9  { background: #f2c96a; color: #5a3d00; }                              /* 大乘级 */
.hc-t10 { background: #e8a94a; color: #3a2400; box-shadow: 0 0 6px rgba(184,134,11,.5); }  /* 渡劫级 */
/* 法宝胶囊：档位底色 + 金色描边区分于机缘 */
.frt-chip { box-shadow: inset 0 0 0 1px rgba(184,134,11,.6); }
/* 仙灵气胶囊：紫金流光，恒排机缘栏第一位 */
.xian-chip {
  background: linear-gradient(90deg, #ede2ff, #fff3d0);
  color: #6a4a9a;
  box-shadow: inset 0 0 0 1px rgba(150,110,210,.55);
}
.chaos-chip {
  background: linear-gradient(90deg, #d9e6f5, #cdd6ee);
  color: #2f3a6a;
  box-shadow: inset 0 0 0 1px rgba(90,110,180,.55);
}
.settle-huan { justify-content: center; margin-top: 10px; }

/* 命格胶囊：四色（绿 / 蓝 / 紫 / 金） */
.fate-chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; border-radius: 9px;
  font-size: 10px; font-weight: 700; padding: 0 7px; line-height: 1;
  white-space: nowrap;
}
.fate-green  { background: #d8f0dd; color: #2f6b45; box-shadow: inset 0 0 0 1px #a8d8b8; }
.fate-blue   { background: #d6e9f8; color: #2a5a86; box-shadow: inset 0 0 0 1px #a8cce8; }
.fate-purple { background: #e6dcf6; color: #5a3f8a; box-shadow: inset 0 0 0 1px #c8b4e8; }
.fate-gold   { background: linear-gradient(180deg, #ffe9a8, #f2c96a); color: #5a3d00; box-shadow: inset 0 0 0 1px #d4a72c; }

.log-box {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: rgba(255,255,255,.8);
  border: 1px solid #cfe6d8;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.log-item {
  font-size: 13.5px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(234,246,239,.9);
  color: #3f5a4b;
}
.log-item.year{ background: transparent; color: #2d4835; font-size: 12.5px; }
.log-item.brk { background: #e6f7ec; border: 1px solid #a8d8b8; color: #1f6b4a; }
.log-item.ev1 { background: #f2f7f4; border: 1px solid #d5e5da; color: #4a6152; }
.log-item.ev2 { background: #f4f0fb; border: 1px solid #d8ccee; color: #5a3f8a; }
.log-item.ev3 { background: #fdf8e8; border: 1px solid #ecdcae; color: #7a5a1e; }
.log-item.ev4 { background: #fdeeec; border: 1px solid #f0c4bc; color: #a83a30; }
.log-item.huan{ background: #f3eefb; border: 1px solid #d8ccee; color: #5a3f8a; }  /* 境界抬升 */
.log-item.rare{ background: #f8f2e0; border: 1px solid #e2d0a0; color: #7a5a1e; }
.log-item.red {
  background: #fdeceb;
  border: 1px solid #e8a89e;
  color: #c0392b;
  font-weight: 700;
}
.log-item.gold {
  background: linear-gradient(180deg, #fff8e2, #fdf0c8);
  border: 1px solid #e0c070;
  color: #8a6410;
  font-weight: 700;
}
.log-item.xian {
  background: linear-gradient(90deg, #f0e8ff, #fff6dc);
  border: 1px solid #c8b4e8;
  color: #6a4a9a;
  font-weight: 700;
}
/* 七彩流光：天劫专用（赤橙黄绿青蓝紫七色渐变 + 文字也走七色） */
.log-item.rainbow {
  background: linear-gradient(90deg,
    rgba(255,118,118,.50), rgba(255,168,88,.50), rgba(250,224,110,.55),
    rgba(126,220,142,.50), rgba(104,206,216,.50), rgba(116,158,240,.50), rgba(188,138,236,.50));
  background-size: 400% 100%;
  border: 1px solid rgba(150,170,205,.55);
  color: #24402f;
  font-weight: 700;
  animation: rainbowShift 1.6s linear infinite;
  text-shadow: 0 1px 0 rgba(255,255,255,.75);
}
@keyframes rainbowShift { 0% { background-position: 0% 0; } 100% { background-position: 400% 0; } }
.log-item.god { background: linear-gradient(180deg, #fffbe8, #fdf2cc); border: 1px solid #d4a72c; color: #7a5505; font-weight: 700; }
/* 特殊事件（灵根蜕变）：流光溢彩，一辈子可能只碰一次 */
.log-item.special {
  background: linear-gradient(90deg, rgba(255,240,190,.85), rgba(214,240,255,.85), rgba(240,220,255,.85), rgba(255,240,190,.85));
  background-size: 400% 100%;
  border: 1px solid #d4a72c;
  color: #6b4a05;
  font-weight: 700;
  animation: rainbowShift 2.4s linear infinite;
}
.log-item.dead{ background: #f6eeee; border: 1px solid #ddc8c8; color: #8a5a5a; }

/* ---------- 天劫闪电特效（每行天劫日志触发一次） ---------- */
#trib-fx {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}
.trib-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 90% at 50% 0%,
    rgba(255,255,255,.96) 0%, rgba(186,220,255,.62) 38%, rgba(120,160,255,.16) 66%, rgba(120,160,255,0) 88%);
  opacity: 0;
  animation: tribFlash .55s ease-out;
}
.trib-bolt {
  position: absolute;
  top: -6%;
  opacity: 0;
  animation: tribBolt .55s ease-out;
  filter: drop-shadow(0 0 6px rgba(160,205,255,.95)) drop-shadow(0 0 20px rgba(90,140,255,.75));
}
@keyframes tribFlash {
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  15%  { opacity: .10; }
  22%  { opacity: .88; }
  36%  { opacity: .16; }
  52%  { opacity: .42; }
  100% { opacity: 0; }
}
@keyframes tribBolt {
  0%   { opacity: 0; }
  5%   { opacity: 1; }
  16%  { opacity: .08; }
  24%  { opacity: .96; }
  40%  { opacity: .18; }
  56%  { opacity: .55; }
  100% { opacity: 0; }
}
/* 用户关掉动效偏好时，只留一记静态闪光 */
@media (prefers-reduced-motion: reduce) {
  .trib-flash, .trib-bolt { animation-duration: .3s; animation-iteration-count: 1; }
}

/* ---------- 结算 ---------- */
#view-settle { justify-content: center; padding-top: 8px; padding-bottom: 8px; }
.settle-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 16px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(79,140,109,.12);
}
.settle-title { text-align: center; font-size: 22px; font-weight: 700; color: #1f6b4a; }
.settle-title.god { color: #8a6410; text-shadow: 0 0 24px rgba(212,167,44,.5); }
/* 天劫相关标题：七彩流光文字 */
.settle-title.trib {
  background: linear-gradient(90deg, #c33b3b, #d67b1e, #b89a12, #1f8a4d, #1b7f92, #2a5cb8, #7a45c0);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowShift 2.2s linear infinite;
}
.settle-wuhun { text-align: center; color: #6d8474; font-size: 13.5px; }
.settle-wuhun b { color: #1f6b4a; }
.settle-rows { display: flex; flex-direction: column; }
.s-row {
  display: flex; justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px dashed #dbeae1;
  font-size: 14px;
}
.s-row:last-child { border-bottom: none; }
.s-row span { color: #6d8474; }
.s-row b { color: #2f5540; }
.settle-god {
  text-align: center;
  font-size: 14px;
  color: #7a5505;
  background: linear-gradient(180deg, rgba(212,167,44,.16), rgba(212,167,44,.05));
  border: 1px solid rgba(212,167,44,.45);
  border-radius: 10px;
  padding: 10px;
  letter-spacing: 1px;
}
.settle-xinwu { font-size: 12.5px; color: #7a5a1e; line-height: 1.6; text-align: center; }
.settle-rank {
  background: rgba(47,143,106,.08);
  border: 1px solid rgba(47,143,106,.22);
  border-radius: 10px;
  padding: 7px;
  color: #2f8f6a;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.settle-note {
  background: rgba(192,57,43,.06);
  border: 1px solid rgba(192,57,43,.28);
  border-radius: 10px;
  padding: 8px 10px;
  color: #a8433a;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}
.settle-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.settle-btns .btn-big { padding: 11px 6px; font-size: 15px; border-radius: 10px; }

/* ---------- 子页通用（标题绝对居中，✕ 固定右上角） ---------- */
.page-view { padding: 0 !important; }
.page-head {
  width: 100%;
  padding: 14px 14px 10px;
  background: #f4fbf7;
  border-bottom: 1px solid #dbeae1;
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 58px;
  display: flex;
  align-items: center;
}
.page-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 19px;
  color: #1f6b4a;
  letter-spacing: 2px;
  white-space: nowrap;
}
.btn-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid #cfe6d8;
  background: #ffffff;
  color: #7d9487;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  margin-left: auto;
  flex: none;
}
.btn-close:active { transform: scale(.92); }
.tabs { display: flex; gap: 8px; padding: 10px 14px 4px; width: 100%; }
.tabs-small { padding-top: 4px; }
.tabs-small .tab { font-size: 12px; padding: 6px 0; }
.tabs-wrap { flex-wrap: wrap; gap: 6px; }
.tabs-wrap .tab { flex: 0 0 calc((100% - 24px) / 5); font-size: 12px; padding: 7px 0; }
.tab {
  flex: 1;
  border: none;
  border-radius: 9px;
  padding: 8px 0;
  background: #ffffff;
  color: #6d8474;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(79,140,109,.08);
}
.tab.active { background: linear-gradient(180deg, #6fd0a2, #2f8f6a); color: #ffffff; }
.lb-note { padding: 6px 14px 0; font-size: 12px; color: #2f8f6a; width: 100%; }
.lb-fate-note { padding: 6px 14px 0; font-size: 11.5px; color: #8a6410; width: 100%; line-height: 1.6; }
.lb-body { padding: 8px 14px 30px; width: 100%; }
.lb-tip { text-align: center; color: #7d9487; padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #dbeae1;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  box-shadow: 0 1px 5px rgba(79,140,109,.06);
}
.lb-row.me { box-shadow: 0 0 0 2px #6fd0a2 inset; background: rgba(111,208,162,.12); }
.lb-rank {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #eaf6ef;
  color: #7d9487;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}
.lb-rank.top { background: #d4a72c; color: #fff; }
.lb-rank.top.r1 { background: #e0a92c; }
.lb-rank.top.r2 { background: #cbb46a; }
.lb-rank.top.r3 { background: #b79a5a; }
.lb-user { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.lb-name { font-size: 14px; color: #3f5a4b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 700; color: #1f6b4a; flex: none; white-space: nowrap; }
.lb-time { font-size: 11px; color: #7d9487; flex: none; }

/* ---------- 图鉴 ---------- */
.dex-body { width: 100%; padding: 8px 14px 30px; }
.dex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dex-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 9px;
  padding: 9px 4px;
  font-size: 12.5px;
  line-height: 1.3;
  min-height: 40px;
  word-break: break-all;
}
.dex-item.have {
  background: linear-gradient(180deg, rgba(111,208,162,.28), rgba(111,208,162,.10));
  border: 1px solid rgba(47,143,106,.5);
  color: #1f6b4a;
  font-weight: 700;
}
.dex-item.lack {
  background: #f4fbf7;
  border: 1px solid #dbeae1;
  color: #a8c0b3;
}
/* 境界图鉴：两列，名称 + 一句描述 */
.dex-realm { grid-template-columns: repeat(2, 1fr); }
.dex-realm .dex-item { flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; min-height: 52px; }
.dex-realm .dex-item b { font-size: 13.5px; }
.dex-realm .dex-item span { font-size: 11px; font-weight: 500; opacity: .85; word-break: break-all; }

/* ---------- 遮罩 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(207,230,216,.72);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mask-box {
  width: 300px;
  max-width: 86vw;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 40px rgba(47,85,64,.22);
}
.mask-title { text-align: center; font-size: 20px; color: #1f6b4a; font-weight: 700; letter-spacing: 2px; }
.mask-info { text-align: center; color: #6d8474; font-size: 13px; }
.mask-box .set-row { justify-content: center; padding: 4px 0; }
.review-box { width: 320px; max-width: 88vw; max-height: 80vh; }
.review-log {
  flex: 1;
  min-height: 200px;
  max-height: 55vh;
  overflow-y: auto;
  background: #f6fcf8;
  border: 1px solid #dbeae1;
  border-radius: 10px;
  padding: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #3f5a4b;
  -webkit-overflow-scrolling: touch;
}
.review-log .rv-brk { color: #1f6b4a; }
.review-log .rv-ev1 { color: #4a6152; }
.review-log .rv-ev2 { color: #5a3f8a; }
.review-log .rv-ev3 { color: #7a5a1e; }
.review-log .rv-ev4 { color: #a83a30; }
.review-log .rv-god { color: #8a6410; font-weight: 700; }
.review-log .rv-dead { color: #8a5a5a; }
.review-log .rv-rare { color: #7a5a1e; }
.review-log .rv-red { color: #c0392b; font-weight: 700; }
.review-log .rv-gold { color: #8a6410; font-weight: 700; }
.review-log .rv-xian { color: #6a4a9a; font-weight: 700; }
.review-log .rv-special { color: #8a6410; font-weight: 700; }
.review-log .rv-huan { color: #5a3f8a; }
/* 回顾一世里的天劫行：七彩文字（七色，赤橙黄绿青蓝紫） */
.review-log .rv-rainbow {
  background: linear-gradient(90deg, #c33b3b, #d67b1e, #b89a12, #1f8a4d, #1b7f92, #2a5cb8, #7a45c0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.review-log .rv-year { color: #2d4835; }

/* ---------- 电脑端 ---------- */
@media (min-width: 520px) {
  body { background: #dcefe4; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #b6d8c6; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 高阶灵根增益（点赞/投币/关注） ---------- */
.btn-follow {
  border-color: #d4a72c;
  color: #8a6410;
  margin-bottom: 12px;
  font-size: 14px;
  padding: 12px 16px;
}
.follow-box { width: 350px; max-width: 90vw; max-height: 86vh; overflow-y: auto; }
.follow-rows { display: flex; flex-direction: column; gap: 10px; }
.follow-video { color: #1f6b4a; font-size: 12px; margin: 4px 0 0; text-align: left; line-height: 1.5; }
.follow-action { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 13px 16px; font-size: 14px; }
.fb-state { font-size: 13px; }
.fb-state.done { color: #2f8f6a; }
.fb-state.todo { color: #a8c0b3; }
.fb-total { font-size: 15px; color: #8a6410; font-weight: 700; }

/* ---------- 成就系统 ---------- */
.home-ach-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.ach-tip { text-align: center; color: #2f8f6a; font-size: 12px; margin-bottom: 12px; }
.ach-total {
  text-align: center; color: #1f6b4a; font-size: 16px; font-weight: 700;
  margin: 6px 14px 10px; padding: 9px;
  width: calc(100% - 28px);
  background: rgba(47,143,106,.08);
  border: 1px solid rgba(47,143,106,.22);
  border-radius: 12px;
}
.ach-list {
  display: flex; flex-direction: column; gap: 14px;
  padding: 6px 16px 30px;
  width: 100%;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}
.ach-list::-webkit-scrollbar { width: 6px; }
.ach-list::-webkit-scrollbar-thumb { background: #6fd0a2; border-radius: 3px; }
.ach-list::-webkit-scrollbar-track { background: #eaf6ef; border-radius: 3px; }
.ach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dbeae1;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff, #f6fcf8);
  box-shadow: 0 2px 10px rgba(79,140,109,.08);
}
.ach-item.done { border-color: #d4a72c; background: linear-gradient(180deg, #fffdf4, #fff8e4); box-shadow: 0 2px 14px rgba(212,167,44,.18); }
.ach-name { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.ach-item.done .ach-name { color: #8a6410; }
.ach-item.todo .ach-name { color: #a8c0b3; }
.ach-bonus { font-size: 13px; white-space: nowrap; }
.ach-item.done .ach-bonus { color: #b8860b; }
.ach-item.todo .ach-bonus { color: #c2d5ca; }

/* ---------- 成就达成面包屑提示 ---------- */
.ach-toast {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99;
  text-align: center;
  padding: 12px 16px;
  background: linear-gradient(180deg, #6fd0a2, #2f8f6a);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  transform: translateY(-100%);
  transition: transform .35s ease;
  box-shadow: 0 4px 16px rgba(47,85,64,.3);
}
.ach-toast.show { transform: translateY(0); }

/* 成就 / 排行榜按钮：标题+小字两行居中 */
#btn-ach, #btn-rank { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 9px 14px; }
#btn-ach > span:first-child, #btn-rank > span:first-child { font-size: 17px; line-height: 1.3; }
.ach-btn-tip { font-size: 10px; color: #2f8f6a; white-space: nowrap; }
#rank-tip { color: #8a6410; }

/* ---------- 手动模式 ---------- */
.manual-tip {
  width: 100%;
  text-align: center;
  color: #b8860b;
  font-size: 13px;
  padding: 6px 0 2px;
}
.set-tip { margin-top: 6px; color: #a8c0b3; font-size: 12px; line-height: 1.6; }

/* ---------- 开局五选一（不可关闭） ---------- */
#view-wake { justify-content: center; }
.wake-box {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #cfe6d8;
  border-radius: 16px;
  padding: 22px 16px 18px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(79,140,109,.12);
}
.wake-title { font-size: 24px; color: #1f6b4a; letter-spacing: 3px; font-weight: 700; text-shadow: 0 0 18px rgba(111,208,162,.4); }
.wake-sub { color: #2f8f6a; font-size: 14px; margin: 6px 0 10px; font-weight: 700; }
.wake-hint { color: #a8c0b3; font-size: 12px; margin-bottom: 14px; }
.wake-list { display: flex; flex-direction: column; gap: 8px; }
/* 卡片两行：第一行「人物卡N + 灵根/气运/模拟点」，第二行「命格：金/紫…」
 * ⚠ 第一行绝不换行：内容放不下时由 game.js 的 fitCard() 整卡缩字号（9-12px） */
.wake-card {
  position: relative;
  display: block;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cfe6d8;
  background: linear-gradient(180deg, #ffffff, #f6fcf8);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 8px rgba(79,140,109,.07);
}
.wake-card:active { transform: scale(.98); border-color: #2f8f6a; filter: brightness(1.02); }
.wake-card.guard { border-color: #d4a72c; box-shadow: 0 0 12px rgba(212,167,44,.3); }
.wake-card-row {
  /* 两栏网格：左栏「人物卡N」贴最左，右栏放属性组并居中，两栏互不侵占 */
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.wake-card-txt { font-size: 1em; font-weight: 700; color: #2f5540; letter-spacing: 0; flex: none; white-space: nowrap; }
/* 「人物卡N」贴最左，用山青与属性区分开 */
.wake-card-no { justify-self: start; color: #2f8f6a; }
/* 属性组：横向排列、永不换行，宽度不够时靠整卡缩字号解决 */
.wake-card-attrs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 12px;
  white-space: nowrap;
  min-width: 0;
}
/* 第二行：命格（「命格」贴最左，2 个词条在剩余空间里居中——与第一行同构） */
.wake-card-fates {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  margin-top: 7px;
}
.wake-card-fates-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

/* ---------- 遭遇机缘弹窗（可拖动、可收起） ---------- */
#decision-mask { align-items: flex-start; padding-top: 7vh; }
.decision-box { width: 330px; max-width: 90vw; position: relative; cursor: grab; touch-action: none; user-select: none; }
.decision-x {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid #cfe6d8;
  background: #f4fbf7;
  color: #7d9487;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}
.decision-x:active { transform: scale(.9); }
.decision-tip { text-align: center; color: #a8c0b3; font-size: 11px; line-height: 1.5; }
/* 信息单行不折行（超宽由脚本缩字号适配） */
.decision-info { text-align: center; color: #2f5540; font-size: 15px; line-height: 1.6; white-space: nowrap; }
.decision-opts { display: flex; flex-direction: column; gap: 10px; }
/* 选择按钮：文案单行不换行，超宽时缩字号 */
.decision-opt {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 700;
}
/* 争夺：金赤；放弃：青绿 */
.opt-fight { border: 1px solid #d4a72c; background: linear-gradient(180deg, #f4cf72, #d4a72c); color: #3a2a00; }
.opt-flee  { border: 1px solid #2f8f6a; background: linear-gradient(180deg, #a8e6c8, #6fd0a2); color: #12402c; }
/* 首页 高光+保底 双按钮同排各占 50% */
.home-duo { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-duo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 9px 6px; }
.btn-duo > span:first-child { font-size: 17px; line-height: 1.3; }
.btn-duo .ach-btn-tip { font-size: 10px; color: #2f8f6a; white-space: nowrap; }
#btn-guard.on { border-color: #d4a72c; background: linear-gradient(180deg, #fffdf4, #fff6dd); box-shadow: 0 2px 14px rgba(212,167,44,.25); }
#btn-guard.on .ach-btn-tip { color: #8a6410; }

/* 高光列表 / 图片预览 / toast */
.hl-box { width: 340px; max-width: 90vw; max-height: 84vh; }
.hl-list { flex: 1; min-height: 120px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.hl-item {
  background: linear-gradient(180deg, #ffffff, #f6fcf8);
  border: 1px solid #dbeae1;
  border-radius: 11px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;                 /* 点条目即导出结算卡 */
  flex: none;
  box-shadow: 0 1px 5px rgba(79,140,109,.06);
}
.hl-item:active { transform: scale(.99); border-color: #2f8f6a; }
.hl-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hl-top b { color: #1f6b4a; font-size: 14.5px; }
.hl-innate { color: #8a6410; font-size: 11.5px; }
.hl-sect { color: #2f8f6a; font-size: 11.5px; }
.hl-end { margin-left: auto; color: #a8433a; font-size: 11.5px; }
.hl-mid { margin-top: 3px; color: #6d8474; font-size: 11.5px; line-height: 1.45; }
.hl-mid b { color: #2f5540; }
.hl-ring { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hl-ring .huan-chip { min-width: 16px; height: 15px; border-radius: 8px; font-size: 9px; padding: 0 5px; }
.hl-ring-cap { color: #6d8474; font-size: 9.5px; margin-right: 2px; }
/* 结算卡预览：图片限制在视口内（生成图很高，按宽度等比缩放会撑出屏幕把按钮顶飞） */
#hl-img-mask { align-items: flex-start; overflow-y: auto; padding: 14px 0 calc(20px + env(safe-area-inset-bottom)); }
.hl-img-box { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 92vw; }
.hl-img { width: auto; height: auto; max-width: min(92vw, 400px); max-height: 60vh; background: #eaf6ef; border-radius: 12px; }
.hl-btns { display: flex; gap: 8px; width: 100%; }
/* 下载 / 复制 / 关闭：单行不换行，放不下由 fitHLBtns() 缩字号 */
.hl-btns .btn { flex: 1; padding: 9px 4px; font-size: 13.5px; white-space: nowrap; overflow: hidden; }
.hl-toast {
  position: fixed; left: 50%; top: 16%; transform: translateX(-50%);
  z-index: 98; background: #2f8f6a; color: #ffffff; font-weight: 700; font-size: 14px;
  border-radius: 999px; padding: 10px 18px; box-shadow: 0 6px 20px rgba(47,85,64,.28);
  white-space: nowrap;
}
.guard-box { width: 320px; max-width: 88vw; }
.guard-rows { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.guard-row { background: #f6fcf8; border-radius: 8px; padding: 6px 10px; text-align: left; color: #3f5a4b; font-size: 13px; line-height: 1.6; }
.guard-row b { color: #1f6b4a; }
.guard-pts { text-align: center; color: #2f8f6a; font-size: 15px; font-weight: 700; }
.guard-pts b { color: #8a6410; font-size: 18px; }

/* 遭遇收起后底部召唤按钮 */
.decision-recall {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 70;
  border: 1px solid #2f8f6a;
  background: linear-gradient(180deg, #6fd0a2, #2f8f6a);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  padding: 10px 22px;
  box-shadow: 0 6px 24px rgba(47,85,64,.28);
}
.decision-recall:active { transform: translateX(-50%) scale(.96); }

/* 高光独立页 */
/* 高光页：页头固定，只有列表滚动（整页撑高会滚不动/把内容顶出视口） */
#view-hl { height: 100vh; overflow: hidden; }
#view-hl .page-head { flex: none; }
.hl-note { width: 100%; padding: 8px 16px 2px; color: #6d8474; font-size: 11.5px; }
.hl-list-page {
  width: 100%;
  flex: 1;
  min-height: 0;             /* flex 子容器可滚动的必要条件 */
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
  margin: 0;
}

/* ---------- 自定义人设 ---------- */
/* 抽卡页第 4 张卡：虚线描边 + 青金强调，一眼看出可编辑 */
.wake-card.custom {
  border-style: dashed;
  border-color: #2f8f6a;
  background: linear-gradient(180deg, #ffffff, #eefaf3);
  box-shadow: 0 0 12px rgba(47,143,106,.22);
}
.wake-card.custom .wake-card-no { color: #b8860b; }

.custom-box { width: 340px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }
.custom-live {
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f6fcf8;
  border: 1px solid #dbeae1;
  border-radius: 10px;
}
.custom-rows { display: flex; flex-direction: column; gap: 10px; }
.custom-row .custom-label { display: flex; justify-content: space-between; align-items: center; color: #6d8474; font-size: 13px; }
.custom-row .custom-label b { color: #2f8f6a; }
.custom-fate-head {
  display: flex; justify-content: space-between; align-items: center;
  color: #3f5a4b; font-size: 13px; font-weight: 700; margin-top: 2px;
}
.custom-fate-head b { color: #2f8f6a; }
.custom-fates {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 34vh; overflow-y: auto; padding: 8px;
  background: #f6fcf8; border: 1px solid #dbeae1; border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.custom-fate-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; column-gap: 8px; }
.custom-fate-name { font-size: 12px; font-weight: 700; color: #2f5540; white-space: nowrap; }
.custom-fate-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* 可选命格胶囊：默认半透明，选中实心加描边，不可选置灰 */
.fate-opt {
  cursor: pointer; border: 0; font: inherit; height: 22px; padding: 0 9px;
  opacity: .5; transition: opacity .1s, transform .1s;
}
.fate-opt.sel { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 2px #2f8f6a, inset 0 0 0 1px rgba(255,255,255,.6); }
.fate-opt.dis { opacity: .22; cursor: default; }
.custom-btns { display: flex; gap: 10px; }
.custom-btns .btn { flex: 1; }

/* ---------- 飞升：是否继续仙界篇 ---------- */
.continue-box { width: 340px; max-width: 90vw; }
.continue-tip {
  text-align: center; color: #9a7b3a; font-size: 12px; line-height: 1.6;
  background: #fdf7e6; border: 1px solid #efdfae; border-radius: 10px; padding: 8px 10px;
}
.continue-btns { display: flex; flex-direction: column; gap: 10px; }

