/* ============================================================
   脑力擂台 · 样式
   ============================================================ */
:root {
  --bg: #080d1a;
  --bg-2: #0d1428;
  --card: rgba(255, 255, 255, .045);
  --card-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #eef3ff;
  --muted: #8ea0c2;
  --muted-2: #64748f;
  --mint: #5ee7c8;
  --violet: #8b8cff;
  --gold: #f5c451;
  --bad: #ff6b81;
  --good: #4ade80;
  --radius: 20px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .38);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 50% -10%, #182349 0%, var(--bg-2) 42%, var(--bg) 100%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
b, strong { font-weight: 700; }
small { font-size: 12px; }

/* 背景光斑 */
.orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; filter: blur(70px); opacity: .55; }
.orbs i { position: absolute; display: block; border-radius: 50%; }
.orbs .o1 { width: 320px; height: 320px; background: #2de0c0; top: -110px; left: -90px; opacity: .30; animation: float1 18s ease-in-out infinite; }
.orbs .o2 { width: 300px; height: 300px; background: #6c6cff; top: 30%; right: -130px; opacity: .34; animation: float2 22s ease-in-out infinite; }
.orbs .o3 { width: 260px; height: 260px; background: #ff7aa8; bottom: -120px; left: 20%; opacity: .16; animation: float1 26s ease-in-out infinite reverse; }
@keyframes float1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(26px, 40px); } }
@keyframes float2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-30px, 30px); } }

/* ============================================================ 布局 */
.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(90px + var(--safe-b));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 2px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 13, 26, .94) 30%, rgba(8, 13, 26, 0));
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(145deg, rgba(94, 231, 200, .22), rgba(139, 140, 255, .22));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt b { font-size: 16px; letter-spacing: .3px; }
.brand-txt small { color: var(--muted-2); font-size: 10.5px; letter-spacing: .6px; }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  max-width: 56%;
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions .icon-btn { width: 32px; height: 32px; font-size: 15px; }
.user-chip:active { transform: scale(.97); }
.uc-emoji {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px;
  background: rgba(255, 255, 255, .08);
}
.uc-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-lv { font-size: 11px; color: var(--gold); white-space: nowrap; }

.main { display: block; min-height: 60vh; }
.view { display: none; animation: fadeUp .32s ease both; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-title {
  display: flex; align-items: baseline; gap: 8px;
  margin: 22px 2px 10px;
  font-size: 13.5px; font-weight: 700; letter-spacing: .3px;
}
.section-title span { font-size: 11px; font-weight: 400; color: var(--muted-2); }

.page-head { padding: 4px 2px 14px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: .5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

/* ============================================================ 首页 - 等级卡 */
.hero {
  padding: 18px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(94, 231, 200, .16), transparent 55%),
    radial-gradient(120% 120% at 100% 0%, rgba(139, 140, 255, .20), transparent 60%),
    var(--card);
  border-color: rgba(255, 255, 255, .12);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-label { font-size: 11.5px; color: var(--muted); letter-spacing: 1px; }
.hero-rating { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.hero-rating span { font-size: 40px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-rating em { font-style: normal; font-size: 12px; color: var(--muted-2); }
.hero-level { font-size: 12.5px; color: var(--mint); margin-top: 2px; font-weight: 600; }

.ring {
  --p: 0;
  width: 76px; height: 76px; border-radius: 50%;
  background: conic-gradient(var(--mint) calc(var(--p) * 1%), rgba(255, 255, 255, .10) 0);
  display: grid; place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 0 24px rgba(94, 231, 200, .18);
}
.ring-in {
  width: 62px; height: 62px; border-radius: 50%;
  background: #0b1120;
  display: grid; place-items: center;
  font-size: 27px;
}
.hero-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .09); margin-top: 14px; overflow: hidden; }
.hero-bar i { display: block; height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--violet)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.hero-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 8px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.hero-stats small { color: var(--muted-2); font-size: 10.5px; }

/* ============================================================ 动作网格 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act {
  position: relative;
  text-align: left;
  padding: 15px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease;
}
.act:active { transform: scale(.975); }
.act-icon { font-size: 21px; display: block; margin-bottom: 8px; }
.act b { display: block; font-size: 14.5px; }
.act small { color: var(--muted-2); font-size: 10.5px; line-height: 1.4; display: block; margin-top: 2px; }
.act::after {
  content: ""; position: absolute; inset: auto -30% -60% auto;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 231, 200, .22), transparent 70%);
  opacity: .8;
}
.act-a::after { background: radial-gradient(circle, rgba(245, 196, 81, .26), transparent 70%); }
.act-b::after { background: radial-gradient(circle, rgba(94, 231, 200, .26), transparent 70%); }
.act-c::after { background: radial-gradient(circle, rgba(139, 140, 255, .28), transparent 70%); }
.act-d::after { background: radial-gradient(circle, rgba(255, 122, 168, .24), transparent 70%); }

/* 邀请条 */
.tip { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-color: rgba(139, 140, 255, .4); background: linear-gradient(120deg, rgba(139, 140, 255, .16), var(--card)); }
.tip-icon { font-size: 22px; }
.tip-body { flex: 1; min-width: 0; }
.tip-body b { font-size: 13.5px; display: block; }
.tip-body small { color: var(--muted); font-size: 11px; }

/* ============================================================ 类别列表 */
.cat-list { display: grid; gap: 8px; }
.cat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  text-align: left; width: 100%;
}
.cat-item:active { background: var(--card-2); }
.cat-ico { font-size: 20px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.cat-main { flex: 1; min-width: 0; }
.cat-main b { font-size: 13.5px; display: block; }
.cat-main small { color: var(--muted-2); font-size: 11px; }
.cat-go { color: var(--muted-2); font-size: 16px; }

/* ============================================================ 列表 */
.list { padding: 6px 14px; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.list .row:last-child { border-bottom: 0; }
.list .empty { color: var(--muted-2); font-size: 12.5px; text-align: center; padding: 22px 0; }
.row-main { flex: 1; min-width: 0; }
.row-main b { font-size: 13px; display: block; }
.row-main small { color: var(--muted-2); font-size: 11px; }
.row-val { text-align: right; font-variant-numeric: tabular-nums; }
.row-val b { font-size: 15px; display: block; }
.row-val small { color: var(--muted-2); font-size: 10.5px; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }
.delta-flat { color: var(--muted-2); }

/* ============================================================ 表单 / 芯片 */
.field-label { font-size: 11.5px; color: var(--muted); letter-spacing: .4px; margin: 14px 0 8px; }
.field-label:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px; border-radius: 999px; font-size: 12.5px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: all .15s ease;
}
.chip.on {
  background: linear-gradient(135deg, rgba(94, 231, 200, .22), rgba(139, 140, 255, .22));
  border-color: rgba(94, 231, 200, .55);
  color: var(--text);
  font-weight: 600;
}
.chip:active { transform: scale(.95); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line);
  transition: transform .14s ease, filter .14s ease, opacity .14s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, #48d8b6, #7b7dff);
  border-color: transparent; color: #06131b;
  box-shadow: 0 10px 24px rgba(94, 200, 220, .22);
}
.btn.ghost { background: rgba(255, 255, 255, .04); }
.btn.block { display: flex; width: 100%; margin-top: 14px; }
.btn.lg { padding: 15px 18px; font-size: 15.5px; }
.btn.sm { padding: 8px 12px; font-size: 12px; border-radius: 11px; }
.btn[disabled] { opacity: .42; pointer-events: none; }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 129, .35); }

.input {
  width: 100%; padding: 12px 14px; border-radius: 13px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line);
  font-size: 14px; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: rgba(94, 231, 200, .55); }
.input.code { letter-spacing: 4px; text-transform: uppercase; font-weight: 700; }
.join-row { display: flex; gap: 8px; }
.join-row .input { flex: 1; }
.join-row .btn { flex: 0 0 auto; }

.muted-sm { color: var(--muted-2); font-size: 11.5px; margin: 10px 0 0; line-height: 1.6; }

/* ============================================================ 闯关页 */
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.rules div { padding: 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, .04); }
.rules span { font-size: 18px; display: block; }
.rules b { font-size: 13.5px; display: block; margin-top: 4px; }
.rules small { color: var(--muted-2); font-size: 10px; }
.rank-info { display: flex; align-items: center; gap: 14px; }
.rank-info .ri-badge { font-size: 30px; }
.rank-info .ri-main { flex: 1; }
.rank-info b { font-size: 14px; }
.rank-info small { color: var(--muted); font-size: 11.5px; display: block; }

/* ============================================================ 对战室 */
.battle { text-align: center; padding: 20px 16px; }
.room-code {
  font-size: 34px; font-weight: 800; letter-spacing: 8px;
  background: linear-gradient(90deg, var(--mint), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.room-sub { color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 6px; }
.vs-player { flex: 1; min-width: 0; }
.vs-player .vp-emoji { font-size: 26px; }
.vs-player .vp-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-player .vp-score { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vs-player .vp-state { font-size: 10.5px; color: var(--muted-2); }
.vs-mid { font-size: 13px; color: var(--muted-2); font-weight: 800; }
.vs-player.me .vp-name { color: var(--mint); }
.vs-player.win .vp-score { color: var(--gold); }
.battle-actions { display: grid; gap: 8px; margin-top: 14px; }
.battle-note { font-size: 11.5px; color: var(--muted-2); margin-top: 10px; }
.answer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin-top: 14px; }
.ag-cell {
  aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .05); color: var(--muted);
}
.ag-cell.ok { background: rgba(74, 222, 128, .18); color: #86efac; }
.ag-cell.no { background: rgba(255, 107, 129, .16); color: #fda4af; }
.ag-cell.miss { background: rgba(255, 255, 255, .03); color: var(--muted-2); }

/* ============================================================ 排行榜 */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); margin-bottom: 12px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.seg button.on { background: rgba(255, 255, 255, .1); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .2); }

.board-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.board-row:last-child { border-bottom: 0; }
.board-row.me { background: linear-gradient(90deg, rgba(94, 231, 200, .1), transparent); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.br-rank { width: 26px; text-align: center; font-weight: 800; font-size: 14px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.br-rank.top { font-size: 18px; }
.br-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: rgba(255, 255, 255, .07); }
.br-main { flex: 1; min-width: 0; }
.br-main b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.br-main small { color: var(--muted-2); font-size: 10.5px; }
.br-val { text-align: right; }
.br-val b { font-size: 17px; font-variant-numeric: tabular-nums; display: block; line-height: 1.2; }
.br-val small { font-size: 10px; color: var(--muted-2); }
.lv-tag { font-size: 10px; padding: 2px 6px; border-radius: 6px; border: 1px solid currentColor; opacity: .9; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-col { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); text-align: center; }
.cmp-col b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.cmp-col small { color: var(--muted-2); font-size: 10.5px; }

/* ============================================================ 我的 */
.me-card { display: flex; align-items: center; gap: 12px; }
.avatar-btn { width: 52px; height: 52px; border-radius: 16px; font-size: 26px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); flex: 0 0 auto; }
.me-info { flex: 1; min-width: 0; }
.me-info .input { padding: 9px 12px; font-size: 14px; font-weight: 600; }
.me-sub { font-size: 11px; color: var(--muted-2); margin-top: 5px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 62px; font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.bar-track { flex: 1; height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--violet)); transition: width .5s ease; }
.bar-num { width: 40px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.me-actions { display: grid; gap: 8px; }

/* ============================================================ 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-b));
  background: rgba(10, 16, 32, .86);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 10px; border-radius: 12px; color: var(--muted-2); }
.tab span { font-size: 19px; filter: grayscale(.55); opacity: .8; transition: all .18s; }
.tab small { font-size: 9.5px; letter-spacing: .3px; }
.tab.on { color: var(--mint); }
.tab.on span { filter: none; opacity: 1; transform: translateY(-1px) scale(1.06); }

/* ============================================================ 答题器 */
.player {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: radial-gradient(900px 400px at 50% -10%, #182349, #0a0f1e 55%);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(14px + var(--safe-b));
  animation: fadeUp .25s ease both;
}
.player[hidden] { display: none; }
.player-head { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 34px; height: 34px; border-radius: 11px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--muted); font-size: 14px; display: grid; place-items: center; flex: 0 0 auto; }
.pl-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.pl-meta b { font-size: 12.5px; }
.pl-meta span { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.pl-timer { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--mint); min-width: 42px; text-align: right; }
.pl-timer.warn { color: var(--gold); }
.pl-timer.danger { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.pl-bar { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .09); margin: 10px 0 0; overflow: hidden; }
.pl-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--mint), var(--violet)); transition: width .3s linear; }

.player-body { flex: 1; overflow-y: auto; padding: 16px 0 8px; display: flex; flex-direction: column; }
.q-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.badge { font-size: 10.5px; padding: 3px 9px; border-radius: 7px; background: rgba(139, 140, 255, .18); color: #b9baff; border: 1px solid rgba(139, 140, 255, .3); }
.diff { display: inline-flex; gap: 3px; align-items: center; }
.diff i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: block; }
.diff i.on { background: var(--gold); }
.tag { font-size: 10.5px; color: var(--muted-2); }
.q-score { margin-left: auto; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.q-text { font-size: 19px; line-height: 1.55; font-weight: 650; margin: 18px 0 20px; letter-spacing: .2px; }
.q-text em { font-style: italic; color: var(--mint); }

.options { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; text-align: left;
  padding: 14px 14px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.5;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.opt:active { transform: scale(.985); }
.opt .key {
  width: 24px; height: 24px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .08); color: var(--muted);
  transition: all .15s;
}
.opt.picked { border-color: rgba(94, 231, 200, .6); background: rgba(94, 231, 200, .1); }
.opt.correct { border-color: rgba(74, 222, 128, .7); background: rgba(74, 222, 128, .13); }
.opt.correct .key { background: var(--good); color: #06210f; }
.opt.wrong { border-color: rgba(255, 107, 129, .7); background: rgba(255, 107, 129, .12); }
.opt.wrong .key { background: var(--bad); color: #24070c; }
.opt.dim { opacity: .5; }

.explain {
  margin-top: 16px; padding: 14px;
  border-radius: 15px;
  background: rgba(94, 231, 200, .07);
  border: 1px solid rgba(94, 231, 200, .22);
  animation: fadeUp .25s ease both;
}
.explain.bad { background: rgba(255, 107, 129, .07); border-color: rgba(255, 107, 129, .22); }
.ex-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.ex-body { font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.ex-ans { font-size: 11.5px; color: var(--muted-2); margin-top: 8px; }

.player-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; }
.foot-actions { display: flex; align-items: center; gap: 8px; }
.streak { font-size: 12px; color: var(--gold); font-weight: 700; min-height: 20px; }
.player-foot .btn { min-width: 120px; }

/* ============================================================ 结算 */
.result {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  background: radial-gradient(800px 400px at 50% 0%, #1b2750, #080d1a 60%);
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + var(--safe-b));
  animation: fadeUp .3s ease both;
}
.result[hidden] { display: none; }
.result-inner { max-width: 460px; margin: 0 auto; }
.rs-emoji { font-size: 54px; text-align: center; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rs-title { text-align: center; font-size: 21px; font-weight: 800; margin-top: 6px; }
.rs-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.rs-score { text-align: center; font-size: 52px; font-weight: 800; letter-spacing: -2px; margin: 16px 0 0; font-variant-numeric: tabular-nums; line-height: 1; }
.rs-score small { font-size: 14px; font-weight: 600; color: var(--muted-2); letter-spacing: 0; margin-left: 4px; }
.rs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.rs-cell { text-align: center; padding: 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.rs-cell b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.rs-cell small { color: var(--muted-2); font-size: 10.5px; }
.rs-rating { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.rs-rating b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.rs-delta { padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.rs-delta.up { background: rgba(74, 222, 128, .16); color: #86efac; }
.rs-delta.down { background: rgba(255, 107, 129, .16); color: #fda4af; }
.rs-actions { display: grid; gap: 8px; margin-top: 24px; }
.rs-note { text-align: center; color: var(--muted-2); font-size: 11px; margin-top: 14px; line-height: 1.7; }

/* ============================================================ 弹窗 */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(4, 8, 18, .72); backdrop-filter: blur(6px); animation: fade .2s ease both; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 380px;
  border-radius: 22px; padding: 22px;
  background: linear-gradient(180deg, #131c33, #0e1526);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow);
  animation: pop .3s cubic-bezier(.2, 1.2, .4, 1) both;
  max-height: 86vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.modal-desc { font-size: 12.5px; color: var(--muted); margin: 0 0 18px; line-height: 1.65; }
.emoji-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0 4px; }
.emoji-pick button { aspect-ratio: 1; border-radius: 12px; font-size: 20px; background: rgba(255, 255, 255, .05); border: 1px solid transparent; }
.emoji-pick button.on { background: rgba(94, 231, 200, .16); border-color: rgba(94, 231, 200, .5); }
.modal-actions { display: grid; gap: 8px; margin-top: 18px; }

/* ============================================================ Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 12px;
  background: rgba(20, 28, 48, .96);
  border: 1px solid var(--line-strong);
  font-size: 12.5px; color: var(--text);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 90;
  max-width: 84vw; text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================ 特效 */
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 95; }

.fx-shake { animation: shakeKf .42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shakeKf {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}

.fx-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 94;
  opacity: .9; transition: opacity .35s ease;
}

.fx-float {
  position: fixed; transform: translate(-50%, -50%);
  font-size: 22px; font-weight: 900; letter-spacing: 1px;
  pointer-events: none; z-index: 96;
  animation: floatUp .9s cubic-bezier(.2, .8, .2, 1) forwards;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .5);
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

.combo-pop {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  font-size: 26px; font-weight: 900; letter-spacing: 2px;
  color: var(--gold); pointer-events: none; opacity: 0;
  text-shadow: 0 4px 24px rgba(245, 196, 81, .45);
}
.combo-pop.show { animation: comboKf .8s cubic-bezier(.2, 1, .3, 1) forwards; }
@keyframes comboKf {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.5) rotate(-6deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1) rotate(0); }
}

/* ============================================================ 逐题回顾 */
.review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.review-head b { font-size: 17px; }
.rev-item {
  border-radius: 16px; padding: 14px; margin-bottom: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
}
.rev-item.ok { border-color: rgba(74, 222, 128, .28); }
.rev-item.no { border-color: rgba(255, 107, 129, .28); }
.rev-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.rev-no { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.rev-q { font-size: 14px; line-height: 1.55; font-weight: 600; }
.rev-opts { display: grid; gap: 5px; margin-top: 10px; }
.rev-opt {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--muted);
  padding: 6px 9px; border-radius: 9px;
  background: rgba(255, 255, 255, .03);
}
.rev-opt .k { font-weight: 700; color: var(--muted-2); }
.rev-opt.ans { background: rgba(74, 222, 128, .13); color: #bbf7d0; }
.rev-opt.ans .k { color: var(--good); }
.rev-opt.pick-bad { background: rgba(255, 107, 129, .12); color: #fecdd3; }
.rev-opt.pick-bad .k { color: var(--bad); }
.rev-ex { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.6; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ============================================================ 对战聊天 */
.chat-sheet {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #141d33, #0e1526);
  border: 1px solid var(--line-strong); border-radius: 16px; padding: 12px;
  box-shadow: var(--shadow); z-index: 5; animation: fadeUp .18s ease both;
}
.chat-emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.chat-emoji {
  aspect-ratio: 1; border-radius: 11px; font-size: 20px; line-height: 1;
  background: rgba(255, 255, 255, .05); border: 1px solid transparent;
}
.chat-emoji:active { transform: scale(.94); background: rgba(94, 231, 200, .16); border-color: rgba(94, 231, 200, .4); }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row .input { flex: 1; padding: 9px 12px; font-size: 13px; }

.chat-bubble {
  position: fixed; left: 50%; top: 84px; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 8px; max-width: 86vw;
  padding: 9px 14px; border-radius: 14px;
  background: rgba(20, 28, 48, .96);
  border: 1px solid rgba(139, 140, 255, .45);
  font-size: 13px; z-index: 97; transition: all .5s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: chatIn .3s cubic-bezier(.2, 1.3, .4, 1) both;
}
.chat-bubble b { color: var(--mint); font-size: 11.5px; white-space: nowrap; }
.chat-bubble span { color: var(--text); }
@keyframes chatIn {
  from { opacity: 0; transform: translate(-50%, -10px) scale(.9); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.room-chat { margin-top: 14px; text-align: left; display: grid; gap: 4px; max-height: 130px; overflow-y: auto; }
.rc-line {
  font-size: 11.5px; color: var(--muted);
  background: rgba(255, 255, 255, .04); border-radius: 8px; padding: 5px 9px;
}
.rc-line b { color: var(--mint); margin-right: 4px; }

/* ============================================================ 离线版标记 */
.offline-badge {
  position: fixed; left: 12px; bottom: calc(96px + var(--safe-b));
  z-index: 40; pointer-events: none;
  font-size: 10.5px; letter-spacing: .5px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(245, 196, 81, .14);
  border: 1px solid rgba(245, 196, 81, .35);
  color: var(--gold);
}

/* 音乐曲库锁定 & 对手进度 */
.chip.locked { opacity: .42; }
.opp-line {
  display: flex; align-items: center; gap: 7px;
  margin-top: 8px; font-size: 11px; color: var(--muted);
  background: rgba(139, 140, 255, .1);
  border: 1px solid rgba(139, 140, 255, .25);
  border-radius: 10px; padding: 5px 9px;
}
.opp-line[hidden] { display: none; }
.opp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 8px var(--violet); flex: 0 0 auto; }
.opp-bar { flex: 1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; display: block; }
.opp-bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--mint)); border-radius: 99px; transition: width .4s ease; }

/* ============================================================ 桌面 */
@media (min-width: 720px) {
  .shell { max-width: 720px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .q-text { font-size: 21px; }
  .opt { font-size: 15.5px; }
  .battle-actions { grid-template-columns: 1fr 1fr; }
}

/* 确保 hidden 属性永远生效（.btn 的 display 会覆盖它） */
[hidden] { display: none !important; }

/* 紧凑排版：去掉多余空白、行距压到最小 */
body { line-height: 1.35; }
.shell { padding: 0 12px calc(78px + var(--safe-b)); }
.page-head { padding: 0 2px 8px; }
.page-head h1 { margin: 0 0 2px; font-size: 20px; line-height: 1.25; }
.page-head p { margin: 0; font-size: 12px; line-height: 1.35; }
.card { padding: 11px 12px; margin-bottom: 8px; }
.list { padding: 2px 10px; }
.field-label { margin: 8px 0 5px; line-height: 1.2; }
.chips { gap: 6px; }
.chip { padding: 6px 10px; font-size: 12px; }
.row { padding: 7px 0 !important; }
.row-main small, .row-val small { line-height: 1.2; }
.empty { padding: 8px 0 !important; font-size: 12px; }
.muted-sm, .tip, .battle-note { line-height: 1.35; }
.btn { padding: 10px 14px; }
.btn.block { margin-top: 10px; }
.stats-mini, .me-card { margin-bottom: 8px; }
.tabbar { padding: 6px 8px calc(6px + var(--safe-b)); }
.view { padding-top: 0; }
h1, h2, h3, p { margin-top: 0; }
.modal-desc, .modal-card p { line-height: 1.4; margin: 6px 0; }
.rs-sub, .rs-note { line-height: 1.35; }

/* 空卡片不占位置，避免出现空白块 */
.card:empty, .stats-mini:empty, #pracStats:empty, #duelArchive:empty,
#boardCompare:empty, #rankInfo:empty, .list:empty { display: none !important; }

/* 侧边导航：底部不再有 tabbar */
.tabbar {
  left: 0; right: auto; bottom: auto;
  top: 50%; transform: translateY(-50%);
  flex-direction: column; justify-content: center;
  width: 58px; padding: 8px 4px; gap: 2px;
  border-radius: 0 16px 16px 0;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 0;
}
.tabbar .tab {
  padding: 6px 2px; gap: 0; width: 100%; border-radius: 10px;
}
.tabbar .tab span { font-size: 17px; line-height: 1.1; }
.tabbar .tab small { font-size: 9px; line-height: 1.1; }
.shell { padding-left: 66px; padding-right: 12px; padding-bottom: calc(16px + var(--safe-b)); }
/* 意见按钮挪到右侧边，避免和导航重叠 */
#fbOpen { left: auto !important; right: 0 !important; top: 50% !important;
  border-radius: 12px 0 0 12px !important; box-shadow: -4px 0 14px rgba(74,123,255,.3) !important; }
/* 提示消息别被导航挡 */
.toast { bottom: calc(24px + var(--safe-b)); }
.offline-badge { bottom: calc(24px + var(--safe-b)); }

/* 侧边导航只显示图标 */
.tabbar .tab small { display: none !important; }
.tabbar .tab span { font-size: 20px; line-height: 1; }
.tabbar .tab { padding: 9px 2px; }

/* 单屏布局：页面不上下滑动 */
html, body { height: 100%; overflow: hidden; }
.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(8px + var(--safe-b));
}
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view.active { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view.active > * { flex: 0 0 auto; }
.view.active > .card:last-child,
.view.active > .list:last-child { flex: 1 1 auto; min-height: 0; overflow: hidden; }
/* ===== 重新排版 v3 ===== */
:root {
  --radius: 12px;
}

/* 基础密度 */
body { font-size: 13px; line-height: 1.28; }
.shell { padding: 0 10px calc(6px + var(--safe-b)) 56px; }

/* 顶栏压扁 */
.topbar { padding: 6px 2px 4px; gap: 6px; }
.brand-mark { font-size: 18px; }
.brand-txt b { font-size: 15px; }
.icon-btn, .user-chip { padding: 5px 8px; font-size: 12px; }

/* 侧边导航：窄条纯图标 */
.tabbar {
  width: 46px; padding: 6px 3px; gap: 4px;
  border-radius: 0 14px 14px 0;
}
.tabbar .tab { padding: 7px 0; border-radius: 9px; }
.tabbar .tab span { font-size: 17px; }
.tabbar .tab.on { background: rgba(123,125,255,.16); }

/* 页面标题 */
.page-head { padding: 0 2px 6px; }
.page-head h1 { font-size: 17px; margin: 0; line-height: 1.2; }
.page-head p { font-size: 11.5px; line-height: 1.3; margin: 1px 0 0; }

/* 卡片更紧凑 */
.card { padding: 9px 10px; margin-bottom: 6px; border-radius: 12px; }
.list { padding: 0 8px; }

/* 选择器 */
.field-label { margin: 6px 0 4px; font-size: 10.5px; }
.chips { gap: 5px; }
.chip { padding: 5px 9px; font-size: 11.5px; border-radius: 999px; }

/* 按钮 */
.btn { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn.block { margin-top: 8px; }
.btn.lg { padding: 10px 14px; font-size: 14px; }

/* 列表行 */
.row { padding: 6px 0 !important; gap: 8px; }
.row b { font-size: 13px; }
.row small, .row-main small, .row-val small { font-size: 10.5px; line-height: 1.2; }
.board-row { padding: 7px 0; gap: 8px; }

/* 首页/我的 用两列网格塞下所有元素 */
.view.active { display: flex; flex-direction: column; gap: 0; min-height: 0; }
#v-home .card, #v-me .card { margin-bottom: 6px; }
#v-me .me-card { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: center; }
#v-me .me-card .btn { width: 100%; }
.stats-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stats-mini > div { padding: 4px 2px; }
.stats-mini b { font-size: 14px; }
.stats-mini small { font-size: 9.5px; }

/* 结果页/弹窗 */
.result-inner { padding: 14px; }
.rs-title { font-size: 20px; }
.rs-score { font-size: 30px; }
.modal-card { padding: 14px; }

/* 防止溢出时出现滚动条：内容等比缩小 */
.view.active > * { min-height: 0; }
.view.active { overflow: hidden; }

/* 意见按钮：右侧细条 */
#fbOpen { width: 22px; padding: 8px 4px; font-size: 10px; }
/* ===== 选择器网格排版 v4 ===== */
/* 四类/难度/题量：一行四格，等宽，不换行不裁切 */
#pracCats, #pracDiffs, #pracModes, #pracCounts,
#duelCount, #duelSeconds, #duelCats {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  width: 100%;
}
#pracCats .chip, #pracDiffs .chip, #pracModes .chip, #pracCounts .chip,
#duelCount .chip, #duelSeconds .chip, #duelCats .chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 2px;
  font-size: 11px;
  line-height: 1.15;
  border-radius: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 练习页整体再收一点，保证一屏放得下 */
#v-practice .card, #v-ranked .card, #v-duel .card { padding: 8px 9px; }
#v-practice .field-label, #v-ranked .field-label, #v-duel .field-label {
  margin: 5px 0 3px; font-size: 10px;
}
#v-practice .btn.block, #v-ranked .btn.block, #v-duel .btn.block {
  margin-top: 6px; padding: 9px 10px; font-size: 13px;
}
#v-practice .page-head p { display: none; }
#v-practice .card .muted-sm { font-size: 10.5px; line-height: 1.25; margin: 4px 0 0; }
/* ===== 全量可见 v5 ===== */
/* 内容区：放得下就不滚动，放不下可以静默滚动（不显示滚动条），绝不裁切 */
html, body { overflow: hidden; height: 100%; }
.shell { height: 100%; display: flex; flex-direction: column; }
main { flex: 1; min-height: 0; display: flex; }
.view.active {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: 6px;
}
.view.active::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* 触控尺寸：所有可点的东西至少 30px 高 */
.chip { min-height: 30px; }
.btn { min-height: 34px; }
.tabbar .tab { min-height: 40px; }
.row .btn, .list .btn { min-height: 28px; }

/* 卡片不裁切内容 */
.card { overflow: visible; }

/* 我的页：两列，元素都留着 */
#v-me .me-card { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
#v-me .me-card > * { min-width: 0; }

/* 排行榜行更紧凑但可点 */
.board-row { padding: 6px 0; }

/* 弹窗内容可滚动，按钮永远可见 */
.modal-card { max-height: 88vh; overflow-y: auto; scrollbar-width: none; }
.modal-card::-webkit-scrollbar { display: none; }
.modal-actions { position: sticky; bottom: 0; background: inherit; padding-top: 8px; }
/* ===== 恢复正常流 v6 ===== */
/* 恢复自然文档流：内容多就短距离滚动，绝不再出现空白页 */
html { height: auto; overflow-y: auto; overflow-x: hidden; }
body { height: auto; overflow: visible; }
.shell {
  height: auto; min-height: 100%;
  display: block;
  padding: 0 10px calc(18px + var(--safe-b)) 56px;
}
main { display: block; }
.view { display: none; }
.view.active { display: block; overflow: visible; min-height: 0; padding-bottom: 10px; }
.view.active > * { flex: none; }

/* 卡片恢复正常高度（内容不被压扁） */
.card { display: block; height: auto; min-height: 0; }
.list { display: block; }
.stats-mini { display: grid; }

/* 我的页：两列仍保留，但允许自然高度 */
#v-me .me-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; height: auto; }

/* 侧栏保持固定 */
.tabbar { position: fixed; left: 0; top: 50%; transform: translateY(-50%); }

/* 内容区留出侧栏宽度，底部不再被导航挤占 */
.toast { bottom: calc(24px + var(--safe-b)); }
/* ===== 顶部图标导航 v7 ===== */
/* 顶部图标导航 */
.tabbar {
  position: static !important;
  left: auto !important; right: auto !important;
  top: auto !important; bottom: auto !important;
  transform: none !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: none;
  margin: 2px 0 6px;
  padding: 4px 2px 6px !important;
  gap: 2px;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  z-index: 5;
}
.tabbar .tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 2px !important;
  border-radius: 10px;
  min-height: 34px !important;
}
.tabbar .tab span { font-size: 19px; line-height: 1; }
.tabbar .tab small { display: none !important; }
.tabbar .tab.on { background: rgba(123,125,255,.18); }

/* 不再给侧栏留空间 */
.shell { padding-left: 10px !important; padding-right: 10px !important; }

/* 锁步对战标记 */
.lk-tag{font-style:normal;font-size:10px;padding:1px 5px;border-radius:6px;margin-left:6px;background:rgba(72,216,182,.25);color:var(--mint)}
.lk-tag.lk-opp{background:rgba(255,107,129,.22);color:#ff9aa8}
.opt .k{font-weight:700}

.lk-wait{padding:26px 14px;text-align:center;color:var(--muted);font-size:13px;line-height:1.7}
.lk-wait small{color:var(--muted-2);font-size:11.5px}
