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

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: #12151a;
  color: #e8e2d5;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100%;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #12151a;
  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(200,164,92,.10) 0%, rgba(200,164,92,0) 45%, rgba(200,164,92,.08) 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 #333b46;
  background: linear-gradient(180deg, #242a32, #191d23);
  color: #cdc6b6;
  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(0,0,0,.10);
}
.btn:active { transform: scale(.97); filter: brightness(1.03); }
.btn-primary {
  border: 1px solid #c8a45c;
  background: linear-gradient(180deg, #e6c87e, #c8a45c);
  color: #1a1e24;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(200,164,92,.28);
}
.btn-big { width: 100%; padding: 14px 20px; font-size: 17px; border-radius: 12px; }
/* 首页主按钮「开始修行」：整体矮一截、内部不留空（其余 btn-big 不受影响） */
#btn-start { padding: 8px 20px; font-size: 16px; line-height: 1.25; border-radius: 10px; }
.btn-danger { border-color: #a08680; color: #b4553f; }
.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #333b46;
  background: linear-gradient(180deg, #242a32, #191d23);
  color: #cdc6b6;
  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, #f0d68a, #c8a45c 55%, #8a6410);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(230,200,126,.35);
}
/* ⚠ 副标题整行永不换行：放不下由 game.js 的 fitHomeSub() 逐 0.5px 缩字号（13 → 8px） */
.home-sub { color: #a29a8a; font-size: 13px; margin-top: 4px; letter-spacing: 1px; white-space: nowrap; }
.home-count {
  background: rgba(200,164,92,.08);
  border: 1px solid rgba(200,164,92,.22);
  border-radius: 20px;
  padding: 8px 14px;
  color: #c8a45c;
  font-size: 12px;
  white-space: nowrap;
}
.home-count b { font-size: 13px; }
.home-lv {
  width: 100%;
  background: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
/* 一行放下：玩家等级 · [Lv.N] · 经验 · 初始行动力加成（放不下优先挤经验那段的字号） */
.lv-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lv-name { color: #a29a8a; font-size: 13px; flex: none; }
.lv-lv { color: #e6c87e; font-size: 16px; font-weight: 700; flex: none; }
.lv-exp-inline { color: #8d8678; font-size: 12px; white-space: nowrap; flex: none; }
.lv-bonus { color: #d4a72c; font-size: 11px; white-space: nowrap; margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.lv-exp-line { margin-top: 7px; color: #8d8678; font-size: 12px; text-align: center; }
/* 经验条：轨道比卡片底色更暗，能看出「满」在哪 */
.lv-bar {
  height: 10px;
  background: #2a313a;
  border: 1px solid #333b46;
  border-radius: 5px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18);
  overflow: hidden;
  margin-top: 8px;
}
.lv-bar-fill { height: 100%; background: linear-gradient(90deg, #e6c87e, #c8a45c); 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: #1a1e24; border: 1px solid #333b46; border-radius: 12px; padding: 12px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.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: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 2;
  color: #cdc6b6;
}
.about-text b { color: #e6c87e; }
.home-sound { width: 100%; display: flex; justify-content: center; margin-top: 4px; }
.btn-sound {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid #333b46;
  background: linear-gradient(180deg, #242a32, #191d23);
  color: #cdc6b6;
  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: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 12px;
  padding: 8px 14px;
}
.speed-label { display: flex; justify-content: space-between; align-items: center; color: #a29a8a; font-size: 13px; }
.speed-label b { color: #c8a45c; }
.speed-range { width: 100%; margin-top: 6px; accent-color: #c8a45c; }
.home-tip {
  width: 100%;
  background: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
}
.tip-title { color: #c8a45c; font-size: 13px; margin-bottom: 6px; letter-spacing: 2px; text-align: center; }
.tip-text { color: #a29a8a; font-size: 12px; line-height: 1.8; text-align: left; }
.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: #8d8678; 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: #cdc6b6; }
.set-label2 { font-size: 15px; color: #cdc6b6; margin-bottom: 8px; }
.set-select {
  width: 100%;
  background: #1a1e24;
  color: #cdc6b6;
  border: 1px solid #333b46;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8d8678 50%), linear-gradient(135deg, #8d8678 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: #2a313a;
  border: 1px solid #333b46;
  border-radius: 13px;
  transition: background .2s;
}
.track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #7d7669;
  transition: transform .2s, background .2s;
}
.set-switch input:checked + .track { background: #e6c87e; border-color: #c8a45c; }
.set-switch input:checked + .track::after { transform: translateX(22px); background: #f5efe0; }

/* ---------- 游戏 ---------- */
#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: #e6c87e;
  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 #333b46;
  background: linear-gradient(180deg, #242a32, #191d23);
  color: #cdc6b6;
  font-size: 17px;
  cursor: pointer;
}
.btn-pause:active { transform: scale(.94); }

.attr-grid {
  width: 100%;
  display: grid;
  /* ⚠ 必须 4 列 × 2 行：首行 等级/模拟点/灵根/气运，次行 修为/法宝战力/法宝加成/总战力。
   *   8 张卡各占 1 格 = 8 格，正好 2×4 —— 总战力**不跨列**（跨 2 列会变成 9 格，被迫挤出第 3 行）。 */
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.attr-span2 { grid-column: auto; }   /* 保留类名兼容，但不再跨列 */
.attr-card {
  background: linear-gradient(180deg, #242a32, #191d23);
  border: 1px solid #333b46;
  border-radius: 12px;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.attr-name { color: #a29a8a; font-size: 11.5px; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-rank { color: #c8a45c; font-weight: 700; font-size: 12px; }
.attr-val { color: #e6c87e; font-size: 24px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.attr-coef { color: #e6c87e; font-size: 19px; }
.attr-sub { color: #8d8678; 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(26,30,36,.72);
  border: 1px solid #333b46;
  border-radius: 10px;
  min-height: 20px;
  max-height: 96px;
  overflow-y: auto;
}
.huan-label { color: #8d8678; 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: #2a3138; color: #b9c4bd; }                              /* 练气级 */
.hc-t2  { background: #274038; color: #8fd0b0; }                              /* 筑基级 */
.hc-t3  { background: #22453f; color: #7fd6c0; }                              /* 金丹级 */
.hc-t4  { background: #1f3f4d; color: #7fc2d8; }                              /* 结婴级 */
.hc-t5  { background: #26394f; color: #8fb0dc; }                              /* 化神级 */
.hc-t6  { background: #332e4f; color: #b0a0e0; }                              /* 出窍级 */
.hc-t7  { background: #3d3323; color: #dcc27a; }                              /* 反虚级 */
.hc-t8  { background: #4a3c1c; color: #e6c87e; }                              /* 合体级 */
.hc-t9  { background: #57451f; color: #f0d68a; }                              /* 大乘级 */
.hc-t10 { background: #5c3f14; color: #ffe9a8; 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);
}
.settle-huan { justify-content: center; margin-top: 10px; }

.log-box {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: rgba(26,30,36,.72);
  border: 1px solid #333b46;
  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(28,32,38,.9);
  color: #cdc6b6;
}
/* ⚠ 深色主题下每条事件日志都要「深底 + 亮字」，且各档位颜色互相区分得开 */
.log-item.year{ background: transparent; color: #9d9689; font-size: 12.5px; }
.log-item.brk { background: #16281f; border: 1px solid #4fae7e; color: #86e0ae; }               /* 突破 · 绿 */
.log-item.ev1 { background: #16232e; border: 1px solid rgba(74,134,180,.6); color: #8fc4e8; }    /* 事件一档 · 蓝 */
.log-item.ev2 { background: #241d33; border: 1px solid rgba(150,120,210,.6); color: #c3aef0; }   /* 事件二档 · 紫 */
.log-item.ev3 { background: #2a2314; border: 1px solid rgba(212,167,44,.6); color: #edcf8a; }    /* 事件三档 · 金 */
.log-item.ev4 { background: #2c1a18; border: 1px solid rgba(224,139,128,.6); color: #f0968a; }   /* 事件四档 · 红 */
.log-item.huan{ background: #241d33; border: 1px solid rgba(150,120,210,.6); color: #c3aef0; }   /* 突破大境界 · 紫 */
.log-item.rare{ background: #2a2314; border: 1px solid rgba(212,167,44,.5); color: #edcf8a; }    /* 稀有 · 金 */
.log-item.red {
  background: #2c1a18;
  border: 1px solid rgba(224,139,128,.6);
  color: #f0968a;
  font-weight: 700;
}
.log-item.gold {
  background: linear-gradient(180deg, #2a2314, #241f17);
  border: 1px solid #e0c070;
  color: #f0d68a;
  font-weight: 700;
}
.log-item.xian {
  background: linear-gradient(90deg, #2a2340, #241d33);
  border: 1px solid #b0a0e0;
  color: #d3c2ff;
  font-weight: 700;
}
/* 七彩流光：天劫专用（深底 + 赤橙黄绿青蓝紫七色带，文字保持亮色可读） */
.log-item.rainbow {
  background-color: #14181f;
  background-image: linear-gradient(90deg,
    rgba(226,110,110,.45), rgba(226,150,80,.45), rgba(224,200,96,.45),
    rgba(110,200,130,.45), rgba(96,190,205,.45), rgba(104,146,226,.45), rgba(170,124,224,.45));
  background-size: 400% 100%;
  border: 1px solid rgba(200,164,92,.5);
  color: #f4eede;
  font-weight: 700;
  animation: rainbowShift 1.6s linear infinite;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
@keyframes rainbowShift { 0% { background-position: 0% 0; } 100% { background-position: 400% 0; } }
.log-item.god { background: linear-gradient(180deg, #332b1a, #2a2314); border: 1px solid #d4a72c; color: #ffe9a8; font-weight: 700; }
/* 特殊事件（灵根蜕变）：深底七彩流光，一辈子可能只碰一次 */
.log-item.special {
  background-color: #1a1408;
  background-image: linear-gradient(90deg, rgba(255,214,120,.42), rgba(150,210,255,.42), rgba(220,170,255,.42), rgba(255,214,120,.42));
  background-size: 400% 100%;
  border: 1px solid #d4a72c;
  color: #ffe9a8;
  font-weight: 700;
  animation: rainbowShift 2.4s linear infinite;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.log-item.dead{ background: #2c1c1c; border: 1px solid rgba(200,110,100,.5); color: #e8a89e; }

/* ---------- 天劫闪电特效（每行天劫日志触发一次） ---------- */
#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: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 16px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
}
.settle-title { text-align: center; font-size: 22px; font-weight: 700; color: #e6c87e; }
.settle-title.god { color: #c8a45c; 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: #a29a8a; font-size: 13.5px; }
.settle-wuhun b { color: #e6c87e; }
.settle-rows { display: flex; flex-direction: column; }
.s-row {
  display: flex; justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px dashed #2a313a;
  font-size: 14px;
}
.s-row:last-child { border-bottom: none; }
.s-row span { color: #a29a8a; }
.s-row b { color: #cdc6b6; }
.settle-god {
  text-align: center;
  font-size: 14px;
  color: #e6c87e;
  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: #dcc27a; line-height: 1.6; text-align: center; }
.settle-rank {
  background: rgba(200,164,92,.08);
  border: 1px solid rgba(200,164,92,.22);
  border-radius: 10px;
  padding: 7px;
  color: #c8a45c;
  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: #e08b80;
  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: #1a1e24;
  border-bottom: 1px solid #2a313a;
  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: #e6c87e;
  letter-spacing: 2px;
  white-space: nowrap;
}
.btn-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid #333b46;
  background: #1a1e24;
  color: #8d8678;
  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: #1a1e24;
  color: #a29a8a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.tab.active { background: linear-gradient(180deg, #e6c87e, #c8a45c); color: #1a1e24; }
.lb-note { padding: 6px 14px 0; font-size: 12px; color: #c8a45c; width: 100%; }
.lb-fate-note { padding: 6px 14px 0; font-size: 11.5px; color: #c8a45c; width: 100%; line-height: 1.6; }
.lb-body { padding: 8px 14px 30px; width: 100%; }
.lb-tip { text-align: center; color: #8d8678; padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1e24;
  border: 1px solid #2a313a;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
}
.lb-row.me { box-shadow: 0 0 0 2px #e6c87e inset; background: rgba(230,200,126,.12); }
.lb-rank {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #12151a;
  color: #8d8678;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}
.lb-rank.top { background: #d4a72c; color: #1a1408; }
.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: #cdc6b6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 700; color: #e6c87e; flex: none; white-space: nowrap; }
.lb-time { font-size: 11px; color: #8d8678; 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(230,200,126,.28), rgba(230,200,126,.10));
  border: 1px solid rgba(200,164,92,.5);
  color: #e6c87e;
  font-weight: 700;
}
.dex-item.lack {
  background: #1a1e24;
  border: 1px solid #2a313a;
  color: #a29a8a;
}

/* ---------- 遮罩 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(51,59,70,.72);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mask-box {
  width: 300px;
  max-width: 86vw;
  background: #1a1e24;
  border: 1px solid #333b46;
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 40px rgba(200,164,92,.22);
}
.mask-title { text-align: center; font-size: 20px; color: #e6c87e; font-weight: 700; letter-spacing: 2px; }
.mask-info { text-align: center; color: #a29a8a; 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: #1a1e24;
  border: 1px solid #2a313a;
  border-radius: 10px;
  padding: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #cdc6b6;
  -webkit-overflow-scrolling: touch;
}
/* ⚠ 这里的配色必须与主日志 `.log-item.*` 一一对应（换肤时最容易漏的就是这一套）：
 *   突破=绿 / 大境界=紫 / 事件四档=蓝·紫·金·红 / 陨落·争夺=红 / 法宝·稀有·飞升=金 / 仙灵气=紫 */
.review-log .rv-brk { color: #86e0ae; }
.review-log .rv-ev1 { color: #8fc4e8; }
.review-log .rv-ev2 { color: #c3aef0; }
.review-log .rv-ev3 { color: #edcf8a; }
.review-log .rv-ev4 { color: #f0968a; }
.review-log .rv-god { color: #ffe9a8; font-weight: 700; }
.review-log .rv-dead { color: #e8a89e; }
.review-log .rv-rare { color: #edcf8a; }
.review-log .rv-red { color: #f0968a; font-weight: 700; }
.review-log .rv-gold { color: #f0d68a; font-weight: 700; }
.review-log .rv-xian { color: #d3c2ff; font-weight: 700; }
.review-log .rv-special { color: #ffe9a8; font-weight: 700; }
.review-log .rv-huan { color: #c3aef0; }
/* 回顾一世里的天劫行：七彩文字（七色，赤橙黄绿青蓝紫） */
.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: #a9a294; }

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

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

/* ---------- 高阶灵根增益（点赞/投币/关注） ---------- */
/* ⚠ 这一条文案很长，永不换行：放不下由 game.js 的 fitFollowBtn() 逐 0.5px 缩字号（12 → 9px） */
.btn-follow {
  border-color: #d4a72c;
  color: #c8a45c;
  /* 它与下面「全站最多成仙」那一行要贴紧：
   * #view-home 是 flex + gap:12px，所以这里用负 margin 把最终间距压到 ~4px。 */
  margin-top: 0;
  margin-bottom: -8px;
  font-size: 12px;              /* 基础字号 14 → 12（文案太长，先降 2px 打底） */
  padding: 8px 16px;            /* 上下留白也压一压，别占一行高 */
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.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: #e6c87e; 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: #c8a45c; }
.fb-state.todo { color: #a29a8a; }
.fb-total { font-size: 15px; color: #c8a45c; 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: #c8a45c; font-size: 12px; margin-bottom: 12px; }
.ach-total {
  text-align: center; color: #e6c87e; font-size: 16px; font-weight: 700;
  margin: 6px 14px 10px; padding: 9px;
  width: calc(100% - 28px);
  background: rgba(200,164,92,.08);
  border: 1px solid rgba(200,164,92,.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: #e6c87e; border-radius: 3px; }
.ach-list::-webkit-scrollbar-track { background: #12151a; border-radius: 3px; }
.ach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #2a313a;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #242a32, #191d23);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.ach-item.done { border-color: #d4a72c; background: linear-gradient(180deg, #201d17, #201d17); 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: #c8a45c; }
.ach-item.todo .ach-name { color: #a29a8a; }
.ach-bonus { font-size: 13px; white-space: nowrap; }
.ach-item.done .ach-bonus { color: #d4a72c; }
.ach-item.todo .ach-bonus { color: #5f594e; }

/* ---------- 顶部提示条（口径同《FGO模拟器》的 .ach-toast）
 * 成就 / 签到 / 登录奖励 / 购买 等一切「提示」都走这一条：
 * 屏幕顶部居中的药丸，出现即固定在 top:24px，靠透明度淡入淡出。 ---------- */
.ach-toast {
  position: fixed;
  left: 50%; top: 24px; transform: translateX(-50%);
  z-index: 99;
  max-width: 90vw;
  background: rgba(18,21,26,.96);
  border: 1px solid #c8a45c;
  color: #f0d68a;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .25s ease;
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
}
.ach-toast.show { opacity: 1; }

/* 成就 / 排行榜按钮：标题+小字两行居中 */
#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: #c8a45c; white-space: nowrap; }
#rank-tip { color: #c8a45c; }

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

/* ---------- 遭遇机缘弹窗（可拖动、可收起） ---------- */
#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 #333b46;
  background: #1a1e24;
  color: #8d8678;
  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: #a29a8a; font-size: 11px; line-height: 1.5; }
/* 信息单行不折行（超宽由脚本缩字号适配） */
.decision-info { text-align: center; color: #cdc6b6; 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 #c8a45c; background: linear-gradient(180deg, #8fd0b0, #e6c87e); color: #14231c; }
/* 首页 高光+保底 双按钮同排各占 50% */
.home-duo { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 首页 高光 / 保底 / 签到 三按钮同排 */
.home-duo.home-trio { grid-template-columns: 1fr 1fr 1fr; }
.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: #c8a45c; white-space: nowrap; }
#btn-guard.on { border-color: #d4a72c; background: linear-gradient(180deg, #201d17, #201d17); box-shadow: 0 2px 14px rgba(212,167,44,.25); }
#btn-guard.on .ach-btn-tip { color: #c8a45c; }

/* 高光列表 / 图片预览 / 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, #242a32, #191d23);
  border: 1px solid #2a313a;
  border-radius: 11px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;                 /* 点条目即导出结算卡 */
  flex: none;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
}
.hl-item:active { transform: scale(.99); border-color: #c8a45c; }
.hl-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hl-top b { color: #e6c87e; font-size: 14.5px; }
.hl-innate { color: #c8a45c; font-size: 11.5px; }
.hl-sect { color: #c8a45c; font-size: 11.5px; }
.hl-end { margin-left: auto; color: #e08b80; font-size: 11.5px; }
.hl-mid { margin-top: 3px; color: #a29a8a; font-size: 11.5px; line-height: 1.45; }
.hl-mid b { color: #cdc6b6; }
.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: #a29a8a; 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: #12151a; 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; }
/* 操作类提示（只服务高光图片的生成/保存/复制）——口径同《FGO模拟器》的 .hl-toast：底部药丸 */
.hl-toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 98;
  background: rgba(18,21,26,.95);
  border: 1px solid #c8a45c;
  color: #f0d68a;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  white-space: nowrap;
  max-width: 88vw; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
}
.guard-box { width: 320px; max-width: 88vw; }
.guard-rows { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.guard-row { background: #1a1e24; border-radius: 8px; padding: 6px 10px; text-align: left; color: #cdc6b6; font-size: 13px; line-height: 1.6; }
.guard-row b { color: #e6c87e; }
.guard-pts { text-align: center; color: #c8a45c; font-size: 15px; font-weight: 700; }
.guard-pts b { color: #c8a45c; 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 #c8a45c;
  background: linear-gradient(180deg, #e6c87e, #c8a45c);
  color: #1a1e24;
  font-weight: 700;
  font-size: 14px;
  border-radius: 999px;
  padding: 10px 22px;
  box-shadow: 0 6px 24px rgba(200,164,92,.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: #a29a8a; 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;
}

/* ============================================================
 * 百世修仙模拟器 · 新增组件（轮回点加成项 / 成仙劫统计 / 每日签到）
 * ============================================================ */

/* ---------- 等级框内的分隔杠 + 轮回点行 ---------- */
.lv-divider { height: 1px; background: rgba(200,164,92,.28); margin: 10px 0 8px; }
.lv-point-line { display: flex; align-items: center; justify-content: space-between; }
.lv-point-name { color: #a29a8a; font-size: 13px; }
.lv-point-val { color: #e6c87e; font-size: 16px; font-weight: 700; }

/* ---------- 加成项购买列表（四行平铺） ---------- */
/* 四行加成项：**能多挤就多挤** —— 上下 padding / margin 全为 0，行与行之间不留缝 */
.shop-list { margin: 4px 0 0; display: flex; flex-direction: column; gap: 0; }
.shop-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: rgba(200,164,92,.06);
  border: 1px solid rgba(200,164,92,.18);
  border-radius: 8px;
  padding: 0 7px;          /* ⚠ 上下 0 */
  margin: 0;               /* ⚠ 上下 0 */
  min-height: 20px;
}
.shop-label {
  flex: 0 1 auto; min-width: 0;
  color: #cdc6b6; font-size: 11px; line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.shop-label b { color: #e6c87e; }
.shop-buy {
  flex: none;
  border: 1px solid #c8a45c;
  background: linear-gradient(180deg, #e6c87e, #c8a45c);
  color: #1a1408;
  border-radius: 6px;
  padding: 1px 6px;        /* ⚠ 上下 1px，几乎贴边 */
  margin: 0;
  line-height: 1.35;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.shop-buy:active { transform: scale(.97); }
.shop-buy.off { border-color: #333b46; background: linear-gradient(180deg, #242a32, #191d23); color: #7d7669; }

/* ---------- 首页 成仙劫统计行 ---------- */
.home-count.home-ascend {
  background: rgba(200,164,92,.10);
  border: 1px solid rgba(200,164,92,.28);
  color: #e6c87e;
}
.home-count.home-ascend b { color: #f0d68a; }

/* ---------- 每日签到（日历）· 结构 / 配色一律照《FGO模拟器》 ---------- */
#view-sign { justify-content: flex-start; }
/* ⚠ `.page-view` 是 padding:0（顶部标题栏自带内边距），签到正文必须自己补左右内边距，
 *   否则日历会比标题栏宽出去 —— 这就是之前「签到页 CSS 不对」的根因。 */
#view-sign .sign-head,
#view-sign .sign-week,
#view-sign .sign-grid,
#view-sign .sign-btns,
#view-sign .sign-note { width: calc(100% - 28px); }
#view-sign .sign-head { display: flex; align-items: baseline; margin: 4px 0 10px; }
.sign-ym { font-size: 15px; font-weight: 700; color: #f0d68a; }
.sign-stat { margin-left: auto; font-size: 12.5px; color: #7fd6c0; }
.sign-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px; margin-bottom: 5px;
}
.sign-week span { text-align: center; font-size: 11.5px; color: #8d8678; }
.sign-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.sg {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  border: 1px solid rgba(200,164,92,.16);
  background: rgba(20,24,38,.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: #8d8678;
}
.sg.blank { border: none; background: none; }
/* 未来的日子：压暗 */
.sg.future { opacity: .35; }
/* 过去漏签：红字 */
.sg.miss { color: #e08b80; border-color: rgba(192,86,74,.25); }
/* 已签到：金色底 */
.sg.done {
  background: linear-gradient(180deg, rgba(200,164,92,.28), rgba(200,164,92,.12));
  border-color: #c8a45c; color: #f0d68a; font-weight: 700;
}
.sg.done::after {
  content: ''; position: absolute; right: 3px; bottom: 3px;
  width: 5px; height: 5px; border-radius: 50%; background: #f0d68a;
}
/* 今天：呼吸高亮 */
.sg.today {
  border-color: #7fd6c0;
  box-shadow: 0 0 10px rgba(127,214,192,.55);
  color: #e8e2d5; font-weight: 700;
  animation: sgPulse 1.4s ease-in-out infinite;
}
.sg.today.done { border-color: #c8a45c; box-shadow: 0 0 10px rgba(200,164,92,.6); animation: none; }
@keyframes sgPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(127,214,192,.35); }
  50%      { box-shadow: 0 0 16px rgba(127,214,192,.8); }
}
.sign-btns { margin-top: 14px; }
.sign-note {
  margin-top: 10px;
  font-size: 11.5px; line-height: 1.7; color: #8d8678; text-align: center;
}
.sign-note b { color: #e6c87e; }
.btn.gray, .btn[disabled] { border-color: #333b46; background: linear-gradient(180deg, #242a32, #191d23); color: #7d7669; box-shadow: none; }
