/* TapSulor 数据看板（网页版）
   主题：data-theme = light | dark；强调色：data-accent = cyan | pink | purple | mint；标题字体：data-font
   断点：手机 < 640px，平板 640–1023px，电脑 >= 1024px
   配色参照 jgd-ranking：默认深色；强调色 cyan 实为翠绿（取值沿用旧名，兼容本地存储），mint 改为晴空蓝
   图表线色 --chart 已校验：对卡片表面（浅色 #FFF/#F5F7FA，深色 #171E26/#20272F）对比度均 >= 3:1 */

@font-face { font-family: UserPixel; src: url('../fonts/PixelFont.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: ChaoKu; src: url('../fonts/ChaoKuFont.ttf') format('truetype'); font-display: swap; }

:root {
  --accent: #0F9D6E; --accent-strong: #0A7A55; --accent-soft: #DDF1EB; --chart: #0F9D6E;
  --primary-bg: linear-gradient(180deg, #0F9D6E, #0A7A55); --primary-border: #0A7A55; --primary-text: #FFFFFF;
  --info: #2A78D6;
  --bg-page: #F5F7FA; --bg-card: #FFFFFF; --bg-muted: #EEF2F6; --bg-hover: #F3F6F9; --bg-thead: #F8FAFC;
  --bg-glass: rgba(255, 255, 255, .78); --bg-bar: rgba(245, 247, 250, .78); --seg-active: var(--bg-card);
  --page-glow: radial-gradient(1200px 600px at 10% -10%, rgba(15, 157, 110, .08), transparent 55%), radial-gradient(900px 500px at 90% 0%, rgba(201, 138, 27, .07), transparent 50%);
  --text-primary: #16222B; --text-secondary: #4A5560; --text-tertiary: #66707A;
  --border-light: rgba(15, 30, 40, .10); --border-strong: rgba(15, 30, 40, .18);
  --success: #0F9D6E; --success-soft: rgba(15, 157, 110, .10); --danger: #D03B3B; --danger-soft: rgba(208, 59, 59, .10); --warn: #C98A1B; --warn-soft: rgba(201, 138, 27, .10);
  --shadow: 0 1px 2px rgba(20, 40, 60, .06), 0 1px 3px rgba(20, 40, 60, .06);
  --shadow-card: 0 18px 50px rgba(20, 40, 60, .12);
  --shadow-lg: 0 18px 50px rgba(20, 40, 60, .18);
  --radius: 12px; --radius-sm: 8px;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-title: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  color-scheme: light;
}
[data-accent="pink"] { --accent: #D6408A; --accent-strong: #B8326F; --accent-soft: #F9E4EF; --chart: #D6408A; --primary-bg: linear-gradient(180deg, #D6408A, #B8326F); --primary-border: #B8326F; }
[data-accent="purple"] { --accent: #6A5AE0; --accent-strong: #5646C8; --accent-soft: #EAE8FB; --chart: #6A5AE0; --primary-bg: linear-gradient(180deg, #6A5AE0, #5646C8); --primary-border: #5646C8; }
[data-accent="mint"] { --accent: #2A78D6; --accent-strong: #1F62B3; --accent-soft: #E1ECF9; --chart: #2A78D6; --primary-bg: linear-gradient(180deg, #2A78D6, #1F62B3); --primary-border: #1F62B3; }
[data-theme="dark"] {
  --accent: #3ECF8E; --accent-strong: #3ECF8E; --accent-soft: #1D3A37; --chart: #3ECF8E;
  --primary-bg: linear-gradient(180deg, #2A4A3A, #1D3329); --primary-border: rgba(62, 207, 142, .4); --primary-text: #E8EEF5;
  --info: #6CB6FF;
  --bg-page: #0F1419; --bg-card: #171E26; --bg-muted: #1D2630; --bg-hover: #222C37; --bg-thead: #1A222B;
  --bg-glass: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%), rgba(23, 30, 38, .82);
  --bg-bar: rgba(15, 20, 25, .78); --seg-active: var(--accent-soft);
  --page-glow: radial-gradient(1200px 600px at 10% -10%, rgba(62, 207, 142, .12), transparent 55%), radial-gradient(900px 500px at 90% 0%, rgba(240, 180, 41, .10), transparent 50%);
  --text-primary: #E8EEF5; --text-secondary: #B4BFCC; --text-tertiary: #8B98A8;
  --border-light: rgba(232, 238, 245, .08); --border-strong: rgba(232, 238, 245, .16);
  --success: #3ECF8E; --success-soft: rgba(62, 207, 142, .10); --danger: #FF6B6B; --danger-soft: rgba(255, 107, 107, .10); --warn: #F0B429; --warn-soft: rgba(240, 180, 41, .10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-card: 0 18px 50px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
[data-theme="dark"][data-accent="pink"] { --accent: #FF7EB6; --accent-strong: #FF7EB6; --accent-soft: #3C2D3D; --chart: #FF7EB6; --primary-bg: linear-gradient(180deg, #4A3346, #332A37); --primary-border: rgba(255, 126, 182, .4); }
[data-theme="dark"][data-accent="purple"] { --accent: #9B8AF2; --accent-strong: #9B8AF2; --accent-soft: #2C2F47; --chart: #9B8AF2; --primary-bg: linear-gradient(180deg, #343653, #272B3E); --primary-border: rgba(155, 138, 242, .4); }
[data-theme="dark"][data-accent="mint"] { --accent: #6CB6FF; --accent-strong: #6CB6FF; --accent-soft: #253649; --chart: #6CB6FF; --primary-bg: linear-gradient(180deg, #2A3F56, #213040); --primary-border: rgba(108, 182, 255, .4); }
[data-font="pixel"] { --font-title: UserPixel, var(--font-body); }
[data-font="chaoku"] { --font-title: ChaoKu, var(--font-body); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg-page); }
body { margin: 0; font: 14px/1.5 var(--font-body); color: var(--text-primary); background: var(--page-glow), var(--bg-page); min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--font-title); margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 1440px; margin: 0 auto; padding: 0 24px calc(32px + env(safe-area-inset-bottom)); }

/* ---------- 顶栏 ---------- */
.command-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 0; }
/* 半透明毛玻璃放在伪元素上：直接给顶栏加 backdrop-filter 会让手机端 position:fixed 的刷新按钮以顶栏为定位容器 */
.command-bar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--bg-bar); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-family: var(--font-title); font-size: 16px; }
.brand-copy span { font-size: 12px; color: var(--text-tertiary); }
.studio { position: relative; margin-left: 12px; min-width: 0; }
.studio-btn { display: flex; align-items: center; gap: 8px; max-width: 320px; padding: 5px 10px 5px 5px; border: 1px solid var(--border-light); border-radius: 999px; background: var(--bg-card); }
.studio-btn:disabled { cursor: default; opacity: 1; }
.studio-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--bg-muted); }
.studio-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
.studio-text b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-text small { font-size: 11px; color: var(--text-tertiary); }
.studio-caret { color: var(--text-tertiary); flex: none; }
.studio-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 260px; max-height: 320px; overflow-y: auto; padding: 6px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.studio-item, .account-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; }
.studio-item:hover { background: var(--bg-hover); }
.studio-item.is-active { background: var(--accent-soft); }
.studio-item img, .studio-item em, .account-item img, .account-item em { flex: none; width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--bg-muted); display: grid; place-items: center; font-style: normal; font-size: 13px; color: var(--text-secondary); }
.studio-item span, .account-item span { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.studio-item b, .account-item b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-item small, .account-item small { font-size: 11px; color: var(--text-tertiary); }
.command-actions { display: flex; gap: 8px; margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border-light); border-radius: 10px; background: var(--bg-card); color: var(--text-secondary); font-size: 20px; line-height: 1; text-decoration: none; }
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent); }
.icon-btn.is-spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 同步条 ---------- */
.sync-bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 0 12px; font-size: 12px; color: var(--text-tertiary); }
.sync-status { color: var(--text-secondary); }
.sync-status.is-warn { color: var(--warn); }
.sync-progress { position: absolute; left: 0; right: 0; bottom: 4px; height: 3px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.sync-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }

/* ---------- 通用控件 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--bg-card); font-size: 13px; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-border); color: var(--primary-text); }
.btn-primary:hover { color: var(--primary-text); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-muted); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.seg button:hover { color: var(--text-primary); }
.seg button.is-active { background: var(--seg-active); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow); }
.seg-sm button { height: 26px; padding: 0 10px; font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.check input { accent-color: var(--accent-strong); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 0; border-radius: 6px; background: var(--bg-muted); color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.badge-err { background: var(--danger-soft); color: var(--danger); cursor: pointer; }
.badge-sync { background: var(--accent-soft); color: var(--accent-strong); }
.empty { padding: 32px 16px; text-align: center; color: var(--text-tertiary); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.custom-range input { height: 32px; padding: 0 8px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--bg-card); }
.range-hint { font-size: 12px; color: var(--text-tertiary); }
.toolbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ---------- 关键指标 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { position: relative; min-width: 0; padding: 14px 16px; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--bg-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-card); }
.kpi-wide { grid-column: span 2; }
.kpi-today, .kpi-month, .kpi-total { background: linear-gradient(135deg, var(--accent-soft), var(--bg-card) 70%); }
.kpi-label { font-size: 12px; color: var(--text-secondary); }
.kpi-value { margin: 4px 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; min-height: 18px; }
.kpi-cmp { color: var(--text-tertiary); }
.kpi-note { margin-top: 4px; font-size: 12px; color: var(--text-tertiary); }
.delta { display: inline-flex; align-items: center; gap: 3px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta i { font-style: normal;  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; font-size: 11px; }
.delta.up i { background: var(--success-soft); color: var(--success); }
.delta.down i { background: var(--danger-soft); color: var(--danger); }
.delta.flat { color: var(--text-tertiary); }

/* ---------- 面板 / 图表 ---------- */
.panel { margin-bottom: 16px; padding: 16px; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--bg-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-card); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; }
.panel-head h3 { font-size: 14px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.count { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); color: var(--text-tertiary); }
.search input { width: 140px; border: 0; outline: 0; background: none; color: var(--text-primary); }
.chart { position: relative; min-height: 190px; }
.ch-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--border-light); stroke-width: 1; }
.ch-axis { fill: var(--text-tertiary); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--chart); opacity: .1; }
.ch-dot { fill: var(--chart); stroke: var(--bg-card); stroke-width: 2; }
.ch-cross { stroke: var(--text-tertiary); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-focus { fill: var(--chart); stroke: var(--bg-card); stroke-width: 2; }
.ch-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.ch-tip { position: absolute; top: 0; z-index: 2; display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--bg-card); box-shadow: var(--shadow-lg); font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: none; }
.ch-tip span { color: var(--text-tertiary); }
.ch-tip b { font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-empty { display: grid; place-items: center; height: 190px; color: var(--text-tertiary); }
.spark { display: block; }
.spark-bar { fill: var(--chart); opacity: .45; }
.spark-bar.is-last { opacity: 1; }
.spark-gap { fill: var(--border-strong); }
.spark-empty { color: var(--text-tertiary); }

/* ---------- 骨架屏 ---------- */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-hover) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
.sk-value { width: 70%; height: 26px; margin: 4px 0; }
.sk-cell { display: inline-block; width: 56px; height: 14px; vertical-align: middle; }
.sk-spark { width: 84px; height: 26px; }
.sk-chart { height: 200px; }
.sk-card { min-height: 180px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, .icon-btn.is-spinning svg { animation: none; } }

/* ---------- 游戏表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.games-table, .daily-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.games-table th, .daily-table th { position: sticky; top: 0; padding: 0 10px 8px; border-bottom: 1px solid var(--border-light); background: var(--bg-thead); font-size: 12px; font-weight: 500; color: var(--text-tertiary); text-align: left; white-space: nowrap; }
.games-table th button { padding: 0; border: 0; background: none; color: inherit; font-weight: inherit; }
.games-table th[aria-sort="ascending"], .games-table th[aria-sort="descending"] { color: var(--text-primary); }
.games-table td, .daily-table td { padding: 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; white-space: nowrap; }
.games-table tbody tr { cursor: pointer; }
.games-table tbody tr:hover, .daily-table tbody tr:hover { background: var(--bg-hover); }
.games-table tr.is-unpub td { color: var(--text-secondary); }
.num { text-align: right !important; }
.cell-delta { margin-top: 2px; font-size: 11px; }
.cell-delta .delta { justify-content: flex-end; }
.spark-col { width: 100px; }
.game-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.game-cell b { font-weight: 600; }
.g-icon { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; overflow: hidden; background: var(--bg-muted); }
.g-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.g-icon em { font-style: normal; font-weight: 600; color: var(--text-tertiary); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badges:empty { display: none; }
.daily-table small { color: var(--text-tertiary); }

/* ---------- 游戏卡片 ---------- */
.game-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.game-card { padding: 14px; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--bg-card); cursor: pointer; }
.game-card:hover { border-color: var(--accent); }
.game-card.is-unpub { opacity: .85; }
.game-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gc-title { min-width: 0; flex: 1; }
.gc-title b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-arrow { flex: none; color: var(--text-tertiary); }
.gc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gm { display: flex; flex-direction: column; min-width: 0; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-muted); }
.gm span { font-size: 12px; color: var(--text-secondary); }
.gm b { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm small { font-size: 12px; color: var(--text-tertiary); }
.game-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--text-tertiary); }

/* ---------- 登录门 ---------- */
.gate { max-width: 420px; margin: 10vh auto; padding: 32px 24px; border: 1px solid var(--border-light); border-radius: 16px; background: var(--bg-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-card); text-align: center; }
.gate img { border-radius: 14px; }
.gate h2 { margin: 14px 0 8px; font-size: 20px; }
.gate p { margin: 0 0 20px; color: var(--text-secondary); line-height: 1.7; }
.gate .btn { height: 40px; padding: 0 22px; font-size: 15px; }

/* ---------- 详情抽屉 ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .45); animation: fade .2s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(760px, 62vw); background: var(--bg-page); box-shadow: var(--shadow-lg); animation: slideIn .22s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); background: var(--bg-card); }
.drawer-icon { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.drawer-title { flex: 1; min-width: 0; }
.drawer-title h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-title small { font-size: 12px; color: var(--text-tertiary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.drawer-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.kpi-grid-drawer { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.kpi-grid-ad { margin-bottom: 0; }
.kpi-grid-drawer .kpi-value { font-size: 19px; }
.d-section { margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--bg-card); }
.d-section h3 { margin-bottom: 10px; }
.d-section h3 small { font-weight: 400; font-size: 12px; color: var(--text-tertiary); }
.d-section .panel-head h3 { margin: 0; }
.d-meta { margin: 10px 0 0; font-size: 12px; color: var(--text-secondary); }
.d-meta.warn { color: var(--warn); }
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fn-step { position: relative; display: flex; flex-direction: column; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-muted); }
.fn-step span { font-size: 12px; color: var(--text-secondary); }
.fn-step b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fn-step small { font-size: 12px; color: var(--text-tertiary); }
body.drawer-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

/* ---------- 设置 ---------- */
.settings-modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.settings-overlay { position: absolute; inset: 0; background: rgba(10, 14, 20, .45); }
.settings-panel { position: relative; width: min(100%, 480px); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--border-light); border-radius: 16px; background: var(--bg-card); box-shadow: var(--shadow-lg); }
.settings-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-light); background: var(--bg-card); }
.settings-header h2 { font-size: 17px; }
.settings-body { padding: 6px 18px 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-light); font-size: 14px; color: var(--text-secondary); }
.theme-dots { display: flex; gap: 10px; }
.theme-dot { width: 26px; height: 26px; padding: 0; border: 2px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px var(--border-light); }
.theme-dot[data-accent="cyan"] { background: #3ECF8E; }
.theme-dot[data-accent="pink"] { background: #FF7EB6; }
.theme-dot[data-accent="purple"] { background: #9B8AF2; }
.theme-dot[data-accent="mint"] { background: #6CB6FF; }
.theme-dot.is-active { border-color: var(--bg-card); box-shadow: 0 0 0 2px var(--text-primary); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .2s; pointer-events: none; }
.switch span::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent-strong); }
.switch input:checked + span::before { transform: translateX(18px); }
.settings-block { padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.settings-block-title { margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.account-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.account-item { border: 1px solid var(--border-light); }
.account-item.is-current { border-color: var(--accent); background: var(--accent-soft); }
.account-add-hint { margin-top: 6px; font-size: 12px; color: var(--text-tertiary); }
.settings-about { padding-top: 10px; }
.settings-about-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--text-secondary); }
.settings-link-btn { padding: 0; border: 0; background: none; color: var(--accent-strong); font-size: 13px; }

/* ---------- 提示 / 页脚 / 下拉刷新 ---------- */
#tb-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40000; max-width: 80%; padding: 10px 16px; border-radius: 10px; background: var(--text-primary); color: var(--bg-card); font-size: 13px; text-align: center; opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; pointer-events: none; }
#tb-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.app-footer { padding: 20px 0 0; text-align: center; font-size: 12px; color: var(--text-tertiary); }
.ptr { position: fixed; top: -48px; opacity: 0; left: 50%; z-index: 50; padding: 6px 14px; border-radius: 999px; background: var(--bg-card); box-shadow: var(--shadow-lg); font-size: 12px; color: var(--text-secondary); transform: translate(-50%, 0); transition: transform .15s; pointer-events: none; }
.ptr.is-pulling { opacity: 1; }
.ptr.is-ready { color: var(--accent-strong); }

/* ---------- 平板 640–1023 ---------- */
@media (max-width: 1023px) {
  .app { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-wide { grid-column: span 2; }
  .view-seg { display: none; }
  .game-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-panel { top: auto; left: 0; width: 100%; height: 92vh; border-radius: 16px 16px 0 0; animation: slideUp .22s ease-out; }
  .drawer-head { border-radius: 16px 16px 0 0; }
}

/* ---------- 手机 < 640 ---------- */
@media (max-width: 639px) {
  .app { padding: 0 12px calc(84px + env(safe-area-inset-bottom)); }
  .command-bar { gap: 8px; padding: 10px 0; }
  .brand-copy { display: none; }
  .studio { margin-left: 0; flex: 1; }
  .studio-btn { max-width: 100%; }
  /* 手机端刷新按钮固定在右下角，单手可点 */
  #refresh-btn { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--primary-border); background: var(--primary-bg); color: var(--primary-text); box-shadow: var(--shadow-lg); }
  .sync-note { display: none; }
  .toolbar { gap: 8px; }
  .toolbar > .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar > .seg button { flex: 1 0 auto; }
  .toolbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  /* 关键数字横向滑动 */
  .kpi-grid:not(.kpi-grid-drawer) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -12px 14px; padding: 0 12px 4px; scrollbar-width: none; }
  .kpi-grid:not(.kpi-grid-drawer) .kpi { flex: 0 0 44%; scroll-snap-align: start; }
  .kpi-grid:not(.kpi-grid-drawer) .kpi-wide { flex-basis: 70%; }
  .kpi-grid.kpi-grid-ad { margin-bottom: 0; }
  .kpi-grid-drawer { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 19px; }
  .panel { padding: 12px; }
  .panel-tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .game-cards { grid-template-columns: 1fr; }
  .drawer-panel { height: 100%; border-radius: 0; }
  .drawer-head { border-radius: 0; padding: 10px 12px; }
  .drawer-body { padding: 12px; }
  #drawer-backend { display: none; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .settings-modal { align-items: flex-end; padding: 0; }
  .settings-panel { width: 100%; max-height: 90vh; border-radius: 16px 16px 0 0; }
}
