/* LiveDeck 直播工作台 —— 设计变量与基础组件（规格 §5）。
   约定：组件类名扁平（.btn / .card / .modal …），布局类以 ws- 开头；只用 transform/opacity 做动效。 */

:root {
  /* 颜色 */
  --bg: #0D1016;
  --panel: #151A23;
  --panel-2: #1B212C;
  --panel-3: #222937;
  --line: #222A36;
  --line-2: #2E3746;
  --fg: #E6EBF2;
  --muted: #9AA6B8;
  --dim: #6B778A;
  --accent: #8B5CFF;
  --accent-hover: #9D75FF;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(139, 92, 255, 0.16);
  --accent-line: rgba(139, 92, 255, 0.55);
  --ok: #3AD29F;
  --warn: #FFB020;
  --danger: #FF5C72;
  --info: #4F8CFF;
  --ok-soft: rgba(58, 210, 159, 0.14);
  --warn-soft: rgba(255, 176, 32, 0.14);
  --danger-soft: rgba(255, 92, 114, 0.13);
  --info-soft: rgba(79, 140, 255, 0.14);
  --bar: #10141B;

  /* 形状 */
  --r-card: 12px;
  --r-modal: 16px;
  --r-btn: 12px;
  --r-ctl: 10px;
  --r-pill: 999px;
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);

  /* 尺寸 */
  --ctl-h: 36px;
  --btn-lg-h: 48px;
  --topbar-h: 60px;
  --statusbar-h: 48px;

  /* 字体 */
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans CJK SC", "Noto Sans CJK JP", "Yu Gothic UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-hover); }
a.btn, a.link-btn, a.tool-btn { text-decoration: none; }
[hidden] { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.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; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.ic { flex: none; display: block; }

:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #2C3443 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2C3443; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #3A4456; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ctl-h); padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap; line-height: 1;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn-icon:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--panel-2); border-color: var(--line-2); color: var(--fg); }
.btn-secondary:hover:not(:disabled) { background: var(--panel-3); border-color: #3A4456; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--fg); }
.btn-danger { background: var(--danger-soft); border-color: rgba(255, 92, 114, .45); color: #FF8A9B; }
.btn-danger:hover:not(:disabled) { background: rgba(255, 92, 114, .22); color: #FFB0BC; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #FF7488; }
.btn-pill { border-radius: var(--r-pill); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-sm.btn-pill { border-radius: var(--r-pill); }
.btn-lg { height: var(--btn-lg-h); padding: 0 24px; font-size: 16px; font-weight: 700; border-radius: var(--r-btn); }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--ctl-h); height: var(--ctl-h); padding: 0;
  border-radius: var(--r-ctl); border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.btn-icon:hover:not(:disabled) { background: var(--panel-2); color: var(--fg); }
.btn-icon.btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.btn-icon.danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-hover); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ================= 表单 ================= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--dim); }
.field-error { margin: 0; min-height: 0; font-size: 13px; color: var(--danger); }
.field-error:empty { display: none; }
.input, .select, .textarea {
  width: 100%; height: var(--ctl-h); padding: 0 12px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  color: var(--fg); outline: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:hover, .select:hover, .textarea:hover { border-color: #3A4456; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input[readonly] { color: var(--muted); background: #171C25; cursor: default; }
.input[readonly]:focus { box-shadow: none; border-color: var(--line-2); }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix { position: absolute; left: 12px; color: var(--muted); font-weight: 700; pointer-events: none; }
.input-affix .input { padding-left: 30px; }
.input-lg { height: 52px; font-size: 18px; border-radius: var(--r-btn); }
.input-affix .input-lg { padding-left: 42px; }
.input-affix .input-lg + .affix, .input-affix .affix-lg { left: 17px; font-size: 18px; }

/* 开关 */
.switch { position: relative; display: inline-flex; flex: none; width: 40px; height: 24px; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: #2C3443; transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #C9D2E0; transition: transform .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

/* 折叠区（高级） */
details.disclosure { border: 1px solid var(--line); border-radius: var(--r-ctl); background: rgba(255, 255, 255, .015); }
details.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 13px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .ic { transition: transform .15s; }
details.disclosure[open] > summary .ic.chev { transform: rotate(90deg); }
details.disclosure > .disclosure-body { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 12px; }

/* ================= 卡片 / 标签 / 状态 ================= */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-pad { padding: 16px; }
.card-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: #262E3D; color: #C9D2E0; white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: #B9A0FF; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-err { background: var(--danger-soft); color: #FF8A9B; }
.tag-info { background: var(--info-soft); color: #8DB4FF; }
.tag-muted { background: #1F2632; color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; position: relative; }
.tone-ok .dot { background: var(--ok); }
.tone-warn .dot { background: var(--warn); }
.tone-err .dot { background: var(--danger); }
.tone-info .dot { background: var(--info); }
.tone-muted .dot { background: #5A6576; }
.status .dot.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; color: var(--ok); opacity: 0; animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: .7; } 80%, 100% { transform: scale(1.4); opacity: 0; } }
.status-label { font-size: 13px; }

/* 胶囊（顶栏 / 底栏） */
.pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--r-pill); background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; white-space: nowrap; }

/* 头像 */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--av-h, 270) 80% 72%), hsl(calc(var(--av-h, 270) + 40) 75% 56%));
  color: rgba(255, 255, 255, .95); font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ================= 弹窗 ================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: rgba(5, 7, 11, .68); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .16s ease;
}
.modal-backdrop.open { opacity: 1; }
.modal {
  display: flex; flex-direction: column; max-height: calc(100vh - 48px);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-modal);
  box-shadow: var(--shadow-modal); outline: none;
  transform: translateY(8px) scale(.985); transition: transform .18s ease;
}
.modal-backdrop.open .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 4px 24px; }
.modal-head-text { flex: 1; min-width: 0; }
.modal-title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.modal-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-close { margin: -4px -4px 0 0; }
.modal-body { padding: 16px 24px 20px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.modal-foot .foot-left { margin-right: auto; display: flex; align-items: center; gap: 10px; }
.modal-foot .foot-msg { flex: 1; min-width: 0; text-align: right; color: var(--danger); font-size: 13px; }
.modal-foot .foot-msg:empty { flex: 1; }
.modal-confirm .modal-body { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start; padding-top: 12px; }
.modal-confirm .modal-foot { border-top: 0; padding-top: 4px; }
.confirm-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: #B9A0FF; }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-text { margin: 0; font-size: 15px; line-height: 1.6; padding-top: 8px; }
.confirm-detail { margin: 0; color: var(--muted); font-size: 13px; }

/* ================= 菜单 ================= */
.menu {
  position: fixed; z-index: 200; padding: 6px;
  background: #1A2029; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-modal);
  opacity: 0; transform: translateY(-4px); transition: opacity .12s, transform .12s;
  max-height: min(70vh, 520px); overflow: auto;
}
.menu.open { opacity: 1; transform: none; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--fg); text-align: left; font-size: 14px; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--panel-3); outline: none; }
.menu-item.checked { background: var(--accent-soft); }
.menu-item.danger { color: #FF8A9B; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item .ic { color: var(--muted); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--dim); font-size: 12px; }
.menu-check { color: var(--accent-hover) !important; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line-2); }
.menu-heading { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; color: var(--dim); }

/* ================= Toast / 横幅 ================= */
.toast-host { position: fixed; left: 50%; bottom: calc(var(--statusbar-h) + 16px); transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(560px, 90vw); padding: 10px 16px; border-radius: 12px; background: #202734; border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 14px; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast .ic { color: var(--ok); }
.toast-error { border-color: rgba(255, 92, 114, .5); }
.toast-error .ic { color: var(--danger); }
.toast.has-action { pointer-events: auto; padding-right: 8px; }
.toast-action { margin-left: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--accent-soft); color: #E3D9FF; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.toast-action:hover { background: var(--accent); color: #fff; }
.toast-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.banners { display: flex; flex-direction: column; }
.banner { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 18px; font-size: 13px; font-weight: 600; border-bottom: 1px solid transparent; }
.banner-error { background: #2A1219; color: #FFB3C0; border-color: #4A1E2A; }
.banner-warn { background: #2A2010; color: #FFD88A; border-color: #4A3812; }
.banner-info { background: #121D33; color: #A9C6FF; border-color: #1E3158; }
.banner .ic { flex: none; }
.banner .banner-text { flex: 1; min-width: 0; }
.banner .btn { height: 26px; padding: 0 12px; font-size: 12px; }

/* ================= 登录 ================= */
.login-view { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto;
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(139, 92, 255, .20), transparent 60%),
    radial-gradient(700px 480px at 85% 90%, rgba(255, 122, 162, .10), transparent 60%),
    var(--bg); }
.login-card { width: min(400px, 100%); padding: 36px 32px 28px; border-radius: 20px; background: rgba(21, 26, 35, .92); border: 1px solid var(--line-2); box-shadow: var(--shadow-modal); }
.login-card .logo { font-size: 24px; }
.login-card h1 { margin: 22px 0 6px; font-size: 22px; font-weight: 800; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .input { height: 46px; font-size: 15px; }
.login-foot { margin-top: 18px; color: var(--dim); font-size: 12px; text-align: center; }

.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: .3px; white-space: nowrap; color: var(--fg); }
.logo b { color: var(--accent); font-weight: 800; }
.logo-mark { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #A47BFF, #6F3CF0); box-shadow: 0 4px 14px rgba(139, 92, 255, .4); color: #fff; }

/* ================= 工作台骨架 ================= */
.ws { position: fixed; inset: 0; display: grid; grid-template-rows: var(--topbar-h) auto minmax(0, 1fr) var(--statusbar-h); }
.ws-top { display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--bar); border-bottom: 1px solid var(--line); min-width: 0; }
.ws-top .logo { margin-right: 4px; }
.ws-top-sep { width: 1px; height: 24px; background: var(--line-2); flex: none; }
.ws-presets { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.ws-presets::-webkit-scrollbar { display: none; }
.ws-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.tool-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background-color .15s, color .15s; }
.tool-btn:hover { background: var(--panel-2); color: var(--fg); }
.tool-btn:disabled { opacity: .4; cursor: not-allowed; background: transparent; color: var(--muted); }
.tool-btn.active { background: var(--accent-soft); color: #C7B3FF; }
.tool-btn.tool-icon { width: 38px; padding: 0; justify-content: center; }

/* 直播间切换器 */
.room-switcher { display: inline-flex; align-items: center; gap: 10px; height: 40px; max-width: 280px; padding: 0 12px 0 5px; border-radius: var(--r-pill); background: var(--panel-2); border: 1px solid var(--line-2); color: var(--fg); font-weight: 700; transition: border-color .15s, background-color .15s; }
.room-switcher:hover, .room-switcher[aria-expanded="true"] { border-color: var(--accent-line); background: #1F2532; }
.room-switcher .rs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-switcher .ic { color: var(--muted); }
.room-switcher.empty { padding-left: 12px; color: var(--muted); }
.rs-menu-room { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.rs-menu-room .rs-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rs-menu-room .rs-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-menu-room .rs-text small { color: var(--dim); font-size: 12px; }

.tiktok-pill { cursor: default; }
.tiktok-pill.tone-ok { border-color: rgba(58, 210, 159, .35); background: rgba(58, 210, 159, .08); }
.tiktok-pill.tone-warn { border-color: rgba(255, 176, 32, .3); }
.tiktok-detail { flex: none; max-width: 220px; margin-left: -4px; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiktok-detail.tone-warn { color: #E9B866; }
.tiktok-detail.tone-err { color: #FF9AAA; }

/* 中栏宽度按可用高度推算（9:16 竖屏画面撑满整栏高度）：可用高度 ≈ 视口高 − 顶栏/底栏/栏头栏脚/内边距（约 230px） */
.ws-main { --pv-w: clamp(220px, calc((100vh - 230px) * 9 / 16), 34vw); position: relative; display: grid; grid-template-columns: var(--left-w, 260px) var(--pv-w) minmax(0, 1fr); gap: 12px; padding: 12px; min-height: 0; }
.ws-main[data-preview="collapsed"] { grid-template-columns: var(--left-w, 260px) 48px minmax(0, 1fr); }
/* 可拖动分栏条（js/layout.js 定位）：平时透明，悬停 / 拖动 / 键盘聚焦时显示主色细线 */
.ws-split { position: absolute; width: 12px; z-index: 6; cursor: col-resize; touch-action: none; outline: none; }
.ws-split::after { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: transparent; transition: background .15s; }
.ws-split:hover::after, .ws-split.is-active::after, .ws-split:focus-visible::after { background: var(--accent); }
.ws-split:focus-visible { box-shadow: none; }
body.ws-resizing { cursor: col-resize; user-select: none; }
body.ws-resizing iframe { pointer-events: none; }
.ws-col { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ws-onboarding { min-height: 0; overflow: auto; display: grid; place-items: center; padding: 24px; }

.ws-status { display: flex; align-items: center; gap: 18px; padding: 0 16px; background: var(--bar); border-top: 1px solid var(--line); font-size: 13px; min-width: 0; }
.ws-status-group { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ws-status .status { color: var(--muted); }
.ws-status .sb-label { color: var(--dim); }
.ws-status .sb-value { font-weight: 700; color: var(--fg); }

/* ================= 加载 / 出错提示 ================= */
.ph-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 12px 8px; }
.ph-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: #B9A0FF; }
.ph-title { margin: 0; font-size: 15px; font-weight: 700; }
.ph-text { margin: 0; color: var(--muted); font-size: 13px; max-width: 340px; line-height: 1.6; }

/* ================= 引导（无直播间） ================= */
.onb { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.onb-hero { padding: 36px; border-radius: 20px; background: radial-gradient(120% 90% at 0% 0%, rgba(139, 92, 255, .22), transparent 55%), var(--panel); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 18px; }
.onb-hero h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.25; }
.onb-hero p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.onb-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.onb-steps { padding: 28px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.onb-steps h2 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 700; }

/* 竖向步骤时间线（OBS 引导 / 引导页） */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: repeating-linear-gradient(180deg, var(--accent-line) 0 4px, transparent 4px 8px); }
.timeline li:last-child::before { display: none; }
.timeline .tl-no { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: #C7B3FF; font-weight: 800; border: 1.5px solid var(--accent-line); }
.timeline .tl-title { margin: 4px 0 2px; font-weight: 700; }
.timeline .tl-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.timeline .tl-text b { color: var(--fg); }

/* ================= 绑定流程 ================= */
.stepper { display: flex; align-items: center; gap: 8px; margin: 2px 0 18px; }
.stepper .st { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13px; font-weight: 700; white-space: nowrap; }
.stepper .st i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.stepper .st.on { color: var(--fg); }
.stepper .st.on i { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper .st.done i { background: var(--accent-soft); border-color: var(--accent-line); color: #C7B3FF; }
.stepper .bar { flex: 1; height: 2px; border-radius: 2px; background: var(--line-2); min-width: 16px; }
.stepper .bar.done { background: var(--accent-line); }

.bind-intro { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.bind-confirm { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); }
.bind-confirm .bc-name { font-size: 22px; font-weight: 800; word-break: break-all; }
.bind-confirm .bc-sub { color: var(--muted); font-size: 13px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; }
.callout .ic { margin-top: 2px; }
.callout-warn { background: var(--warn-soft); color: #FFD88A; }
.callout-info { background: var(--info-soft); color: #B5CCFF; }
.callout-accent { background: var(--accent-soft); color: #D2C2FF; }

/* OBS 链接 */
.url-row { display: flex; gap: 8px; align-items: stretch; }
.url-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: var(--r-ctl); background: #0F131A; border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.url-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-row .btn { height: 44px; }
.obs-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 22px; align-items: start; }
.obs-figure { border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.obs-figure svg { width: 100%; height: auto; }
.obs-figure figcaption { color: var(--dim); font-size: 12px; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; }

/* ================= 管理直播间 ================= */
.rm-list { display: flex; flex-direction: column; gap: 8px; }
.rm-row { display: grid; grid-template-columns: 44px minmax(0, 1.4fr) minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); transition: border-color .15s; }
.rm-row:hover { border-color: var(--line-2); }
.rm-row.current { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.rm-row .rm-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.rm-row .rm-sub { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-row .rm-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-row .rm-actions { display: flex; align-items: center; gap: 4px; }
.rm-empty { padding: 36px 12px; text-align: center; color: var(--muted); }

.section { display: flex; flex-direction: column; gap: 12px; }
.section + .section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title { margin: 0; font-size: 15px; font-weight: 800; }
.section-desc { margin: 0; color: var(--dim); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 12px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--panel-2); text-align: left; color: var(--fg); transition: border-color .15s, background-color .15s; }
.theme-card:hover { border-color: #3A4456; }
.theme-card[aria-checked="true"] { border-color: var(--accent); background: #1F1A33; box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .tc-preview { height: 72px; border-radius: 10px; position: relative; overflow: hidden; }
.theme-card .tc-name { font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-card .tc-desc { color: var(--dim); font-size: 12px; line-height: 1.4; }
.theme-card .tc-check { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.theme-card[aria-checked="false"] .tc-check { display: none; }

.widget-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.widget-card { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px 14px; align-items: center; padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); transition: border-color .15s, background-color .15s; }
.widget-card.on { border-color: var(--accent-line); background: #1C1A2B; }
.widget-card .wc-thumb { grid-row: span 2; width: 76px; height: 56px; border-radius: 10px; background: #0E1219; border: 1px solid var(--line-2); display: grid; place-items: center; overflow: hidden; }
.widget-card .wc-name { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.widget-card .wc-desc { grid-column: 2; color: var(--dim); font-size: 12px; line-height: 1.4; }
.widget-card .wc-side { grid-row: span 2; grid-column: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.widget-card .wc-error { grid-column: 1 / -1; font-size: 12px; color: var(--danger); }
.widget-card .wc-error:empty { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.toggle-field { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; height: var(--ctl-h); padding: 0 12px; border-radius: var(--r-ctl); background: var(--panel-2); border: 1px solid var(--line-2); }
.toggle-field .field-label { color: var(--fg); font-weight: 600; }

.back-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font-weight: 600; padding: 4px 6px; margin-left: -6px; border-radius: 8px; }
.back-link:hover { color: var(--fg); background: var(--panel-2); }

/* ================= 窄屏（1280 及以下） ================= */
@media (max-width: 1440px) {
  .tool-btn { padding: 0 11px; }
  .room-switcher { max-width: 220px; }
}
@media (max-width: 1320px) {
  .tool-btn .tool-label { display: none; }
  .tool-btn { width: 40px; padding: 0; justify-content: center; }
  .ws-top { gap: 10px; }
}
@media (max-width: 1100px) {
  .onb { grid-template-columns: 1fr; }
  .obs-grid { grid-template-columns: 1fr; }
  .obs-figure { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 管理直播间列表：可点击的挂件数标签（打开主题与挂件） */
.tag.tag-btn { cursor: pointer; border: 1px solid var(--line-2, var(--line)); background: transparent; font: inherit; }
.tag.tag-btn:hover { border-color: var(--accent); color: var(--fg); }
