/* ============================================================
 * 凡人修仙模拟器 · 样式（移动优先，兼容电脑 480px 容器）
 * 主题：米白仙韵 + 淡金点缀（白色系修仙画风）
 * ============================================================ */
[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: #f2ecdf;
  color: #3e3a31;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100%;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #fdfbf5 0%, #f6f1e5 45%, #f0eadb 100%);
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  top: 0; left: 50%;
  width: 480px; max-width: 100%;
  height: 100%;
  transform: translateX(-50%);
  background:
    radial-gradient(1.5px 1.5px at 20% 15%, rgba(184,149,72,.35), transparent),
    radial-gradient(1px 1px at 80% 30%, rgba(184,149,72,.28), transparent),
    radial-gradient(1px 1px at 45% 65%, rgba(150,140,110,.2), transparent),
    radial-gradient(1.5px 1.5px at 70% 80%, rgba(184,149,72,.3), transparent),
    radial-gradient(1px 1px at 15% 85%, rgba(150,140,110,.2), transparent);
  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 #dccfae;
  background: linear-gradient(180deg, #fffdf8, #f4eedd);
  color: #4a453a;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(120,100,60,.08);
}
.btn:active { transform: scale(.97); filter: brightness(.96); }
.btn-primary {
  border: 1px solid #b89548;
  background: linear-gradient(180deg, #e8cd82, #bd9a4e);
  color: #4a360f;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(184,149,72,.3);
}
.btn-big { width: 100%; padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.btn-danger { border-color: #d9a29a; color: #b05348; }
.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #dccfae;
  background: linear-gradient(180deg, #fffdf8, #f4eedd);
  color: #6a6455;
  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;
  background: linear-gradient(180deg, #e6cf8f, #a8863d 62%, #6f5620);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 14px rgba(184,149,72,.25);
}
.home-sub { color: #8f897a; font-size: 13px; margin-top: 4px; letter-spacing: 1px; }
.home-count {
  background: rgba(184,149,72,.1);
  border: 1px solid rgba(184,149,72,.3);
  border-radius: 20px;
  padding: 8px 14px;
  color: #a07f35;
  font-size: 12px;
  white-space: nowrap;   /* 玩过/成仙人数不换行，缩小字体 */
}
.home-count b { font-size: 13px; }
.home-lv {
  width: 100%;
  background: rgba(255,253,248,.9);
  border: 1px solid #e2d9c2;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(120,100,60,.07);
}
.lv-head { display: flex; align-items: center; gap: 8px; }
.lv-name { color: #8f897a; font-size: 13px; }
.lv-lv { color: #8a6d2f; font-size: 16px; font-weight: 700; }
.lv-bonus { color: #c07a3e; font-size: 11px; white-space: nowrap; margin-left: 4px; }
.lv-exp { margin-left: auto; color: #9a958a; font-size: 12px; }
.lv-bar { height: 10px; background: #ede6d2; border-radius: 5px; overflow: hidden; margin-top: 8px; }
.lv-bar-fill { height: 100%; background: linear-gradient(90deg, #8fbf62, #c3e0a1); 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; }
.settings-body { width: 100%; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.set-card { background: rgba(255,253,248,.9); border: 1px solid #e2d9c2; border-radius: 12px; padding: 12px 14px; }
.set-card .set-row { justify-content: space-between; }
.set-card .speed-label { margin-bottom: 4px; }
.about-body { width: 100%; padding: 14px; }
.about-text {
  background: rgba(255,253,248,.9);
  border: 1px solid #e2d9c2;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 2;
  color: #55514a;
}
.about-text b { color: #8a6d2f; }
.home-sound { width: 100%; display: flex; justify-content: center; margin-top: 4px; }
.btn-sound {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid #dccfae;
  background: linear-gradient(180deg, #fffdf8, #f4eedd);
  color: #6a6455;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-sound:active { transform: scale(.92); filter: brightness(.96); }
.home-speed {
  width: 100%;
  max-width: 260px;
  background: rgba(255,253,248,.9);
  border: 1px solid #e2d9c2;
  border-radius: 12px;
  padding: 8px 14px;
}
.speed-label { display: flex; justify-content: space-between; align-items: center; color: #8f897a; font-size: 13px; }
.speed-label b { color: #a07f35; }
.speed-range { width: 100%; margin-top: 6px; accent-color: #b89548; }
.home-tip {
  width: 100%;
  background: rgba(255,253,248,.85);
  border: 1px solid #e6decb;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
}
.tip-title { color: #a07f35; font-size: 13px; margin-bottom: 6px; letter-spacing: 2px; text-align: center; }
.tip-text { color: #8f897a; font-size: 12px; line-height: 1.8; text-align: left; }
.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: #9a958a; 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: #55514a; }
.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: #e8e1cd;
  border: 1px solid #d9cfb4;
  border-radius: 13px;
  transition: background .2s;
}
.track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #a8a294;
  transition: transform .2s, background .2s;
}
.set-switch input:checked + .track { background: #c2a25a; border-color: #b89548; }
.set-switch input:checked + .track::after { transform: translateX(22px); background: #fff; }

/* ---------- 游戏 ---------- */
#view-game { padding-top: 0; padding-bottom: 20px; }
.game-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 14px 8px 6px;
}
.game-title {
  font-size: 20px;
  letter-spacing: 4px;
  color: #8a6d2f;
  font-weight: 700;
}
.btn-pause {
  position: absolute;
  right: 4px; top: 12px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid #dccfae;
  background: linear-gradient(180deg, #fffdf8, #f4eedd);
  color: #6a6455;
  font-size: 17px;
  cursor: pointer;
}
.btn-pause:active { transform: scale(.94); }

.attr-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.attr-card {
  background: linear-gradient(180deg, #fffdf8, #f6f0e0);
  border: 1px solid #e2d9c2;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(120,100,60,.07);
}
.attr-name { color: #8f897a; font-size: 12px; letter-spacing: 1px; }
.attr-rank { color: #a07f35; font-weight: 700; font-size: 12.5px; }
.attr-val { color: #6f5620; font-size: 26px; font-weight: 700; }
.attr-sub { color: #a09b8f; font-size: 12px; }
.attr-wuhun { grid-column: 1 / -1; }
.attr-wuhun-name { color: #6f5620; font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.attr-innate-line { color: #a07f35; font-size: 13px; margin-top: 2px; }
.attr-innate-line b { color: #c07a3e; }

.log-box {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: rgba(255,253,248,.75);
  border: 1px solid #e2d9c2;
  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(246,240,224,.7);
  color: #55514a;
}
.log-item.year{ background: rgba(246,240,224,.4); color: #9a958a; font-size: 12.5px; }
.log-item.brk { background: rgba(116,191,105,.16); border: 1px solid rgba(91,159,80,.4); color: #3d7a33; }
.log-item.gain { background: rgba(116,191,105,.16); border: 1px solid rgba(91,159,80,.4); color: #3d7a33; }
.log-item.ev1 { background: rgba(110,150,220,.13); border: 1px solid rgba(96,130,200,.32); color: #27539c; }
.log-item.ev2 { background: rgba(180,120,220,.13); border: 1px solid rgba(160,100,200,.35); color: #7a2fb5; }
.log-item.ev3 { background: rgba(212,175,55,.15); border: 1px solid rgba(184,149,72,.42); color: #8a6d2f; }
.log-item.ev4 { background: rgba(230,80,80,.14); border: 1px solid rgba(210,70,70,.45); color: #c0392b; }
.log-item.rare{ background: rgba(240,150,80,.15); border: 1px solid rgba(220,130,60,.38); color: #c2601a; }
.log-item.red {
  background: rgba(230,60,60,.14);
  border: 1px solid rgba(210,60,60,.5);
  color: #c0392b;
  font-weight: 700;
}
.log-item.rainbow {
  background: linear-gradient(90deg, rgba(220,90,90,.2), rgba(220,180,70,.2), rgba(110,190,110,.2), rgba(90,150,220,.2), rgba(170,110,220,.2));
  background-size: 400% 100%;
  border: 1px solid rgba(184,149,72,.5);
  color: #4a453a;
  font-weight: 700;
  animation: rainbowShift 1.2s linear infinite;
}
@keyframes rainbowShift { 0% { background-position: 0% 0; } 100% { background-position: 400% 0; } }
.log-item.god { background: rgba(226,192,110,.18); border: 1px solid rgba(184,149,72,.5); color: #7d6430; font-weight: 700; }
.log-item.dead{ background: rgba(180,70,60,.13); border: 1px solid rgba(170,60,50,.42); color: #b23a2f; }

/* ---------- 结算（紧凑，无滚动条） ---------- */
#view-settle { justify-content: center; padding-top: 8px; padding-bottom: 8px; }
.settle-box {
  width: 100%;
  background: rgba(255,253,248,.92);
  border: 1px solid #e2d9c2;
  border-radius: 16px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 3px 16px rgba(120,100,60,.12);
}
.settle-title { text-align: center; font-size: 22px; font-weight: 700; color: #6f5620; }
.settle-title.god { color: #8a6d2f; text-shadow: 0 0 18px rgba(184,149,72,.5); }
.settle-wuhun { text-align: center; color: #8f897a; font-size: 13.5px; }
.settle-wuhun b { color: #c2601a; }
.settle-rows { display: flex; flex-direction: column; }
.s-row {
  display: flex; justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px dashed #e0d7bd;
  font-size: 14px;
}
.s-row:last-child { border-bottom: none; }
.s-row span { color: #8f897a; }
.s-row b { color: #4a453a; }
.settle-god {
  text-align: center;
  font-size: 14px;
  color: #7d6430;
  background: linear-gradient(180deg, rgba(226,192,110,.22), rgba(226,192,110,.1));
  border: 1px solid rgba(184,149,72,.5);
  border-radius: 10px;
  padding: 10px;
  letter-spacing: 1px;
}
.settle-xinwu { font-size: 12.5px; color: #c2601a; line-height: 1.6; text-align: center; }
.settle-rank {
  background: rgba(184,149,72,.1);
  border: 1px solid rgba(184,149,72,.3);
  border-radius: 10px;
  padding: 7px;
  color: #a07f35;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.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; }

/* ---------- 排行榜（页头 + 三层 tab + 卡片式列表） ---------- */
.page-view { padding: 0 !important; }
.page-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  background: #fbf7ee;
  border-bottom: 1px solid #e2d9c2;
  position: sticky;
  top: 0;
  z-index: 5;
}
.page-title { flex: 1; text-align: center; font-size: 19px; color: #a07f35; margin: 0; letter-spacing: 2px; }
.btn-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid #dccfae;
  background: #f6f0e0;
  color: #9a958a;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  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; }
.tab {
  flex: 1;
  border: none;
  border-radius: 9px;
  padding: 8px 0;
  background: #f1ead8;
  color: #8f897a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tab.active { background: linear-gradient(180deg, #e8cd82, #bd9a4e); color: #4a360f; }
.lb-note { padding: 6px 14px 0; font-size: 12px; color: #a07f35; width: 100%; }
.lb-body { padding: 8px 14px 30px; width: 100%; }
.lb-tip { text-align: center; color: #a09b8f; padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fffdf8;
  border: 1px solid #e4ddcb;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.lb-row.me { box-shadow: 0 0 0 2px #b89548 inset; background: rgba(184,149,72,.12); }
.lb-rank {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #eee7d3;
  color: #8f897a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}
.lb-rank.top { background: #e08835; color: #fff; }
.lb-rank.top.r1 { background: #e05a4a; }
.lb-rank.top.r2 { background: #e0943c; }
.lb-rank.top.r3 { background: #d9b54a; }
.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: #4a453a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 700; color: #8a6d2f; flex: none; white-space: nowrap; }
.lb-time { font-size: 11px; color: #a09b8f; flex: none; }

/* ---------- 暂停遮罩 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(92,78,50,.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mask-box {
  width: 300px;
  max-width: 86vw;
  background: #fffdf8;
  border: 1px solid #e2d9c2;
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(90,70,30,.25);
}
.mask-title { text-align: center; font-size: 20px; color: #a07f35; font-weight: 700; letter-spacing: 2px; }
.mask-info { text-align: center; color: #8f897a; 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: rgba(255,253,248,.75);
  border: 1px solid #e2d9c2;
  border-radius: 10px;
  padding: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #55514a;
  -webkit-overflow-scrolling: touch;
}
.review-log .rv-brk { color: #3d7a33; }
.review-log .rv-gain { color: #3d7a33; }
.review-log .rv-ev1 { color: #27539c; }
.review-log .rv-ev2 { color: #7a2fb5; }
.review-log .rv-ev3 { color: #8a6d2f; }
.review-log .rv-ev4 { color: #c0392b; }
.review-log .rv-god { color: #8a6d2f; font-weight: 700; }
.review-log .rv-dead { color: #b23a2f; }
.review-log .rv-rare { color: #c2601a; }
.review-log .rv-red { color: #c0392b; font-weight: 700; }
.review-log .rv-rainbow {
  background: linear-gradient(90deg, #d05a4a, #d9a63a, #6fae54, #4a7ac4, #9a5ac4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.review-log .rv-year { color: #9a958a; }

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

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

/* ---------- 高阶天赋增益（点赞/投币/关注） ---------- */
.btn-follow {
  border-color: #b89548;
  color: #a07f35;
  margin-bottom: 12px;
  font-size: 14px;
  padding: 12px 16px;
}
.follow-box { width: 320px; max-width: 88vw; }
.follow-rows { display: flex; flex-direction: column; gap: 10px; }
.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: #4d9a44; }
.fb-state.todo { color: #a8a294; }
.fb-total { font-size: 15px; color: #a07f35; 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: #a07f35; font-size: 12px; margin-bottom: 12px; }
.ach-total {
  text-align: center; color: #a07f35; font-size: 16px; font-weight: 700;
  margin: 6px 14px 10px; padding: 9px;
  width: calc(100% - 28px);
  background: rgba(184,149,72,.1);
  border: 1px solid rgba(184,149,72,.3);
  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: #cdb26a; border-radius: 3px; }
.ach-list::-webkit-scrollbar-track { background: #f1ead8; border-radius: 3px; }
.ach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #e2d9c2;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fffdf8, #f6f0e0);
  box-shadow: 0 2px 8px rgba(120,100,60,.08);
}
.ach-item.done { border-color: #c2a25a; background: linear-gradient(180deg, #faf3df, #f2e7c8); box-shadow: 0 2px 12px rgba(184,149,72,.2); }
.ach-name { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.ach-item.done .ach-name { color: #8a6d2f; }
.ach-item.todo .ach-name { color: #8f897a; }
.ach-bonus { font-size: 13px; white-space: nowrap; }
.ach-item.done .ach-bonus { color: #4d9a44; }
.ach-item.todo .ach-bonus { color: #b0aa9c; }

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

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