/* ============================================================
 * 御兽之神模拟器 · 样式（移动优先，兼容电脑 480px 容器）
 * 主题：紫黑暗黑森冷 + 暗红点缀（御兽大陆森冷画风）
 * ============================================================ */
[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: #0d0713;
  color: #c9b8d9;
  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, #1e1230 0%, #170d24 45%, #100817 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(176,74,122,.35), transparent),
    radial-gradient(1px 1px at 80% 30%, rgba(122,59,143,.28), transparent),
    radial-gradient(1px 1px at 45% 65%, rgba(90,50,120,.2), transparent),
    radial-gradient(1.5px 1.5px at 70% 80%, rgba(176,74,122,.3), transparent),
    radial-gradient(1px 1px at 15% 85%, rgba(90,50,120,.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 #3a2448;
  background: linear-gradient(180deg, #241536, #1a0f26);
  color: #c9b8d9;
  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(0,0,0,.4);
}
.btn:active { transform: scale(.97); filter: brightness(1.2); }
.btn-primary {
  border: 1px solid #8a3a6a;
  background: linear-gradient(180deg, #c04a88, #7a2f5c);
  color: #ffe3f1;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(176,74,122,.35);
}
.btn-big { width: 100%; padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.btn-danger { border-color: #7a3a4a; color: #e08a9a; }
.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #3a2448;
  background: linear-gradient(180deg, #241536, #1a0f26);
  color: #b39ac7;
  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, #e0a0d0, #b04a7a 62%, #5a2050);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 14px rgba(176,74,122,.4);
}
.home-sub { color: #8a6fa8; font-size: 13px; margin-top: 4px; letter-spacing: 1px; }
.home-count {
  background: rgba(176,74,122,.12);
  border: 1px solid rgba(176,74,122,.35);
  border-radius: 20px;
  padding: 8px 14px;
  color: #c07aa0;
  font-size: 12px;
  white-space: nowrap;
}
.home-count b { font-size: 13px; }
.home-lv {
  width: 100%;
  background: rgba(30,18,48,.9);
  border: 1px solid #3a2448;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.lv-head { display: flex; align-items: center; gap: 8px; }
.lv-name { color: #8a6fa8; font-size: 13px; }
.lv-lv { color: #d08ab0; font-size: 16px; font-weight: 700; }
.lv-bonus { color: #e0a0c0; font-size: 11px; white-space: nowrap; margin-left: 4px; }
.lv-exp { margin-left: auto; color: #7a5f9a; font-size: 12px; }
.lv-bar { height: 10px; background: #2a1840; border-radius: 5px; overflow: hidden; margin-top: 8px; }
.lv-bar-fill { height: 100%; background: linear-gradient(90deg, #7a3b8f, #b04a7a); 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 1fr; gap: 10px; }
.settings-body { width: 100%; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.set-card { background: rgba(30,18,48,.9); border: 1px solid #3a2448; border-radius: 12px; padding: 12px 14px; }
.set-card .set-row { justify-content: space-between; }
.set-card .speed-label { margin-bottom: 4px; }
.speed-range { width: 100%; margin-top: 6px; accent-color: #b04a7a; }
.about-body { width: 100%; padding: 14px; }
.about-text {
  background: rgba(30,18,48,.9);
  border: 1px solid #3a2448;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 2;
  color: #b39ac7;
}
.about-text b { color: #d08ab0; }
.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: #7a5f9a; 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: #b39ac7; }
.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: #2a1840;
  border: 1px solid #3a2448;
  border-radius: 13px;
  transition: background .2s;
}
.track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #6a4f8a;
  transition: transform .2s, background .2s;
}
.set-switch input:checked + .track { background: #8a3a6a; border-color: #b04a7a; }
.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: #d08ab0;
  font-weight: 700;
}
.btn-pause {
  position: absolute;
  right: 4px; top: 12px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid #3a2448;
  background: linear-gradient(180deg, #241536, #1a0f26);
  color: #b39ac7;
  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, #241536, #1a0f26);
  border: 1px solid #3a2448;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.attr-top {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.attr-top-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: linear-gradient(180deg, #241536, #1a0f26);
  border: 1px solid #3a2448;
  border-radius: 10px;
  padding: 8px 6px;
  white-space: nowrap;
  overflow: hidden;
}
.attr-tl { color: #8a6fa8; font-size: 11px; }
.attr-tv { color: #d08ab0; font-weight: 700; font-size: 14px; }
.attr-tnum { color: #e0a0c0; font-weight: 700; font-size: 18px; }
.attr-name { color: #8a6fa8; font-size: 12px; letter-spacing: 1px; }
.attr-val { color: #e0a0c0; font-size: 26px; font-weight: 700; }

.log-box {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: rgba(20,12,32,.75);
  border: 1px solid #3a2448;
  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(42,24,64,.5);
  color: #b39ac7;
}
.log-item.year { background: rgba(42,24,64,.3); color: #7a5f9a; font-size: 12.5px; }
.log-item.brk { background: rgba(90,160,80,.2); border: 1px solid rgba(90,160,80,.45); color: #7ac070; }
.log-item.gain { background: rgba(120,120,140,.18); border: 1px solid rgba(120,120,140,.35); color: #9a94a8; }
.log-item.fuse { background: rgba(220,80,90,.18); border: 1px solid rgba(220,80,90,.42); color: #f07080; }
.log-item.ev1 { background: rgba(90,120,200,.16); border: 1px solid rgba(96,120,190,.4); color: #8aa0e0; }
.log-item.ev2 { background: rgba(140,90,190,.16); border: 1px solid rgba(140,90,190,.42); color: #b08ae0; }
.log-item.ev3 { background: rgba(232,192,96,.16); border: 1px solid rgba(232,192,96,.45); color: #e8c060; }
.log-item.ev4 { background: rgba(200,60,80,.18); border: 1px solid rgba(200,60,80,.5); color: #f08a9a; }
.log-item.rare { background: rgba(220,120,70,.18); border: 1px solid rgba(220,120,70,.42); color: #f0a070; }
.log-item.red {
  background: rgba(200,60,80,.18);
  border: 1px solid rgba(200,60,80,.55);
  color: #f08a9a;
  font-weight: 700;
}
.log-item.rainbow {
  background: linear-gradient(90deg, rgba(200,60,80,.22), rgba(176,74,122,.22), rgba(122,59,143,.22), rgba(90,120,200,.22), rgba(140,90,190,.22));
  background-size: 400% 100%;
  border: 1px solid rgba(176,74,122,.55);
  color: #e8d8f0;
  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(176,74,122,.2); border: 1px solid rgba(176,74,122,.55); color: #f0b8d0; font-weight: 700; }
.log-item.landing { background: rgba(232,192,96,.14); border: 1px solid rgba(232,192,96,.5); color: #f0d080; font-weight: 700; }
.log-item.dead { background: rgba(150,50,60,.16); border: 1px solid rgba(150,50,60,.45); color: #e08a8a; }

/* ---------- 结算 ---------- */
#view-settle { justify-content: center; padding-top: 8px; padding-bottom: 8px; }
.settle-box {
  width: 100%;
  background: rgba(30,18,48,.92);
  border: 1px solid #3a2448;
  border-radius: 16px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 3px 16px rgba(0,0,0,.5);
}
.settle-title { text-align: center; font-size: 22px; font-weight: 700; color: #e0a0c0; }
.settle-title.god { color: #f0b8d0; text-shadow: 0 0 18px rgba(176,74,122,.6); }
.settle-wuhun { text-align: center; color: #8a6fa8; font-size: 13.5px; }
.settle-wuhun b { color: #f0a070; }
.settle-rows { display: flex; flex-direction: column; }
.s-row {
  display: flex; justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px dashed #3a2448;
  font-size: 14px;
}
.s-row:last-child { border-bottom: none; }
.s-row span { color: #8a6fa8; }
.s-row b { color: #c9b8d9; }
.settle-god {
  text-align: center;
  font-size: 14px;
  color: #f0b8d0;
  background: linear-gradient(180deg, rgba(176,74,122,.24), rgba(176,74,122,.1));
  border: 1px solid rgba(176,74,122,.55);
  border-radius: 10px;
  padding: 10px;
  letter-spacing: 1px;
}
.settle-beast { font-size: 12.5px; color: #e0a0c0; line-height: 1.7; text-align: center; }
.settle-rank {
  background: rgba(176,74,122,.12);
  border: 1px solid rgba(176,74,122,.35);
  border-radius: 10px;
  padding: 7px;
  color: #c07aa0;
  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; }

/* ---------- 排行榜 / 通用页 ---------- */
.page-view { padding: 0 !important; }
.page-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  background: #1a0f26;
  border-bottom: 1px solid #3a2448;
  position: sticky;
  top: 0;
  z-index: 5;
}
.page-title { flex: 1; text-align: center; font-size: 19px; color: #c07aa0; margin: 0; letter-spacing: 2px; }
.btn-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid #3a2448;
  background: #1a0f26;
  color: #7a5f9a;
  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: #2a1840;
  color: #8a6fa8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tab.active { background: linear-gradient(180deg, #c04a88, #7a2f5c); color: #ffe3f1; }
.lb-note { padding: 6px 14px 0; font-size: 12px; color: #c07aa0; width: 100%; }
.lb-body { padding: 8px 14px 30px; width: 100%; }
.lb-tip { text-align: center; color: #7a5f9a; padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #241536;
  border: 1px solid #3a2448;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.lb-row.me { box-shadow: 0 0 0 2px #8a3a6a inset; background: rgba(176,74,122,.14); }
.lb-rank {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #2a1840;
  color: #8a6fa8;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}
.lb-rank.top { background: #b04a7a; color: #fff; }
.lb-rank.top.r1 { background: #d05050; }
.lb-rank.top.r2 { background: #c0605a; }
.lb-rank.top.r3 { background: #b04a7a; }
.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: #c9b8d9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 700; color: #d08ab0; flex: none; white-space: nowrap; }
.lb-time { font-size: 11px; color: #7a5f9a; flex: none; }

/* ---------- 图鉴 ---------- */
.book-body { width: 100%; padding: 8px 14px 30px; }
.beast-list { display: flex; flex-direction: column; gap: 16px; }
.beast-sec { display: flex; flex-direction: column; gap: 8px; }
.beast-sec-title {
  font-size: 15px; font-weight: 700; color: #c07aa0;
  letter-spacing: 1px; padding-left: 2px;
}
.beast-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.beast-cell {
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid #3a2448;
  white-space: nowrap;
}
.beast-cell.own { background: rgba(176,74,122,.2); border-color: #8a3a6a; color: #f0b8d0; }
.beast-cell.miss { background: rgba(42,24,64,.4); color: #5a4870; }
.god-log-list { display: flex; flex-direction: column; gap: 8px; }
.god-log-item {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #241536;
  border: 1px solid #3a2448;
  color: #c9b8d9;
}

/* ---------- 暂停遮罩 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(8,4,14,.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mask-box {
  width: 300px;
  max-width: 86vw;
  background: #1e1230;
  border: 1px solid #3a2448;
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.mask-title { text-align: center; font-size: 20px; color: #c07aa0; font-weight: 700; letter-spacing: 2px; }
.mask-info { text-align: center; color: #8a6fa8; 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(20,12,32,.75);
  border: 1px solid #3a2448;
  border-radius: 10px;
  padding: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #b39ac7;
  -webkit-overflow-scrolling: touch;
}
.review-log .rv-brk { color: #7ac070; }
.review-log .rv-gain { color: #9a94a8; }
.review-log .rv-fuse { color: #f07080; }
.review-log .rv-ev1 { color: #8aa0e0; }
.review-log .rv-ev2 { color: #b08ae0; }
.review-log .rv-ev3 { color: #e8c060; }
.review-log .rv-ev4 { color: #f08a9a; }
.review-log .rv-god { color: #f0b8d0; font-weight: 700; }
.review-log .rv-landing { color: #f0d080; font-weight: 700; }
.review-log .rv-dead { color: #e08a8a; }
.review-log .rv-rare { color: #f0a070; }
.review-log .rv-red { color: #f08a9a; font-weight: 700; }
.review-log .rv-rainbow {
  background: linear-gradient(90deg, #e07080, #d08ab0, #9a6fc0, #7a90d0, #b07ae0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.review-log .rv-year { color: #7a5f9a; }

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

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

/* ---------- 高阶资质增益（点赞/投币/关注） ---------- */
.btn-follow {
  border-color: #8a3a6a;
  color: #c07aa0;
  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: #8ae08a; }
.fb-state.todo { color: #6a4f8a; }
.fb-total { font-size: 15px; color: #c07aa0; 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: #c07aa0; font-size: 12px; margin-bottom: 12px; }
.ach-total {
  text-align: center; color: #c07aa0; font-size: 16px; font-weight: 700;
  margin: 6px 14px 10px; padding: 9px;
  width: calc(100% - 28px);
  background: rgba(176,74,122,.12);
  border: 1px solid rgba(176,74,122,.35);
  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: #4a2f68; border-radius: 3px; }
.ach-list::-webkit-scrollbar-track { background: #241536; border-radius: 3px; }
.ach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #3a2448;
  border-radius: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #241536, #1a0f26);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.ach-item.done { border-color: #8a3a6a; background: linear-gradient(180deg, #2e1840, #241536); box-shadow: 0 2px 12px rgba(176,74,122,.25); }
.ach-name { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.ach-item.done .ach-name { color: #d08ab0; }
.ach-item.todo .ach-name { color: #6a4f8a; }
.ach-bonus { font-size: 13px; white-space: nowrap; }
.ach-item.done .ach-bonus { color: #8ae08a; }
.ach-item.todo .ach-bonus { color: #5a4870; }

/* ---------- 成就达成面包屑提示 ---------- */
.ach-toast {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99;
  text-align: center;
  padding: 12px 16px;
  background: linear-gradient(180deg, #c04a88, #7a2f5c);
  color: #ffe3f1;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  transform: translateY(-100%);
  transition: transform .35s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.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: #c07aa0; white-space: nowrap; }
