:root {
  --bg: #f4f5f9;
  --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .14), transparent 60%),
             radial-gradient(900px 500px at 100% 0%, rgba(255, 77, 141, .10), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --surface-3: #e8eaf2;
  --border: rgba(20, 24, 40, .08);
  --text: #141826;
  --text-2: #5b6275;
  --text-3: #8c93a6;
  --accent: #6d4dff;
  --accent-2: #ff4d8d;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #b14dff 50%, #ff4d8d 100%);
  --accent-soft: rgba(109, 77, 255, .10);
  --ok: #12b76a;
  --warn: #f79009;
  --danger: #f04438;
  --dy: #fe2c55;
  --xhs: #ff2442;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .18);
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .20), transparent 60%),
               radial-gradient(900px 500px at 100% 0%, rgba(255, 77, 141, .12), transparent 60%);
    --surface: #141720;
    --surface-2: #1b1f2a;
    --surface-3: #252a37;
    --border: rgba(255, 255, 255, .08);
    --text: #eef0f6;
    --text-2: #a7adbd;
    --text-3: #6f7689;
    --accent-soft: rgba(124, 92, 255, .18);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, .20), transparent 60%),
             radial-gradient(900px 500px at 100% 0%, rgba(255, 77, 141, .12), transparent 60%);
  --surface: #141720;
  --surface-2: #1b1f2a;
  --surface-3: #252a37;
  --border: rgba(255, 255, 255, .08);
  --text: #eef0f6;
  --text-2: #a7adbd;
  --text-3: #6f7689;
  --accent-soft: rgba(124, 92, 255, .18);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 手机适配：
   · 不给 body 设 min-height:100vh —— iOS 上 100vh 比可见区域高（含底部工具栏），内容很少时也会出现滚动条和大片空白；
   · overflow-x：html 用 hidden（作用于视口），body 用 clip（不会变成滚动容器，顶栏 sticky 仍然有效）；
   · 背景光晕放在 fixed 伪元素里：iOS 不支持 background-attachment: fixed。 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); overflow-x: hidden; }
body {
  margin: 0; color: var(--text); background: var(--bg); overflow-x: clip; max-width: 100%;
  overscroll-behavior-x: none;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans",
        "Microsoft YaHei", "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--bg-glow); }
svg { width: 18px; height: 18px; flex: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px rgba(124, 92, 255, .35); }
.brand-mark svg { width: 20px; height: 20px; }
.top-actions { display: flex; gap: 4px; align-items: center; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .14); }
.lang-label { font-size: 13px; font-weight: 600; }
.lang-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 46px; min-width: 160px; padding: 6px; display: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.menu.open { display: block; animation: pop .14s ease-out; }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.active { color: var(--accent); font-weight: 600; }

/* ---------- 首屏 ---------- */
.hero { text-align: center; padding: 40px 0 22px; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(26px, 5.4vw, 40px); line-height: 1.2; letter-spacing: -.5px;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0 auto; max-width: 560px; color: var(--text-2); }
.chips { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-dy .dot { background: var(--dy); box-shadow: 3px 0 0 #25f4ee; }
.chip-xhs .dot { background: var(--xhs); }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.input-card { padding: 16px; }
.input-box { position: relative; }
textarea {
  display: block; width: 100%; min-height: 112px; resize: vertical; padding: 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; transition: border-color .15s, background .15s;
}
textarea:focus { border-color: var(--accent); background: var(--surface); }
textarea::placeholder { color: var(--text-3); }
/* 识别状态放在输入框下方，不再叠在文字上 */
.input-meta { display: flex; align-items: center; min-height: 20px; margin-top: 8px; padding: 0 2px; }
.detect { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.detect::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.detect.ok { color: var(--ok); } .detect.ok::before { background: var(--ok); }
.detect.bad { color: var(--warn); } .detect.bad::before { background: var(--warn); }
.input-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .08s, filter .15s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px rgba(124, 92, 255, .32); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-tg { background: #229ed9; color: #fff; }
.btn-tg:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.full { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

.banner { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; border: 1px solid; }
.banner.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.banner.ban { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: color-mix(in srgb, var(--danger) 75%, var(--text)); font-weight: 600; }

/* ---------- 解析结果 ---------- */
.result-card { margin-top: 18px; padding: 16px; animation: rise .25s ease-out; }
.meta { display: flex; gap: 14px; }
.meta-cover { position: relative; flex: none; width: 104px; height: 138px; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: pointer; }
.meta-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta-cover .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(transparent 50%, rgba(0, 0, 0, .45)); color: #fff; }
.meta-cover .play svg { width: 32px; height: 32px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.meta-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.meta-title { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.meta-author { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.meta-author img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.tag.dy { background: color-mix(in srgb, var(--dy) 14%, transparent); color: var(--dy); }
.tag.xhs { background: color-mix(in srgb, var(--xhs) 14%, transparent); color: var(--xhs); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag svg { width: 13px; height: 13px; }

.section-title { margin: 18px 0 10px; font-size: 13px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; display: flex; justify-content: space-between; align-items: center; }
.q-list { display: grid; gap: 8px; }
.q-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.q-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.q-item.active { border-color: var(--accent); background: var(--accent-soft); }
.q-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-3); display: grid; place-items: center; }
.q-item.active .q-radio { border-color: var(--accent); }
.q-item.active .q-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.q-main { min-width: 0; }
.q-name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--accent-grad); color: #fff; font-weight: 700; }
.q-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.q-size { font-weight: 700; font-variant-numeric: tabular-nums; }

.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.actions .btn, .input-actions .btn { padding: 0 10px; min-width: 0; }
.btn span { overflow: hidden; text-overflow: ellipsis; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.opts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; color: var(--text-2); font-size: 13.5px; }
.opts label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.opts input { width: 17px; height: 17px; accent-color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.g-item { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.g-item:hover img { transform: scale(1.03); }
.g-item .live-badge { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; backdrop-filter: blur(6px); }
.g-item .live-badge svg { width: 13px; height: 13px; }
.g-item .g-dim { position: absolute; left: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 11px; }
.g-check { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.g-check svg { width: 15px; height: 15px; opacity: 0; }
.g-item.sel .g-check { background: var(--accent); border-color: var(--accent); }
.g-item.sel .g-check svg { opacity: 1; }
.g-item.sel { outline: 3px solid var(--accent); outline-offset: -3px; }

.audio-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-top: 10px; }
.audio-row .a-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.audio-row .a-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 任务进度 ---------- */
.tasks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 18px 0 28px; }
.task { min-width: 0; padding: 14px 16px; animation: rise .2s ease-out; }
.task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-name { font-weight: 600; font-size: 14px; min-width: 0; display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; }
.task-name > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.task-name svg { color: var(--accent); margin-top: 1px; }
.task-pct { flex: none; font-size: 15px; font-weight: 750; color: var(--accent); font-variant-numeric: tabular-nums; }
.task.done .task-pct { color: var(--ok); }
.task-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.task-time { color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.task-note { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.task-state { font-size: 12.5px; color: var(--text-2); min-width: 0; }
.task.done .task-state { color: var(--ok); }
.task.fail .task-state { color: var(--danger); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 8px; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent-grad); transition: width .3s ease; }
.task.done .bar i { background: var(--ok); }
.task.fail .bar i { background: var(--danger); }
.bar.indeterminate i { width: 35% !important; animation: indet 1.1s ease-in-out infinite; }
.task-info { display: flex; gap: 10px; margin-top: 2px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.task-info:empty { display: none; }
.task-err { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.task-err b { display: block; margin-bottom: 2px; }
.task-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.task-actions a { text-decoration: none; }

/* ---------- 弹窗 ---------- */
.modal, .drawer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; overscroll-behavior: contain; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 16, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .15s; }
.modal-panel { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-panel.small { max-width: 380px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.player-panel { max-width: 880px; padding: 14px; display: flex; flex-direction: column; }
.player-box { background: #000; border-radius: 14px; overflow: hidden; display: grid; place-items: center; flex: none; }
.player-box video { width: 100%; max-height: 70vh; max-height: calc(100dvh - 290px); min-height: 180px; display: block; background: #000; }
/* 醒目的关闭按钮 */
.btn-close { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 11px; border: 0; border-radius: 99px;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; cursor: pointer; flex: none; }
.btn-close svg { width: 16px; height: 16px; }
.btn-close:active { transform: scale(.96); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.seg button { height: 34px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.hint { margin: 8px 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.form { display: grid; gap: 12px; margin-top: 8px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.input { width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; outline: none; }
.input:focus { border-color: var(--accent); background: var(--surface); }
.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.form-actions .btn { flex: 1; }
.tg-status { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.tg-status.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }

.drawer { justify-content: flex-end; padding: 0; }
.drawer-panel { position: relative; width: min(420px, 100%); height: 100%; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: var(--shadow-lg); animation: slide .2s ease-out; }
.history-list { flex: 1; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; margin: 0 -4px; padding: 0 4px; }
.h-item { min-width: 0; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.h-top { display: flex; gap: 8px; align-items: flex-start; }
.h-top .tag { flex: none; }
.h-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.h-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.h-sub .ok { color: var(--ok); } .h-sub .fail { color: var(--danger); }
.h-actions { display: flex; gap: 4px; margin-top: 8px; }
.h-actions .icon-btn { height: 32px; min-width: 32px; padding: 0 8px; font-size: 12.5px; background: var(--surface); }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 14px; }

/* ---------- 图片查看器 ---------- */
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .94); display: flex; flex-direction: column; animation: fade .15s; }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; color: #fff; font-size: 14px; }
.viewer-tools { display: flex; gap: 4px; }
.viewer-stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-stage video { position: absolute; inset: 0; margin: auto; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-nav:hover { background: rgba(255, 255, 255, .22); }
.viewer-nav.prev { left: 14px; } .viewer-nav.next { right: 14px; }
.viewer-nav svg { width: 22px; height: 22px; }
#viewerLive.on { background: rgba(255, 255, 255, .2); }

/* ---------- 提示 ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { padding: 12px 14px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s ease-out; }
.toast b { display: block; }
.toast small { display: block; opacity: .8; margin-top: 2px; font-size: 12.5px; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

main.wrap { padding-bottom: env(safe-area-inset-bottom); }

/* 账号 */
.user-initial { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-grad); color: #fff; font-size: 12px; font-weight: 700; }
#userBtn.on svg { display: none; }
.menu .menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .hero { padding: 26px 0 16px; }
  .brand-name { font-size: 16px; }
  .lang-label { display: none; }
  .icon-btn { min-width: 38px; padding: 0 8px; }
  .input-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .audio-row { flex-wrap: wrap; }
  .audio-row .a-title { flex-basis: calc(100% - 56px); }
  .audio-row .btn { width: 100%; }
  .input-actions .btn-primary { grid-column: 1 / -1; order: -1; height: 50px; font-size: 16px; }
  .actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .actions .btn-primary { grid-column: 1 / -1; order: -1; height: 50px; }
  .meta-cover { width: 88px; height: 118px; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .g-item { border-radius: 9px; }
  .g-item .g-dim { display: none; }
  .g-check { width: 24px; height: 24px; right: 5px; top: 5px; }
  .viewer-nav { display: none; }
  .modal { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .modal-panel { padding: 16px; border-radius: 18px; }
  .player-panel { padding: 12px; }
  .player-box { margin: 0 -2px; }
  .seg button { padding: 0 10px; }
}
/* 很窄的屏幕（iPhone SE 等 320～375px）：顶栏收紧，避免横向溢出 */
@media (max-width: 380px) {
  .wrap { padding: 0 12px; }
  .brand { gap: 8px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-name { font-size: 15px; }
  .top-actions { gap: 0; }
  .icon-btn { min-width: 36px; padding: 0 7px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Telegram 账号登录 */
.form-title { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 6px; }
.tg-account { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.tg-me { display: grid; gap: 2px; min-width: 0; }
.tg-me b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-me small { font-size: 12px; color: var(--text-2); }
#tgGuard { margin-top: 12px; }
#tgGuard.cool { color: var(--danger); }

/* 验证码重发 */
.tg-resend { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.tg-resend .btn { flex: none; }

/* 播放器工具条：左侧开关，右侧（右下角）静音 / 画中画 / 全屏 */
.player-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.player-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.player-btns { display: flex; gap: 6px; flex: none; margin-left: auto; }
.player-btns .icon-btn { width: 42px; height: 42px; padding: 0; background: var(--surface-2); color: var(--text); border-radius: 12px; }
.player-btns .icon-btn svg { width: 20px; height: 20px; }
.player-btns .icon-btn.on { background: var(--accent-soft); color: var(--accent); }
#playerQualities button small { color: var(--text-3); font-weight: 500; margin-left: 2px; }
#playerQualities button.active small { color: inherit; opacity: .8; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 17px; height: 17px; accent-color: var(--accent); }
.cache-info { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 扫码登录 */
.tg-mode { margin-top: 0; }
.tg-mode button { flex: 1; }
.tg-qr { display: grid; justify-items: center; gap: 4px; padding: 12px; border-radius: 14px; background: var(--surface-2); text-align: center; }
.tg-qr img { width: 216px; height: 216px; border-radius: 10px; background: #fff; image-rendering: pixelated; }
.tg-qr .hint { margin: 4px 0; }
.tg-qr a { text-decoration: none; }
.tg-status.err { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.history-note { margin: -4px 2px 0; font-size: 12.5px; }

/* 账号窗口里的 Telegram 设置入口 */
.acc-tg { margin-top: 12px; }
/* 密码框：普通文本框 + 圆点遮挡，允许第三方输入法 */
.pw { -webkit-text-security: disc; text-security: disc; }
/* 图文分页 / 下载格式 */
.more-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.more-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.h-author { margin-top: 4px; font-size: 12.5px; color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; word-break: break-all; }
.h-author span { color: var(--text-3); }
.fmt-seg { margin-top: 0; }
.fmt-seg button { flex: 1; }
.fmt-hint { margin: 6px 2px 0; font-size: 12.5px; }
/* 下载记录：清空按钮挨着标题，左侧是一条不显眼的关闭把手 */
.head-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.drawer-handle { position: absolute; left: 0; top: 50%; transform: translate(-100%, -50%); width: 22px; height: 64px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px 0 0 10px; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text-3); opacity: .75; }
.drawer-handle:hover { opacity: 1; color: var(--text); }
.drawer-handle svg { width: 16px; height: 16px; }
@media (max-width: 460px) {
  /* 抽屉占满全屏时把手放进面板内侧 */
  .drawer-handle { transform: translateY(-50%); border-radius: 0 10px 10px 0; width: 18px; background: var(--surface-2); }
}
