/* Editor and workspace use shared appearance tokens; prompt content keeps its own colors. */
:root {
  --bg-top: #e2ecfa;
  --bg-bottom: #f6f5fb;
  --banner-surface: var(--bg-bottom);
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #5e6776;
  --tertiary: #9aa1ad;
  --fill: #eef1f6;
  --sep: #e6e8ee;
  --accent: #34c759;
  --on-accent: #06210e;
  --accent-text: #1f8f3d;
  --danger: #d70015;
  --shadow: 0 6px 20px rgba(40, 60, 110, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-top: #121722;
    --bg-bottom: #0b0c10;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #a1a7b3;
    --tertiary: #6e7480;
    --fill: #2c2c2e;
    --sep: #2e3036;
    --accent-text: #4ade80;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg-top: #121722; --bg-bottom: #0b0c10; --card: #1c1c1e; --text: #f2f2f7; --muted: #a1a7b3;
  --tertiary: #6e7480; --fill: #2c2c2e; --sep: #2e3036; --accent-text: #4ade80; --shadow: 0 1px 0 rgba(255,255,255,.04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 60%) fixed;
  background-color: var(--bg-bottom);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ── 顶栏 ── */
#app { display: flex; flex-direction: column; min-height: 100dvh; padding: 0 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 12px; max-width: 1200px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon { width: 36px; height: 36px; }
.brand-logo { display: inline-flex; flex-shrink: 0; background: var(--accent); isolation: isolate;
  mask: url('icons/brand-logo.png') center/contain no-repeat; -webkit-mask: url('icons/brand-logo.png') center/contain no-repeat; }
.brand-logo .brand-icon { filter: grayscale(1); mix-blend-mode: multiply; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 14px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip.tier { color: var(--accent-text); }

/* ── 工作区 ── */
.workspace { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; max-width: 1200px; width: 100%; margin: 0 auto 16px; min-height: 0; }
.sidebar, .editor { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; }
.sidebar { display: flex; flex-direction: column; padding: 12px; max-height: calc(100dvh - 90px); position: sticky; top: 8px; }
.sidebar-head { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; min-width: 0; height: 38px; border-radius: 12px; border: 0; background: var(--fill); padding: 0 12px; font-size: 15px; }
.icon-btn { width: 38px; height: 38px; flex-shrink: 0; border-radius: 19px; border: 0; background: var(--fill); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.accent { background: var(--accent); color: var(--on-accent); }
.script-list { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.script-list li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 10px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.script-list li button:hover { background: var(--fill); }
.script-list li button[aria-current="true"] { background: var(--fill); }
.script-list .t { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-list .p, .script-list .m { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-list .m { color: var(--tertiary); font-variant-numeric: tabular-nums; }
.sidebar-foot { padding-top: 8px; border-top: 1px solid var(--sep); }
.link { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }

.editor { display: flex; flex-direction: column; min-width: 0; padding: 16px 20px 14px; gap: 10px; }
.editor-head { display: flex; align-items: center; gap: 8px; }
.editor-head .back { display: none; }
.title-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 24px; font-weight: 700; padding: 4px 0; }
.title-input:focus { outline: none; }
.stats { font-size: 13px; color: var(--muted); display: flex; gap: 14px; font-variant-numeric: tabular-nums; }
.body-input { flex: 1; min-height: 46vh; resize: none; border: 0; border-radius: 14px; background: var(--fill); padding: 14px 16px; font-size: 17px; line-height: 1.7; }
.body-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.start-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.segment { display: flex; background: var(--fill); border-radius: 20px; padding: 3px; gap: 2px; }
.segment button { border: 0; background: transparent; height: 34px; padding: 0 14px; border-radius: 17px; font-size: 14px; color: var(--muted); }
.segment button[aria-checked="true"] { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.primary { margin-left: auto; height: 48px; padding: 0 26px; border-radius: 24px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.secondary { height: 48px; padding: 0 18px; border-radius: 24px; border: 0; background: var(--fill); color: var(--text); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.start-bar .secondary { margin-left: auto; }
.start-bar .secondary + .primary { margin-left: 0; }
.primary.small { height: 40px; padding: 0 20px; font-size: 15px; margin-left: 0; }
.primary:active { transform: scale(.98); }
.quota-line { margin: 0; font-size: 13px; color: var(--muted); min-height: 18px; }

/* 手机：列表和编辑区分两屏 */
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
  body.editing .sidebar { display: none; }
  body:not(.editing) .editor { display: none; }
  .editor-head .back { display: inline-flex; }
  .brand-sub { display: none; }
  .brand-icon { width: 30px; height: 30px; border-radius: 7px; }
  .brand-name { font-size: 17px; }
  .brand { flex: 1 1 auto; }
  .topbar-actions { flex-wrap: nowrap; gap: 6px; }
  .topbar-actions .chip { padding-inline: 11px; }
  .topbar-actions { flex-shrink: 0; }
  .primary { margin-left: 0; flex: 1; justify-content: center; }
  .segment { width: 100%; }
  .segment button { flex: 1; padding: 0 6px; }
}
/* 很窄的手机（375 宽）：名字加右边三个按钮放不下一行，只留图标，不再折成「AI魔方提词 / 器」两行 */
@media (max-width: 400px) {
  .brand-name { display: none; }
}

/* ── 提词画面 ── */
.prompter { position: fixed; inset: 0; z-index: 50; background: var(--p-bg, #000); color: var(--p-fg, #fff); overflow: hidden; touch-action: none; }
.stage { position: absolute; inset: 0; overflow: hidden; }
.flip { position: absolute; inset: 0; }
.content { position: absolute; left: 0; right: 0; top: 0; will-change: transform; padding: 0 var(--p-margin, 6vw); font-size: var(--p-size, 56px); line-height: var(--p-line, 1.5); font-weight: 600; text-align: var(--p-align, left); }
.content p { margin: 0 0 .45em; white-space: pre-wrap; overflow-wrap: anywhere; }
.content p.hd { font-size: .5em; font-weight: 600; color: var(--accent); margin-top: .6em; letter-spacing: .02em; }
.content p.gap { height: .6em; }
.content .cue { color: #5ac8fa; font-size: .72em; font-weight: 500; }
.content strong { color: #ffd60a; }
.content .pause { color: rgba(255,255,255,.35); font-weight: 400; }
.content .pad-top, .content .pad-bottom { height: 100vh; }
::highlight(read) { color: color-mix(in srgb, var(--p-fg, #fff) 38%, transparent); }
.content p.read { opacity: .38; }
.reading-line { position: absolute; left: 0; right: 0; top: calc(var(--p-linepos, .3) * 100%); height: 1px; background: color-mix(in srgb, var(--accent) 70%, transparent); pointer-events: none; }
.reading-line .tri { position: absolute; left: 3px; top: -6px; width: 0; height: 0; border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent; border-left: 9px solid var(--accent); }
.prompter.mirror-h .flip { transform: scaleX(-1); }
.prompter.mirror-v .flip { transform: scaleY(-1); }
.prompter.mirror-h.mirror-v .flip { transform: scale(-1, -1); }
/* 当前句色带：每行一条圆角条，只贴着字；画在文字下面（content 是层叠上下文，-1 在背景之上、文字之下） */
.bands { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: -1; pointer-events: none; }
.bands i { position: absolute; display: block; background: color-mix(in srgb, var(--accent) 28%, transparent); }
.bands.deep i { background: color-mix(in srgb, var(--accent) 56%, transparent); }

/* 工具条：和电脑版提词窗一样，一排贴在最上面，半透明黑底，播放中不动 3 秒就收起 */
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: rgba(0, 0, 0, .35); color: #fff; font-size: 13px; transition: opacity .3s; overflow-x: auto; scrollbar-width: none; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.hud::-webkit-scrollbar { display: none; }
.hb { width: 30px; height: 30px; flex-shrink: 0; border: 0; border-radius: 6px; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.hb svg, .hmode svg, .hslider svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hb:hover { background: rgba(255,255,255,.12); }
.hb:active { background: rgba(255,255,255,.3); }
.hb.on { background: rgba(255,255,255,.22); }
.hb:focus-visible, .hmode select:focus-visible, .hslider input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hb[hidden], .hslider[hidden], .meter[hidden] { display: none; }
.hmode { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; height: 30px; border-radius: 6px; flex-shrink: 0; }
.hmode:hover { background: rgba(255,255,255,.12); }
.hmode select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: #fff; font: inherit; font-weight: 600; padding: 0; cursor: pointer; }
.hmode select option { color: #000; }
.meter { display: inline-flex; align-items: center; gap: 2.5px; height: 20px; padding: 0 4px; flex-shrink: 0; }
.meter i { display: block; width: 3px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); transition: height .2s, background .2s; }
.meter.live i { background: var(--accent); }
.meter.live i:nth-child(1) { height: 7px; } .meter.live i:nth-child(2) { height: 11px; } .meter.live i:nth-child(3) { height: 15px; }
.meter.live i:nth-child(4) { height: 11px; } .meter.live i:nth-child(5) { height: 8px; }
.hslider { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; height: 30px; flex-shrink: 0; }
.hslider .aa { font-weight: 700; font-size: 12px; }
.hslider input { width: 92px; accent-color: var(--accent); }
.hslider b { min-width: 24px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hspace { flex: 1 0 6px; }
.hstatus { font-size: 11px; color: rgba(255,255,255,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.hpct { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.65); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; flex-shrink: 0; }
.prompter.idle .hud { opacity: 0; }
/* 计时器：左上角小胶囊（已读 · 还剩），超时变橙 */
.timer-pill { position: absolute; left: 10px; top: calc(48px + env(safe-area-inset-top)); display: inline-flex; gap: 10px; align-items: center; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; transition: top .3s; }
.timer-pill .over { color: #ff9f0a; }
.timer-pill small { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.6); margin-right: 3px; }
.prompter.idle .timer-pill { top: calc(10px + env(safe-area-inset-top)); }
.timer-pill[hidden] { display: none; }
/* 窄屏（手机竖着）：一排放不下就分两排——上排按钮，下排滑条和状态，关闭、设置不会被挤出去 */
@media (max-width: 720px) {
  .hud { flex-wrap: wrap; row-gap: 2px; overflow-x: visible; }
  #pMirror { margin-left: auto; }
  #pMirror, #pTimerBtn, #pPip, #pFull, #pSettings, #pClose { order: 3; }
  .hspace { order: 5; flex: 0 0 100%; height: 0; }
  .hmode { order: 10; }
  .meter { order: 11; }
  .hslider { order: 20; flex: 1 1 120px; min-width: 0; }
  .hslider input { flex: 1; width: auto; min-width: 0; }
  .hpct { display: none; }
  .hstatus { order: 30; flex: 1 1 100%; padding: 0 6px 2px; }
  .timer-pill { top: calc(100px + env(safe-area-inset-top)); }
}
/* 手机、平板：按钮大一点好点 */
@media (pointer: coarse) {
  .hb { width: 40px; height: 40px; }
  .hmode { height: 40px; }
  .hslider input { width: 110px; }
  .timer-pill { top: calc(58px + env(safe-area-inset-top)); }
}
@media (pointer: coarse) and (max-width: 720px) {
  .timer-pill { top: calc(118px + env(safe-area-inset-top)); }
}
.round { width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.round.small { width: 34px; height: 34px; }
.round.play { width: 58px; height: 58px; border-radius: 29px; background: var(--accent); color: var(--on-accent); }
.round.on { background: #fff; color: #000; }
.countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30vmin; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); pointer-events: none; }

.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); background: #1c1c1e; color: #f2f2f7; box-shadow: -10px 0 30px rgba(0,0,0,.4); display: flex; flex-direction: column; z-index: 5; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: calc(16px + env(safe-area-inset-top)) 16px 10px; font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 0 16px 24px; }
.drawer h4 { margin: 18px 0 6px; font-size: 13px; color: #a1a7b3; font-weight: 500; }
.drawer .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-bottom: 1px solid #2e3036; font-size: 15px; }
.drawer .row input[type=range] { width: 150px; accent-color: var(--accent); }
.drawer .row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

/* ── 开关和滑块：仿 iOS 26 液态玻璃（和手机、电脑版一致）——平时白色胶囊圆钮；按住开关、拖动滑块时圆钮变大、变成透明的玻璃 ── */
.drawer .row input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; cursor: pointer; margin: 0;
  width: 51px; height: 31px; border-radius: 16px;
  background: rgba(120,120,128,.32) radial-gradient(ellipse 18px 13.5px at 21px 50%, #fff 0 96%, transparent 100%) no-repeat;
  transition: background-color .25s, background-position .25s;
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.04);
}
.drawer .row input[type=checkbox]:checked {
  background-color: var(--accent);
  background-image: radial-gradient(ellipse 18px 13.5px at 30px 50%, #fff 0 96%, transparent 100%);
}
/* 按住：圆钮变成横着拉长的玻璃胶囊，透出后面的颜色 */
.drawer .row input[type=checkbox]:active {
  background-image: radial-gradient(ellipse 19px 15px at 18px 50%, rgba(255,255,255,.28) 0 92%, rgba(255,255,255,.85) 96%, transparent 100%);
}
.drawer .row input[type=checkbox]:checked:active {
  background-image: radial-gradient(ellipse 19px 15px at 33px 50%, rgba(255,255,255,.28) 0 92%, rgba(255,255,255,.85) 96%, transparent 100%);
}
.drawer .row input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.drawer .row input[type=range], .hslider input[type=range], .duo-slider input[type=range] {
  -webkit-appearance: none; appearance: none; height: 28px; background: transparent; cursor: pointer;
}
.drawer .row input[type=range]::-webkit-slider-runnable-track, .hslider input[type=range]::-webkit-slider-runnable-track,
.duo-slider input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 50%) 100% no-repeat, rgba(120,120,128,.3);
}
.drawer .row input[type=range]::-webkit-slider-thumb, .hslider input[type=range]::-webkit-slider-thumb,
.duo-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 38px; height: 24px; margin-top: -9px; border-radius: 12px; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .15s, background-color .15s, box-shadow .15s;
}
/* 拖动：圆钮放大成透明的玻璃透镜，下面的轨道能透过来 */
.drawer .row input[type=range]:active::-webkit-slider-thumb, .hslider input[type=range]:active::-webkit-slider-thumb,
.duo-slider input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.35, 1.25); background: rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.75), inset 0 1px 6px rgba(255,255,255,.35), 0 4px 14px rgba(0,0,0,.25);
}
.drawer .row input[type=range]::-moz-range-track, .hslider input[type=range]::-moz-range-track, .duo-slider input[type=range]::-moz-range-track {
  height: 6px; border-radius: 3px; background: rgba(120,120,128,.3);
}
.drawer .row input[type=range]::-moz-range-progress, .hslider input[type=range]::-moz-range-progress, .duo-slider input[type=range]::-moz-range-progress {
  height: 6px; border-radius: 3px; background: var(--accent);
}
.drawer .row input[type=range]::-moz-range-thumb, .hslider input[type=range]::-moz-range-thumb, .duo-slider input[type=range]::-moz-range-thumb {
  width: 38px; height: 24px; border: 0; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.drawer .row input[type=range]:active::-moz-range-thumb, .hslider input[type=range]:active::-moz-range-thumb, .duo-slider input[type=range]:active::-moz-range-thumb {
  background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.75), 0 4px 14px rgba(0,0,0,.25);
}
/* 工具条上地方小：圆钮小一号 */
.hslider input[type=range]::-webkit-slider-thumb { width: 26px; height: 18px; margin-top: -6px; border-radius: 9px; }
.hslider input[type=range]::-webkit-slider-runnable-track { height: 6px; }
.hslider input[type=range]::-moz-range-thumb { width: 26px; height: 18px; border-radius: 9px; }
.drawer select { background: #2c2c2e; border: 0; border-radius: 10px; height: 34px; padding: 0 10px; color: #fff; }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 28px; height: 28px; border-radius: 14px; border: 2px solid #444; background: linear-gradient(135deg, var(--bg) 50%, var(--fg) 50%); }
.swatches button[aria-pressed="true"] { border-color: var(--accent); }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.drawer .note { color: #a1a7b3; }

/* ── 弹层 ── */
dialog.sheet { border: 0; padding: 0; border-radius: 22px; background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.3); width: min(980px, 94vw); height: min(720px, 88dvh); }
dialog.sheet.small { width: min(520px, 94vw); height: auto; }
dialog::backdrop { background: rgba(10, 14, 24, .45); }
dialog[open] { display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px; font-size: 17px; }
.sheet-head .search { max-width: 320px; }
.sheet-head .round { background: var(--fill); color: var(--text); margin-left: auto; }
.chips-row { display: flex; gap: 8px; padding: 4px 16px 10px; overflow-x: auto; flex-shrink: 0; }
.chips-row button { height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: var(--fill); font-size: 13px; white-space: nowrap; }
.chips-row button[aria-pressed="true"] { background: var(--text); color: var(--card); }
.lib-body { flex: 1; display: grid; grid-template-columns: 320px minmax(0,1fr); min-height: 0; border-top: 1px solid var(--sep); }
.lib-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; border-right: 1px solid var(--sep); }
.lib-list button { width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.lib-list button:hover, .lib-list button[aria-current="true"] { background: var(--fill); }
.lib-list .t { font-size: 15px; font-weight: 600; }
.lib-list .m { font-size: 12px; color: var(--muted); }
.lib-preview { overflow-y: auto; padding: 18px 22px; }
.lib-preview h3 { margin: 0 0 4px; font-size: 20px; }
.lib-preview .m { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.lib-preview .txt { white-space: pre-wrap; line-height: 1.8; font-size: 15px; }
.lib-preview .txt .cue { color: #0a84ff; }
.lib-preview .use { margin: 16px 0 0; }
@media (max-width: 760px) {
  .lib-body { grid-template-columns: 1fr; }
  .lib-preview { display: none; }
  dialog.sheet.previewing .lib-list { display: none; }
  dialog.sheet.previewing .lib-preview { display: block; }
}
.tier-body { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.tier-status { margin: 0; font-size: 15px; font-weight: 600; }
.tier-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.license { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.license textarea { border: 0; border-radius: 12px; background: var(--fill); padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; resize: vertical; }
.tier-actions { display: flex; gap: 12px; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: rgba(28,28,30,.92); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 双窗口：导播台（深色，和提词画面的控件一套） ── */
.duo { position: fixed; top: 0; right: 0; bottom: 0; width: 360px; z-index: 40; background: #15171d; color: #f2f2f7; display: flex; flex-direction: column; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: -12px 0 30px rgba(0,0,0,.25); }
body.duo-on #app { padding-right: 376px; }
.duo-head { display: flex; justify-content: space-between; align-items: flex-start; }
.duo-head b { font-size: 17px; }
.duo-conn { font-size: 12px; color: #a1a7b3; margin-top: 3px; }
.duo-conn.live { color: #4ade80; }
.duo-timer { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.duo-progress { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.duo-progress div { height: 100%; width: 0; background: var(--accent); }
.duo-row { display: flex; align-items: center; gap: 10px; }
.duo-row select { flex: 1; height: 40px; border-radius: 20px; border: 0; background: rgba(255,255,255,.12); color: #fff; padding: 0 12px; }
.duo-row select option { color: #000; }
.duo-row.checks { gap: 18px; font-size: 14px; color: #d1d5db; }
.duo-slider { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #a1a7b3; }
.duo-slider input { flex: 1; accent-color: var(--accent); }
.duo-slider b { min-width: 32px; text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.duo-sub { font-size: 12px; color: #8b91a0; margin-top: 4px; }
.duo-paras { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.duo-paras button { width: 100%; text-align: left; border: 0; border-radius: 10px; padding: 8px 10px; background: transparent; color: #c7cbd4; font-size: 13.5px; line-height: 1.5; display: block; }
.duo-paras button span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.duo-paras button:hover { background: rgba(255,255,255,.06); }
.duo-paras button.cue { color: #7dd3fc; font-size: 12.5px; }
.duo-paras button.read { color: #6b7280; }
.duo-paras button.now { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #fff; }
.duo .note { color: #8b91a0; margin: 0; font-size: 12px; line-height: 1.6; }
.duo .secondary { background: rgba(255,255,255,.1); color: #fff; height: 40px; justify-content: center; }
@media (max-width: 1180px) { body.duo-on .sidebar { display: none; } body.duo-on .workspace { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { body.duo-on #app { padding-right: 16px; } .duo { width: min(360px, 92vw); } }
@media (pointer: coarse), (max-width: 760px) { #btnDuo { display: none; } }

/* 主持窗口：等稿子 */
.talent-wait { position: fixed; inset: 0; z-index: 45; background: #000; color: #f2f2f7; display: grid; place-items: center; text-align: center; padding: 16px; }
.talent-wait b { font-size: 26px; }
.talent-wait p { color: #a1a7b3; margin: 10px 0 0; }
body.talent #app { display: none; }

/* 浮窗里：窗口小，控件精简成一排（字号用 + / − 键，设置回网页里调） */
body.pip { margin: 0; background: #000; }
body.pip #pSettings, body.pip #pFull, body.pip .hslider:not(#speedWrap), body.pip .hstatus { display: none !important; }

/* Native workspace parity: restrained surfaces, themed states and compact tools. */
:root[data-theme="graphite"], :root[data-theme="liquid"], :root[data-theme="luminous"] {
  --bg-top: #292c32; --bg-bottom: #131417; --card: #24262c; --text: #f3f4f6;
  --muted: #b4b8c2; --tertiary: #969da9; --fill: #33363d; --sep: #474a51;
  --shadow: 0 8px 24px #0003; color-scheme: dark;
}
:root[data-theme="liquid"] { --card: #292c32cc; --fill: #40444b99; --sep: #b2b9c044; }
:root[data-theme="luminous"] { --bg-top: #16171b; --bg-bottom: #0d0e10; --card: #202126; --fill: #2b2d34; }
:root[data-theme="ice"] {
  --bg-top: #dbe3e9; --bg-bottom: #edf1f4; --card: #f5f7f9; --text: #17202a;
  --muted: #495663; --tertiary: #586572; --fill: #dfe6ec; --sep: #bec8d0;
  --shadow: 6px 6px 16px #86939c55, -3px -3px 10px #fff9; color-scheme: light;
}
button, .brand-name, .content p.hd { letter-spacing: 0; }
button:disabled { opacity: .45; cursor: default; }
input[type="checkbox"], progress { accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.script-list li button[aria-current="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--card)); box-shadow: inset 3px 0 var(--accent), inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.script-list li button { border-radius: 6px; }
.search, .body-input, .chip, .segment, .segment button, .sheet, .drawer, .secondary, .primary { border-radius: 8px; }
.chip, .secondary, .search { border: 1px solid var(--sep); }
.search:focus, select:focus-visible { outline-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.segment button[aria-checked="true"] { box-shadow: inset 0 -2px var(--accent); }
.primary, .home-command, .home-tool { position: relative; isolation: isolate; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.primary::before, .home-command::before, .home-tool::before {
  content: ""; position: absolute; inset: 100% -20% -150%; border-radius: 50%; z-index: -1;
  background: color-mix(in srgb, var(--accent) 22%, transparent); transition: transform .35s ease-out;
}
@media (hover: hover) {
  .primary:hover::before, .home-command:hover::before, .home-tool:hover::before { transform: translateY(-110%); }
  .home-tool:hover, .home-script-title:hover { color: var(--accent-text); }
  .chip:hover, .secondary:hover { border-color: var(--accent-text); }
}
.primary:active, .home-tool:active, .home-command:active { transform: scale(.98); }
:root[data-theme="luminous"] .primary, :root[data-theme="graphite"] .primary,
:root[data-theme="luminous"] .home-command.active { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent); }
:root[data-theme="liquid"] .sheet, :root[data-theme="liquid"] .sidebar, :root[data-theme="liquid"] .editor,
:root[data-theme="liquid"] .home-script, :root[data-theme="liquid"] .home-summary { backdrop-filter: blur(22px) saturate(1.2); border: 1px solid var(--sep); box-shadow: inset 0 1px #ffffff66, 0 12px 30px #0004; }
.appearance-sheet { max-width: 430px; }
.appearance-fields { padding: 22px; display: grid; gap: 22px; }
.appearance-fields label:not(.appearance-toggle) { display: grid; gap: 9px; font-size: 14px; font-weight: 600; }
.appearance-fields select, .home-heading select { max-width: 100%; padding: 9px; background: var(--fill); color: var(--text); border: 1px solid var(--sep); border-radius: 6px; font-size: 13px; }
.appearance-fields fieldset { margin: 0; border: 0; padding: 0; }
.appearance-fields legend { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.appearance-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.accent-swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--swatch); border: 2px solid transparent; }
.accent-swatch[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 3px; box-shadow: 0 0 16px color-mix(in srgb, var(--swatch) 45%, transparent); }
.appearance-toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.appearance-toggle input { width: 40px; height: 24px; }
input[type="checkbox"][role="switch"] { appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 40px;
  width: 40px; height: 24px; border: 1px solid var(--sep); border-radius: 12px; background: var(--fill); cursor: pointer;
  box-shadow: inset 0 1px 3px #0002; transition: background .2s, box-shadow .2s; }
input[type="checkbox"][role="switch"]::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .2s ease; }
input[type="checkbox"][role="switch"]:checked { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 9px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="checkbox"][role="switch"]:checked::before { transform: translateX(16px); }
.daily-growth { display: flex; align-items: baseline; gap: 10px; margin: 0 0 18px; min-width: 0; }
.daily-growth>span { flex-shrink: 0; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 13%, transparent); padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.daily-growth p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.feature-banners { position: relative; aspect-ratio: 1672/941; max-width: 680px; width: 100%; margin: 0 auto 24px; border-radius: 8px;
  overflow: hidden; background: var(--card); border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--sep)); touch-action: pan-y; }
.feature-banner-slide { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 0; border: 0;
  background: transparent; opacity: 0; pointer-events: none; transition: opacity .45s ease-in-out; }
.feature-banner-slide.active { opacity: 1; pointer-events: auto; z-index: 1; }
.feature-banner-slide canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.feature-banners[data-tone="light"] { border: 0; border-radius: 0; background: transparent; box-shadow: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 1.8%, #000 98.2%, transparent), linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 1.8%, #000 98.2%, transparent), linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
@media (prefers-reduced-transparency: reduce) {
  .feature-banners[data-tone="light"] { -webkit-mask-image: none; mask-image: none; }
}
.feature-banner-slide:focus-visible { outline-offset: -4px; }
.feature-banner-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); font-size: 18px; }
:root[data-theme="ice"] .feature-banners[data-tone="dark"], :root[data-theme="liquid"] .feature-banners[data-tone="dark"], :root[data-theme="luminous"] .feature-banners[data-tone="dark"] {
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 18%, transparent); }
.banner-mode-options { display: grid; padding: 8px 20px 20px; }
.banner-mode-options button { display: grid; gap: 7px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--sep); padding: 17px 4px; }
.banner-mode-options button:last-child { border-bottom: 0; }
.banner-mode-options strong { font-size: 15px; color: var(--accent-text); }
.banner-mode-options span { font-size: 13px; color: var(--muted); }
.banner-native-body { padding: 4px 24px 24px; font-size: 14px; line-height: 1.7; }
.banner-native-body a { text-decoration: none; }
.home-workspace { min-width: 0; padding: 8px 4px 24px; container-type: inline-size; }
.home-heading { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.home-heading h1 { font-size: 22px; margin: 0; }
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.home-stats>div { border-bottom: 1px solid var(--sep); padding: 12px 0; display: grid; gap: 10px; }
.home-stats span { font-size: 12px; color: var(--muted); }
.home-stats strong { font-size: 24px; font-weight: 650; }
.home-primary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.home-command { min-height: 138px; text-align: left; padding: 20px; font-size: 20px; font-weight: 650; border: 1px solid var(--sep); background: var(--card); border-radius: 8px; }
.home-command.active { background: color-mix(in srgb, var(--accent) 15%, var(--card)); border-color: var(--accent-text); }
.home-tools { display: grid; gap: 10px; margin-bottom: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-tool { background: var(--card); padding: 14px 10px; border: 1px solid var(--sep); border-radius: 6px; font-size: 13px; min-height: 44px; }
.home-columns { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 18px; align-items: start; }
.home-tasks { display: grid; gap: 14px; min-width: 0; }
.home-tasks h2, .home-summary h2 { font-size: 16px; margin: 0; }
.home-tasks .segment { width: 100%; min-width: 0; }
.home-tasks .segment button { flex: 1; padding: 0 6px; font-size: 12px; }
.home-script { background: var(--card); border: 1px solid var(--sep); border-radius: 8px; padding: 15px; min-width: 0; }
.home-script.selected { border-color: var(--accent-text); background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 10%, transparent); }
.home-script-title { border: 0; background: none; text-align: left; padding: 0; font-size: 15px; font-weight: 600; width: 100%; overflow-wrap: anywhere; }
.home-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.home-preview { font-size: 14px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.home-script-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.secondary.small { height: 40px; font-size: 13px; }
.home-rail { display: grid; gap: 16px; }
.home-rail .home-tools { grid-template-columns: 1fr; }
.home-summary { background: var(--card); border: 1px solid var(--sep); border-radius: 8px; padding: 16px; display: grid; gap: 14px; }
.home-summary strong { font-size: 22px; }
.home-summary progress { width: 100%; height: 8px; }
.home-plan-link { text-align: left; background: transparent; border: 0; padding: 4px 0; color: var(--accent-text); overflow-wrap: anywhere; }
.home-accordion { display: flex; gap: 10px; min-height: 280px; }
.home-fold { flex: 1; min-width: 0; padding: 16px 12px; border: 1px solid var(--sep); border-radius: 8px; background: var(--card); display: flex; flex-direction: column; gap: 12px; }
.home-fold.expanded { flex: 3; border-color: var(--accent-text); }
.home-fold-tab { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 600; overflow-wrap: anywhere; }
.home-fold .primary { margin-top: auto; justify-content: center; }
@container (max-width: 620px) { .home-columns { grid-template-columns: 1fr; } .home-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-rail .home-tools { grid-column: 1/-1; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { body.home-open .sidebar { display: none; } .home-heading { flex-wrap: wrap; } .home-accordion { flex-direction: column; } .home-fold { min-height: 62px; } .home-fold.expanded { min-height: 210px; } }
@media (max-width: 600px) { .topbar { flex-wrap: wrap; } .brand { flex-basis: 100%; } .brand-name { display: block; } .topbar-actions { width: 100%; justify-content: space-between; gap: 4px; } .topbar-actions .chip { padding: 0 10px; font-size: 12px; } #app { padding-inline: 12px; } .home-rail { grid-template-columns: 1fr; } .home-stats strong { font-size: 21px; } .home-command { font-size: 18px; min-height: 112px; } }
@media (prefers-reduced-motion: no-preference) { :root[data-motion="on"] .brand-logo { animation: brand-breathe 4s ease-in-out infinite; } }
@keyframes brand-breathe { 50% { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent); } }
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (prefers-contrast: more) { .home-script.selected { outline: 2px solid var(--accent-text); } .home-meta, .home-preview { color: var(--text); } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── 速度气泡 + 稿件时长（和手机、电脑一样，照 Teleprompter）── */
.hspeed { width: auto; padding: 0 8px; gap: 5px; }
.hspeed b { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hdur { flex-shrink: 0; height: 24px; padding: 0 8px; border: 0; border-radius: 7px; cursor: pointer;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent);
  font: 700 13px/1 ui-rounded, -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.hdur:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.speed-pop { position: absolute; z-index: 30; box-sizing: border-box; padding: 14px 16px 12px; border-radius: 20px; color: #fff;
  background: rgba(38, 38, 40, .82); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column; gap: 10px; animation: spIn .18s ease-out; }
.speed-pop[hidden] { display: none; }
.speed-pop::before { content: ""; position: absolute; top: -7px; left: calc(var(--ax, 50%) - 7px); width: 14px; height: 14px;
  background: inherit; border-left: 1px solid rgba(255,255,255,.12); border-top: 1px solid rgba(255,255,255,.12);
  transform: rotate(45deg); border-top-left-radius: 3px; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* 入场只做位移和缩放、不从全透明开始：页面在后台时浏览器会停住动画，停在第一帧也看得见 */
@keyframes spIn { from { transform: translateY(-4px) scale(.97); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .speed-pop { animation: none; } }
.sp-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; }
.sp-head small { font-size: 13px; color: rgba(255,255,255,.7); }
.sp-head b { font: 700 28px/1 ui-rounded, -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--accent); }
.sp-head span { margin-left: auto; font-size: 13px; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }
.sp-hint { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255,255,255,.75); }
.sp-hint[hidden] { display: none; }
.sp-hint span { flex: 1; }
.sp-hint button { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 12px; cursor: pointer; white-space: nowrap; padding: 4px 0; }
.sp-row { display: flex; align-items: center; gap: 10px; }
.sp-end { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-end sup { font-size: 8px; font-weight: 500; color: rgba(255,255,255,.65); margin-left: 1px; }
/* 滑条平时只有一条带颜色的轨道，按住才出现圆钮（照 iOS 26 系统滑条） */
.speed-pop input[type=range] { flex: 1; min-width: 0; -webkit-appearance: none; appearance: none; height: 30px; background: transparent; cursor: pointer; }
.speed-pop input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 50%) 100% no-repeat, rgba(255,255,255,.18); }
.speed-pop input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 22px; margin-top: -7px; border-radius: 11px;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.speed-pop input[type=range].grab::-webkit-slider-thumb, .speed-pop input[type=range]:focus-visible::-webkit-slider-thumb { opacity: 1; transform: none; }
.speed-pop input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); }
.speed-pop input[type=range]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
.speed-pop input[type=range]::-moz-range-thumb { width: 30px; height: 22px; border: 0; border-radius: 11px; background: #fff; opacity: 0; transition: opacity .15s; }
.speed-pop input[type=range].grab::-moz-range-thumb { opacity: 1; }
