/* ---- 4.7 游戏内观感字体：思源黑体子集（可变字重 100-900） ---- */
@font-face {
  font-family: "HSR Sans SC";
  src: url("../assets/fonts/hsr-sans-sc.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* ============================================================
   崩一把 · 样式表
   主题：崩坏：星穹铁道 4.7「星海终章」—— 酒红幕布 + 桃粉高光 + 薰衣草紫
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 4.7「此刻，将群星付之一笑」· 亮色剧场主题（取自版本 KV 取色） */
  --bg: #F4E7F1;
  --bg-2: #EEDBE9;
  --bg-3: #FDF7FB;
  --panel: rgba(255, 252, 254, 0.78);
  --panel-solid: #FFF9FC;
  --line: rgba(134, 89, 141, 0.20);
  --line-strong: rgba(166, 46, 107, 0.45);
  --gold: #A62E6B;
  --gold-deep: #7C234F;
  --cyan: #6B4C9A;
  --text: #3A1B33;
  --muted: #6F4A66;
  --dim: #856481;

  --ok-bg: rgba(70, 208, 138, 0.22);
  --ok-line: #1F8A5B;
  --ok-text: #0E4A2F;
  --mid-bg: rgba(232, 161, 132, 0.28);
  --mid-line: #B7643F;
  --mid-text: #6B2F16;
  --no-bg: rgba(134, 89, 141, 0.10);
  --no-line: #C8B2C2;
  --no-text: #7D6478;

  --radius: 12px;
  --shadow: 0 18px 48px rgba(96, 44, 80, 0.16);
  --serif: "HSR Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI Emoji", system-ui, sans-serif;
  --sans: "HSR Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI Emoji", system-ui, sans-serif;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
/* hidden 属性必须压得住 .icon-btn 等子类里的 display，
   否则作者样式会盖掉浏览器默认的 [hidden]{display:none}，元素照样显示 */
[hidden] { display: none !important; }
::selection { background: rgba(201, 127, 193, 0.32); }

/* ---------- 星轨背景 ---------- */
#stars {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.aurora {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(900px 620px at 78% -6%, rgba(201, 127, 193, 0.14), transparent 62%),
    radial-gradient(760px 520px at 6% 12%, rgba(169, 158, 201, 0.13), transparent 60%),
    radial-gradient(1100px 760px at 50% 118%, rgba(122, 36, 62, 0.16), transparent 66%);
}
/* ---------- 启动遮罩 ---------- */
#boot {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  padding: 24px; background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
#boot.leaving { opacity: 0; visibility: hidden; }
.boot__card { width: min(100%, 340px); text-align: center; }
.boot__emblem {
  position: relative; width: 84px; height: 84px; margin: 0 auto 22px;
  border: 1px solid var(--line-strong); border-radius: 50%;
  box-shadow: inset 0 0 28px rgba(169, 158, 201, 0.18), 0 0 36px rgba(201, 127, 193, 0.14);
}
.boot__emblem::before, .boot__emblem::after {
  content: ""; position: absolute; inset: 10px; border: 1px solid rgba(169, 158, 201, 0.5);
  border-radius: 50%; animation: ripple 1.9s ease-in-out infinite;
}
.boot__emblem::after { inset: 26px; border-color: var(--gold); animation-delay: -0.95s; }
@keyframes ripple {
  0%, 100% { opacity: 0.4; transform: scale(0.84); }
  50% { opacity: 1; transform: scale(1.08); }
}
.boot__eyebrow { font: 700 0.66rem/1.4 Georgia, serif; letter-spacing: 0.26em; color: var(--gold); }
.boot__card h1 { font: 700 1.6rem/1.3 var(--serif); letter-spacing: 0.14em; margin: 6px 0 8px; }
.boot__msg { color: var(--muted); font-size: 0.78rem; min-height: 1.6em; }
.boot__bar {
  height: 4px; margin-top: 14px; border-radius: 99px; overflow: hidden;
  background: rgba(134, 89, 141, 0.16);
}
.boot__bar i { display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold)); transition: width 0.25s ease; }

/* ---------- 主框架 ---------- */
#app { position: relative; z-index: 2; display: flex; flex-direction: column; min-height: 100vh; }
#view { flex: 1; width: min(1220px, 100%); margin: 0 auto; padding: 18px 18px 40px; }
#view.is-game { padding-bottom: 128px; }

/* ---------- 顶栏 ---------- */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px max(18px, calc((100% - 1220px) / 2 + 18px));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand__mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(140deg, var(--cyan), var(--gold));
  box-shadow: 0 0 12px rgba(201, 127, 193, 0.8);
  transform: translateY(-1px);
}
.brand__cn { font: 700 1.12rem/1 var(--serif); letter-spacing: 0.16em; color: var(--gold); }
.brand__en { font: 600 0.6rem/1 Georgia, serif; letter-spacing: 0.22em; color: var(--dim); }
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav a {
  padding: 6px 13px; border-radius: 999px; font-size: 0.85rem; color: var(--muted);
  border: 1px solid transparent; transition: 0.2s;
}
.mainnav a:hover { color: var(--text); border-color: var(--line); }
.mainnav a.active { color: var(--gold); border-color: var(--line-strong); background: rgba(201, 127, 193, 0.08); }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.78rem; color: var(--muted); transition: 0.2s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--line-strong); }
.theme-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(140deg, var(--cyan), var(--gold)); }

/* ---------- 通用组件 ---------- */
.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow); position: relative;
}
.panel::before {
  content: ""; position: absolute; inset: 6px; border-radius: calc(var(--radius) - 5px);
  border: 1px solid rgba(201, 127, 193, 0.08); pointer-events: none;
}
.eyebrow {
  font: 700 0.62rem/1.4 Georgia, serif; letter-spacing: 0.26em;
  color: var(--gold); text-transform: uppercase;
}
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font: 700 1.18rem/1.3 var(--serif); letter-spacing: 0.1em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; font-size: 0.86rem; font-weight: 600;
  border: 1px solid var(--line-strong); color: var(--gold);
  background: rgba(201, 127, 193, 0.08); transition: 0.2s;
}
.btn:hover { background: rgba(201, 127, 193, 0.18); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.btn--ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(134, 89, 141, 0.08); }
.btn--primary {
  color: #1a1206; border-color: transparent;
  background: linear-gradient(120deg, #FFD9CE, #A62E6B 45%, #C97C88);
  box-shadow: 0 10px 26px rgba(201, 127, 193, 0.24);
}
.btn--primary:hover { box-shadow: 0 14px 32px rgba(201, 127, 193, 0.36); }
.btn--danger { border-color: rgba(214, 106, 122, 0.5); color: #ee9aa8; background: rgba(214, 106, 122, 0.1); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 0.76rem; color: var(--muted); transition: 0.18s;
}
button.chip:hover { color: var(--text); border-color: var(--line-strong); }
button.chip.on { color: #1a1206; background: linear-gradient(120deg, #FFD9CE, #C97C88); border-color: transparent; font-weight: 600; }

/* ---------- 首页 ---------- */
.home-hero { position: relative; overflow: hidden; margin-bottom: 22px; padding: 46px 30px 40px; text-align: center; }
.home-hero__glow {
  position: absolute; width: 460px; height: 460px; border-radius: 50%;
  filter: blur(70px); opacity: 0.5; pointer-events: none;
}
.home-hero__glow--a { left: -120px; top: -140px; background: rgba(169, 158, 201, 0.4); }
.home-hero__glow--b { right: -130px; bottom: -180px; background: rgba(201, 127, 193, 0.35); }
.home-hero__inner { position: relative; z-index: 2; }
.home-hero h1 {
  font: 700 clamp(2.6rem, 8vw, 4.2rem)/1.1 var(--serif);
  letter-spacing: 0.14em; margin: 10px 0 4px;
  background: linear-gradient(180deg, #fff 8%, var(--gold) 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 12px 40px rgba(201, 127, 193, 0.28);
}
.home-hero__sub { color: var(--muted); font-size: 0.92rem; letter-spacing: 0.08em; }

.hero-figure {
  position: absolute; z-index: 1; bottom: 0; width: 260px; pointer-events: none;
  filter: drop-shadow(0 18px 40px rgba(96, 44, 80, 0.22));
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}
.hero-figure--l { left: 2%; }
.hero-figure--r { right: 2%; transform: scaleX(-1); }

.hero-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 30px 0 6px; position: relative; z-index: 3; }
.hero-main {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: min(360px, 88vw); padding: 15px 24px; border-radius: 16px;
  border: 1px solid var(--line-strong); color: var(--gold);
  background: linear-gradient(160deg, rgba(201, 127, 193, 0.16), rgba(169, 158, 201, 0.07));
  box-shadow: 0 16px 40px rgba(96, 44, 80, 0.16), inset 0 0 30px rgba(201, 127, 193, 0.1);
  transition: 0.22s;
}
.hero-main:hover { transform: translateY(-2px); box-shadow: 0 22px 52px rgba(201, 127, 193, 0.24); }
.hero-main strong { font: 700 1.28rem/1.4 var(--serif); letter-spacing: 0.16em; }
.hero-main small { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.14em; }
.hero-sub-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hero-sub {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(134, 89, 141, 0.06);
  font-size: 0.85rem; color: var(--text); transition: 0.2s;
}
.hero-sub:hover { border-color: var(--line-strong); background: rgba(201, 127, 193, 0.1); }

.home-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin-bottom: 22px; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }

.notice-list li { border-bottom: 1px dashed var(--line); }
.notice-list li:last-child { border-bottom: none; }
.notice-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 4px; text-align: left; transition: 0.2s;
}
.notice-item:hover { padding-left: 9px; }
.notice-item__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; box-shadow: 0 0 8px var(--gold); }
.notice-item__t { flex: 1; font-size: 0.88rem; }
.notice-item__d { font: 600 0.72rem/1 Georgia, serif; color: var(--dim); font-variant-numeric: tabular-nums; }
.notice-item__x { color: var(--dim); font-size: 1.1rem; line-height: 1; transition: transform 0.25s; }
.notice-item.open .notice-item__x { transform: rotate(45deg); color: var(--gold); }
.notice-body { display: none; padding: 0 6px 16px 22px; color: var(--muted); font-size: 0.83rem; }
.notice-body.show { display: block; animation: fadeUp 0.28s ease; }
.notice-body ul { display: grid; gap: 5px; }
.notice-body li::before { content: "▸ "; color: var(--gold); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  padding: 14px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(134, 89, 141, 0.05);
}
.stat b { display: block; font: 700 1.6rem/1.1 Georgia, serif; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.74rem; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- 页脚 ---------- */
#footer {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between;
  width: min(1220px, 100%); margin: 0 auto; padding: 22px 18px 34px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem;
}
#footer h4 { font: 700 0.82rem/1.4 var(--serif); color: var(--text); letter-spacing: 0.1em; margin-bottom: 8px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer__links a { color: var(--muted); border-bottom: 1px dashed transparent; }
.footer__links a:hover { color: var(--gold); border-bottom-color: var(--line-strong); }
.footer__col--meta { text-align: right; max-width: 460px; }
.footer__ver { font-family: Georgia, serif; font-variant-numeric: tabular-nums; }
.footer__note { color: var(--dim); font-size: 0.74rem; margin-top: 5px; }

/* ---------- 难度选择 ---------- */
.stage { display: grid; gap: 12px; max-width: 700px; margin: 26px auto 0; }
.stage-head { text-align: center; margin-bottom: 8px; }
.stage-head h1 { font: 700 1.95rem/1.3 var(--serif); letter-spacing: 0.14em; margin: 8px 0 4px; }
.stage-head p { color: var(--muted); font-size: 0.86rem; }
.stage-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); transition: 0.2s;
}
.stage-opt:hover { border-color: var(--line-strong); transform: translateX(3px); background: rgba(201, 127, 193, 0.08); }
.stage-opt__icon { width: 40px; height: 40px; flex: none; }
.stage-opt__t { flex: 1; }
.stage-opt__t b { display: block; font-size: 1rem; letter-spacing: 0.08em; }
.stage-opt__t small { color: var(--muted); font-size: 0.78rem; }
.stage-opt__n { font: 600 0.76rem/1 Georgia, serif; color: var(--gold); }
.stage-opt__arrow { color: var(--dim); }

/* ---------- 对局 ---------- */
.gamebar {
  position: sticky; top: 54px; z-index: 30; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}
.gamebar__title { font: 700 0.96rem/1.3 var(--serif); letter-spacing: 0.1em; }
.gamebar__meta { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.meter {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 999px; border: 1px solid var(--line); font-size: 0.76rem; color: var(--muted);
}
.meter b { color: var(--text); font-family: Georgia, serif; font-variant-numeric: tabular-nums; }

.rules { margin-bottom: 14px; padding: 0; overflow: hidden; }
.rules__toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px;
  text-align: left; font-size: 0.85rem;
}
.rules__toggle b { color: var(--gold); }
.rules__body { display: none; padding: 0 16px 14px; color: var(--muted); font-size: 0.82rem; }
.rules__body.show { display: block; }
.rules__body ul { display: grid; gap: 6px; margin-top: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid; }

.table-scroll { overflow-x: auto; border-radius: var(--radius); }
table.guess { width: 100%; border-collapse: separate; border-spacing: 0 6px; min-width: 1040px; }
table.guess th {
  padding: 8px 10px; text-align: center; font-size: 0.74rem; font-weight: 600;
  color: var(--muted); letter-spacing: 0.06em; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.guess th:first-child, table.guess td:first-child { text-align: left; }
table.guess td {
  padding: 9px 10px; text-align: center; font-size: 0.82rem;
  border-top: 1px solid var(--cell-line, var(--line));
  border-bottom: 1px solid var(--cell-line, var(--line));
  background: var(--cell-bg, var(--panel));
  transition: 0.2s;
}
table.guess td:first-child {
  border-left: 1px solid var(--cell-line, var(--line));
  border-radius: 10px 0 0 10px;
}
table.guess td:last-child { border-right: 1px solid var(--cell-line, var(--line)); border-radius: 0 10px 10px 0; }
td.hit   { --cell-bg: var(--ok-bg);  --cell-line: var(--ok-line);  color: var(--ok-text); }
td.part  { --cell-bg: var(--mid-bg); --cell-line: var(--mid-line); color: var(--mid-text); }
td.miss  { --cell-bg: var(--no-bg);  --cell-line: var(--no-line);  color: var(--no-text); }
td.hit .arrow, td.part .arrow { font-weight: 700; }
.cell-avatar { display: flex; align-items: center; gap: 9px; }
.cell-avatar img {
  width: 34px; height: 46px; object-fit: cover; object-position: top center;
  border-radius: 6px; border: 1px solid var(--cell-line, var(--line)); background: rgba(255, 252, 254, 0.55);
}
.cell-avatar b { font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.cell-avatar em { font-style: normal; font-size: 0.68rem; color: var(--dim); display: block; }
.icon-cell { display: inline-flex; align-items: center; gap: 5px; }
.icon-cell img { width: 20px; height: 20px; }
/* 同 .card__pa-ic：浅色主题下命途白图标反色显示 */
.star-row { letter-spacing: 2px; font-size: 0.8rem; }
.star-gold { color: var(--gold); }
.empty-row td {
  padding: 34px 14px; text-align: center; color: var(--dim); font-size: 0.85rem;
  border: 1px dashed var(--line); background: rgba(134, 89, 141, 0.04);
}
.empty-row td:first-child { border-radius: 12px 0 0 12px; }
.empty-row td:last-child { border-radius: 0 12px 12px 0; }

/* 输入区 */
.guess-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 12px 18px calc(12px + var(--toy-safe-bottom, env(safe-area-inset-bottom, 0px)));
  border-top: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.guess-dock__inner { width: min(760px, 100%); margin: 0 auto; position: relative; }
.guess-input {
  display: flex; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(255, 252, 254, 0.72);
}
.guess-input input {
  flex: 1; min-width: 0; padding: 8px 6px 8px 14px; border: none; background: none; outline: none;
  font-size: 0.92rem;
}
.guess-input input::placeholder { color: var(--dim); }
.autocomplete {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  max-height: 320px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--panel-solid); box-shadow: var(--shadow); display: none;
}
.autocomplete.show { display: block; }
.ac-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px;
  border-radius: 9px; text-align: left; transition: 0.15s;
}
.ac-item:hover, .ac-item.on { background: rgba(201, 127, 193, 0.14); }
.ac-item img { width: 28px; height: 38px; object-fit: cover; object-position: top; border-radius: 5px; border: 1px solid var(--line); }
.ac-item__main { flex: 1; min-width: 0; }
.ac-item__main b { font-size: 0.84rem; }
.ac-item__main small { display: block; color: var(--dim); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-tag { font-size: 0.62rem; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--gold); flex: none; }
.ac-empty { padding: 14px; text-align: center; color: var(--dim); font-size: 0.8rem; }

/* ---------- 角色图鉴 ---------- */
.roster-tools { display: grid; gap: 12px; margin-bottom: 16px; padding: 16px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 252, 254, 0.66);
}
.search-box input { flex: 1; min-width: 0; border: none; background: none; outline: none; }
.filter-group { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.filter-group__label { flex: none; width: 58px; padding-top: 5px; font-size: 0.76rem; color: var(--dim); }
.filter-group__opts { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.filter-hint { font-size: 0.74rem; color: var(--dim); }
.roster-count { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.roster-count b { color: var(--gold); font-family: Georgia, serif; font-size: 1.05rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.card {
  position: relative; overflow: hidden; padding: 0; text-align: left;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  transition: 0.22s;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 16px 34px rgba(96, 44, 80, 0.18); }
.card__pic { position: relative; aspect-ratio: 376 / 460; background: linear-gradient(180deg, rgba(134, 89, 141, 0.1), transparent); }
.card__pic img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.card__rarity { position: absolute; top: 6px; left: 6px; font-size: 0.62rem; padding: 1px 7px; border-radius: 99px; color: #1a1206; background: linear-gradient(120deg, #FFD9CE, #C97C88); font-weight: 700; }
.card__info { padding: 8px 10px 11px; }
.card__info b { display: block; font-size: 0.85rem; letter-spacing: 0.02em; }
.card__info small { color: var(--dim); font-size: 0.7rem; }
.card__el-ic { display: inline; width: 14px; height: 14px; vertical-align: -2px; margin-left: 5px; }
/* 命途图标是纯白色 PNG：深空主题直接用；浅色主题反成深色，避免白底白图看不见 */
/* 详情弹窗 */
.modal-back {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 20px; background: rgba(58, 27, 51, 0.34); backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}
.modal {
  width: min(880px, 100%); max-height: 88vh; overflow-y: auto;
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--panel-solid); box-shadow: var(--shadow);
  animation: fadeUp 0.26s ease;
}
.modal__close { position: absolute; top: 12px; right: 14px; font-size: 1.4rem; line-height: 1; color: var(--muted); z-index: 3; }
.modal__close:hover { color: var(--gold); }
.detail { display: grid; grid-template-columns: 280px 1fr; gap: 0; }
@media (max-width: 700px) { .detail { grid-template-columns: 1fr; } }
.detail__art { position: relative; background: linear-gradient(180deg, rgba(134, 89, 141, 0.14), rgba(20, 8, 16, 0.2)); }
.detail__art img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; object-position: top center; }
.detail__body { padding: 22px 24px; }
.detail__body h3 { font: 700 1.5rem/1.3 var(--serif); letter-spacing: 0.08em; }
.detail__title { color: var(--gold); font-size: 0.82rem; margin-top: 3px; }
.detail__tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 14px; }
.detail__rows { display: grid; gap: 0; border-top: 1px solid var(--line); }
.drow { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.83rem; }
.drow dt { flex: none; width: 74px; color: var(--dim); }
.drow dd { flex: 1; color: var(--text); }
.detail__lore { margin-top: 16px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(134, 89, 141, 0.05); color: var(--muted); font-size: 0.82rem; }
.detail__lore h4 { font: 700 0.8rem/1.4 var(--serif); color: var(--gold); letter-spacing: 0.12em; margin-bottom: 6px; }

/* ---------- 双人对战 ---------- */
.duel-modes { display: grid; gap: 12px; max-width: 700px; margin: 26px auto 0; }
.code-display {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 22px; margin: 16px 0; border-radius: 14px;
  border: 1px dashed var(--line-strong); background: rgba(201, 127, 193, 0.06);
}
.code-display b { font: 700 2.1rem/1 Georgia, serif; letter-spacing: 0.34em; color: var(--gold); }
.duel-board { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 760px) { .duel-board { grid-template-columns: 1fr; } }
.duel-side { padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.duel-side.turn { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong), 0 14px 34px rgba(201, 127, 193, 0.16); }
.duel-side h4 { font: 700 1rem/1.4 var(--serif); letter-spacing: 0.1em; margin-bottom: 4px; }
.duel-side .duel-n { font: 700 1.9rem/1.2 Georgia, serif; color: var(--gold); }
.duel-side small { color: var(--muted); font-size: 0.76rem; }

/* 对手的推演记录：左侧青色标记，便于区分先后手 */
table.guess tr.row.opp td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }

/* ---------- 账户 / 人机验证 ---------- */
.account-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--dim);
  box-shadow: 0 0 0 3px rgba(169, 158, 201, 0.1); transition: 0.2s;
}
#account-btn.is-on .account-dot { background: var(--cyan); box-shadow: 0 0 0 3px rgba(169, 158, 201, 0.22); }

.auth-panel { max-width: 620px; margin: 24px auto 0; padding: 26px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-current {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: rgba(201, 127, 193, 0.07);
}
.auth-current b { font-size: 0.9rem; }
.auth-current span { flex: 1; min-width: 120px; color: var(--muted); font-size: 0.78rem; }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; }
.auth-form label > span,
.captcha-field > span { font-size: 0.76rem; color: var(--dim); letter-spacing: 0.06em; }
.auth-form input {
  width: 100%; padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; color: var(--text);
  border: 1px solid var(--line); background: rgba(255, 252, 254, 0.72); outline: none; transition: 0.18s;
}
.auth-form input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.12); }
.auth-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.captcha-field { display: grid; gap: 8px; }
.captcha-loading { padding: 10px 0; font-size: 0.78rem; color: var(--dim); }
.captcha-fail { font-size: 0.78rem; color: var(--muted); line-height: 1.9; }

/* ---------- 匹配等待 ---------- */
.queue-dots { display: flex; justify-content: center; gap: 10px; }
.queue-dots i {
  width: 10px; height: 10px; border-radius: 50%; background: var(--gold);
  animation: queuePulse 1.1s ease-in-out infinite;
}
.queue-dots i:nth-child(2) { animation-delay: 0.18s; }
.queue-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes queuePulse {
  0%, 100% { transform: translateY(0) scale(0.7); opacity: 0.35; }
  50% { transform: translateY(-6px) scale(1); opacity: 1; }
}
.guess-input input[disabled] { opacity: 0.55; }

/* ---------- 鸣谢 ---------- */
.credits { max-width: 700px; margin: 20px auto 0; padding: 26px; }
.credits h1 { font: 700 1.7rem/1.3 var(--serif); letter-spacing: 0.14em; margin: 8px 0 18px; }
.credits h4 { font: 700 0.84rem/1.4 var(--serif); color: var(--gold); letter-spacing: 0.16em; margin: 18px 0 6px; }
.credits p { color: var(--muted); font-size: 0.85rem; }
.credits .tail { margin-top: 26px; text-align: center; color: var(--dim); letter-spacing: 0.2em; }

/* ---------- 结果弹窗 ---------- */
.result { width: min(560px, 100%); padding: 30px 26px; text-align: center; }
.result__badge { width: 76px; height: 76px; margin: 0 auto 14px; }
.result h3 { font: 700 1.7rem/1.3 var(--serif); letter-spacing: 0.14em; margin-bottom: 6px; }
.result p { color: var(--muted); font-size: 0.86rem; }
.result__answer { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0; padding: 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(201, 127, 193, 0.07); }
.result__answer img { width: 68px; height: 92px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); }
.result__answer div { text-align: left; }
.result__answer b { display: block; font-size: 1.1rem; letter-spacing: 0.08em; }
.result__answer small { color: var(--muted); font-size: 0.76rem; }
.result__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.result__stats { display: flex; gap: 22px; justify-content: center; margin-top: 14px; }
.result__stats div { text-align: center; }
.result__stats b { display: block; font: 700 1.3rem/1.2 Georgia, serif; color: var(--gold); }
.result__stats span { font-size: 0.72rem; color: var(--dim); }
.share-box { margin-top: 14px; padding: 12px; border-radius: 10px; border: 1px dashed var(--line); color: var(--dim); font-size: 0.72rem; text-align: left; white-space: pre-wrap; word-break: break-all; }

/* ---------- 提示条 ---------- */
#toast-root { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 95; display: grid; gap: 8px; }
.toast {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--panel-solid); color: var(--text); font-size: 0.82rem;
  box-shadow: var(--shadow); animation: fadeUp 0.24s ease;
}
.toast.warn { border-color: rgba(224, 179, 74, 0.6); color: var(--mid-text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .brand__en { display: none; }
  .hero-figure { width: 150px; opacity: 0.5; }
  .home-hero { padding: 30px 16px 26px; }
  #view { padding: 14px 12px 40px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 9px; }
  .footer__col--meta { text-align: left; }
  .guess-dock { padding-left: 12px; padding-right: 12px; }
  #app { min-height: 100dvh; }

  /* ---- 顶栏：窄屏一行放不下，拆成「品牌 + 入口」/「主导航」两行 ---- */
  #topbar {
    flex-wrap: wrap; gap: 6px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  }
  .brand { flex: none; }
  .brand__cn { font-size: 1rem; letter-spacing: 0.1em; }
  .topbar__right { margin-left: auto; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .icon-btn { padding: 8px 11px; font-size: 0.72rem; }
  .mainnav { order: 3; width: 100%; margin-left: 0; gap: 6px; }
  .mainnav a {
    flex: 1; display: flex; align-items: center; justify-content: center;
    min-height: 38px; padding: 6px 4px; font-size: 0.8rem; white-space: nowrap;
  }

  /* 入口按钮在手机上要看得见：三个按钮都保留文字（深空 / 白昼 只有两个字，放得下） */
  #account-label {
    max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  /* ---- 触控与可读性 ---- */
  .btn { padding: 11px 18px; }
  .chip { padding: 7px 13px; }
  /* iOS 对 16px 以下的输入框会自动放大页面，改为 16px 避免跳动 */
  .guess-input input, .search-box input, .auth-form input,
  .admin-search input, .admin-field input, .admin-textarea { font-size: 16px; }

  /* ---- 推演表格：收窄最小宽度、缩小内边距，减少横向滚动 ---- */
  .table-scroll { margin: 0 -12px; padding: 0 12px; }
  table.guess { min-width: 900px; }
  table.guess th, table.guess td { padding: 7px 7px; }
  .cell-avatar { gap: 7px; }
  .cell-avatar img { width: 28px; height: 38px; }
  .cell-avatar b { font-size: 0.8rem; }

  /* ---- 弹窗 ---- */
  .modal-back { padding: 12px; }
  .modal { max-height: 90dvh; }
  .detail__body { padding: 18px 16px; }
  .code-display { padding: 16px 12px; }
  .code-display b { font-size: 1.7rem; letter-spacing: 0.2em; }
  .auth-panel { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 管理后台 ---------- */
.admin .stage-head { text-align: left; padding-left: 2px; }

.admin-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(140deg, #FFD9CE, #C97C88);
  box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.16); transition: 0.2s;
}
#admin-btn:hover .admin-dot { box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.3); }

.admin-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 14px 0 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.admin-tab {
  padding: 6px 15px; border-radius: 999px; font-size: 0.82rem;
  color: var(--muted); border: 1px solid transparent; transition: 0.18s;
}
.admin-tab:hover { color: var(--text); border-color: var(--line); }
.admin-tab.on {
  color: var(--gold); border-color: var(--line-strong);
  background: rgba(201, 127, 193, 0.1); font-weight: 600;
}

.admin-hint { font-size: 0.76rem; color: var(--dim); line-height: 1.7; }
.admin-dim { color: var(--dim); font-size: 0.7rem; }
.admin-form__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* 概览 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 16px 18px; }
.stat-card__k { font-size: 0.74rem; color: var(--dim); letter-spacing: 0.14em; }
.stat-card__v { font: 700 1.9rem/1.2 Georgia, serif; color: var(--gold); margin: 4px 0 2px; }
.stat-card__h { font-size: 0.72rem; color: var(--muted); }
.admin-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-chip {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(134, 89, 141, 0.06);
  font-size: 0.76rem; color: var(--muted);
}

/* 搜索与表格 */
.admin-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-search input {
  width: 220px; padding: 8px 15px; border-radius: 999px; font-size: 0.84rem;
  color: var(--text); border: 1px solid var(--line);
  background: rgba(255, 252, 254, 0.72); outline: none; transition: 0.18s;
}
.admin-search input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.12); }
.admin-search .btn { padding: 7px 16px; font-size: 0.8rem; }

.admin-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th {
  text-align: left; padding: 8px 10px; white-space: nowrap;
  font: 600 0.7rem/1.4 var(--sans); letter-spacing: 0.1em;
  color: var(--dim); border-bottom: 1px solid var(--line);
}
.admin-table td { padding: 9px 10px; border-bottom: 1px dashed var(--line); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(134, 89, 141, 0.06); }
.admin-table code { font-size: 0.76rem; color: var(--cyan); }
.admin-table__actions { white-space: nowrap; }
.admin-table__actions .btn { margin: 0 4px 4px 0; }

.admin-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; border: 1px solid var(--line);
  background: rgba(134, 89, 141, 0.08); color: var(--muted);
}
.admin-badge--gold { border-color: var(--line-strong); background: rgba(201, 127, 193, 0.14); color: var(--gold); }
.admin-badge--ok { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-text); }
.admin-badge--red { border-color: rgba(214, 106, 122, 0.5); background: rgba(214, 106, 122, 0.12); color: #ee9aa8; }

.admin-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.admin-pager__btns { display: flex; gap: 8px; }
.admin-pager .btn { padding: 6px 15px; font-size: 0.8rem; }

/* 房间与队列 */
.admin-queue {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 7px;
  border: 1px solid var(--line); background: rgba(134, 89, 141, 0.05);
  font-size: 0.82rem;
}
.admin-queue b { color: var(--gold); font-size: 0.8rem; letter-spacing: 0.1em; }
.admin-queue span { color: var(--muted); }

/* 后台弹窗表单 */
.admin-modal { width: min(460px, 100%); padding: 24px 24px 20px; }
.admin-modal__t { font: 700 1.12rem/1.4 var(--serif); letter-spacing: 0.1em; margin-bottom: 14px; padding-right: 28px; }
.admin-modal__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.admin-modal__actions .btn { padding: 8px 18px; font-size: 0.84rem; }
.admin-field { display: grid; gap: 6px; margin-bottom: 12px; }
.admin-field > span { font-size: 0.76rem; color: var(--dim); letter-spacing: 0.06em; }
.admin-field input {
  width: 100%; padding: 9px 15px; border-radius: 999px; font-size: 0.88rem; color: var(--text);
  border: 1px solid var(--line); background: rgba(255, 252, 254, 0.72); outline: none; transition: 0.18s;
}
.admin-field input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.12); }

.admin-textarea {
  width: 100%; min-height: 96px; padding: 12px 16px; border-radius: 12px;
  font: inherit; font-size: 0.88rem; color: var(--text);
  border: 1px solid var(--line); background: rgba(255, 252, 254, 0.72);
  outline: none; resize: vertical; transition: 0.18s;
}
.admin-textarea:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(201, 127, 193, 0.12); }

.btn--xs { padding: 4px 11px; font-size: 0.74rem; }

@media (max-width: 720px) {
  .admin .stage-head h1 { font-size: 1.5rem; }
  .admin-search { width: 100%; }
  .admin-search input { flex: 1; width: auto; min-width: 0; }
  .stat-card__v { font-size: 1.6rem; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
  .stat-card { padding: 13px 14px; }
  .admin-tabs { gap: 4px; margin: 10px 0 12px; padding-bottom: 8px; }
  .admin-tab { padding: 7px 12px; font-size: 0.76rem; }
  .admin-table { font-size: 0.78rem; }
  .admin-table th, .admin-table td { padding: 7px 8px; }
  /* 表格里的行内按钮要够手指点，别用桌面端的迷你尺寸 */
  .admin-table .btn--xs { padding: 7px 12px; font-size: 0.78rem; }
  .admin-queue { font-size: 0.78rem; padding: 8px 10px; }
  .admin-pager__btns { gap: 6px; }
  .admin-modal { padding: 20px 16px 16px; }
  .admin-modal__actions .btn { flex: 1; }
}

/* ---------- 移动端 100dvh 与 安全区适配 (Bilibili Toy 规范) ---------- */
html, body {
  height: 100%;
}
body {
  min-height: 100dvh;
}
#app {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 顶栏天梯徽章 ---------- */
.rank-dot {
  font-size: 1rem;
  line-height: 1;
}

/* ---------- 星轨天梯（Bilibili Toy 排行榜） ---------- */
.rank-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.rank-hero {
  text-align: center;
  margin-bottom: 24px;
}
.rank-hero__badge {
  display: inline-block;
  padding: 4px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
  background: rgba(201, 127, 193, 0.12);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  margin-bottom: 10px;
}
.rank-hero h1 {
  font-family: var(--serif);
  font-size: 2.2rem;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
  color: var(--text);
  background: linear-gradient(135deg, #fff 30%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.rank-hero__desc {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.rank-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 999px;
}
.rank-status-tag.is-toy {
  background: rgba(70, 208, 138, 0.12);
  border: 1px solid var(--ok-line);
  color: var(--ok-text);
}
.rank-status-tag.is-local {
  background: rgba(169, 158, 201, 0.1);
  border: 1px solid rgba(169, 158, 201, 0.3);
  color: var(--cyan);
}

.rank-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.rank-stat-card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(255, 252, 254, 0.55);
  transition: transform 0.2s, border-color 0.2s;
}
.rank-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}
.rank-stat-card__k {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.rank-stat-card__v {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}
.rank-stat-card__sub {
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: 4px;
}

.rank-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rank-board-tabs, .rank-period-tabs {
  display: flex;
  gap: 6px;
}
.rank-board-tab, .rank-period-tab {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.rank-board-tab:hover, .rank-period-tab:hover {
  border-color: var(--gold);
  color: var(--text);
}
.rank-board-tab.active, .rank-period-tab.active {
  background: rgba(201, 127, 193, 0.16);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}
.rank-refresh-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
}
.rank-board-info {
  font-size: 0.82rem;
  color: var(--dim);
  margin-bottom: 16px;
  padding: 0 4px;
}

.rank-panel {
  padding: 16px;
  min-height: 280px;
}
.rank-list-loading, .rank-list-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 0.95rem;
}
.rank-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: all 0.18s;
}
.rank-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
}
.rank-row--top {
  border-color: rgba(201, 127, 193, 0.35);
  background: rgba(201, 127, 193, 0.06);
}
.rank-row__pos {
  width: 32px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
}
.rank-row__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rank-row__avatar--ph {
  font-size: 1.2rem;
  color: var(--gold);
}
.rank-row__name {
  flex: 1;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-row__score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
}
.rank-row__score small {
  font-size: 0.72rem;
  font-weight: normal;
  color: var(--muted);
  margin-left: 3px;
}

.rank-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

@media (max-width: 640px) {
  .rank-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .rank-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .rank-board-tabs, .rank-period-tabs {
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .rank-row {
    padding: 8px 12px;
    gap: 10px;
  }
  .rank-row__avatar {
    width: 34px;
    height: 34px;
  }
}

/* ---- NPC / 待实装 支持 ---- */
.card__tag {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 2px 7px; border-radius: 6px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  color: #0a0e17; background: var(--gold); border: 1px solid rgba(255,255,255,0.25);
}
.card__tag--soon { background: #7fb0e0; }
.kcell {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; border: 1px solid var(--line-strong);
}
.kcell--self { color: var(--gold); border-color: rgba(253,194,182,0.5); background: rgba(253,194,182,0.1); }
.kcell--npc  { color: #a9c8ea; border-color: rgba(140,180,230,0.5); background: rgba(140,180,230,0.12); }
.chip--kind { border-color: rgba(140,180,230,0.45); }
.chip--npc  { color: #a9c8ea; }
.chip--soon { color: #7fb0e0; border-color: rgba(127,176,224,0.5); }
td .kcell { white-space: nowrap; }


/* ================= 4.7 剧场主题覆盖 ================= */
/* 幕布 + 追光：复用 .aurora 层，避免新增堆叠层级 */
.aurora {
  background:
    radial-gradient(1100px 620px at 50% -14%, rgba(201, 127, 193, 0.20), transparent 64%),
    radial-gradient(820px 520px at 82% 6%, rgba(169, 158, 201, 0.14), transparent 62%),
    radial-gradient(900px 700px at 8% 96%, rgba(122, 36, 62, 0.28), transparent 68%),
    linear-gradient(90deg, rgba(92, 22, 38, 0.55) 0%, rgba(92, 22, 38, 0) 16%,
                    rgba(92, 22, 38, 0) 84%, rgba(92, 22, 38, 0.55) 100%);
}
/* 顶栏：幕布横杆的感觉 */
#topbar {
  border-bottom-color: rgba(201, 127, 193, 0.18);
  box-shadow: 0 1px 0 rgba(166, 46, 107, 0.10), 0 14px 40px rgba(96, 44, 80, 0.14);
}
.brand__cn { letter-spacing: 0.14em; }
.brand__mark { box-shadow: 0 0 18px rgba(201, 127, 193, 0.55); }

/* 面板：暖色内描边 + 轻聚光 */
.panel {
  border-color: rgba(201, 127, 193, 0.16);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(201, 127, 193, 0.07);
}
.panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(680px 240px at 50% -30%, rgba(201, 127, 193, 0.08), transparent 70%);
}

/* 主按钮：桃粉 → 玫瑰 */
.btn--primary {
  color: #2a0d16;
  background: linear-gradient(120deg, #FFD9CE, #A62E6B 46%, #C97C88);
  box-shadow: 0 10px 26px rgba(166, 46, 107, 0.26);
}
.btn--primary:hover { box-shadow: 0 12px 32px rgba(166, 46, 107, 0.38); }

/* 卡片 */
.card { border-color: rgba(201, 127, 193, 0.14); }
.card:hover {
  border-color: rgba(166, 46, 107, 0.55);
  box-shadow: 0 16px 40px rgba(96, 44, 80, 0.18), 0 0 0 1px rgba(166, 46, 107, 0.18);
}
.card__rarity { color: #2a0d16; }

/* 标签 / 徽章 */
.chip.on, .icon-btn.is-on {
  color: var(--gold);
  border-color: var(--line-strong);
  background: rgba(166, 46, 107, 0.12);
}
.section-head h2 { color: var(--text); }

/* 表头与分隔线 */
.guess th { border-bottom-color: rgba(201, 127, 193, 0.22); }
.guess td { border-bottom-color: rgba(134, 89, 141, 0.10); }

/* 页脚 */
#footer { border-top-color: rgba(201, 127, 193, 0.14); }


/* ================= 4.7 亮色剧场主题覆盖 ================= */
/* 背景：粉紫 → 藕紫 的柔和渐变 + 幕布侧光，对应 KV 的明亮粉紫 */
.aurora {
  background:
    radial-gradient(1100px 620px at 50% -14%, rgba(237, 178, 230, 0.55), transparent 64%),
    radial-gradient(820px 520px at 84% 4%, rgba(201, 127, 193, 0.34), transparent 62%),
    radial-gradient(900px 700px at 6% 96%, rgba(134, 89, 141, 0.26), transparent 68%),
    linear-gradient(90deg, rgba(201, 127, 193, 0.22) 0%, rgba(201, 127, 193, 0) 16%,
                    rgba(201, 127, 193, 0) 84%, rgba(201, 127, 193, 0.22) 100%);
}
#topbar {
  border-bottom-color: rgba(166, 46, 107, 0.18);
  box-shadow: 0 1px 0 rgba(166, 46, 107, 0.10), 0 10px 30px rgba(96, 44, 80, 0.10);
}
.brand__mark { box-shadow: 0 0 16px rgba(201, 127, 193, 0.65); }

.panel { border-color: rgba(134, 89, 141, 0.18); }
.panel::after {
  background: radial-gradient(680px 240px at 50% -30%, rgba(237, 178, 230, 0.22), transparent 70%);
}

.btn--primary {
  color: #FFF7FB;
  background: linear-gradient(120deg, #D46FBE, #B23C87 48%, #8E2C6B);
  box-shadow: 0 10px 26px rgba(166, 46, 107, 0.28);
}
.btn--primary:hover { box-shadow: 0 12px 32px rgba(166, 46, 107, 0.36); }

.card { border-color: rgba(134, 89, 141, 0.18); background: var(--panel); }
.card:hover {
  border-color: rgba(166, 46, 107, 0.55);
  box-shadow: 0 16px 40px rgba(96, 44, 80, 0.18), 0 0 0 1px rgba(201, 127, 193, 0.25);
}
.card__rarity { color: #FFF7FB; background: linear-gradient(120deg, #C25EA8, #9A365D); }
.card__tag { color: #FFF7FB; }
.card__tag--soon { background: #6B4C9A; }

.chip.on, .icon-btn.is-on {
  color: #FFF7FB; border-color: transparent;
  background: linear-gradient(120deg, #C25EA8, #9A365D);
}

.guess th { border-bottom-color: rgba(166, 46, 107, 0.22); color: var(--muted); }
.guess td { border-bottom-color: rgba(134, 89, 141, 0.14); }
.guess tr:hover td { background: rgba(237, 178, 230, 0.18); }

#footer { border-top-color: rgba(166, 46, 107, 0.16); background: transparent; }
.modal { border-color: rgba(166, 46, 107, 0.25); }


/* ================= 首页主视觉：阿哈大图 ================= */
.home-hero {
  min-height: 440px;
  padding: 56px 34px 54px;
  text-align: left;
  display: flex;
  align-items: center;
}
.home-hero__kv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 68% 44%;
  z-index: 0;
}
.home-hero__kv--m { display: none; }
.home-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg,
    rgba(253, 242, 249, 0.97) 0%,
    rgba(253, 242, 249, 0.92) 32%,
    rgba(253, 242, 249, 0.42) 56%,
    rgba(253, 242, 249, 0.02) 82%,
    rgba(253, 242, 249, 0) 100%);
}
.home-hero__inner { position: relative; z-index: 2; max-width: 660px; }
.home-hero__glow { display: none; }
.home-hero h1 {
  background: linear-gradient(180deg, #7B2E5E 6%, #A62E6B 94%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 10px 34px rgba(166, 46, 107, 0.18);
}
.home-hero__sub { color: #6F4A66; }
.home-hero__ver {
  display: inline-block; margin-top: 16px;
  padding: 5px 15px; border-radius: 999px;
  background: linear-gradient(120deg, #C25EA8, #9A365D);
  color: #FFF7FB; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em;
  box-shadow: 0 8px 20px rgba(166, 46, 107, 0.24);
}
.home-hero .hero-main { box-shadow: 0 16px 34px rgba(166, 46, 107, 0.24); }
@media (max-width: 760px) {
  /* 移动端：图在上、字在下，彻底避免文字压住人物 */
  .home-hero {
    display: block;
    padding: 0;
    min-height: 0;
    text-align: left;
  }
  .home-hero::before { display: none; }
  .home-hero__kv--d { display: none; }
  .home-hero__kv--m {
    display: block;
    position: relative;
    inset: auto;
    width: 100%;
    aspect-ratio: 1.3 / 1;
    height: auto;
    max-height: 330px;
    object-fit: cover;
    object-position: 50% 50%;
    border-radius: 0;
  }
  .home-hero__inner { padding: 22px 22px 26px; max-width: 100%; }
  .home-hero h1 { margin-top: 4px; }
}
@media (min-width: 761px) and (max-width: 1080px) {
  .home-hero__inner { max-width: 520px; }
  .home-hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.2rem); }
}


/* ================= 移动端/全站 视觉层级修正（按视觉评审） ================= */
/* 1) 主按钮改为实色，拿回第一视觉权重 */
.home-hero .hero-main {
  border: 1px solid transparent;
  color: #FFF7FB;
  background: linear-gradient(120deg, #D46FBE 0%, #B23C87 48%, #8E2C6B 100%);
  box-shadow: 0 16px 34px rgba(166, 46, 107, 0.30);
}
.home-hero .hero-main strong { letter-spacing: 0.12em; }
.home-hero .hero-main small { color: rgba(255, 247, 251, 0.82); }
.home-hero .hero-main:hover { box-shadow: 0 22px 44px rgba(166, 46, 107, 0.38); }

/* 2) 版本胶囊降级为浅描边，不再抢主按钮 */
.home-hero__ver {
  background: rgba(201, 127, 193, 0.12);
  border: 1px solid rgba(166, 46, 107, 0.35);
  color: #8E2C6B;
  font-weight: 600;
  box-shadow: none;
  margin-top: 14px;
}

/* 3) 按钮组左对齐，与文本同轴 */
.home-hero .hero-actions { align-items: flex-start; margin-top: 26px; }
.home-hero .hero-main { align-items: flex-start; text-align: left; width: min(320px, 100%); padding: 15px 22px; }
.home-hero .hero-sub-actions { justify-content: flex-start; }
.home-hero .hero-sub { padding: 8px 16px; }

/* 4) 段落节奏：拉开“组”之间的间距 */
.home-hero__sub { margin-top: 2px; }
.home-hero__ver + .hero-actions { margin-top: 26px; }

@media (max-width: 760px) {
  .home-hero__inner { padding: 22px 20px 30px; }
  #topbar { padding-top: 12px; padding-bottom: 10px; }
  .home-hero h1 { letter-spacing: 0.10em; }
}


/* 版本行：纯文字，不再形成第二焦点 */
.home-hero__ver {
  display: block;
  margin: 8px 0 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.home-hero__ver + h1 { margin-top: 8px; }


/* ================= 关注门禁 ================= */
.stage-opt.is-locked {
  border-style: dashed;
  border-color: rgba(166, 46, 107, 0.35);
  background: rgba(201, 127, 193, 0.06);
}
.stage-opt.is-locked .stage-opt__t b { color: var(--muted); }
.stage-opt.is-locked .stage-opt__t small { color: var(--dim); }
.stage-opt.is-locked .stage-opt__n {
  color: var(--gold);
  border-color: rgba(166, 46, 107, 0.35);
  background: rgba(201, 127, 193, 0.12);
}
.stage-opt.is-locked:hover {
  border-color: rgba(166, 46, 107, 0.65);
  transform: translateX(3px);
}

.follow-gate { padding: 26px 26px 22px; text-align: left; }
.follow-gate h3 { font: 700 1.25rem/1.4 var(--serif); letter-spacing: 0.06em; margin: 6px 0 10px; }
.follow-gate p { color: var(--muted); font-size: 0.88rem; }
.follow-gate b { color: var(--text); }
.follow-gate__steps {
  margin: 14px 0 18px; padding-left: 20px; color: var(--muted); font-size: 0.86rem; line-height: 1.9;
}
.follow-gate__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.follow-gate__hint { margin-top: 12px; font-size: 0.8rem; color: var(--gold); min-height: 1.2em; }


/* 难度卡片在窄屏不挤压右侧状态文案 */
.stage-opt { gap: 12px; }
.stage-opt__n { white-space: nowrap; flex: none; }
.stage-opt__t { min-width: 0; }
.stage-opt__t b, .stage-opt__t small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
@media (max-width: 520px) {
  .stage-opt { padding: 13px 14px; gap: 9px; }
  .stage-opt__icon { width: 32px; height: 32px; }
  .stage-opt__t b { font-size: 0.94rem; }
  .stage-opt__t small { font-size: 0.72rem; }
  .stage-opt__n { font-size: 0.7rem; }
  .stage-opt__arrow { font-size: 0.85rem; }
}


/* 结算页反馈引导 */
.result__feedback {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed rgba(166, 46, 107, 0.28);
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
}
.result__feedback-t {
  flex: none; margin-top: 2px;
  padding: 2px 10px; border-radius: 999px;
  background: rgba(201, 127, 193, 0.16);
  border: 1px solid rgba(166, 46, 107, 0.30);
  color: var(--gold); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
}
.result__feedback p {
  margin: 0; font-size: 0.82rem; line-height: 1.7; color: var(--muted);
}
.result__feedback b { color: var(--text); font-weight: 700; }
@media (max-width: 520px) {
  .result__feedback { flex-direction: column; gap: 8px; }
}


/* 模糊匹配标签 */
.ac-tag--fuzzy {
  background: rgba(107, 76, 154, 0.14);
  border-color: rgba(107, 76, 154, 0.35);
  color: #6B4C9A;
}


/* ================= 联机对战（Beta） ================= */
.online-entry { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.online-entry small { color: var(--muted); font-size: 0.76rem; }
.online-box { padding: 24px 24px 20px; text-align: left; max-width: 520px; }
.online-box h3 { font: 700 1.2rem/1.4 var(--serif); margin: 6px 0 10px; }
.online-tip { color: var(--muted); font-size: 0.82rem; line-height: 1.7; margin-top: 8px; }
.online-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.online-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 520px) { .online-grid { grid-template-columns: 1fr; } }
.online-col { display: flex; flex-direction: column; gap: 8px; }
.online-col b { font-size: 0.86rem; letter-spacing: 0.06em; }
.online-col select, .online-col input {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-solid); color: var(--text); font-size: 0.92rem;
}
.online-code {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 4px;
  font-size: 0.9rem; color: var(--muted);
}
.online-code b { font-size: 1.6rem; letter-spacing: 0.24em; color: var(--gold); }
.online-seats { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.online-seats li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(201, 127, 193, 0.06); font-size: 0.88rem;
}
.online-seats li.won { border-color: var(--ok-line); background: var(--ok-bg); }
.online-seats li.empty { color: var(--dim); justify-content: center; }
.online-seats small { color: var(--muted); font-size: 0.76rem; }
.online-win { margin-top: 12px; color: var(--gold); font-weight: 700; font-size: 0.92rem; }


/* 匹配中 */
.online-match { display: flex; align-items: center; gap: 14px; margin: 16px 0 4px; }
.online-match p { color: var(--muted); font-size: 0.86rem; line-height: 1.7; }
.online-match b { color: var(--gold); font-size: 1.1rem; }
.online-match__dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: var(--gold); box-shadow: 0 0 0 0 rgba(245,185,174,.7);
  animation: onpulse 1.6s infinite;
}
@keyframes onpulse {
  0% { box-shadow: 0 0 0 0 rgba(245,185,174,.55); }
  70% { box-shadow: 0 0 0 16px rgba(245,185,174,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,185,174,0); }
}


/* 房间列表 */
.online-rooms { margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(166,46,107,.25); }
.online-rooms__head { display: flex; align-items: center; justify-content: space-between; }
.online-rooms__head b { font-size: 0.86rem; letter-spacing: .06em; }
.online-rooms__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.online-rooms__list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(201,127,193,.05); }
.online-rooms__list li.empty { justify-content: center; color: var(--dim); font-size: .82rem; }
.online-rooms__code { font: 700 1.05rem/1 var(--serif); letter-spacing: .18em; color: var(--gold); }
.online-rooms__meta { flex: 1; color: var(--muted); font-size: .78rem; }
.online-rooms__list .btn { padding: 4px 12px; font-size: .78rem; }


/* 匹配难度选择 */
.online-matchbox { margin-top: 16px; padding-top: 14px; border-top: 1px dashed rgba(166,46,107,.25); }
.online-matchbox b { font-size: .86rem; letter-spacing: .06em; }
.online-matchbox__row { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.online-matchbox select {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-solid); color: var(--text); font-size: .92rem; flex: 1;
}
.online-seats li em {
  font-style: normal; font-size: .66rem; padding: 1px 6px; border-radius: 999px;
  background: rgba(201,127,193,.18); color: var(--gold); margin-left: 6px; vertical-align: 1px;
}
/* 联机结算 */
.online-result { padding: 26px 26px 22px; text-align: center; }
.online-result h3 { font: 800 1.5rem/1.4 var(--serif); margin: 8px 0 12px; }
.online-result__who { color: var(--muted); font-size: .92rem; }
.online-result__who b { color: var(--text); }
.online-result__stats { display: flex; justify-content: center; gap: 36px; margin: 18px 0 4px; }
.online-result__stats div { display: flex; flex-direction: column; gap: 2px; }
.online-result__stats b { font: 700 1.4rem/1 var(--serif); color: var(--gold); }
.online-result__stats span { font-size: .74rem; color: var(--muted); letter-spacing: .08em; }
.online-result .online-actions { justify-content: center; }


/* 联机诊断信息 */
.online-diag { margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: rgba(107,76,154,.07); border: 1px dashed rgba(107,76,154,.25); }
.online-diag span { display: block; font-size: .72rem; color: var(--muted); line-height: 1.8; }


/* 上次房间重进 */
.online-resume {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  background: rgba(201,127,193,.10); border: 1px solid rgba(166,46,107,.28);
  font-size: .84rem; color: var(--muted);
}
.online-resume b { color: var(--gold); letter-spacing: .12em; font-size: 1rem; }


/* 胜场榜 */
.online-board-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; max-height: 380px; overflow-y: auto; }
.online-board-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(201,127,193,.06);
}
.online-board-list li.empty { justify-content: center; color: var(--dim); font-size: .82rem; }
.online-board-rank { width: 30px; flex: none; text-align: center; font: 700 1rem/1 var(--serif); color: var(--gold); }
.online-board-name { flex: 1 1 auto; min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-board-stat { font-size: .8rem; color: var(--muted); white-space: nowrap; margin-left: auto; }
.online-board-stat b { color: var(--gold); font-size: 1rem; margin-right: 2px; }
.online-board-sub { font-size: .72rem; color: var(--dim); white-space: nowrap; }


/* 榜单调试区：等宽、可横向滚动，别把 JSON 折断 */
#online-board-debug {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .68rem; line-height: 1.6;
  white-space: pre; overflow-x: auto;
  color: var(--dim);
}


/* ================= safe-area 适配补充 =================
 * 已有：.guess-dock 底部、#app 底部
 * 补充：顶栏（状态栏/挖孔）、弹窗（上下）、页脚（手势条）
 */
@supports (padding: env(safe-area-inset-top)) {
  #topbar {
    padding-top: calc(10px + var(--toy-safe-top, env(safe-area-inset-top, 0px)));
  }
  .modal-back {
    padding-top: calc(20px + var(--toy-safe-top, env(safe-area-inset-top, 0px)));
    padding-bottom: calc(20px + var(--toy-safe-bottom, env(safe-area-inset-bottom, 0px)));
  }
  .modal {
    max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
  #footer {
    padding-bottom: calc(34px + var(--toy-safe-bottom, env(safe-area-inset-bottom, 0px)));
  }
  #boot {
    padding-top: calc(24px + var(--toy-safe-top, env(safe-area-inset-top, 0px)));
    padding-bottom: calc(24px + var(--toy-safe-bottom, env(safe-area-inset-bottom, 0px)));
  }
}


/* 立绘缺失占位 */
.pic-ph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 96px;
  font: 700 2rem/1 var(--serif); color: var(--gold);
  background: linear-gradient(160deg, rgba(201,127,193,.16), rgba(107,76,154,.12));
}
.pic-ph--lg { min-height: 320px; font-size: 4rem; border-radius: 12px; }


/* 首页：开始推演 + 联机对战 并排 */
.hero-mains { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }
.hero-mains .hero-main { flex: 1 1 180px; }
.hero-main--online {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid rgba(166,46,107,.45); border-radius: 14px;
  background: rgba(255,255,255,.55); color: var(--gold); cursor: pointer;
  font-family: inherit; padding: 14px 18px;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.hero-main--online:hover { transform: translateY(-2px); background: rgba(255,255,255,.78); box-shadow: 0 10px 26px rgba(166,46,107,.18); }
.hero-main--online strong { font: 800 1.12rem/1.2 var(--serif); letter-spacing: .08em; }
.hero-main--online small { font-size: .72rem; color: var(--muted); letter-spacing: .18em; }

/* 结算页：原一把 */
.btn--yuan { border-color: rgba(166,46,107,.45); color: var(--gold); }
@media (max-width: 520px) {
  .hero-mains { flex-wrap: nowrap; }
  .hero-mains .hero-main { flex: 1 1 0; min-width: 0; padding: 12px 8px; }
  .hero-main--online strong { font-size: .98rem; letter-spacing: .04em; }
}


/* ================= 更多玩法 ================= */
.home-modes { margin-bottom: 18px; }
.home-modes__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 640px) { .home-modes__grid { grid-template-columns: 1fr; } }
.home-mode {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 14px; text-decoration: none;
  background: rgba(201,127,193,.07); transition: transform .16s ease, box-shadow .16s ease;
}
.home-mode:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(166,46,107,.14); }
.home-mode b { font: 700 1.02rem/1.3 var(--serif); color: var(--text); }
.home-mode small { color: var(--muted); font-size: .76rem; }

/* 模式页 */
.mode-page { padding: 26px 26px 30px; max-width: 720px; }
.mode-page h2 { font: 800 1.6rem/1.3 var(--serif); margin: 8px 0 10px; }
.mode-page__desc { color: var(--muted); font-size: .9rem; line-height: 1.9; margin-bottom: 18px; }
.mode-page__stats { display: flex; gap: 34px; margin: 0 0 22px; }
.mode-page__stats div { display: flex; flex-direction: column; gap: 2px; }
.mode-page__stats b { font: 700 1.5rem/1 var(--serif); color: var(--gold); }
.mode-page__stats span { font-size: .74rem; color: var(--muted); letter-spacing: .08em; }
.mode-page__done { color: var(--muted); font-size: .9rem; }

/* 模式结算 */
.mode-result { padding: 26px 26px 22px; text-align: center; }
.mode-result h3 { font: 800 1.4rem/1.4 var(--serif); margin: 8px 0 10px; }
.mode-result__sub { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.mode-result__sub b { color: var(--gold); }
.mode-result__card {
  display: flex; align-items: center; gap: 12px; margin: 18px auto 0; max-width: 320px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; text-align: left;
}
.mode-result__card img { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; }
.mode-result__card b { display: block; font-size: .95rem; }
.mode-result__card small { display: block; color: var(--muted); font-size: .72rem; }
.mode-result__tip { margin-top: 14px; color: var(--dim); font-size: .74rem; }
.mode-result .result__actions { justify-content: center; margin-top: 18px; }


/* 图鉴收集 */
.card__got {
  position: absolute; right: 8px; top: 8px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--gold); color: #fff; font-size: .78rem; font-weight: 700;
}
.card__pic { position: relative; }
.collect-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 6px 0 16px; padding: 10px 14px; border-radius: 10px;
  background: rgba(201,127,193,.08); border: 1px solid var(--line); font-size: .84rem; color: var(--muted);
}
.collect-bar b { color: var(--gold); font-size: 1rem; }
.collect-bar__hint { font-size: .74rem; color: var(--dim); }


/* ================= 设置按钮 / 面板 ================= */
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-solid); color: var(--muted); font-size: 17px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--gold); border-color: rgba(166,46,107,.4); transform: rotate(24deg); }
.settings-box { padding: 26px 26px 22px; min-width: 460px; max-width: 560px; }
.settings-box h3 { font: 800 1.35rem/1.4 var(--serif); margin: 8px 0 18px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-bottom: 1px dashed var(--line); cursor: pointer;
}
.switch-row__text { display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.switch-row b { font-size: .96rem; }
.switch-row small { color: var(--muted); font-size: .76rem; line-height: 1.6; }
.switch-row input[type=checkbox] {
  appearance: none; width: 50px; height: 28px; border-radius: 999px; flex: none;
  background: rgba(133,100,129,.28); position: relative; cursor: pointer; transition: background .2s ease;
}
.switch-row input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s ease;
}
.switch-row input[type=checkbox]:checked { background: var(--gold); }
.switch-row input[type=checkbox]:checked::after { transform: translateX(22px); }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
@media (max-width: 560px) { .settings-box { min-width: 0; width: 100%; } }

/* ================= 色盲色弱模式 ================= */
html[data-cvd="1"] {
  --ok-bg: rgba(31,111,178,.16);
  --ok-line: rgba(31,111,178,.62);
  --ok-text: #14496F;
  --mid-bg: rgba(216,118,0,.16);
  --mid-line: rgba(216,118,0,.62);
  --mid-text: #8A4A00;
  --no-bg: rgba(90,90,102,.10);
  --no-line: rgba(90,90,102,.34);
  --no-text: #4A4A55;
}
html[data-cvd="1"] table.guess td { border-left-width: 2px; border-left-style: solid; }
html[data-cvd="1"] table.guess td.hit { border-left-width: 5px; }
html[data-cvd="1"] table.guess td.part { border-left-width: 3px; border-left-style: dashed; }
html[data-cvd="1"] table.guess td.miss { border-left-width: 1px; }
html[data-cvd="1"] td.hit::before,
html[data-cvd="1"] td.part::before,
html[data-cvd="1"] td.miss::before {
  font-weight: 700; margin-right: 6px; opacity: .9;
}
html[data-cvd="1"] td.hit::before { content: "✓"; color: #1F6FB2; }
html[data-cvd="1"] td.part::before { content: "≈"; color: #D87600; }
html[data-cvd="1"] td.miss::before { content: "✕"; color: #6A6A78; }
/* 图例同步加符号 */
html[data-cvd="1"] .legend__hit::before { content: "✓ "; font-weight: 700; color: #1F6FB2; }
html[data-cvd="1"] .legend__part::before { content: "≈ "; font-weight: 700; color: #D87600; }
html[data-cvd="1"] .legend__miss::before { content: "✕ "; font-weight: 700; color: #6A6A78; }


/* 顶栏窄屏：只留图标，避免文字竖排 */
@media (max-width: 520px) {
  #topbar .icon-btn__t { display: none; }
  #topbar .mainnav { gap: 10px; }
  #topbar .mainnav a { white-space: nowrap; font-size: .82rem; }
  #topbar .icon-btn { width: 30px; height: 30px; font-size: 15px; }
}
/* 色盲模式：角色名列不加符号，保持干净 */
html[data-cvd="1"] table.guess td:first-child::before { content: none; }


/* 顶栏「天梯排行」胶囊：禁止换行挤压 */
#topbar .icon-btn__t { white-space: nowrap; }
#topbar .topbar__right { flex: none; }
#topbar .topbar__right .icon-btn { width: auto; min-width: 34px; padding: 0 12px; gap: 6px; border-radius: 999px; }
#topbar .mainnav { flex-wrap: nowrap; }
#topbar .mainnav a { white-space: nowrap; }


/* NPC 首次登场 */
.debut {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 14px 0 4px; padding: 10px 14px; border-radius: 10px;
  background: rgba(107,76,154,.07); border: 1px dashed rgba(107,76,154,.25);
  font-size: .78rem; color: var(--muted);
}
.debut__tag {
  font-size: .64rem; letter-spacing: .12em; padding: 2px 8px; border-radius: 999px;
  background: rgba(107,76,154,.16); color: #6B4C9A;
}
.debut__item b { color: var(--text); font-weight: 700; margin-right: 4px; }

.debut__soft { font-style: normal; font-size: .66rem; color: #B4762E; background: rgba(216,118,0,.12); padding: 1px 6px; border-radius: 999px; margin-left: 4px; }

.online-result__ai { margin-top: 6px; font-size: .78rem; color: #8A5A78; background: rgba(166,46,107,.08); display: inline-block; padding: 4px 12px; border-radius: 999px; }


/* 联机：对手进度条 */
.opp-bar {
  display: none; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 9px 16px; border-radius: 10px;
  background: rgba(107,76,154,.08); border: 1px solid rgba(107,76,154,.22);
  font-size: .8rem; color: var(--muted);
}
.opp-bar__who { font-weight: 700; color: #6B4C9A; }
.opp-bar__used b { color: var(--gold); font-size: .95rem; }
.opp-bar__hits i {
  font-style: normal; display: inline-block; margin-left: 6px; padding: 2px 8px;
  border-radius: 999px; background: rgba(31,111,178,.14); color: #14496F; font-size: .72rem;
}

.follow-gate__progress { margin-top: 12px; font-size: .92rem; color: var(--muted); }
.follow-gate__progress b { color: var(--gold); font-size: 1.15rem; }


/* ================= 手机端：3×3 卡片盘面 ================= */
.guess-cards { display: flex; flex-direction: column; gap: 10px; }
.gcard {
  background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px;
}
.gcard--empty { text-align: center; color: var(--dim); font-size: .84rem; padding: 28px 12px; }
.gcard__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gcard__head img {
  width: 34px; height: 46px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); background: rgba(255,252,254,.6);
}
.gcard__ph {
  width: 34px; height: 46px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(201,127,193,.18), rgba(107,76,154,.14));
  color: var(--gold); font-weight: 700;
}
.gcard__head b { display: block; font-size: .95rem; }
.gcard__head small { color: var(--dim); font-size: .7rem; }
.gcard__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.gcell {
  border-radius: 9px; padding: 7px 4px; min-height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; border: 1px solid var(--no-line); background: var(--no-bg); color: var(--no-text);
}
.gcell__lab { font-size: .62rem; opacity: .7; letter-spacing: .04em; }
.gcell__val { font-size: .82rem; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; justify-content: center; }
.gcell__val img { width: 18px; height: 18px; object-fit: contain; }
.gcell.hit { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.gcell.part { background: var(--mid-bg); border-color: var(--mid-line); color: var(--mid-text); }

/* 色盲模式的符号也带上 */
html[data-cvd="1"] .gcell.hit::before { content: "✓"; position: absolute; margin: -34px 0 0 -46px; font-size: .7rem; }
html[data-cvd="1"] .gcell { position: relative; }

/* 卡片滚动时避开吸顶导航 */
.gcard { scroll-margin-top: 76px; }
.guess-cards { scroll-margin-bottom: 90px; }
