/* ============================================================
 * 人生重开模拟器 · 样式（黑白主题：白底黑字 · 移动优先）
 * 档位白/蓝/紫/金保留少量彩色作区分
 * ============================================================ */
[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: #a9a9a9; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #7a7a7a; }
*::-webkit-scrollbar-track { background: transparent; }

html, body {
  margin: 0; padding: 0;
  background: #f2f2ef;
  color: #1a1a1a;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100%;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #fff; position: relative; }

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

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid #111;
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: scale(.97); background: #eee; }
.btn-primary { background: #000; color: #fff; border-color: #000; font-weight: 700; }
.btn-primary:active { background: #333; }
.btn-big { width: 100%; padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #8a2a2a; color: #b91c1c; }
.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

/* ---------- 页头：返回 ✕ 在右上角，标题绝对居中 ---------- */
.page-head {
  width: 100%;
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 10px 10px;
}
.page-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 18px;
  letter-spacing: 2px;
  color: #111;
  text-align: center;
  white-space: nowrap;
  max-width: 72%;
  overflow: hidden;
}
.btn-back { position: relative; z-index: 2; }

/* ---------- 首页 ---------- */
#view-home { justify-content: flex-start; gap: 14px; padding-top: 40px; }
.home-hero { text-align: center; }
.home-hero { width: 100%; }
.home-title { margin: 0 auto; font-size: 32px; letter-spacing: 0; font-weight: 800; color: #000; white-space: nowrap; max-width: 100%; overflow: hidden; }
.home-sub { color: #666; font-size: 15px; margin-top: 6px; letter-spacing: 0; white-space: nowrap; max-width: 100%; overflow: hidden; }
.home-count {
  background: #fafafa;
  border: 1px solid #bbb;
  border-radius: 16px;
  padding: 6px 12px;
  color: #444;
  font-size: 12.5px;
  white-space: nowrap;
}
.home-count b { color: #000; font-size: 13px; }
.home-lv { width: 100%; background: #fff; border: 1px solid #d6d6d6; border-radius: 12px; padding: 12px 16px; }
.lv-head { display: flex; align-items: center; gap: 8px; }
.lv-name { color: #666; font-size: 13px; }
.lv-lv { color: #000; font-size: 17px; font-weight: 800; margin-left: auto; }
.lv-bonus { color: #7a5c00; font-size: 11.5px; margin-left: 6px; }
.lv-bar { height: 10px; background: #e5e5e5; border-radius: 5px; overflow: hidden; margin-top: 8px; }
.lv-bar-fill { height: 100%; background: #111; border-radius: 5px; width: 0%; transition: width .3s; }
.lv-exp-line { margin-top: 7px; color: #666; font-size: 12px; text-align: center; }

.home-btns { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.home-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.home-grid .btn { font-size: 14px; padding: 12px 6px; white-space: nowrap; }
.btn-follow { margin-top: 2px; border-color: #000; background: #000; color: #fff; font-weight: 700; }
.btn-follow:active { background: #333; }
.ach-plus { display: block; color: #7a5c00; font-size: 10.5px; line-height: 1.4; }
.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: #666; font-size: 12px; margin-bottom: 6px; }
.qr-img { width: 130px; height: 130px; border-radius: 10px; background: #fff; border: 1px solid #d6d6d6; padding: 5px; }

/* ---------- 面板/提示 ---------- */
.panel { width: 100%; background: #fff; border: 1px solid #d6d6d6; border-radius: 12px; padding: 14px; }
.small-tip { color: #555; font-size: 12px; line-height: 1.8; }
.mid-head { width: 100%; display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.mid-head .mt { color: #666; font-size: 13px; }
.mid-head .mv { color: #000; font-size: 16px; font-weight: 800; }

/* ---------- 设置开关 ---------- */
.set-card { background: #fff; border: 1px solid #d6d6d6; border-radius: 12px; padding: 12px 14px; width: 100%; }
.set-card + .set-card { margin-top: 10px; }
.set-row { display: flex; align-items: center; gap: 10px; cursor: pointer; justify-content: space-between; }
.set-label { font-size: 15px; color: #222; }
.set-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex: 0 0 auto; }
.set-switch input { opacity: 0; width: 0; height: 0; }
.track { position: absolute; inset: 0; background: #e2e2e2; border: 1px solid #ccc; border-radius: 13px; transition: background .2s; }
.track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid #ccc; transition: transform .2s; }
.set-switch input:checked + .track { background: #111; border-color: #111; }
.set-switch input:checked + .track::after { transform: translateX(22px); background: #fff; border-color: #fff; }
.speed-label { display: flex; justify-content: space-between; align-items: center; color: #666; font-size: 13px; width: 100%; }
.speed-label b { color: #000; }
.speed-range { width: 100%; margin-top: 8px; accent-color: #000; }

/* ---------- 页签 ---------- */
.tabs { width: 100%; display: flex; gap: 6px; margin: 4px 0 10px; }
.tab { flex: 1; border: 1px solid #bbb; background: #fff; color: #555; border-radius: 8px; padding: 7px 4px; font-size: 12.5px; cursor: pointer; white-space: nowrap; text-align: center; }
.tab.on { border-color: #000; background: #000; color: #fff; font-weight: 700; }

/* ---------- 词条卡 ---------- */
#view-start { align-items: stretch; }
.ten-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tcard {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.tcard:active { transform: scale(.97); }
.tcard.sel { border-color: #000; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.tcard .tc-name { font-weight: 700; font-size: 15px; color: #111; }
.tcard .tc-desc { color: #555; font-size: 12px; line-height: 1.5; }
.tcard .tc-grade { position: absolute; top: 7px; right: 9px; font-size: 11px; }
.tcard .tc-no { color: #aaa; font-size: 11px; }
/* 档位小色：白/蓝/紫/金 */
.tg0 .tc-name, .tg0 .tc-grade { color: #222; }
.tg1 .tc-name, .tg1 .tc-grade { color: #1d4ed8; }
.tg2 .tc-name, .tg2 .tc-grade { color: #7c3aed; }
.tg3 { border-color: #b45309; }
.tg3 .tc-name, .tg3 .tc-grade { color: #b45309; }
.tg3 .tc-desc { color: #6b4b16; }
.empty-hint { color: #999; font-size: 13px; padding: 20px; text-align: center; }

/* ---------- 加点 ---------- */
#view-allocate { align-items: stretch; }
.alloc-grid { width: 100%; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.a-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #d6d6d6; border-radius: 10px; padding: 8px 10px; }
.a-name { width: 56px; flex: 0 0 auto; color: #666; font-size: 13px; }
.a-val { flex: 1; text-align: center; color: #000; font-size: 22px; font-weight: 700; }
.a-btn { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #111; background: #fff; color: #111; font-size: 20px; line-height: 1; cursor: pointer; }
.a-btn:active { transform: scale(.92); background: #eee; }
.a-btn:disabled { opacity: .35; }
.btn-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

/* ---------- 游戏日志 ---------- */
#view-play { padding-top: 0; padding-bottom: 16px; }
.game-top { width: 100%; display: flex; align-items: center; justify-content: center; position: relative; padding: 12px 4px 4px; }
.game-title {
  font-size: 12.5px;
  letter-spacing: 0;
  color: #111;
  font-weight: 800;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 0 56px;   /* 避开左右角标的 岁/暂停 按钮 */
  overflow: hidden;
}
.game-year { position: absolute; left: 0; background: #f2f2f2; border: 1px solid #bbb; color: #333; border-radius: 14px; padding: 4px 10px; font-size: 12.5px; }
.btn-pause { position: absolute; right: 0; top: 4px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #111; background: #fff; color: #111; font-size: 16px; cursor: pointer; }
.attr-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.attr-card { background: #fff; border: 1px solid #d6d6d6; border-radius: 10px; padding: 8px 10px; }
.attr-name { color: #666; font-size: 11.5px; }
.attr-val { color: #000; font-size: 21px; font-weight: 700; }
.active-words {
  width: 100%;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 10px;
  padding: 8px 10px;
}
.active-words .aw-label { color: #666; font-size: 12px; flex: 0 0 auto; }
.aw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #bbb;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12.5px;
  background: #f6f6f3;
  color: #222;
}
.aw-chip.extra { border-style: dashed; }
.aw-chip .g { font-size: 10px; }
.aw-chip.c1 { border-color: #7fb2f0; color: #1d4ed8; }
.aw-chip.c2 { border-color: #c5a0f5; color: #7c3aed; }
.aw-chip.c3 { border-color: #e3b25c; color: #b45309; background: #fdf7e7; }
.manual-tip { width: 100%; background: #f0f0f0; border: 1px solid #bbb; color: #333; border-radius: 8px; padding: 7px 10px; margin-top: 8px; font-size: 12.5px; text-align: center; }

.log-box {
  width: 100%;
  flex: 1;
  min-height: 200px;
  margin-top: 8px;
  overflow-y: auto;
  background: #fafaf8;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  -webkit-overflow-scrolling: touch;
}
.log-item { font-size: 13.5px; line-height: 1.5; padding: 6px 9px; border-radius: 7px; background: #fff; border: 1px solid #ececec; color: #333; }
.log-item.year { background: transparent; border: none; color: #999; font-size: 12px; font-weight: 700; }
.log-item.tlt { background: #f4f7ff; border: 1px solid #c9d7f0; color: #1d3f8f; }
.log-item.evt { background: #fff; border-left: 3px solid #bbb; color: #333; }
.log-item.gold { background: #fdf7e7; border: 1px solid #e7c878; color: #7a5c00; }
.log-item.danger { background: #fdecec; border: 1px solid #e7b8b8; color: #b91c1c; }
.log-item.good { background: #eef8ef; border: 1px solid #b7d9ba; color: #1e7e34; }
.log-item.dead { background: #f6dcdc; border: 1px solid #e0a0a0; color: #a11; font-weight: 700; }

/* ---------- 结算 ---------- */
#view-settle { justify-content: center; padding-top: 8px; }
.settle-box { width: 100%; }
.settle-title { text-align: center; font-size: 24px; letter-spacing: 3px; margin: 4px 0 14px; font-weight: 800; color: #000; }
.settle-title.ascend { color: #b45309; font-size: 28px; text-shadow: 0 0 14px rgba(212,175,55,.45); }
.settle-rows { width: 100%; display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid #d6d6d6; border-radius: 9px; padding: 9px 12px; font-size: 14px; }
.s-row span { color: #666; flex: 0 0 auto; }
.s-row b { color: #000; flex: 0 0 auto; font-size: 17px; }
.s-row em { color: #7a5c00; font-style: normal; font-size: 12px; flex: 1; text-align: right; min-width: 0; }
.settle-line { color: #555; font-size: 12.5px; line-height: 1.8; margin: 6px 0; text-align: center; }
.settle-btns { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.inherit-head { color: #666; font-size: 13px; margin: 6px 0 8px; text-align: center; }
.inherit-head b { color: #111; }

/* ---------- 图鉴 / 成就列表 ---------- */
#view-tome, #view-ach { align-items: stretch; }
.cnt-line { width: 100%; text-align: center; color: #666; font-size: 13px; margin-bottom: 8px; }
.cnt-line b { color: #000; }
.list { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.item { border-radius: 9px; padding: 9px 12px; background: #fff; border: 1px solid #d6d6d6; display: flex; flex-direction: column; gap: 3px; }
.item .it-name { font-size: 15px; font-weight: 700; color: #111; }
.item .it-sub { color: #666; font-size: 12.5px; line-height: 1.5; }
.item.locked { opacity: .45; }
.item .it-mark { font-size: 11px; align-self: flex-end; color: #999; }
.item.g1 .it-name { color: #1d4ed8; }
.item.g2 .it-name { color: #7c3aed; }
.item.g3 .it-name { color: #b45309; }
.item.g3 { border-color: #d9a45c; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: calc(100% - 60px); max-width: 420px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #111; color: #fff; border-radius: 10px; padding: 11px 14px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: toast-in .25s ease; word-break: break-word; }
.toast.gold { background: #fdf7e7; color: #7a5c00; border: 1px solid #e7c878; }
.toast.bad { background: #b91c1c; color: #fff; }
@keyframes toast-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Mask ---------- */
.mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20,20,20,.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.mask-box { width: 100%; max-width: 420px; background: #fff; border: 1px solid #ccc; border-radius: 14px; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; max-height: 84vh; overflow-y: auto; }
.mask-title { text-align: center; color: #111; font-size: 17px; letter-spacing: 2px; font-weight: 700; }
.mask-info { color: #333; font-size: 14px; line-height: 1.8; text-align: center; }
.mask-rows { width: 100%; display: flex; flex-direction: column; gap: 6px; }

.fb-rows { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.fb-rowline { display: flex; align-items: center; justify-content: space-between; background: #fafafa; border: 1px solid #d6d6d6; border-radius: 9px; padding: 9px 12px; font-size: 13.5px; }
.fb-rowline .st { color: #666; }
.fb-rowline .done { color: #1e7e34; }
.fb-rowline .todo { color: #b91c1c; }

/* ---------- 回顾 / 可滚动 ---------- */
.review-log { width: 100%; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.scroll-y { overflow-y: auto; min-height: 0; }

/* ---------- 排行榜 ---------- */
.rank-row { width: 100%; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #d6d6d6; border-radius: 9px; padding: 9px 12px; }
.rank-row.top { border-color: #111; background: #f6f6f3; }
.rank-no { width: 34px; flex: 0 0 auto; text-align: center; color: #888; font-weight: 700; }
.rank-no.r1 { color: #111; font-weight: 900; }
.rank-no.r2 { color: #444; }
.rank-no.r3 { color: #7a5c00; }
.rank-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid #d0d0d0;
  background: #f0f0f0;
  flex: 0 0 auto;
  object-fit: cover;
}
.rank-user { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #111; font-size: 14px; }
.rank-mine {
  width: 100%;
  background: #f7f3e8;
  border: 1px solid #d9b25c;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 8px;
  color: #7a5c00;
  font-size: 13.5px;
  text-align: center;
  font-weight: 700;
}
.rank-score { flex: 0 0 auto; color: #000; font-weight: 700; font-size: 14px; }

@media (min-width: 600px) {
  #view-home { padding-top: 60px; }
}
