/* 赵云与阿斗 · 样式：宣纸、墨色、朱砂 */
:root {
  --paper: #f3ead8;
  --paper2: #e9dcc3;
  --paper3: #fbf7ee;
  --ink: #1d1a17;
  --ink2: #4a4038;
  --muted: #8a7d6c;
  --red: #b3261e;
  --red2: #d4663f;
  --gold: #e0a100;
  --blue: #2f4f8f;
  --brush: "ZYBrush", "STKaiti", "KaiTi", "Kaiti SC", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #2b2622;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 240, 210, 0.08), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(180, 40, 30, 0.12), transparent 50%);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
input[type=text] { -webkit-user-select: text; user-select: text; }

#app {
  position: relative;
  margin: 0 auto;
  height: 100vh; height: 100dvh;
  width: min(100vw, calc(100dvh * 0.56));
  max-width: 100vw;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}
@supports not (height: 100dvh) { #app { width: min(100vw, calc(100vh * 0.56)); } }
@media (max-width: 600px) { #app { width: 100vw; box-shadow: none; } }

.boot { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--brush); font-size: 48px; color: var(--red); background: var(--paper); }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: var(--safe-bot); }

/* 纸纹 */
.screen:not(.battle)::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(120, 90, 50, 0.08) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(120, 90, 50, 0.06) 0 2px, transparent 3px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.04));
  background-size: 37px 41px, 53px 47px, 100% 100%;
}

/* ───────── 按钮 ───────── */
.btn {
  position: relative; border: none; border-radius: 14px; padding: 12px 22px;
  font-family: var(--brush); font-size: 24px; letter-spacing: 2px;
  background: var(--paper3); color: var(--ink);
  box-shadow: 0 4px 0 rgba(60, 40, 20, 0.35), inset 0 0 0 2px rgba(60, 40, 20, 0.25);
  transition: transform 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(60, 40, 20, 0.35), inset 0 0 0 2px rgba(60, 40, 20, 0.25); }
.btn.red { background: linear-gradient(#d86a42, #b5402a); color: #fff; text-shadow: 0 2px 0 rgba(90, 20, 10, 0.6); box-shadow: 0 5px 0 #6e1d10, inset 0 0 0 2px rgba(90, 20, 10, 0.5); }
.btn.gold { background: linear-gradient(#f2c44a, #d39a10); color: #4a2a00; box-shadow: 0 4px 0 #8a5a00, inset 0 0 0 2px rgba(120, 70, 0, 0.4); font-family: var(--sans); font-weight: 700; letter-spacing: 0; display: inline-flex; align-items: center; gap: 4px; }
.btn.ghost { background: rgba(255, 255, 255, 0.5); }
.btn.big { font-size: 36px; padding: 16px 40px; border-radius: 18px; }
.btn.small { font-size: 16px; padding: 7px 12px; border-radius: 10px; }
.btn.danger { color: var(--red); }
.btn small { font-family: var(--sans); font-size: 13px; letter-spacing: 0; opacity: 0.75; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(60, 55, 50, 0.85); color: #f4ecdc; font-size: 22px; font-weight: 700; display: grid; place-items: center; }

.coin { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe27a, #d39a10); color: #6a4200; font-style: normal; font-family: var(--brush); font-size: 13px; box-shadow: inset 0 0 0 2px #b07a00; }
.star { font-style: normal; color: rgba(90, 80, 60, 0.35); font-size: 26px; text-shadow: 0 1px 0 #fff; }
.star.on { color: var(--gold); text-shadow: 0 1px 0 #7a5200, 0 0 8px rgba(255, 200, 60, 0.6); }
.dot { position: absolute; top: 4px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ───────── 标题 ───────── */
.title-screen { align-items: center; justify-content: center; cursor: pointer; background: linear-gradient(#e7dcc6, var(--paper) 40%, #e3d3b5); }
.title-art { display: flex; flex-direction: column; align-items: center; }
.title-logo { font-family: var(--brush); font-size: clamp(56px, 16vw, 92px); color: var(--red); text-shadow: 3px 4px 0 rgba(60, 20, 10, 0.18); letter-spacing: 4px; transform: rotate(-3deg); }
.title-sub { font-family: var(--brush); font-size: 22px; color: var(--ink2); margin-top: 4px; letter-spacing: 6px; }
.title-hero { position: relative; margin-top: 40px; width: 240px; height: 200px; }
.hero-adou { position: absolute; left: 70px; top: 6px; font-family: var(--brush); font-size: 110px; color: var(--ink); animation: bob 2.4s ease-in-out infinite; }
.hero-zy { position: absolute; left: 30px; top: 110px; font-family: var(--brush); font-size: 72px; color: #a0521a; transform: rotate(-6deg); animation: ride 1.2s ease-in-out infinite; }
.crown { position: absolute; left: 50%; top: 6px; width: 46px; height: 24px; transform: translateX(-46%); background: var(--gold); clip-path: polygon(0 100%, 6% 20%, 28% 62%, 50% 0, 72% 62%, 94% 20%, 100% 100%); filter: drop-shadow(0 2px 0 #7a5200); }
.title-tap { margin-top: 50px; font-family: var(--brush); font-size: 28px; color: var(--ink2); animation: pulse 1.6s ease-in-out infinite; }
.title-foot { position: absolute; bottom: calc(18px + var(--safe-bot)); font-size: 12px; color: var(--muted); }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes ride { 50% { transform: rotate(-3deg) translateY(-5px); } }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ───────── 主城 ───────── */
.home { align-items: center; background: linear-gradient(#e5d8bf, var(--paper) 35%, #e7d9bf); }
.topbar { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 0; gap: 10px; }
.gold-pill { flex: 1; max-width: 200px; display: flex; align-items: center; gap: 8px; background: #2b2622; color: #f3d27a; border-radius: 22px; padding: 6px 14px 6px 8px; font-weight: 800; font-size: 18px; clip-path: polygon(2% 10%, 100% 0, 97% 100%, 0 92%); }
.home-title { font-family: var(--brush); font-size: clamp(48px, 13vw, 70px); color: var(--red); margin-top: 6px; letter-spacing: 3px; text-shadow: 2px 3px 0 rgba(60, 20, 10, 0.15); }
.rank-box { text-align: center; cursor: pointer; margin-top: -4px; }
.rank-name { font-family: var(--brush); font-size: 26px; color: #5a3a10; }
.rank-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stage { position: relative; width: 82%; max-width: 330px; aspect-ratio: 1.25; margin-top: 18px; flex-shrink: 1; min-height: 120px; }
.stage-board { position: absolute; inset: 24% 4% 12%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px; background: #8fb59f; border: 3px solid var(--ink); border-radius: 10px; transform: perspective(500px) rotateX(38deg); box-shadow: 0 16px 20px rgba(0, 0, 0, 0.18); }
.cellp { background: #fbf8f1; border-radius: 4px; }
.cellp.mat { background: repeating-linear-gradient(45deg, #b8955a, #b8955a 4px, #a58248 4px, #a58248 8px); }
.stage-adou { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); z-index: 1; font-family: var(--brush); font-size: clamp(54px, 15vw, 80px); color: var(--ink); animation: bob 2.4s ease-in-out infinite; }
.stage-adou .crown { top: 8%; width: 36px; height: 20px; }
.stage-zy { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-family: var(--brush); font-size: clamp(42px, 12vw, 60px); color: #a0521a; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6); }
.stage-deck { position: absolute; right: -8%; top: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.stage-deck .lbl { font-size: 11px; color: var(--muted); }
.mini-gen { font-family: var(--brush); font-size: 18px; color: #7a3e00; background: #fff4d6; border: 2px solid var(--red); border-radius: 6px; padding: 0 4px; }
.home-btns { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; }
.start-btn { min-width: 250px; }
.sup-line { font-size: 12px; color: var(--red); }
.nav { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px 14px calc(14px + var(--safe-bot)); margin-top: 12px; }
.nav-btn { position: relative; border: none; background: rgba(255, 255, 255, 0.55); border-radius: 14px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 3px 0 rgba(60, 40, 20, 0.25), inset 0 0 0 2px rgba(60, 40, 20, 0.15); }
.nav-ch { font-family: var(--brush); font-size: 30px; color: var(--red); line-height: 1.1; }
.nav-lbl { font-size: 13px; color: var(--ink2); }

/* ───────── 匹配 ───────── */
.match { justify-content: center; align-items: stretch; background: linear-gradient(#b7c4e6 0%, #e9e1f0 48%, #f4d6d0 52%, #e9b4aa 100%); }
.match-title { position: absolute; top: calc(8% + var(--safe-top)); width: 100%; text-align: center; font-family: var(--brush); font-size: 44px; color: var(--ink2); animation: pulse 1s infinite; }
.match-title.done { color: var(--red); animation: none; text-shadow: 2px 2px 0 #fff; }
.flag { margin: 0 -10px; padding: 22px 30px; display: flex; align-items: center; gap: 16px; color: #fff; font-size: 15px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); }
.flag.blue { background: linear-gradient(90deg, #2f4f8f, #4669b0); clip-path: polygon(0 6%, 100% 0, 96% 100%, 3% 92%); animation: slideL 0.5s ease-out; }
.flag.red { background: linear-gradient(90deg, #c9483a, #9e2a22); clip-path: polygon(4% 0, 100% 8%, 98% 94%, 0 100%); justify-content: flex-end; text-align: right; animation: slideR 0.5s ease-out; }
.flag-av { width: 72px; height: 72px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: #f4ecdc; color: var(--ink); font-family: var(--brush); font-size: 46px; border: 3px solid #fff; }
.flag-name { font-family: var(--brush); font-size: 28px; }
.flag-rate { opacity: 0.85; }
.vs { text-align: center; font-size: 56px; margin: 18px 0; color: #4a4a5a; }
.match-map { position: absolute; bottom: calc(10% + var(--safe-bot)); width: 100%; text-align: center; font-family: var(--brush); font-size: 22px; color: #5a2a20; }
@keyframes slideL { from { transform: translateX(-100%); } }
@keyframes slideR { from { transform: translateX(100%); } }

/* ───────── 战斗 ───────── */
.battle { background: #efe4d0; padding: 0; }
.battle-cv { position: absolute; inset: var(--safe-top) 0 var(--safe-bot) 0; width: 100%; height: calc(100% - var(--safe-top) - var(--safe-bot)); touch-action: none; display: block; }
.tip { position: absolute; left: 4%; right: 4%; top: calc(11% + var(--safe-top)); background: rgba(251, 247, 238, 0.97); border: 2px solid var(--ink2); border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.55; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 5; }
.tip.show { opacity: 1; transform: none; pointer-events: auto; }
.tip-title { display: block; font-family: var(--brush); font-size: 22px; font-weight: normal; color: var(--red); margin-bottom: 2px; }

/* ───────── 弹窗 ───────── */
.modal-wrap { position: absolute; inset: 0; z-index: 20; background: rgba(20, 15, 10, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.15s; }
.modal { position: relative; width: 100%; max-width: 420px; max-height: 88%; display: flex; flex-direction: column; background: var(--paper3); border-radius: 16px; border: 3px solid #5a4636; box-shadow: 0 0 0 6px rgba(244, 236, 220, 0.6), 0 20px 40px rgba(0, 0, 0, 0.4); animation: pop 0.2s ease-out; }
.modal-title { font-family: var(--brush); font-size: 32px; text-align: center; padding: 14px 40px 4px; color: var(--ink); }
.modal-x { position: absolute; top: -14px; left: -14px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #5a4636; background: #fbf3e0; font-size: 28px; line-height: 1; color: var(--ink2); }
.modal-body { padding: 8px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-btns { display: flex; justify-content: center; gap: 14px; padding: 12px 16px 18px; flex-wrap: wrap; }
.modal-wrap.tall .modal { max-height: 92%; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.help-text { font-size: 15px; line-height: 1.65; color: var(--ink2); }
.help-text h4 { font-family: var(--brush); font-size: 22px; font-weight: normal; color: var(--red); margin: 12px 0 2px; }
.help-text b { color: var(--ink); }
.pause-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.vol-row { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.vol-row span { width: 3em; }
.vol-row input[type=range] { flex: 1; accent-color: var(--red); }
.vol-row input[type=text] { flex: 1; font-size: 16px; padding: 6px 10px; border-radius: 8px; border: 2px solid #c8b89e; background: #fff; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.chk input { width: 20px; height: 20px; accent-color: var(--red); }
.chk.small { font-size: 12px; color: var(--muted); }

/* ───────── 结算 ───────── */
.result-wrap { background: rgba(20, 15, 10, 0.6); }
.result { width: 100%; max-width: 420px; max-height: 92%; overflow-y: auto; background: var(--paper3); border-radius: 18px; border: 3px solid #5a4636; padding: 18px 18px 6px; text-align: center; animation: pop 0.25s ease-out; }
.res-title { font-family: var(--brush); font-size: 64px; color: var(--red); text-shadow: 3px 3px 0 rgba(60, 20, 10, 0.15); }
.result.lose .res-title { color: #4a5a6a; }
.res-rank { font-family: var(--brush); font-size: 26px; color: #5a3a10; }
.res-delta { font-family: var(--sans); font-size: 15px; font-weight: 700; }
.res-delta.up { color: #c47a00; } .res-delta.down { color: #6a7a8a; }
.res-up { margin-top: 6px; font-family: var(--brush); font-size: 30px; color: var(--red); animation: pop 0.4s; }
.res-big { font-family: var(--brush); font-size: 30px; color: #5a3a10; }
.res-line { font-size: 13px; color: var(--muted); margin: 8px 0; }
.rewards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.rw { border: 2px solid #c8b89e; border-radius: 10px; padding: 4px 10px; font-size: 14px; font-weight: 700; background: #fff; display: inline-flex; align-items: center; gap: 4px; }
.rw.gold { color: #8a5a00; border-color: var(--gold); }
.rw.soul { color: var(--red); border-color: var(--red); }
.mvp-title { font-family: var(--brush); font-size: 20px; color: var(--ink2); margin-top: 8px; }
.mvp { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.mvp-row { display: grid; grid-template-columns: 6em 1fr 4em; align-items: center; gap: 8px; font-size: 14px; }
.mvp-name { font-family: var(--brush); font-size: 18px; text-align: right; }
.mvp-bar { height: 10px; background: rgba(0, 0, 0, 0.08); border-radius: 5px; overflow: hidden; }
.mvp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d4663f, #b3261e); }
.mvp-n { text-align: left; color: var(--muted); }

/* ───────── 子页面 ───────── */
.page { background: linear-gradient(#e5d8bf, var(--paper) 25%); }
.page-head { display: flex; align-items: center; padding: 10px 12px; gap: 8px; border-bottom: 2px solid rgba(90, 70, 54, 0.25); }
.back { border: none; background: rgba(60, 55, 50, 0.85); color: #f4ecdc; border-radius: 18px; padding: 6px 14px; font-size: 15px; }
.page-title { flex: 1; text-align: center; font-family: var(--brush); font-size: 32px; margin-right: 70px; }
.page-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px calc(20px + var(--safe-bot)); }
.page-tip { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.page-sub { font-family: var(--brush); font-size: 22px; margin: 14px 0 6px; color: var(--ink2); }
.page-sub small { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-left: 6px; }
.page-gold { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-weight: 800; color: #8a5a00; }

.gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gen-card { position: relative; border-radius: 12px; padding: 12px 4px 8px; text-align: center; background: rgba(255, 255, 255, 0.5); border: 2px solid rgba(90, 70, 54, 0.25); cursor: pointer; }
.gen-card.unlocked { background: #fff4d6; border-color: var(--red); }
.gen-card.locked .gen-chars { color: #b0a594; }
.gen-card.in-deck { box-shadow: 0 0 0 3px var(--gold); }
.gen-chars { font-family: var(--brush); font-size: 34px; color: #7a3e00; line-height: 1.1; }
.gen-type { font-size: 12px; color: var(--muted); }
.gen-w { font-size: 12px; font-weight: 700; color: var(--muted); }
.gen-lock { font-size: 11px; color: var(--muted); }
.deck-badge { position: absolute; top: -8px; right: -6px; background: var(--red); color: #fff; font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.gen-card.big { padding: 14px; margin-bottom: 8px; }
.gen-title { color: var(--muted); font-size: 13px; }
.gen-skill { font-size: 14px; margin-top: 6px; color: var(--ink2); }
.gen-detail { font-size: 14px; line-height: 1.6; }
.gd-head { display: flex; gap: 14px; align-items: center; }
.gd-chars { font-family: var(--brush); font-size: 50px; color: #7a3e00; background: #fff4d6; border: 3px solid var(--red); border-radius: 12px; padding: 0 10px; }
.gd-title { font-family: var(--brush); font-size: 22px; }
.gd-type { color: var(--muted); font-size: 13px; }
.gd-skill { margin: 10px 0; }
.gd-skill b { color: var(--red); }
.gd-lock { color: var(--red); font-weight: 700; }
.gd-sub { font-family: var(--brush); font-size: 20px; margin-top: 8px; }
.w-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.w-opt { text-align: left; border: 2px solid; border-radius: 10px; background: #fff; padding: 6px 10px; display: flex; flex-direction: column; }
.w-opt.on { background: #fff3c4; box-shadow: 0 0 0 2px var(--gold); }
.w-opt small { color: var(--muted); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { position: relative; flex: 1; border: none; border-radius: 10px; padding: 8px 0; font-family: var(--brush); font-size: 24px; background: rgba(255, 255, 255, 0.5); color: var(--ink2); }
.tab.on { background: var(--red); color: #fff; }
.w-list { display: flex; flex-direction: column; gap: 8px; }
.w-item { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.55); border-radius: 12px; padding: 10px; border: 2px solid rgba(90, 70, 54, 0.15); }
.w-item.owned { background: #fffaf0; border-color: rgba(90, 70, 54, 0.35); }
.w-item:not(.owned) .w-icon { filter: grayscale(0.7) opacity(0.6); }
.w-icon { width: 46px; height: 46px; flex-shrink: 0; border-radius: 10px; color: #fff; font-family: var(--brush); font-size: 30px; display: grid; place-items: center; }
.w-main { flex: 1; min-width: 0; }
.w-name { font-size: 16px; }
.rar { font-size: 11px; color: var(--muted); }
.wstar { color: var(--gold); margin-left: 4px; font-size: 13px; }
.ex { margin-left: 6px; font-size: 11px; color: #fff; background: var(--red); padding: 0 5px; border-radius: 6px; }
.w-desc { font-size: 12px; color: var(--ink2); line-height: 1.45; }
.w-meta { font-size: 11px; color: var(--muted); }
.frag-bar { position: relative; margin-top: 5px; height: 18px; background: rgba(0, 0, 0, 0.08); border-radius: 9px; overflow: hidden; display: flex; align-items: center; }
.frag-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #f2c44a, #d39a10); }
.frag-bar span { position: relative; font-size: 11px; padding-left: 8px; line-height: 1; color: var(--ink); white-space: nowrap; }

.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.6); border-radius: 12px; padding: 10px; border: 2px solid rgba(90, 70, 54, 0.15); }
.si-icon { width: 50px; height: 50px; border-radius: 50%; background: var(--red); color: #fff; font-family: var(--brush); font-size: 30px; display: grid; place-items: center; flex-shrink: 0; }
.si-icon.box { border-radius: 10px; background: #7a4a1a; }
.si-main { flex: 1; min-width: 0; font-size: 15px; }
.si-desc { font-size: 12px; color: var(--ink2); }

.tiers { display: flex; flex-direction: column; gap: 8px; }
.tier { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.4); border: 2px solid rgba(90, 70, 54, 0.15); }
.tier.done { opacity: 0.6; }
.tier.here { background: #fff4d6; border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 161, 0, 0.5); }
.tier-name { font-family: var(--brush); font-size: 30px; width: 2.4em; text-align: center; color: #5a3a10; }
.tier-info { font-size: 12px; color: var(--ink2); line-height: 1.5; }
.tier-gen { color: var(--red); }
.tier-here { font-weight: 700; }

.toast { position: fixed; left: 50%; top: 18%; transform: translate(-50%, -10px); background: rgba(30, 25, 20, 0.9); color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 15px; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 50; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 640px) {
  .stage { max-width: 230px; }
  .home-title { font-size: 44px; }
  .btn.big { font-size: 30px; padding: 12px 32px; }
}

/* ───────── 玩法模式按钮 ───────── */
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(92vw, 360px); }
.btn.mode { position: relative; font-size: 22px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.btn.mode small { font-size: 11px; opacity: 0.7; }
.btn.mode .dot { top: 2px; right: 4px; }
.match-weather { font-family: var(--sans); font-size: 13px; color: #6a3a20; margin-top: 4px; }
.nav { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nav-ch { font-size: 26px; }
.nav-lbl { font-size: 12px; }

/* ───────── 锦囊页 ───────── */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card-item { position: relative; display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.55); border: 2px solid rgba(90, 70, 54, 0.15); cursor: pointer; }
.card-item.on { background: #fff4d6; border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 161, 0, 0.45); }
.card-item.locked { opacity: 0.55; }
.ci-pouch { width: 52px; height: 60px; flex-shrink: 0; display: grid; place-items: center; padding-top: 8px; color: #fff4d6; font-family: var(--brush); font-size: 30px; background: var(--red); border-radius: 10px 10px 26px 26px; box-shadow: inset 0 10px 0 #d4663f; }
.card-item.locked .ci-pouch { background: #8a827a; box-shadow: inset 0 10px 0 #a8a098; }
.ci-main { flex: 1; min-width: 0; font-size: 15px; }
.ci-desc { font-size: 12px; color: var(--ink2); line-height: 1.5; }
.ci-lock { font-size: 11px; color: var(--red); margin-top: 2px; }

/* ───────── 战役 ───────── */
.camp-list { display: flex; flex-direction: column; gap: 8px; }
.camp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.55); border: 2px solid rgba(90, 70, 54, 0.18); cursor: pointer; }
.camp-item.done { background: #fff8e8; }
.camp-item.locked { opacity: 0.5; }
.camp-no { font-family: var(--brush); font-size: 18px; color: var(--red); writing-mode: vertical-rl; letter-spacing: 2px; }
.camp-main { flex: 1; min-width: 0; }
.camp-name { font-family: var(--brush); font-size: 26px; line-height: 1.2; }
.camp-sub { font-size: 12px; color: var(--muted); }
.stars.small .star { font-size: 18px; }
.lock-ic { font-family: var(--brush); color: var(--muted); font-size: 20px; }
.camp-detail { font-size: 14px; line-height: 1.65; color: var(--ink2); }
.cd-story { font-family: var(--brush); font-size: 18px; color: var(--ink); line-height: 1.7; margin: 0 0 8px; }
.cd-rules { margin: 6px 0; padding-left: 1.2em; }
.cd-tip { color: #6a4a10; margin: 6px 0; }
.cd-reward { color: var(--red); font-weight: 700; margin: 6px 0 0; }

/* ───────── 每日挑战 ───────── */
.daily-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: #fff8e8; border: 2px solid rgba(179, 38, 30, 0.35); margin-bottom: 12px; text-align: center; }
.dh-date { font-family: var(--brush); font-size: 28px; color: var(--red); }
.dh-row { font-size: 13px; color: var(--ink2); }
.dh-gens { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mini-gen.big { font-size: 22px; padding: 2px 8px; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.mini-gen.big small { font-family: var(--sans); font-size: 10px; font-weight: 700; }
.lb { display: flex; flex-direction: column; gap: 4px; }
.lb-loading { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 8px; }
.lb-row { display: grid; grid-template-columns: 2.4em 1fr 4.5em 5em; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.55); font-size: 14px; font-variant-numeric: tabular-nums; }
.lb-row.me { background: #fff4d6; box-shadow: 0 0 0 2px var(--gold); }
.lb-rank { font-weight: 800; color: var(--muted); text-align: center; }
.lb-rank.top { color: var(--red); }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wave { color: var(--muted); font-size: 12px; text-align: right; }
.lb-score { font-weight: 800; text-align: right; }

/* ───────── 存档码 ───────── */
.save-row { display: flex; gap: 10px; flex-wrap: wrap; }
.save-code { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 8px; border-radius: 8px; border: 2px solid #c8b89e; background: #fff; resize: vertical; -webkit-user-select: text; user-select: text; word-break: break-all; }
.save-err { color: var(--red); font-size: 13px; min-height: 1.2em; margin-top: 6px; }

/* ───────── 宽屏两侧信息栏 ───────── */
.side-panel { display: none; }
@media (min-width: 1000px) and (min-aspect-ratio: 6/5) {
  .side-panel {
    display: block; position: fixed; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto;
    width: min(300px, calc(50vw - 28dvh - 40px));
    background: rgba(243, 234, 216, 0.96); border: 2px solid #5a4636; border-radius: 14px;
    padding: 12px 14px; font-size: 13px; line-height: 1.55; color: var(--ink2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
  .side-panel.left { right: calc(50vw + 28dvh + 16px); }
  .side-panel.right { left: calc(50vw + 28dvh + 16px); }
}
.side-panel h3 { margin: 0 0 6px; font-family: var(--brush); font-weight: normal; font-size: 24px; color: var(--red); }
.side-panel h4 { margin: 10px 0 4px; font-family: var(--brush); font-weight: normal; font-size: 18px; color: var(--ink); }
.sp-row { font-variant-numeric: tabular-nums; }
.sp-dim { color: rgba(90, 70, 54, 0.3); }
.sp-dim2 { color: var(--muted); }
.sp-units { display: flex; flex-wrap: wrap; gap: 4px; }
.sp-u { display: inline-flex; align-items: baseline; gap: 1px; font-family: var(--brush); font-size: 22px; color: var(--ink); background: #fffaf0; border: 1px solid rgba(90, 70, 54, 0.25); border-radius: 6px; padding: 0 5px; }
.sp-u.gen { color: #7a3e00; border-color: var(--red); background: #fff4d6; font-size: 18px; }
.sp-u small { font-family: var(--sans); font-size: 10px; color: var(--muted); }
.sp-card { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 8px; background: var(--red); color: #fff; font-size: 12px; }
.sp-card.used { background: #a8a098; text-decoration: line-through; }
.sp-boss { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(158, 27, 22, 0.1); color: #7a1510; }
.sp-bond { margin-bottom: 4px; }
.sp-bond b { color: #2f74c0; }
.sp-bond.form b { color: var(--red); }
.sp-bond.gen b { color: #a06a00; }
.sp-story { font-family: var(--brush); font-size: 16px; color: var(--ink); }
.sp-tip { color: #6a4a10; }
.ci-orb { width: 54px; height: 54px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: #2f4f8f; color: #fff4d6; font-family: var(--brush); font-size: 30px; box-shadow: inset 0 0 0 3px #e0a100; }
.card-item.locked .ci-orb { background: #8a8f9a; box-shadow: inset 0 0 0 3px #b8b0a0; }
.ci-cd { margin-left: 8px; font-size: 11px; font-weight: normal; color: #2f4f8f; }
.sp-card.skill { background: #2f4f8f; }
.sp-card.skill.used { background: #8a8f9a; text-decoration: none; }
