/* 场边 · TikTok LIVE 主播提示 H5 —— 手机优先、深色、高对比 */
:root {
  color-scheme: dark;
  --bg: #0a0c14;
  --surface: #131726;
  --surface-2: #1a1f31;
  --surface-3: #232a40;
  --line: #2b3249;
  --line-strong: #3d4663;
  --text: #f6f7fb;
  --text-2: #c9cfdf;
  --muted: #9aa3ba;
  --faint: #6f7893;
  --mint: #6ff0c8;
  --mint-ink: #062019;
  --mint-soft: #6ff0c81f;
  --gold: #ffcf6e;
  --gold-soft: #ffcf6e1f;
  --pink: #ff9fc0;
  --pink-soft: #ff9fc01f;
  --violet: #b9a6ff;
  --violet-soft: #b9a6ff1f;
  --sky: #8fd8ff;
  --red: #ff8b98;
  --red-soft: #ff8b981f;
  --radius: 14px;
  --shadow: 0 20px 50px #0009;
  --nav-h: 66px;
  --tap: 48px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open, body.popup-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .45; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; color: var(--text-2); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 通用组件 ---------- */
.eyebrow { margin: 0 0 2px; color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.eyebrow-gold { color: var(--gold); }
.helper-text { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.fine-print { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.field-label { display: block; margin: 16px 0 7px; color: var(--text-2); font-size: 13px; font-weight: 700; }
.form-error { min-height: 20px; margin: 8px 0; color: var(--red); font-size: 13px; }

.text-input {
  display: block; width: 100%; min-height: var(--tap);
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: #0d1120; color: var(--text); font-size: 16px; outline: 0;
}
.text-input:focus { border-color: var(--mint); }
textarea.text-input { resize: vertical; min-height: 92px; line-height: 1.5; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 10px 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 15px; font-weight: 800; white-space: nowrap; text-decoration: none;
  transition: transform .1s, background-color .15s, border-color .15s;
}
.button:active:not(:disabled) { transform: scale(.97); }
.button-lg { min-height: 54px; font-size: 16px; }
.button-full { width: 100%; }
.button-primary { background: var(--mint); color: var(--mint-ink); }
.button-primary:hover:not(:disabled) { background: #9bf7da; }
.button-secondary { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.button-secondary:hover:not(:disabled) { background: #2c3450; }
.button-quiet { background: transparent; color: var(--text-2); border-color: var(--line-strong); }
.button-quiet:hover:not(:disabled) { background: var(--surface-2); }
.button-danger { background: var(--red-soft); color: var(--red); border-color: #ff8b9866; }
.button[data-loading="true"] { position: relative; color: transparent !important; }
.button[data-loading="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) var(--muted) transparent transparent;
  animation: spin .7s linear infinite;
}
.button-primary[data-loading="true"]::after { border-color: var(--mint-ink) var(--mint-ink) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 800; line-height: 1.4; white-space: nowrap;
}
.tag-mint { color: var(--mint); background: var(--mint-soft); border-color: #6ff0c855; }
.tag-gold { color: var(--gold); background: var(--gold-soft); border-color: #ffcf6e55; }
.tag-pink { color: var(--pink); background: var(--pink-soft); border-color: #ff9fc055; }
.tag-violet { color: var(--violet); background: var(--violet-soft); border-color: #b9a6ff55; }
.tag-red { color: var(--red); background: var(--red-soft); border-color: #ff8b9855; }
.tag-sky { color: var(--sky); background: #8fd8ff1a; border-color: #8fd8ff55; }

.panel {
  margin-top: 16px; padding: 18px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }

.empty-state {
  padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: 18px;
  text-align: center; background: var(--surface); color: var(--muted);
}
.empty-state .empty-icon { display: block; font-size: 30px; color: var(--mint); line-height: 1.2; }
.empty-state strong { display: block; margin-top: 6px; color: var(--text); font-size: 17px; }
.empty-state p { max-width: 290px; margin: 6px auto 0; font-size: 14px; }
.empty-state .button { margin-top: 14px; }

/* ---------- 启动 / 访问码 ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.splash-card { width: min(100%, 380px); text-align: center; }
.splash-logo { color: var(--mint); font-size: 44px; line-height: 1; margin-bottom: 12px; }
.splash-text { margin: 0; color: var(--text-2); font-size: 15px; }
.splash-actions { display: grid; gap: 10px; margin-top: 22px; }
.auth-card {
  text-align: left; padding: 28px 22px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow);
}
.auth-card .splash-logo { text-align: left; }
.auth-title { margin: 0; font-size: 36px; letter-spacing: -.04em; }
.auth-lead { margin: 6px 0 18px; color: var(--muted); font-size: 15px; }

/* ---------- 框架 ---------- */
.app-shell { min-height: 100vh; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; margin: 0 -16px; padding: env(safe-area-inset-top) 16px 0;
  background: #0a0c14f0; border-bottom: 1px solid #ffffff10;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 20px; font-weight: 900; letter-spacing: -.03em; flex: none; }
.brand-mark { color: var(--mint); font-size: 24px; line-height: 1; }
.topbar-status { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.topbar-manage {
  flex: none; min-width: 48px; min-height: 38px; padding: 4px 9px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 800;
}
.sync-pill, .collector-pill {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line-strong);
  color: var(--text-2); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.collector-pill { overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.sync-pill::before, .collector-pill::before, .status-dot::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint);
}
.is-ok::before { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.is-warn::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.is-bad::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.is-demo::before { background: var(--gold); }
.sync-pill.is-bad { color: var(--red); border-color: #ff8b9866; }
.sync-pill.is-warn { color: var(--gold); border-color: #ffcf6e66; }
@keyframes pulse { 50% { opacity: .35; } }

.main-content { max-width: 680px; margin: 0 auto; padding-top: 14px; }
.tab-panel { animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.page-heading h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.heading-count { color: var(--muted); font-size: 13px; font-weight: 700; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading.compact { margin-top: 20px; }
.section-meta { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- 管理页导航：播中页不显示 ---------- */
.manage-header { margin: 5px 0 18px; }
.manage-back {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 12px;
  border: 0; background: none; color: var(--mint); font-size: 15px; font-weight: 800;
}
.manage-back-badge { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--pink); color: #2a0614; font-size: 12px; text-align: center; }
.manage-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.manage-nav-item { min-height: 44px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; font-weight: 800; }
.manage-nav-item.is-active { background: var(--surface-3); color: var(--text); }
.manage-dirty-dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--gold); }

/* ---------- 直播提示 ---------- */
.mode-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface);
}
.sync-warning { margin-top: 8px; }
.mode-strip .mode-icon {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface-3); font-size: 18px; font-weight: 900;
}
.mode-strip .mode-copy { flex: 1; min-width: 0; }
.mode-strip strong { display: block; font-size: 16px; line-height: 1.3; }
.mode-strip p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.mode-strip .button { min-height: 40px; padding: 6px 12px; font-size: 13px; flex: none; }
.mode-strip.mode-live { border-color: #6ff0c866; background: linear-gradient(90deg, #11312a, var(--surface) 80%); }
.mode-strip.mode-live .mode-icon { background: var(--mint); color: var(--mint-ink); }
.mode-strip.mode-demo { border-color: #ffcf6e77; background: repeating-linear-gradient(135deg, #2a2312 0 12px, #241e10 12px 24px); }
.mode-strip.mode-demo .mode-icon { background: var(--gold); color: #2a1d00; }
.mode-strip.mode-demo strong { color: var(--gold); }
.mode-strip.mode-warn { border-color: #ffcf6e77; }
.mode-strip.mode-warn .mode-icon { background: var(--gold-soft); color: var(--gold); }
.mode-strip.mode-bad { border-color: #ff8b9888; background: #2a141b; }
.mode-strip.mode-bad .mode-icon { background: var(--red-soft); color: var(--red); }
.display-heading { margin-top: 28px; }
.display-heading h2 { font-size: 17px; letter-spacing: .01em; }
.is-display .empty-state { display: flex; min-height: max(300px, calc(100dvh - 190px)); flex-direction: column; align-items: center; justify-content: center; background: transparent; border-style: solid; }
.is-display .alert-foot { display: none; }

.alert-card {
  position: relative; padding: 18px 16px 16px;
  border: 1px solid #6ff0c866; border-radius: 22px;
  background: linear-gradient(160deg, #173129 0%, #141a2a 55%, #161a2e 100%);
  box-shadow: 0 18px 44px #0008;
}
.alert-card.is-vip { border-color: #ffcf6e88; background: linear-gradient(160deg, #33290f 0%, #161a2a 55%, #161a2e 100%); }
.alert-card.is-new { animation: arrive .9s ease-out; }
@keyframes arrive {
  0% { box-shadow: 0 0 0 0 #6ff0c8cc; transform: scale(.985); }
  60% { box-shadow: 0 0 0 10px #6ff0c800; transform: none; }
  100% { box-shadow: 0 18px 44px #0008; }
}
.alert-demo-ribbon {
  display: inline-block; margin: 0 0 10px; padding: 3px 9px; border-radius: 6px;
  background: var(--gold); color: #2a1d00; font-size: 12px; font-weight: 900; letter-spacing: .04em;
}
.alert-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, #5ee8c2, #7c95ff); color: #0b1a1c; font-size: 22px; font-weight: 900;
}
.avatar.warm { background: linear-gradient(135deg, #ffd08f, #ff93b8); }
.avatar.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 17px; }
.alert-who { flex: 1; min-width: 0; }
.alert-name { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.alert-sub { margin: 2px 0 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.alert-age { flex: none; align-self: flex-start; color: var(--muted); font-size: 13px; font-weight: 700; text-align: right; }
.alert-age.is-old { color: var(--gold); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.topic-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: topic; }
.topic {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px; border-radius: 14px; border: 1px solid #ffffff1a; background: #ffffff0c;
}
.topic-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--mint-soft); color: var(--mint); font-size: 15px; font-weight: 900;
}
.topic-text { display: block; font-size: 17px; line-height: 1.45; font-weight: 700; overflow-wrap: anywhere; }
.topic-source { display: inline-block; margin-top: 5px; }

.alert-actions {
  position: sticky; z-index: 2; bottom: calc(env(safe-area-inset-bottom) + 8px);
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px;
  margin: 12px -8px 0; padding: 8px; border-radius: 18px;
  background: #141a2bf2; box-shadow: 0 -6px 18px #0006;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.alert-actions .button { min-height: 56px; font-size: 16px; padding: 8px; }
.alert-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.link-button {
  min-height: 40px; padding: 6px 2px; border: 0; background: none;
  color: var(--mint); font-size: 14px; font-weight: 800;
}

.queue-list { display: grid; gap: 8px; }
.queue-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  color: var(--text); text-align: left;
}
.queue-item:hover { border-color: var(--line-strong); }
.queue-item.is-vip { border-color: #ffcf6e55; }
.queue-info { flex: 1; min-width: 0; }
.queue-info strong { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-info span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-chevron { color: var(--muted); font-size: 22px; }
.queue-more { margin: 4px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

.stats-section { margin-top: 20px; }
.stats-section h2 { margin: 0 0 10px; font-size: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { min-width: 0; padding: 12px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: center; }
.stat strong { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.demo-panel { border-color: #ffcf6e44; }
.demo-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.demo-button {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  min-height: 62px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface-2); text-align: left;
}
.demo-button strong { font-size: 15px; }
.demo-button span { color: var(--muted); font-size: 12px; }
.demo-button:hover:not(:disabled) { border-color: #ffcf6e88; }
.demo-button[data-loading="true"] { opacity: .6; }

/* ---------- 观众 ---------- */
.search-field {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface);
}
.search-field:focus-within { border-color: var(--mint); }
.search-icon { color: var(--muted); font-size: 22px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 12px 0; }
.chip-row { display: flex; gap: 8px; margin: 12px 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none; min-height: 40px; padding: 6px 15px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  font-size: 14px; font-weight: 700;
}
.filter-chip.is-active { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); }
.viewer-list { display: grid; gap: 8px; }
.viewer-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  text-align: left;
}
.viewer-item:hover { border-color: var(--line-strong); }
.viewer-main { flex: 1; min-width: 0; }
.viewer-name { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; }
.viewer-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-name .star { flex: none; color: var(--gold); }
.viewer-meta { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-side { flex: none; text-align: right; }
.viewer-side .count { display: block; font-size: 18px; font-weight: 900; color: var(--pink); line-height: 1.1; }
.viewer-side .count.zero { color: var(--faint); }
.viewer-side small { color: var(--muted); font-size: 12px; }

/* ---------- 事件 ---------- */
.event-list { margin: 10px 0 0; padding: 0; list-style: none; }
.event-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--mint-soft); color: var(--mint); font-size: 17px; font-weight: 900;
}
.event-icon.comment { background: var(--violet-soft); color: var(--violet); }
.event-icon.gift { background: var(--gold-soft); color: var(--gold); }
.event-icon.follow { background: var(--pink-soft); color: var(--pink); }
.event-body { flex: 1; min-width: 0; }
.event-title { display: block; font-size: 15px; overflow-wrap: anywhere; }
.event-title b { font-weight: 800; }
.event-name {
  padding: 0; border: 0; background: none; color: var(--text);
  font-weight: 800; text-decoration: underline; text-decoration-color: #ffffff40; text-underline-offset: 3px;
  min-height: 32px;
}
.event-name:hover { color: var(--mint); }
.event-title span { color: var(--text-2); }
.event-text { margin: 3px 0 0; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.event-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.event-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.event-side .tag { font-size: 11px; padding: 1px 6px; }

/* ---------- 设置 ---------- */
.status-line { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.status-line.is-bad { background: #2a141b; color: var(--red); }
.status-line.is-ok { background: #11312a; color: var(--mint); }
.status-dot { display: inline-flex; padding-top: 6px; }
.status-dot::before { width: 12px; height: 12px; }
.handle-field {
  display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: #0d1120;
  color: var(--muted); font-size: 18px; font-weight: 800;
}
.handle-field:focus-within { border-color: var(--mint); }
.handle-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; font-weight: 600; color: var(--text); padding: 12px 0; }
.handle-field input:disabled { color: var(--muted); }
.button-row { display: flex; gap: 8px; margin-top: 14px; }
.button-row .button { flex: 1; }
.button-row .button-quiet { flex: 0 0 34%; }

.rule { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rule:first-of-type { margin-top: 6px; }
.rule-last { border-bottom: 0; padding-bottom: 4px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; }
.rule-copy { min-width: 0; }
.rule-title { display: block; font-size: 16px; font-weight: 800; }
.rule-copy p { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 56px; height: 34px; margin: 0; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--surface-3); cursor: pointer;
  transition: background-color .15s;
}
.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #dfe3ee; transition: transform .18s;
}
.switch:checked { background: var(--mint); border-color: var(--mint); }
.switch:checked::before { transform: translateX(22px); background: var(--mint-ink); }
.switch:disabled { opacity: .4; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stepper-label { flex: 1; color: var(--text-2); font-size: 14px; font-weight: 700; }
.step-btn {
  width: var(--tap); height: var(--tap); border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-size: 22px; font-weight: 800; line-height: 1;
}
.step-btn:active:not(:disabled) { background: var(--surface-3); }
.step-input {
  width: 72px; height: var(--tap); border-radius: 12px; border: 1px solid var(--line-strong);
  background: #0d1120; text-align: center; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield; outline: 0;
}
.step-input::-webkit-outer-spin-button, .step-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-input:focus { border-color: var(--mint); }
.stepper.is-off { opacity: .4; }
.save-bar {
  position: sticky; z-index: 10; bottom: env(safe-area-inset-bottom);
  margin: 16px -16px 0; padding: 10px 16px 12px;
  background: linear-gradient(to bottom, #0a0c1400, #0a0c14 30%);
}
.settings-form :is(input, button, textarea) { scroll-margin-bottom: 140px; }
.save-feedback { min-height: 20px; margin: 0 0 6px; text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); }
.save-feedback.is-dirty { color: var(--gold); }
.save-feedback.is-ok { color: var(--mint); }
.save-feedback.is-bad { color: var(--red); }

/* ---------- 观众详情抽屉 ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: #02040ac4; }
.sheet {
  position: relative; width: min(100%, 640px); max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 24px 24px 0 0;
  background: #151a2a; box-shadow: var(--shadow);
  animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--line-strong); }

/* ---------- 自动弹出的达标提醒 ---------- */
.alert-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 10px; }
.alert-overlay-backdrop { position: absolute; inset: 0; background: #02040ae8; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.alert-dialog {
  position: relative; width: min(100%, 560px); max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 14px calc(12px + env(safe-area-inset-bottom)); border: 1px solid #6ff0c877; border-radius: 22px;
  background: #151a2a; box-shadow: 0 22px 70px #000c;
}
.alert-dialog-head { position: sticky; top: -14px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -14px -14px 12px; padding: 14px; background: #151a2af5; border-bottom: 1px solid var(--line); }
.alert-dialog-head h2 { margin: 0; font-size: 19px; line-height: 1.2; }
.alert-dialog-head .button { min-height: 40px; padding: 6px 12px; }
.alert-dialog .alert-card { padding: 0; border: 0; background: transparent; box-shadow: none; }
.alert-dialog .alert-name { font-size: 30px; }
.alert-dialog .topic { background: var(--surface-2); }
.alert-dialog .alert-actions { bottom: 0; margin: 14px 0 0; }
.alert-dialog .alert-foot { display: none; }
.detail-header { display: flex; align-items: center; gap: 12px; }
.detail-header .who { flex: 1; min-width: 0; }
.detail-header h2 { margin: 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.detail-header p { margin: 1px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.icon-button {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 24px; line-height: 1;
}
.detail-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.fact { padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.fact strong { display: block; font-size: 18px; }
.fact span { color: var(--muted); font-size: 12px; }
.identity-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: 13px; }
.vip-button { margin-top: 12px; }
.vip-button.is-on { background: var(--gold-soft); color: var(--gold); border-color: #ffcf6e77; }
.detail-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 10px; font-size: 16px; }
.detail-section h3 span { color: var(--muted); font-weight: 600; }
.memory-item {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; padding: 12px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2);
}
.memory-copy { flex: 1; min-width: 0; }
.memory-copy p { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.memory-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.memory-delete {
  flex: none; min-height: 40px; min-width: 56px; padding: 4px 10px; border-radius: 10px;
  border: 1px solid transparent; background: none; color: var(--red); font-size: 14px; font-weight: 800;
}
.memory-delete.is-confirm { background: var(--red); color: #2a0610; }
.memory-form { display: flex; gap: 8px; margin-top: 10px; }
.memory-form .text-input { flex: 1; min-width: 0; }
.memory-form .button { flex: none; }
.interaction-item { padding: 10px 0; border-bottom: 1px solid #ffffff10; }
.interaction-item:last-child { border-bottom: 0; }
.interaction-head { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.interaction-item p { margin: 4px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.detail-empty { margin: 0; color: var(--muted); font-size: 14px; }
.detail-loading { padding: 30px 0; text-align: center; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: #262e44; color: var(--text); box-shadow: var(--shadow);
  font-size: 15px; font-weight: 700; text-align: center;
}
.toast.is-bad { background: #4a1f2b; border-color: #ff8b9888; color: #ffd8de; }
.toast.is-ok { border-color: #6ff0c877; }

/* ---------- 宽屏 ---------- */
@media (min-width: 760px) {
  .app-shell { padding: 0 24px 48px; }
  .topbar { margin: 0 -24px; padding: 0 24px; }
  .main-content { width: 100%; }
  .toast { bottom: 24px; }
  .save-bar { bottom: 0; }
  .sheet-overlay { align-items: center; }
  .sheet { border-bottom: 1px solid var(--line-strong); border-radius: 24px; max-height: 86vh; }
  .sheet-handle { display: none; }
}
@media (max-width: 359px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .topbar { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .brand-name { display: none; }
  .stat strong { font-size: 20px; }
  .stat span { font-size: 11px; }
  .alert-name { font-size: 22px; }
  .topic-text { font-size: 16px; }
  .alert-actions .button { font-size: 14px; }
}
