/* ===== OpenRemoteShouter 控制台样式 ===== */

:root {
  --bg: #060a13;
  --bg-2: #0a1220;
  --panel: rgba(20, 32, 54, 0.92);
  --panel-solid: #101a2e;
  --panel-soft: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.20);
  --text: #e9eefb;
  --muted: #93a1bc;
  --muted-2: #6e7d9a;
  --red: #ff3d3d;
  --red-deep: #e02424;
  --accent-rgb: 255, 61, 61;
  --accent-rgb-2: 255, 100, 100;
  --accent-a: #ff5252;
  --accent-b: #e01f1f;
  --accent-a-hover: #ff6666;
  --accent-b-hover: #e62a2a;
  --glow-1: rgba(var(--accent-rgb), 0.16);
  --glow-2: rgba(75, 141, 255, 0.12);
  --orange: #ff7a45;
  --blue: #4b8dff;
  --green: #2ee6a8;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, var(--glow-2), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.28);
  color: #fff;
}
.btn.primary:hover { background: linear-gradient(135deg, var(--accent-a-hover), var(--accent-b-hover)); }

.btn.ghost {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line);
  color: #c9d4e8;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-strong); }

.btn.ghost.danger { color: #ff9a9a; border-color: rgba(255, 80, 80, 0.3); }
.btn.ghost.danger:hover { background: rgba(var(--accent-rgb), 0.12); }

.btn.mini { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.mini.icon-only { width: 30px; }
.btn.block { width: 100%; height: 46px; font-size: 15px; }

.input, .select, .search {
  height: 42px;
  width: 100%;
  padding: 0 13px;
  border-radius: 10px;
  background: #0a1424;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 14px;
}
.input:focus, .select:focus, .search:focus {
  border-color: rgba(var(--accent-rgb-2), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.select {
  appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #a5b8d8 50%),
    linear-gradient(135deg, #a5b8d8 50%, transparent 50%),
    linear-gradient(180deg, #17253f, #0c1729);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 14px) 50%,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.select:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1), 0 6px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}
.select:active:not(:disabled) {
  transform: translateY(0);
  transition-duration: 0.1s;
}
.select option {
  background: linear-gradient(180deg, #1a2946, #0f1a2e);
  color: #dfe7f5;
  padding: 10px 12px;
}
.select option:hover,
.select option:checked {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.3), rgba(var(--accent-rgb), 0.15));
  color: #fff;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  padding: 14px;
  border-radius: 12px;
  background: #0a1424;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  outline: none;
  line-height: 1.65;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus { border-color: rgba(var(--accent-rgb-2), 0.55); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12); }
textarea::placeholder, .input::placeholder, .search::placeholder { color: var(--muted-2); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted-2); }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.16); }

/* ---------- 主题 ---------- */

:root[data-theme="blue"] {
  --red: #4b8dff; --red-deep: #2a63d8;
  --accent-rgb: 75, 141, 255; --accent-rgb-2: 110, 165, 255;
  --accent-a: #5b9bff; --accent-b: #2a63d8;
  --accent-a-hover: #78adff; --accent-b-hover: #3572e6;
  --glow-1: rgba(75, 141, 255, 0.2); --glow-2: rgba(46, 230, 168, 0.12);
}
:root[data-theme="green"] {
  --red: #2ee6a8; --red-deep: #0f9d6e;
  --accent-rgb: 46, 214, 150; --accent-rgb-2: 90, 240, 190;
  --accent-a: #2ee6a8; --accent-b: #0f9d6e;
  --accent-a-hover: #46f0b6; --accent-b-hover: #14b37e;
  --glow-1: rgba(46, 230, 168, 0.18); --glow-2: rgba(75, 141, 255, 0.1);
}
:root[data-theme="violet"] {
  --red: #a78bfa; --red-deep: #7c3aed;
  --accent-rgb: 154, 120, 255; --accent-rgb-2: 190, 160, 255;
  --accent-a: #a78bfa; --accent-b: #6d28d9;
  --accent-a-hover: #b79dff; --accent-b-hover: #7c3aed;
  --glow-1: rgba(154, 120, 255, 0.2); --glow-2: rgba(75, 141, 255, 0.12);
}
:root[data-theme^="light"] {
  --bg: #eef2f8;
  --bg-2: #e3e9f3;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-solid: #ffffff;
  --panel-soft: rgba(15, 23, 42, 0.05);
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #17223a;
  --muted: #5c6b85;
  --muted-2: #7c8aa2;
  --red: #e5484d; --red-deep: #c53030;
  --accent-rgb: 220, 53, 53; --accent-rgb-2: 240, 90, 90;
  --accent-a: #e5484d; --accent-b: #c53030;
  --accent-a-hover: #ef5f63; --accent-b-hover: #d33b3f;
  --glow-1: rgba(220, 53, 53, 0.12); --glow-2: rgba(75, 141, 255, 0.10);
  --shadow: 0 18px 40px rgba(23, 37, 66, 0.14);
}
/* 浅色扩展主题：沿用「明亮白」的浅底与描边，只替换页面底色、强调色和光晕 */
:root[data-theme="light-azure"] {
  --bg: #edf4fd;
  --bg-2: #e0ecfa;
  --red: #2f6fed; --red-deep: #1d4ed8;
  --accent-rgb: 47, 111, 237; --accent-rgb-2: 96, 165, 250;
  --accent-a: #3b82f6; --accent-b: #1d4ed8;
  --accent-a-hover: #5a95f8; --accent-b-hover: #2563eb;
  --glow-1: rgba(59, 130, 246, 0.14); --glow-2: rgba(14, 165, 233, 0.10);
  --shadow: 0 18px 40px rgba(23, 55, 110, 0.14);
}
:root[data-theme="light-mint"] {
  --bg: #ecf8f2;
  --bg-2: #ddf1e7;
  --red: #0f9d6e; --red-deep: #047857;
  --accent-rgb: 16, 185, 129; --accent-rgb-2: 52, 211, 153;
  --accent-a: #10b981; --accent-b: #047857;
  --accent-a-hover: #2ccb95; --accent-b-hover: #059669;
  --glow-1: rgba(16, 185, 129, 0.14); --glow-2: rgba(13, 148, 136, 0.10);
  --shadow: 0 18px 40px rgba(20, 66, 52, 0.14);
}
:root[data-theme="light-amber"] {
  --bg: #fdf5ea;
  --bg-2: #f9ebd6;
  --red: #d97706; --red-deep: #b45309;
  --accent-rgb: 217, 119, 6; --accent-rgb-2: 251, 191, 36;
  --accent-a: #f59e0b; --accent-b: #b45309;
  --accent-a-hover: #f7ad2b; --accent-b-hover: #c2610a;
  --glow-1: rgba(245, 158, 11, 0.16); --glow-2: rgba(239, 68, 68, 0.08);
  --shadow: 0 18px 40px rgba(92, 62, 20, 0.14);
}
/* Notion 风格主题：暖白画布、炭黑文字、紫色主按钮、发丝线边框 */
:root[data-theme="light-notion"] {
  --bg: #f6f5f4;
  --bg-2: #edebe9;
  --red: #5645d4; --red-deep: #4534b3;
  --accent-rgb: 86, 69, 212; --accent-rgb-2: 123, 108, 224;
  --accent-a: #5645d4; --accent-b: #4534b3;
  --accent-a-hover: #4534b3; --accent-b-hover: #3a2a99;
  --glow-1: rgba(86, 69, 212, 0.05);
  --glow-2: rgba(221, 91, 0, 0.04);
  --blue: #0075de;
  --green: #1aae39;
  --orange: #dd5b00;
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 4px 12px rgba(15, 15, 15, 0.07);
  --radius: 12px;
}
/* Notion：主按钮/选中态改为纯色矩形（不用渐变），次按钮白底描边 */
:root[data-theme="light-notion"] .btn.primary,
:root[data-theme="light-notion"] .tab.active,
:root[data-theme="light-notion"] .seg.active {
  background: #5645d4;
  box-shadow: none;
}
:root[data-theme="light-notion"] .btn.primary:hover,
:root[data-theme="light-notion"] .tab.active:hover,
:root[data-theme="light-notion"] .seg.active:hover {
  background: #4534b3;
}
:root[data-theme="light-notion"] .btn.ghost { background: #ffffff; border-color: var(--line-strong); }
:root[data-theme="light-notion"] .btn.ghost:hover { background: #fafaf9; }
:root[data-theme="light-notion"] .btn.shout {
  background: #5645d4;
  border-color: rgba(15, 15, 15, 0.08);
  box-shadow: 0 4px 12px rgba(15, 15, 15, 0.08);
}
:root[data-theme="light-notion"] .btn.shout:hover { box-shadow: 0 8px 20px rgba(86, 69, 212, 0.22); }
:root[data-theme="light-notion"] .empty .link { color: #e03131; }
:root[data-theme="light-notion"] .toast.err { border-left-color: #e03131; }
/* 浅色主题滚动条在浅底上不可见：加深滚动条 */
:root[data-theme^="light"] .device-list::-webkit-scrollbar-thumb,
:root[data-theme^="light"] .history-list::-webkit-scrollbar-thumb,
:root[data-theme^="light"] .content::-webkit-scrollbar-thumb { background: rgba(15, 15, 15, 0.16); }
/* 浅色主题：把暗色玻璃面板换成白底，保证对比度 */
:root[data-theme^="light"] .topbar { background: rgba(255, 255, 255, 0.78); }
:root[data-theme^="light"] .btn.ghost { background: rgba(15, 23, 42, 0.05); color: var(--text); }
:root[data-theme^="light"] .btn.ghost:hover { background: rgba(15, 23, 42, 0.09); }
:root[data-theme^="light"] .input,
:root[data-theme^="light"] .search,
:root[data-theme^="light"] textarea {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--line);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
:root[data-theme^="light"] .quick-input { background: rgba(255, 255, 255, 0.94); }
:root[data-theme^="light"] .select {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, transparent 50%, #5c6b85 50%),
    linear-gradient(135deg, #5c6b85 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border-color: var(--line);
  box-shadow: none;
}
:root[data-theme^="light"] .select option { background: #ffffff; color: var(--text); }
:root[data-theme^="light"] .panel { box-shadow: 0 10px 28px rgba(23, 37, 66, 0.10); }
:root[data-theme^="light"] .device-card { background: rgba(15, 23, 42, 0.035); }
:root[data-theme^="light"] .device-card:hover { background: rgba(15, 23, 42, 0.06); }
:root[data-theme^="light"] .theme-card { background: rgba(15, 23, 42, 0.05); }
:root[data-theme^="light"] .theme-card.active { color: var(--text); }
:root[data-theme^="light"] .login-card { background: linear-gradient(180deg, #ffffff, #f1f5fa); }
:root[data-theme^="light"] .link-btn {
  color: var(--blue, #2f6fed);
  background: #f1f5fd;
  border-color: #d8e3f8;
}
:root[data-theme^="light"] .link-btn:hover {
  color: #0f4fd1;
  background: #e7efff;
  border-color: #b9cff6;
}
:root[data-theme^="light"] .modal { background: linear-gradient(180deg, #ffffff, #f6f8fc); }
:root[data-theme^="light"] .modal-mask { background: rgba(23, 37, 66, 0.38); }
:root[data-theme^="light"] .toast { background: rgba(255, 255, 255, 0.98); color: var(--text); box-shadow: 0 12px 28px rgba(23, 37, 66, 0.16); }
/* 浅色主题下登录提示代码改为高对比的暖黄深字 */
:root[data-theme^="light"] .login-hint code { color: #793400; background: #fef7d6; }
:root[data-theme^="light"] .tab.active { background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); color: #fff; box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.28); }
/* 明亮主题下降低分段控件底槽的灰度，未选中文字加深，选中项用主题色实心 */
:root[data-theme^="light"] .segmented { background: rgba(15, 23, 42, 0.08); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06); }
:root[data-theme^="light"] .seg:not(.active) { color: #4a5566; }
:root[data-theme^="light"] .seg:not(.active):hover { background: rgba(255, 255, 255, 0.85); color: var(--text); }
:root[data-theme^="light"] .seg.active { background: linear-gradient(135deg, var(--accent-a), var(--accent-b)); color: #fff; box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.28); }
:root[data-theme^="light"] .user-chip:hover { border-color: var(--line-strong); background: rgba(15, 23, 42, 0.06); }
:root[data-theme^="light"] .quick-chip,
:root[data-theme^="light"] .pill,
:root[data-theme^="light"] .group-row,
:root[data-theme^="light"] .target-devices,
:root[data-theme^="light"] .history-item { background: rgba(15, 23, 42, 0.045); }
:root[data-theme^="light"] .quick-chip:hover,
:root[data-theme^="light"] .history-item:hover { color: var(--text); background: rgba(15, 23, 42, 0.075); }
:root[data-theme^="light"] .quick-chip:hover,
:root[data-theme^="light"] .device-actions .btn:hover { color: var(--text); }
:root[data-theme^="light"] .device-actions .btn { color: var(--muted); }
:root[data-theme^="light"] .device-actions .btn.danger { color: #c53030; }
:root[data-theme^="light"] .device-actions .btn:hover { background: rgba(15, 23, 42, 0.08); }
:root[data-theme^="light"] .pill.active { color: var(--text); }
:root[data-theme^="light"] .h-actions .btn { color: var(--muted); }
:root[data-theme^="light"] .h-actions .btn.danger { color: #c53030; }
:root[data-theme^="light"] .h-actions .btn:hover { color: var(--text); background: rgba(15, 23, 42, 0.08); }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-top: 8px; }
.theme-card {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12.5px;
  transition: border-color .2s, background .2s, color .2s;
}
.theme-card:hover { color: var(--text); border-color: var(--line-strong); }
.theme-card.active { color: #fff; border-color: rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .13); }
.theme-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.theme-dot.red { background: linear-gradient(135deg, #ff5252, #e01f1f); }
.theme-dot.blue { background: linear-gradient(135deg, #5b9bff, #2a63d8); }
.theme-dot.green { background: linear-gradient(135deg, #2ee6a8, #0f9d6e); }
.theme-dot.violet { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.theme-dot.light { background: linear-gradient(135deg, #ffffff, #dbe4f3); border: 1px solid #b8c4d8; }
.theme-dot.notion { background: linear-gradient(135deg, #8b7ff0, #3a2a99); }
.theme-dot.azure { background: linear-gradient(135deg, #93c5fd, #1d4ed8); }
.theme-dot.mint { background: linear-gradient(135deg, #6ee7b7, #047857); }
.theme-dot.amber { background: linear-gradient(135deg, #fcd34d, #b45309); }
@media (max-width: 640px) {
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 登录 ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 38px 34px 28px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 34, 56, 0.94), rgba(12, 19, 33, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.5s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-card h1 { margin: 18px 0 6px; font-size: 24px; letter-spacing: 0.5px; }
.login-sub { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.login-card form { display: grid; gap: 12px; }
.login-hint { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.login-hint code { color: #ffd166; background: rgba(255, 209, 102, 0.1); padding: 2px 6px; border-radius: 5px; }
.login-foot { margin-top: 26px; font-size: 11.5px; color: var(--muted-2); letter-spacing: 0.4px; }
.login-foot.beian { margin-top: 8px; }
.login-foot.beian a { color: var(--muted-2); text-decoration: none; transition: color 0.15s; }
.login-foot.beian a:hover { color: var(--muted); }

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, rgba(var(--accent-rgb), 0.22), rgba(255, 122, 69, 0.06));
  border: 1px solid rgba(var(--accent-rgb-2), 0.35);
  color: #ff6b6b;
  flex: none;
}
.brand-mark svg { width: 24px; height: 24px; stroke-width: 1.9; }
.brand-mark.lg { width: 62px; height: 62px; margin: 0 auto; border-radius: 18px; }
.brand-mark.lg svg { width: 34px; height: 34px; }

/* ---------- 顶栏 ---------- */

.app { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 20px;
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, 0.7);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
  flex: none;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16.5px; letter-spacing: 1px; }
.brand-text span { font-size: 10.5px; color: var(--muted-2); letter-spacing: 1.4px; text-transform: uppercase; }

.stats { display: flex; gap: 20px; margin-left: 10px; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stat b { color: var(--text); font-size: 16px; font-weight: 600; }
.stat.warn b { color: #ffb85c; }

.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- 布局 ---------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 370px;
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  padding: 16px 20px 20px;
  min-height: 0;
  overflow: hidden;
}

.history-side { min-height: 0; display: flex; flex-direction: column; }
.history-side .history-panel { width: 100%; min-height: 0; }
.history-side .history-list { max-height: none; flex: 1; }

/* 作业记录条目样式（与喊话记录独立；两个面板按 tab 切换，同一时间只显示一个） */
.hw-history-panel { margin-top: 0; }
.hw-record .h-type {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.22), rgba(81, 45, 168, 0.18));
  color: #b79fff;
  border: 1px solid rgba(124, 77, 255, 0.35);
}
.hw-record-icon { font-size: 16px; }
.hw-record-subject {
  display: inline-block;
  background: linear-gradient(135deg, #7c4dff, #512da8);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px; margin-right: 6px;
}
.hw-record-from {
  color: #8aa1c7; font-size: 12px; margin-left: 8px;
}
.hw-record-schedule {
  color: #ffb87d; font-size: 12px; font-weight: 600; margin-left: 8px;
}
.hw-record-state {
  font-size: 12px; font-weight: 600; margin-left: 8px;
  padding: 1px 8px; border-radius: 999px;
}
.hw-record-state.on { color: #8fe3b5; background: rgba(76, 217, 150, 0.12); }
.hw-record-state.off { color: #9aa7bd; background: rgba(255, 255, 255, 0.06); }
.hw-record-state.remote { color: #ffd48a; background: rgba(255, 184, 77, 0.14); }
/* 定时中：蓝色胶囊 + 实时倒计时 */
.hw-record-state.pending { color: #abd4ff; background: rgba(94, 165, 255, 0.14); }
.hw-record-state .hw-countdown {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #d8ebff;
}
/* 定时作业到点时终端不在线：整条记录高亮 + 橙色警示标签（单独一行，窄侧栏也可读） */
.history-item.hw-record.has-warn {
  border-color: rgba(255, 160, 64, 0.45);
  background: rgba(255, 140, 40, 0.08);
}
.hw-record-schedule, .hw-record-state { flex: none; white-space: nowrap; }
.h-warn-row { margin-top: 6px; }
.hw-record-warn {
  display: block; width: fit-content; max-width: 100%;
  box-sizing: border-box;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px; font-weight: 700;
  line-height: 1.5;
  white-space: normal;
  color: #ffce8a;
  background: rgba(255, 160, 64, 0.18);
  border: 1px solid rgba(255, 160, 64, 0.5);
}
:root[data-theme^="light"] .history-item.hw-record.has-warn {
  border-color: rgba(234, 88, 12, 0.4);
  background: rgba(234, 88, 12, 0.1);
}
:root[data-theme^="light"] .hw-record-warn {
  color: #b45309;
  background: rgba(234, 88, 12, 0.14);
  border-color: rgba(234, 88, 12, 0.45);
}

/* 作业持续时间选择：小字胶囊按钮，默认 60 分钟 */
.hw-duration {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hw-duration-label { font-size: 12px; color: #8fa0b8; }
.hw-duration-list { display: flex; gap: 8px; flex-wrap: wrap; }
.hw-dur-chip {
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: #c9d4e8;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hw-dur-chip:hover { border-color: rgba(120, 170, 255, 0.35); color: #fff; }
.hw-dur-chip.active {
  background: linear-gradient(135deg, #7c4dff, #512da8);
  border-color: rgba(124, 77, 255, 0.85);
  color: #fff; font-weight: 600;
}

/* 作业记录分页 */
.hw-pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 0 4px;
}
.hw-pager .btn { min-height: 34px; padding: 0 14px; font-size: 13px; }
.hw-pager .btn[disabled] { opacity: 0.4; cursor: default; }
.hw-pager-info { font-size: 13px; color: #8fa0b8; font-variant-numeric: tabular-nums; }

/* 作业记录行：按钮加大，触摸/鼠标都更好点 */
.hw-record .h-actions .hw-btn {
  min-width: 44px; min-height: 40px;
  padding: 0 12px;
  gap: 5px;
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
}
.hw-record .h-actions .hw-btn svg { width: 18px; height: 18px; }

/* 作业记录行可点击查看内容 */
.hw-record { cursor: pointer; }

/* 作业详情弹窗 */
.hw-detail-text {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 46vh;
  overflow: auto;
}
.hw-detail-meta { margin-top: 14px; display: grid; gap: 7px; }
.hw-detail-row { display: flex; gap: 10px; font-size: 13px; line-height: 1.6; }
.hw-detail-k { flex: none; width: 68px; color: var(--muted); }
.hw-detail-v { color: var(--text); word-break: break-word; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  min-height: 58px;
}
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.4px; }
.chip-count {
  min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-grid; place-items: center;
  font-size: 11.5px; color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
}
.panel-head > .btn:last-child { margin-left: auto; }

/* ---------- 终端列表 ---------- */

.sidebar { min-height: 0; display: flex; }
.devices { display: flex; flex-direction: column; width: 100%; min-height: 0; }

/* 终端管理入口：仅手机端显示；「完成」按钮仅手机覆盖态显示 */
#deviceMgrBtn { display: none; }
.devices-close { display: none; }

.filters {
  display: grid;
  grid-template-columns: 1fr 126px;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.filters .search, .filters .select { height: 36px; font-size: 13px; }

.device-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.device-list::-webkit-scrollbar, .history-list::-webkit-scrollbar, .content::-webkit-scrollbar { width: 8px; }
.device-list::-webkit-scrollbar-thumb, .history-list::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.09); border-radius: 8px;
}

.device-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 11px 12px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  /* 上千台终端时跳过视口外卡片的布局/绘制，滚动更流畅 */
  content-visibility: auto;
  contain-intrinsic-size: 96px;
}
.device-card:hover { background: rgba(255, 255, 255, 0.075); border-color: var(--line-strong); }
/* 离线终端只淡化信息区，操作按钮保持正常亮度，避免看不出可编辑/可删除 */
.device-card.offline .avatar,
.device-card.offline .device-main,
.device-card.offline .device-volume { opacity: 0.62; }
.device-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, rgba(75, 141, 255, 0.25), rgba(75, 141, 255, 0.06));
  border: 1px solid rgba(75, 141, 255, 0.25);
  font-size: 14px; font-weight: 600; color: #a9c8ff;
  flex: none;
}
.device-main { min-width: 0; flex: 1; }
.device-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.device-name .tag {
  font-size: 10.5px; font-weight: 400; color: var(--muted);
  border: 1px solid var(--line); padding: 1px 6px; border-radius: 20px; flex: none;
}
.device-meta {
  font-size: 11.5px; color: var(--muted-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
/* 终端备注（仅当前账号可见） */
.device-remark {
  font-size: 11.5px; color: #e8c268;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
/* 用户管理-普通用户的自服务面板 */
.self-panel {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 10px 12px; margin-top: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.self-panel .input { flex: 1; height: 36px; min-height: 36px; font-size: 13px; }
.self-panel .input.code { max-width: 110px; flex: none; letter-spacing: 2px; text-align: center; }
.self-panel.hidden { display: none; }
/* 昵称行独占一行，下面的说明文字才不会把输入框挤到右边 */
.self-panel > .self-row { flex: none; width: 100%; min-width: 0; }
.self-col { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.self-row { display: flex; gap: 8px; align-items: center; }
.self-row .input { flex: 1; height: 36px; font-size: 13px; }
.self-row .input.code { max-width: 110px; flex: none; letter-spacing: 2px; text-align: center; }
.device-actions { display: flex; gap: 2px; }
.device-actions .btn { width: 32px; height: 32px; min-width: 32px; padding: 0; border-radius: 7px; color: #c9d4e8; }
.device-actions .btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.device-actions .btn.danger { color: #ff9a9a; }
.device-actions .btn.danger:hover { color: #ff8080; background: rgba(var(--accent-rgb), 0.12); }
.device-actions svg { width: 17px; height: 17px; }
.device-volume {
  display: flex; align-items: center; gap: 8px;
  margin-top: 9px; padding-top: 9px; border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.device-volume input { flex: 1; }
.vol-num { font-size: 11.5px; color: var(--muted); width: 34px; text-align: right; flex: none; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  background: transparent;
  cursor: pointer;
  accent-color: var(--red);
  width: 100%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.75), rgba(var(--accent-rgb), 0.2));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(var(--accent-rgb), 0.35); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.empty.small { padding: 22px 14px; font-size: 12.5px; }
.empty b { color: var(--text); }
.empty .link { color: #ff8080; cursor: pointer; }

/* ---------- 主内容 ---------- */

.content { min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 2px; min-height: 0; }

.composer { display: flex; flex-direction: column; }
.composer-head { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.tabs { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.32); padding: 4px; border-radius: 12px; flex-shrink: 0; }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 18px; border-radius: 9px;
  font-size: 14px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--muted); white-space: nowrap; flex: 0 0 auto; transition: all 0.2s;
}
.tab svg { width: 17px; height: 17px; opacity: 0.75; transition: opacity 0.2s; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
/* 选中态改成主题色实心块：未选中是暗底灰字，选中是亮色填充，三个入口一眼可分 */
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.32);
}
.tab.active svg { opacity: 1; }
.tab:focus-visible { outline: 2px solid rgba(var(--accent-rgb-2), 0.7); outline-offset: 2px; }
.target-summary { font-size: 12.5px; color: var(--muted); }
.target-summary b { color: #ff9d7a; font-weight: 600; }

.target-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.target-label { color: var(--muted); }
.segmented { display: flex; background: rgba(0, 0, 0, 0.32); border-radius: 10px; padding: 3px; }

/* 作业布置表单 */
.hw-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 640px) { .hw-row { grid-template-columns: 1fr; } }
.hw-subject { width: 110px; max-width: 110px; }
.hw-textarea { min-height: 150px; line-height: 1.75; font-family: ui-monospace, "PingFang SC", system-ui; }
/* 立即布置模块：持续时间 + 大屏预览 + 立即布置按钮，视觉上是一个整体 */
.hw-quick {
  padding: 14px 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}
.hw-quick .hw-duration { margin-top: 0; }
/* 定时布置：开始/结束时间（位于持续时间下方）+ 右侧独立按钮（沿用主题色） */
.hw-custom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}
.hw-custom-times { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hw-custom-btn { height: 42px; padding: 0 18px; white-space: nowrap; }
@media (max-width: 520px) {
  .hw-custom { grid-template-columns: minmax(0, 1fr); }
  .hw-custom-btn { width: 100%; }
}
/* 手机竖屏：窄屏时用 gap 缩小 + 两个时间框都保持并排 */
@media (max-width: 400px) {
  .hw-custom-times { gap: 8px; }
  .hw-custom-times .hw-time { font-size: 13px; letter-spacing: 0.5px; }
}
/* 只有极端窄屏（< 320px）才堆成一列 */
@media (max-width: 319px) { .hw-custom-times { grid-template-columns: 1fr; } }

/* 时间输入框 + 清除按钮 */
.hw-time-wrap { position: relative; display: flex; align-items: center; }
.hw-time-wrap .hw-time { padding-right: 36px; cursor: pointer; }
.hw-time-wrap .hw-time::-webkit-calendar-picker-indicator { display: none !important; }
.hw-time-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.08); color: var(--muted); font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.hw-time-wrap:hover .hw-time-clear { opacity: 1; }
.hw-time-clear:hover { background: rgba(255,100,100,0.25); color: #ff9a9a; }

/* 时间选择 popover —— 滚轮式 */
.hw-time-pop {
  position: absolute; z-index: 9999;
  display: flex; align-items: stretch; gap: 0;
  background: #0e1a2e; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
  padding: 14px 10px 54px;
  --hw-item-h: 40px;          /* 每个选项高度 */
  --hw-col-h: calc(var(--hw-item-h) * 5);  /* 可见 5 个选项 */
  --hw-pop-w: 220px;
}
.hw-time-pop.hidden { display: none; }
.hw-time-pop-sep {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: var(--muted);
  padding: 0 4px; user-select: none;
}
.hw-time-pop-col {
  --hw-col-w: 64px;
  width: var(--hw-col-w); height: var(--hw-col-h);
  position: relative; overflow: hidden;
  display: flex;
}
/* 上下渐变遮罩，突出中间选项 */
.hw-time-pop-col::before,
.hw-time-pop-col::after {
  content: ''; position: absolute; left: 0; right: 0; height: var(--hw-item-h);
  pointer-events: none; z-index: 3;
}
.hw-time-pop-col::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(14,26,46,0.95), rgba(14,26,46,0));
}
.hw-time-pop-col::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(14,26,46,0.95), rgba(14,26,46,0));
}
/* 中间选中高亮区 */
.hw-time-pop-indicator {
  position: absolute; left: 2px; right: 2px;
  top: calc(var(--hw-col-h) / 2 - var(--hw-item-h) / 2);
  height: var(--hw-item-h); z-index: 2;
  border: 1.5px solid rgba(124,77,255,0.55);
  border-radius: 8px;
  background: rgba(124,77,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(124,77,255,0.18);
  pointer-events: none;
}
.hw-time-pop-list {
  list-style: none; margin: 0; padding: 0;
  height: 100%; overflow-y: auto; overflow-x: hidden;
  width: 100%; flex: 1;
  scrollbar-width: none;  /* 隐藏滚动条 */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* proximity：接近吸附点才吸，不强制拽过去 —— 减弱吸附感 */
  scroll-snap-type: y proximity;
}
.hw-time-pop-list::-webkit-scrollbar { display: none; }
.hw-time-pop-list li {
  height: var(--hw-item-h); line-height: var(--hw-item-h);
  text-align: center;
  font-size: 16px; font-weight: 500; color: #8a9ab8;
  cursor: pointer; user-select: none;
  scroll-snap-align: center;
  transition: color .1s, font-weight .1s;
}
.hw-time-pop-list li.near { color: #c9d4e8; }
.hw-time-pop-list li.center {
  color: #fff; font-weight: 700; font-size: 17px;
  text-shadow: 0 1px 3px rgba(124,77,255,0.5);
}
.hw-time-pop-list li.disabled { color: rgba(138,154,184,0.25); cursor: not-allowed; }
.hw-time-pop-list li.null-slot { color: rgba(138,154,184,0.4); font-size: 19px; letter-spacing: 2px; }
.hw-time-pop-actions {
  position: absolute; bottom: 8px; right: 8px; left: 8px;
  display: flex; justify-content: flex-end; gap: 8px;
}
.hw-time-pop-btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: #c9d4e8; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.hw-time-pop-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.hw-time-pop-btn.primary {
  background: linear-gradient(135deg, #7c4dff, #512da8); border-color: transparent; color: #fff;
}
.hw-time-pop-btn.primary:hover { box-shadow: 0 2px 10px rgba(124,77,255,0.5); }

/* 浅色主题覆盖 */
:root[data-theme^="light"] .hw-time-pop {
  background: #ffffff; border-color: var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.03);
}
:root[data-theme^="light"] .hw-time-pop-col::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.96), rgba(255,255,255,0));
}
:root[data-theme^="light"] .hw-time-pop-col::after {
  background: linear-gradient(to top, rgba(255,255,255,0.96), rgba(255,255,255,0));
}
:root[data-theme^="light"] .hw-time-pop-list li { color: #95a3ba; }
:root[data-theme^="light"] .hw-time-pop-list li.near { color: #3d4b63; }
:root[data-theme^="light"] .hw-time-pop-list li.center {
  color: #512da8; font-weight: 700; font-size: 17px; text-shadow: none;
}
:root[data-theme^="light"] .hw-time-pop-sep { color: var(--muted); }
:root[data-theme^="light"] .hw-time-pop-btn {
  background: rgba(15,23,42,0.05); color: #3d4b63; border-color: var(--line);
}
:root[data-theme^="light"] .hw-time-pop-btn:hover { background: rgba(15,23,42,0.1); color: #0f172a; }
:root[data-theme^="light"] .hw-time-clear { background: rgba(15,23,42,0.06); color: #6b7a94; }
:root[data-theme^="light"] .hw-time-clear:hover { background: rgba(220,38,38,0.15); color: #dc2626; }
/* 学科按钮 grid */
.hw-subject-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 2px 0 6px;
}
@media (max-width: 520px) { .hw-subject-grid { grid-template-columns: repeat(3, 1fr); } }
.hw-subject-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: #c9d4e8;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .18s ease;
  user-select: none;
  text-align: center;
  white-space: nowrap;
}
.hw-subject-chip:hover { border-color: rgba(120, 170, 255, 0.35); color: #fff; transform: translateY(-1px); }
.hw-subject-chip.active {
  background: linear-gradient(135deg, #7c4dff, #512da8);
  border-color: rgba(124, 77, 255, 0.85);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 22px rgba(124, 77, 255, 0.42);
}
.hw-subject-chip .hw-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #ffb0b0;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: none;
  transition: background .15s;
}
.hw-subject-chip:hover .hw-del { display: inline-flex; align-items: center; justify-content: center; }
.hw-subject-chip .hw-del:hover { background: #e54141; color: #fff; }
.hw-subject-chip.hw-add {
  background: rgba(255, 255, 255, 0.04);
  border-style: dashed;
  border-color: rgba(120, 170, 255, 0.32);
  color: #8fb3ff;
  cursor: pointer;
}
.hw-subject-chip.hw-add:hover { background: rgba(75, 141, 255, 0.14); border-color: rgba(120, 170, 255, 0.6); color: #fff; }
.hw-subject-chip input {
  width: calc(100% - 12px);
  height: 32px;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  outline: none;
}
:root[data-theme^="light"] .hw-subject-chip {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.04);
  color: #2b3a54;
}
:root[data-theme^="light"] .hw-subject-chip:hover { border-color: #7c4dff; color: #343c5a; }
:root[data-theme^="light"] .hw-subject-chip.active {
  background: linear-gradient(135deg, #7c4dff, #512da8);
  border-color: #512da8;
  color: #fff;
  box-shadow: 0 4px 18px rgba(124, 77, 255, 0.32);
}
:root[data-theme^="light"] .hw-subject-chip.hw-add {
  border-color: rgba(124, 77, 255, 0.42);
  color: #6366f1;
}

/* 手机端 composer-foot：预览按钮不挤 + 立即布置按钮不溢出 */
.composer-foot .hw-foot-preview { flex-shrink: 0; width: auto; padding: 0 14px; height: 58px; }
.composer-foot #sendHomeworkBtn.block { width: auto; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg {
  height: 34px; padding: 0 15px; border-radius: 8px; font-size: 13px;
  color: var(--muted); transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg.active {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.32);
}
.seg:not(.active):hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.seg-tag {
  font-style: normal; font-size: 10px; line-height: 1;
  padding: 2.5px 6px; border-radius: 99px;
  background: rgba(98, 214, 167, 0.2); color: #7ee2b8;
  border: 1px solid rgba(98, 214, 167, 0.4);
}
/* 选中段徽标跟随主题色反白，避免绿标压在红色/蓝色底上仍然发暗 */
.seg.active .seg-tag { background: rgba(255, 255, 255, 0.22); color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.seg:not(.active) .seg-tag { background: rgba(255, 255, 255, 0.06); color: var(--muted); border-color: transparent; }
.target-bar .select { width: auto; min-width: 150px; height: 34px; font-size: 13px; }

/* 当前发送目标 chips：分组蓝色 / 终端绿色 */
.target-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.t-chip {
  font-size: 11.5px; line-height: 1; padding: 4px 9px; border-radius: 7px;
  border: 1px solid; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t-chip.group { background: rgba(75, 141, 255, 0.13); border-color: rgba(75, 141, 255, 0.38); color: #9dc0ff; }
.t-chip.dev { background: rgba(46, 230, 168, 0.10); border-color: rgba(46, 230, 168, 0.32); color: #7fe8c4; }
.t-chip.more { background: rgba(255, 255, 255, 0.05); border-color: var(--line); color: var(--muted); }

.target-devices {
  display: flex; flex-wrap: wrap; gap: 6px;
  width: 100%; max-height: 108px; overflow-y: auto;
  padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.22);
}
.dev-check {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18); font-size: 13px; font-weight: 500;
  color: #cdd7e8; background: rgba(255, 255, 255, 0.05);
  cursor: pointer; user-select: none; transition: all 0.18s;
}
.dev-check:hover { color: #fff; border-color: rgba(var(--accent-rgb-2), 0.45); background: rgba(var(--accent-rgb), 0.09); }
.dev-check input { accent-color: var(--green); width: 14px; height: 14px; margin: 0; }
.dev-check.on { color: #b8f8e0; border-color: rgba(46, 230, 168, 0.6); background: rgba(46, 230, 168, 0.16); font-weight: 600; }
/* 离线终端不再整块半透明（那样名字会看不清），改为虚线边 + 灰色名字 + 离线角标 */
.dev-check.offline { opacity: 1; color: #8b95a8; border-style: dashed; border-color: rgba(255, 255, 255, 0.14); }
.dev-check.offline::after {
  content: '离线'; margin-left: 2px; padding: 1px 5px;
  font-size: 10px; font-weight: 500; line-height: 1.3;
  color: #8b95a8; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 99px;
}

.tab-pane { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12px; color: var(--muted); letter-spacing: 0.3px; }
.field-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted-2); }
.hint { color: var(--muted-2); }
.counter { font-variant-numeric: tabular-nums; }
.counter.warn { color: #ffb85c; }

.quick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-chip {
  padding: 8px 14px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08);
  font-size: 13px; font-weight: 500; color: #e2e9f7; transition: all 0.18s;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quick-chip:hover { color: #fff; border-color: rgba(var(--accent-rgb-2), 0.4); background: rgba(var(--accent-rgb), 0.08); }

/* 常用语编辑态 / 工具按钮 / 内联输入 */
.quick-chip.tool {
  flex: none; min-width: 32px; padding: 7px 10px;
  color: var(--muted); font-size: 13px; line-height: 1;
}
.quick-chip.tool.on { color: #7fe8c4; border-color: rgba(46, 230, 168, 0.35); background: rgba(46, 230, 168, 0.08); }
.quick-chip.del { border-color: rgba(255, 80, 80, 0.35); color: #ffb3b3; display: inline-flex; align-items: center; gap: 6px; }
.quick-chip.del:hover { background: rgba(var(--accent-rgb), 0.14); }
.quick-chip.del i { font-style: normal; font-size: 14px; line-height: 1; opacity: 0.8; }
.quick-input {
  height: 32px; padding: 0 12px; border-radius: 20px; min-width: 200px;
  border: 1px solid rgba(var(--accent-rgb-2), 0.45); background: #0a1424;
  color: var(--text); font-size: 12.5px; outline: none;
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.options.wrap { display: flex; flex-wrap: wrap; align-items: flex-end; }
.options.wrap .grow { flex: 1; min-width: 220px; }

/* 二级菜单：根据样式显示的子选项行 */
.sub-options { display: flex; flex-direction: column; gap: 10px; margin-top: -6px; }
.sub-options:empty { display: none; }
.sub-field { display: none; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub-field.show { display: flex; }
.sub-label { font-size: 12px; color: var(--muted); flex: none; letter-spacing: 0.3px; }
.sub-field .style-pills { flex: 1; }

.style-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px; color: var(--muted); transition: all 0.2s;
}
.pill.active { color: #fff; border-color: rgba(var(--accent-rgb-2), 0.45); background: rgba(var(--accent-rgb), 0.13); }
.pill:disabled { opacity: 0.4; cursor: not-allowed; }
.tts-tip { font-size: 11px; color: var(--muted-2); min-height: 14px; }
.tts-tip.ok { color: #62d6a7; }
.tts-tip.bad { color: #d98b8b; }

.input:disabled, .select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.hint-line { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

.sliders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.slider-field { display: flex; flex-direction: column; gap: 4px; }
.slider-field label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.slider-field label b { color: #dbe4f5; font-weight: 600; font-variant-numeric: tabular-nums; }
.slider-field.is-disabled { opacity: 0.45; }
.slider-field.is-disabled input[type="range"] { cursor: not-allowed; }
.slider-field.is-disabled label b { color: var(--muted); }

.voice-select-row { display: flex; align-items: center; gap: 10px; }
.voice-select-row > label { font-size: 12px; color: var(--muted); flex: none; width: 56px; }
.voice-select-row .select { height: 36px; font-size: 13px; }
.grow { flex: 1; }

.composer-foot {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: auto;
}
.preview-btn { height: 48px; padding: 0 18px; }
.composer-foot.in-text {
  padding: 0; margin-top: 12px;
  border-top: 0; background: none; border-radius: 0;
}
.composer-foot.in-text .preview-btn { height: 58px; }
.btn.shout {
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  height: 48px;
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, var(--accent-a-hover) 0%, var(--accent-b) 46%, var(--accent-b-hover) 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  box-shadow:
    0 10px 26px rgba(var(--accent-rgb), 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
/* 掠过式高光，悬停/点击时扫过一遍 */
.btn.shout::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.42) 48%, transparent 66%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.btn.shout:hover::before { transform: translateX(130%); }
.btn.shout:hover {
  transform: translateY(-1px);
  box-shadow:
    0 16px 34px rgba(255, 45, 45, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}
.btn.shout:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 6px 16px rgba(224, 32, 32, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.25);
}
.btn.shout:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 3px; }
.btn.shout svg {
  width: 32px; height: 32px; padding: 6px;
  box-sizing: border-box;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex: none;
}
.btn.shout.xl { height: 58px; font-size: 18px; letter-spacing: 5px; border-radius: 14px; }
.btn.shout.block { width: 100%; flex: none; }
@media (prefers-reduced-motion: reduce) {
  .btn.shout, .btn.shout::before { transition: none; }
}

/* ---------- 录音 ---------- */

.recorder {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column; gap: 12px;
}
.rec-main { display: flex; align-items: center; gap: 16px; }
.rec-btn {
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 34% 30%, #ff6a6a, #c81c1c);
  box-shadow: 0 10px 26px rgba(255, 45, 45, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  color: #fff; flex: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.rec-btn:hover { transform: scale(1.04); }
.rec-btn svg { width: 27px; height: 27px; }
.rec-btn.recording {
  background: radial-gradient(circle at 34% 30%, #ff8a5b, #d63a0f);
  animation: recPulse 1.4s infinite;
}
@keyframes recPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 50, 0.5); }
  70% { box-shadow: 0 0 0 18px rgba(255, 90, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 90, 50, 0); }
}
.rec-info { min-width: 0; flex: 1; }
.rec-title { font-size: 15px; font-weight: 600; }
.rec-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.rec-timer { font-family: "SF Mono", Consolas, monospace; font-size: 20px; color: var(--muted); flex: none; }
.rec-timer.on { color: #ff8b6a; }
.rec-wave { height: 56px; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.025); }
.rec-wave canvas { width: 100%; height: 100%; display: block; }
.preview-audio { width: 100%; height: 38px; filter: invert(0.92) hue-rotate(180deg); border-radius: 8px; }
/* 浅色主题下音频控件不需要反色适配 */
:root[data-theme^="light"] .preview-audio { filter: none; }
.rec-hint { font-size: 12px; color: var(--muted-2); min-height: 16px; }
.rec-hint.bad { color: #ff9a9a; }
.upload-btn { height: 42px; }
.upload-btn svg { width: 16px; height: 16px; }

/* ---------- 历史 ---------- */

.history-panel { display: flex; flex-direction: column; min-height: 220px; }
.history-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 12px 12px;
}
.pager:empty { padding: 0; }
.pager-info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 分组多选（终端编辑弹窗） */
.group-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.group-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}
.group-check:hover { border-color: var(--line-strong); }
.group-check input { accent-color: #2ee6a8; width: 15px; height: 15px; }
.group-check.on {
  border-color: rgba(46, 230, 168, 0.5);
  background: rgba(46, 230, 168, 0.1);
  color: #b8f4dc;
}

/* 分组管理弹窗 */
#groupRows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 46vh;
  overflow-y: auto;
}
.group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.group-row .group-name { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.group-def {
  font-style: normal;
  font-size: 10.5px;
  color: var(--blue);
  border: 1px solid rgba(75, 141, 255, 0.4);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
}
.group-count { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.group-row .actions { display: flex; gap: 6px; flex-shrink: 0; }
.group-row .rename-input { flex: 1; height: 34px; min-width: 0; }
.group-add { display: flex; gap: 10px; }
.group-add .input { flex: 1; }
.pair-group-row { display: flex; gap: 10px; }
.pair-group-row .select, .pair-group-row .input { flex: 1; min-width: 0; }
.pair-group-row .btn { flex: none; }

/* 播报回报：已播放 x/y */
.ack-tag {
  font-size: 11.5px; font-weight: 600;
  color: #d3ddec;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.ack-tag.ok { color: #9df3cf; border-color: rgba(46, 230, 168, 0.55); background: rgba(46, 230, 168, 0.14); }
.ack-tag.warn { color: #ffc4b4; border-color: rgba(255, 122, 69, 0.6); background: rgba(255, 122, 69, 0.16); }
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  transition: all 0.18s;
}
.history-item:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-strong); }
.h-type {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
}
.h-type svg { width: 16px; height: 16px; }
.history-item.voice .h-type { background: rgba(75, 141, 255, 0.13); color: #8fb7ff; }
.h-main { flex: 1; min-width: 0; }
.h-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; row-gap: 3px; flex-wrap: wrap; overflow: hidden; }
.h-meta .h-time { flex: none; }
.h-meta .h-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-meta .badge { color: #ff9d7a; flex: none; }
.h-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.h-tags:empty { display: none; }
.h-actions { display: flex; gap: 8px; align-items: center; }
.h-actions .btn { width: 30px; height: 30px; min-width: 30px; padding: 0; color: #c9d4e8; }
.h-actions .btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.h-actions .btn.danger { color: #ff9a9a; }
.h-actions .btn.danger:hover { color: #ff8080; }

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 6, 12, 0.66);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #141e33, #0c1424);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.22s ease;
}
.modal.wide { width: min(560px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .close { font-size: 18px; color: var(--muted); width: 32px; height: 32px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 15px; }
.modal-body .field > label { font-size: 12.5px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  font-size: 13.5px; cursor: pointer;
}
.switch-row em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.switch-row input { appearance: none; width: 42px; height: 24px; border-radius: 20px; background: #2a3550; position: relative; transition: background 0.2s; flex: none; }
.switch-row input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #8695b0; transition: all 0.2s;
}
.switch-row input:checked { background: rgba(var(--accent-rgb), 0.65); }
.switch-row input:checked::after { left: 21px; background: #fff; }

.settings-block { border-top: 1px solid var(--line); padding-top: 15px; }
.settings-block h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 500; }
.group-manage { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
.group-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); font-size: 13px; }
.group-row .btn { color: var(--muted); width: 26px; height: 26px; }
.group-row .btn:hover { color: #ff8080; }
.inline-add { display: flex; gap: 8px; }
.inline-add .input { height: 38px; }
.tts-status { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.tts-status b { color: #62d6a7; }
.tts-status .bad { color: #e59a9a; }

.help-body { gap: 12px; }
.help-step { display: flex; gap: 12px; font-size: 13px; color: #c6d1e5; line-height: 1.6; }
.help-step b {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
  background: rgba(var(--accent-rgb), 0.15); color: #ff8b8b; margin-top: 1px;
}
.help-link { margin: 4px 0 2px; }
.help-link .btn { width: 100%; }
.help-note { font-size: 11.5px; color: var(--muted-2); line-height: 1.7; margin: 0; }

/* ---------- Toast ---------- */

.toasts {
  position: fixed; top: 18px; right: 18px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: rgba(18, 28, 48, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-size: 13px; color: #dce5f6;
  max-width: 340px;
  border-left: 3px solid var(--blue);
  animation: toastIn 0.24s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: #ffb84d; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* 断线重连遮罩 */
.conn-mask {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 11, 20, 0.5);
  backdrop-filter: blur(2px);
}
.conn-mask.hidden { display: none; }
.conn-mask-card {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: 12px;
  background: rgba(18, 28, 48, 0.96); border: 1px solid var(--line-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-size: 13.5px; color: #dce5f6;
}
:root[data-theme^="light"] .conn-mask-card { background: rgba(255, 255, 255, 0.98); color: var(--text); }
.conn-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--blue);
  animation: connSpin 0.8s linear infinite;
}
@keyframes connSpin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */

@media (max-width: 1440px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr) 350px; }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: start;
    padding: 14px; gap: 14px;
    overflow-y: auto;
  }
  .history-side { grid-column: 1 / -1; display: block; min-height: auto; }
  .content { overflow: visible; min-height: auto; }
  .history-side .history-list { max-height: 360px; flex: none; }
}

@media (max-width: 1080px) {
  .sliders { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 840px) {
  .topbar { height: 62px; padding: 0 14px; gap: 12px; }
  .brand-text span { display: none; }
  .stats { display: flex; margin-left: auto; gap: 12px; }
  .top-actions .btn.ghost.danger { width: 38px; padding: 0; font-size: 0; gap: 0; }
  .top-actions .btn.ghost.danger svg { width: 17px; height: 17px; }
  .layout { display: flex; flex-direction: column; overflow-y: auto; padding: 12px; min-height: 0; }
  /* 手机端纵向滚动：主区与记录区按内容高度排布，避免被 flex 压缩 */
  .content, .history-side { flex: none; }
  .h-actions { opacity: 1; }
  /* 手机端：终端列表默认隐藏，点「终端管理」后整页覆盖 */
  #deviceMgrBtn { display: inline-flex; flex: none; }
  .sidebar { display: none; }
  body.devices-open { overflow: hidden; }
  body.devices-open .sidebar {
    display: block;
    position: fixed; inset: 0; z-index: 60;
    background: var(--bg);
    padding: 12px;
    overflow-y: auto;
  }
  body.devices-open .devices { max-height: none; height: 100%; }
  body.devices-open .devices-close { display: inline-flex; }
  .content { overflow: visible; }
  .options { grid-template-columns: 1fr 1fr; gap: 10px; }
  .options .pill { height: 32px; padding: 0 10px; font-size: 12px; }
  .composer-head { padding: 12px 14px; }
  .target-summary { font-size: 12px; }
  .target-bar { padding: 10px 14px; gap: 8px; }
  .seg { padding: 0 10px; }
  .tab-pane { padding: 14px; }
  .login-card { padding: 30px 22px 24px; }
  /* 手机端：history-side 只显示当前 tab 对应的记录面板 */
  .history-side { display: flex; flex-direction: column; gap: 12px; }
  .history-side .history-panel { min-height: auto; flex: none; }
  .history-side .history-list { max-height: 280px; flex: none; }
  .hw-history-panel { margin-top: 0; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark svg { width: 21px; height: 21px; }
  .brand-text strong { font-size: 15px; }
  .stats { gap: 9px; }
  .stat span { display: none; }
  .top-actions { gap: 4px; }
  .top-actions .btn.icon-only { width: 36px; height: 36px; }
  .filters { grid-template-columns: 1fr 110px; }
  .sliders { gap: 10px; }
  .composer-foot { flex-direction: row; }
  .preview-btn { width: auto; flex: none; padding: 0 14px; }
  .btn.shout { width: auto; flex: 1; letter-spacing: 2px; font-size: 16px; }
  .options.wrap .field { width: 100%; }
  .voice-select-row { flex-wrap: wrap; }
  .voice-select-row > label { width: auto; }
  .modal-foot .btn { flex: 1; }
  /* 顶部栏收紧：隐藏品牌文字与用户名，保留图标，避免换行 */
  .brand-text { display: none; }
  .user-chip { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .user-chip span { display: none; }
  .stat span { display: inline; font-size: 10.5px; }
  /* 快捷短语换行排列，避免左右滑动 */
  .quick-row {
    flex-wrap: wrap;
    overflow: visible;
  }
  .quick-chip { flex: none; max-width: 100%; }
  /* 记录条目在窄屏去掉类型图标、收紧操作按钮，给标题留出空间 */
  .h-type { display: none; }
  .history-item { gap: 8px; padding: 9px 10px; }
  .h-actions { gap: 6px; }
  .h-actions .btn { width: 26px; min-width: 26px; height: 26px; }
}

/* 触摸设备没有 hover，记录操作按钮常显 */
@media (hover: none) {
  .h-actions { opacity: 1; }
}

/* ============ 多用户 / 硬件码 / 语音开关 ============ */

.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 12.5px; color: var(--text);
  max-width: 200px;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.user-chip:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.07); }
.user-chip svg { width: 15px; height: 15px; stroke: var(--muted); stroke-width: 1.8; fill: none; flex: none; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pair-code-input {
  height: 56px; text-align: center;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 24px; letter-spacing: 10px; text-indent: 10px;
  font-variant-numeric: tabular-nums;
}
.bind-sheet { width: min(470px, 94vw); }

.remember-row {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 2px 4px; font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.remember-row input { width: 15px; height: 15px; accent-color: var(--accent-b); cursor: pointer; }
.login-register {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; font-size: 12.5px; color: var(--muted);
}
.link-btn {
  padding: 6px 13px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
  color: #a9c8ff; font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.link-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
.link-btn:active { transform: translateY(1px); }

.speak-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 2px 0 14px;
}
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 20px; background: #2a3550; position: relative; transition: background 0.2s; flex: none; margin: 0; }
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #8a97b1; transition: left 0.2s, background 0.2s;
}
.switch input:checked { background: rgba(var(--accent-rgb), 0.65); }
.switch input:checked::after { left: 21px; background: #fff; }
.speak-tip { font-style: normal; font-size: 11.5px; color: var(--muted-2); }
.speak-row.off .speak-tip { color: #ffb661; }

/* ---------- 确认收到 ---------- */

.ack-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 2px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.ack-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.ack-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ack-wait { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
/* 美化：关闭方式下拉框，贴合主题 */
.ack-wait .select {
  height: 34px;
  width: auto;
  min-width: 176px;
  font-size: 12.5px;
  border-radius: 10px;
  background-image:
    linear-gradient(45deg, transparent 50%, #a5b8d8 50%),
    linear-gradient(135deg, #a5b8d8 50%, transparent 50%),
    linear-gradient(180deg, #17253f, #0c1729);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.ack-wait .select:hover:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12), 0 6px 20px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}
.ack-wait .select:active:not(:disabled) {
  transform: translateY(0);
  transition-duration: 0.1s;
}
.ack-wait .select:focus {
  border-color: rgba(var(--accent-rgb-2), 0.65);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  outline: none;
}
.ack-wait .select:disabled { opacity: 0.45; cursor: not-allowed; }
/* 停止播报按钮：放在关闭方式右侧 */
.ack-stop {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  border-radius: 10px;
  flex: none;
}
.ack-stop svg { width: 15px; height: 15px; }
.ack-tip { font-style: normal; font-size: 11.5px; color: var(--muted-2); }
/* 「同时语音播报」内联在 ack-top 中 */
.speak-inline { flex: none; }
.speak-inline.off { opacity: 0.6; }
@media (max-width: 640px) {
  .ack-row { gap: 10px; padding: 10px 12px; }
  .ack-top { justify-content: space-between; }
  .ack-bottom { gap: 8px; }
  .ack-wait { flex: 1; min-width: 0; }
  .ack-wait > span { display: none; }
  .ack-wait .select { width: 100%; min-width: 0; flex: 1; }
  .ack-stop { flex: none; }
}
@media (max-width: 380px) {
  .ack-row { gap: 8px; }
  .ack-row .switch span { font-size: 12px; }
  .ack-wait .select { font-size: 12px; padding-left: 10px; padding-right: 28px; background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
  .ack-stop { padding: 0 10px; font-size: 12px; }
}

.user-create {
  display: grid; grid-template-columns: 1fr 1fr 110px auto; gap: 8px;
  margin-bottom: 14px;
}
.user-create .input, .user-create .select { font-size: 13px; }
.user-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-soft);
}
.user-row .u-name { font-size: 13.5px; font-weight: 600; }
.user-row .u-meta { font-size: 11.5px; color: var(--muted-2); }
.user-row .u-badge {
  font-size: 10.5px; padding: 2px 7px; border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.14); color: #ff8f8f;
}
.user-row .u-badge.role-user { background: rgba(64, 150, 255, 0.14); color: #8ec2ff; }
.user-row .u-grow { flex: 1; min-width: 0; }
.user-row .btn { font-size: 11.5px; padding: 6px 10px; }
/* 桌面端：操作区透明，子元素仍是 .user-row 的直属 flex 项，排版与原来一致 */
.user-row .u-actions { display: contents; }

/* 手机端：用户卡片改为上下多行（昵称 / 信息 / 操作），桌面端不受影响 */
@media (max-width: 640px) {
  .user-row {
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 12px; border-radius: 12px;
  }
  .user-row .u-grow { flex: none; width: 100%; }
  .user-row .u-name {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 14px; line-height: 1.45;
  }
  .user-row .u-username { color: var(--muted-2); font-weight: 400; }
  .user-row .u-self-tag {
    font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
    background: rgba(var(--accent-rgb), 0.14); color: #ff9a9a; white-space: nowrap;
  }
  .user-row .u-meta { margin-top: 4px; line-height: 1.55; word-break: break-all; }
  .user-row .u-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
  .user-row .u-actions .u-badge { flex: none; }
  .user-row .u-actions .btn { flex: 1 1 auto; min-width: 82px; height: 34px; padding: 0 10px; font-size: 12px; }

  /* 自服务面板：输入框独占一行，按钮不挤压 */
  .self-row { flex-wrap: wrap; }
  .self-row .input { flex: 1 1 100%; min-width: 0; }
  .self-row .input.code { flex: 1 1 100%; max-width: none; }
  .self-panel > .btn { width: 100%; }
}

.device-owner { font-size: 10.5px; color: #8ec2ff; margin-left: 6px; }
.hw-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: var(--muted-2); }

@media (max-width: 840px) {
  .user-create { grid-template-columns: 1fr 1fr; }
  .user-create .btn { grid-column: span 2; }
  .user-chip { max-width: 120px; }
}
@media (max-width: 640px) {
  /* 绑定终端：手机端底部弹出整页 */
  #bindModal { place-items: end center; padding: 24px 0 0; }
  #bindModal .modal {
    width: 100%; max-width: none; margin: 0;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
  /* 触屏目标加大，符合拇指操作习惯 */
  .seg { height: 40px; padding: 0 17px; font-size: 13.5px; }
  .device-actions { gap: 4px; }
  .device-actions .btn { width: 34px; height: 34px; min-width: 34px; }
  .device-actions svg { width: 18px; height: 18px; }
  .h-actions .btn { width: 34px; height: 34px; min-width: 34px; }
  /* 发送目标：模式切换与默认按钮同一行，分组/终端选择器占满下一行 */
  .target-bar { display: flex; flex-wrap: wrap; align-items: center; }
  .target-bar .target-label { display: none; }
  .target-bar .segmented { order: 1; flex: 1 1 auto; width: auto; }
  .target-bar .segmented .seg { flex: 1; justify-content: center; padding: 0 6px; white-space: nowrap; }
  .target-bar .seg-tag { padding: 2px 4px; }
  #clearTargetDevices { order: 2; }
  .target-bar #targetGroup { order: 5; width: 100%; }
  .target-bar #targetDevices { order: 6; width: 100%; }
  .btn.shout.xl { height: 58px; font-size: 18px; letter-spacing: 4px; border-radius: 14px; }
  .btn.shout svg { width: 38px; height: 38px; padding: 8px; }
  .composer-foot.in-text { flex-direction: row; align-items: stretch; }
  .composer-foot.in-text .preview-btn { width: auto; flex: none; height: 58px; padding: 0 14px; }
  .modal-foot .btn { min-height: 46px; }
  .filters .search, .filters .select, .bind-sheet .input, .bind-sheet .select { min-height: 46px; }
  #pairCodeInput { font-size: 28px; }
}

/* ============ 大屏预览窗口 ============ */
.big-preview {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #f6f5f4;
  overflow: hidden;
  animation: bpFade 0.25s ease;
}
.big-preview.hidden { display: none !important; }
@keyframes bpFade { from { opacity: 0; } to { opacity: 1; } }

.bp-toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 99;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), transparent);
  color: #37352f; font-size: 13px;
}
.bp-label { font-weight: 700; letter-spacing: 2px; font-size: 12px; color: #5645d4; }
.bp-hint { flex: 1; color: #787671; font-size: 12.5px; }
.bp-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(15,15,15,0.18);
  background: rgba(255,255,255,0.85);
  color: #1a1a1a; cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.18s, border-color 0.18s;
}
.bp-close:hover { background: #ffffff; border-color: rgba(15,15,15,0.35); }
.bp-close svg { width: 18px; height: 18px; stroke-width: 2.2; }

/* stage 主体 */
.bp-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: clamp(80px, 11vh, 130px) clamp(24px, 6vw, 130px) clamp(70px, 10vh, 120px);
  font-family: var(--display-font, "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif);
}
.bp-stage-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 70% at 50% 40%, rgba(86, 69, 212, 0.08), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(246, 245, 244, 0.92));
  transition: background 0.4s;
  z-index: -1;
}
.bp-stage-top {
  position: absolute;
  top: clamp(76px, 10vh, 120px);
  left: clamp(24px, 6vw, 130px);
  right: clamp(24px, 6vw, 130px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.bp-live {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  border-radius: 22px;
  background: rgba(86, 69, 212, 0.08);
  border: 1px solid rgba(86, 69, 212, 0.25);
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 3px;
  color: #5645d4;
}
.bp-live i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5645d4;
  animation: bpLivePulse 1.1s ease-in-out infinite;
}
@keyframes bpLivePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(86, 69, 212, 0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 0 9px rgba(86, 69, 212, 0); }
}
.bp-stage-meta { font-size: clamp(11px, 0.9vw, 13px); color: #787671; letter-spacing: 1px; }

.bp-text-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.bp-shout-text {
  margin: 0;
  text-align: center;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: clamp(1px, 0.18vw, 3px);
  color: #1a1a1a;
  text-shadow: none;
  max-width: min(88vw, 1100px);
  max-height: 78vh;
  padding: clamp(28px, 4.5vh, 64px) clamp(32px, 5vw, 96px);
  border-radius: clamp(14px, 1.6vw, 24px);
  background: #ffffff;
  border: 1px solid #e5e3df;
  box-shadow: rgba(15, 15, 15, 0.2) 0 24px 48px -8px;
  word-break: break-word;
  overflow-wrap: anywhere;
  animation: bpTextIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes bpTextIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* 紧急样式 */
.bp-stage.urgent .bp-stage-bg {
  background:
    radial-gradient(80% 80% at 50% 45%, rgba(255, 55, 55, 0.35), transparent 62%),
    linear-gradient(180deg, #6d0c0c, #200305 70%, #170204);
}
.bp-stage.urgent .bp-shout-text {
  background: linear-gradient(180deg, rgba(90, 14, 14, 0.68), rgba(40, 6, 8, 0.76));
  border-color: rgba(255, 110, 110, 0.3);
  box-shadow: 0 28px 80px rgba(120, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.25), 0 4px 60px rgba(255, 30, 30, 0.6);
}
.bp-stage.urgent::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 10px solid rgba(255, 60, 60, 0.55);
  box-shadow: inset 0 0 80px rgba(255, 30, 30, 0.4);
  animation: bpUrgentBorder 1.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 8;
}
@keyframes bpUrgentBorder {
  0%, 100% { border-color: rgba(255, 60, 60, 0.3); }
  50% { border-color: rgba(255, 90, 60, 0.75); }
}
.bp-stage.urgent .bp-live { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.bp-stage.urgent .bp-live i { background: #fff; animation-name: bpUrgentLivePulse; }
@keyframes bpUrgentLivePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); }
}

/* 公告样式：天蓝便签卡 */
.bp-stage.notice .bp-stage-bg {
  background:
    radial-gradient(80% 80% at 50% 45%, rgba(0, 117, 222, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(238, 244, 252, 0.95));
}
.bp-stage.notice .bp-shout-text {
  background: #dcecfa;
  border-color: rgba(0, 117, 222, 0.28);
  box-shadow: rgba(15, 15, 15, 0.14) 0 16px 40px -8px;
  color: #0a2a52;
  text-shadow: none;
}
.bp-stage.notice .bp-live { background: rgba(0, 117, 222, 0.1); border-color: rgba(0, 117, 222, 0.28); color: #005bab; }
.bp-stage.notice .bp-live i { background: #0075de; }

/* 滚动字幕 */
.bp-stage.scroll-mode .bp-text-wrap { justify-content: flex-start; align-items: center; }
.bp-stage.scroll-mode .bp-shout-text {
  white-space: nowrap;
  max-width: none;
  max-height: none;
  text-align: left;
  animation: none;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  border-radius: 0;
  font-size: clamp(36px, 10vh, 120px);
  line-height: 1.2;
  color: #1a1a1a;
  text-shadow: none;
  will-change: transform;
}

/* 弹窗样式：Notion 亮黄横幅 */
.bp-stage.popup .bp-stage-bg {
  background:
    radial-gradient(120% 100% at 50% 50%, rgba(86, 69, 212, 0.08), rgba(246, 245, 244, 0.95));
}
.bp-stage.popup .bp-shout-text {
  background: #f9e79f;
  border: 2px solid rgba(221, 91, 0, 0.35);
  box-shadow: rgba(15, 15, 15, 0.14) 0 16px 40px -8px;
  color: #37352f;
  text-shadow: none;
}
.bp-stage.popup .bp-live {
  background: rgba(221, 91, 0, 0.1);
  border-color: rgba(221, 91, 0, 0.32);
  color: #793400;
}
.bp-stage.popup .bp-live i { background: #dd5b00; }

/* ====== 预览：作业布置 ====== */
.bp-stage.homework-mode .bp-stage-bg {
  background:
    radial-gradient(70% 60% at 18% 20%, rgba(86, 69, 212, 0.1), transparent 65%),
    radial-gradient(60% 50% at 85% 80%, rgba(0, 117, 222, 0.08), transparent 70%),
    linear-gradient(180deg, #fafaf9 0%, #f0efed 100%);
}
.bp-stage.homework-mode .bp-stage-meta {
  color: #793400; font-weight: 600; letter-spacing: 2px;
  font-size: clamp(14px, 2vw, 22px);
  text-shadow: none;
}
.bp-stage.homework-mode .bp-stage-source { color: #787671; font-size: 12px; }
.bp-stage.homework-mode .bp-shout-text.hw-text {
  all: unset;
  display: block;
  background: #ffffff;
  border: 1px solid #e5e3df;
  border-radius: 14px;
  padding: clamp(14px, 2.5vw, 28px) clamp(16px, 3vw, 34px);
  box-shadow: rgba(15, 15, 15, 0.2) 0 24px 48px -8px;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.bp-stage.homework-mode .hw-item {
  display: flex; align-items: flex-start;
  gap: clamp(8px, 1.2vw, 14px);
  padding: clamp(6px, 0.8vw, 12px) 0;
  border-bottom: 1px dashed #ede9e4;
  color: #37352f;
  font-size: clamp(13px, 1.6vw, 20px);
  line-height: 1.65;
}
.bp-stage.homework-mode .hw-item:last-child { border-bottom: none; }
.bp-stage.homework-mode .hw-dot {
  flex: 0 0 auto;
  width: clamp(20px, 2.2vw, 30px);
  height: clamp(20px, 2.2vw, 30px);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(10px, 1.1vw, 14px); font-weight: 700;
  color: #0a1128;
  background: linear-gradient(135deg, #ffb547, #ff8a3a);
  box-shadow: 0 4px 14px rgba(255, 150, 70, 0.4);
  margin-top: 2px;
}
.bp-stage.homework-mode .hw-line { flex: 1; }
.bp-stage.homework-mode .bp-live { background: rgba(221, 91, 0, 0.1); border-color: rgba(221, 91, 0, 0.3); color: #793400; }

/* 语音喊话卡片 */
.bp-voice-card {
  position: absolute;
  left: 50%;
  bottom: clamp(90px, 15vh, 180px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.6vw, 22px);
  padding: clamp(14px, 1.8vh, 22px) clamp(20px, 2.4vw, 34px);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e5e3df;
  box-shadow: rgba(15, 15, 15, 0.2) 0 24px 48px -8px;
  max-width: min(760px, 88vw);
  animation: bpCardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  z-index: 9;
}
@keyframes bpCardIn {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.bp-voice-icon {
  width: clamp(44px, 5vh, 58px);
  height: clamp(44px, 5vh, 58px);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #5645d4;
  background: rgba(86, 69, 212, 0.08);
  border: 1px solid rgba(86, 69, 212, 0.25);
}
.bp-voice-icon svg { width: 55%; height: 55%; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bp-voice-body { min-width: 0; }
.bp-voice-title {
  font-size: clamp(16px, 1.7vw, 24px);
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.bp-voice-sub { font-size: clamp(10px, 0.9vw, 12px); color: #787671; letter-spacing: 2px; margin-top: 3px; }
.bp-eq { display: flex; align-items: center; gap: 4px; height: 30px; margin-left: auto; flex: none; }
.bp-eq i {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #7b3ff2, #5645d4);
  animation: bpEqBar 0.9s ease-in-out infinite;
}
.bp-eq i:nth-child(1) { animation-delay: 0.05s; }
.bp-eq i:nth-child(2) { animation-delay: 0.28s; }
.bp-eq i:nth-child(3) { animation-delay: 0.12s; }
.bp-eq i:nth-child(4) { animation-delay: 0.4s; }
.bp-eq i:nth-child(5) { animation-delay: 0.2s; }
.bp-eq i:nth-child(6) { animation-delay: 0.33s; }
.bp-eq i:nth-child(7) { animation-delay: 0.08s; }
@keyframes bpEqBar {
  0%, 100% { height: 7px; opacity: 0.55; }
  50% { height: 28px; opacity: 1; }
}

/* 进度条 */
.bp-stage-bottom {
  position: absolute;
  left: clamp(24px, 6vw, 130px);
  right: clamp(24px, 6vw, 130px);
  bottom: clamp(30px, 5vh, 54px);
  z-index: 6;
}
.bp-progress {
  height: 3px;
  border-radius: 4px;
  background: rgba(15, 15, 15, 0.08);
  overflow: hidden;
}
.bp-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: #5645d4;
  transition: width 0.5s linear;
}
.bp-stage-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: clamp(10px, 0.8vw, 12px);
  color: #a4a097;
  letter-spacing: 1px;
}

/* 确认收到 */
.bp-stage.ack-mode .bp-progress { opacity: 0; }
.bp-stage.ack-mode .bp-text-wrap {
  position: absolute;
  left: clamp(24px, 6vw, 130px);
  right: clamp(24px, 6vw, 130px);
  top: clamp(80px, 11vh, 130px);
  bottom: calc(clamp(48px, 6vh, 78px) + 110px);
  width: auto;
  height: auto;
}

.bp-ack-layer {
  position: absolute;
  left: 50%;
  bottom: clamp(48px, 6vh, 78px);
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(9px, 1.1vh, 14px) clamp(12px, 1.4vw, 20px);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e5e3df;
  box-shadow: rgba(15, 15, 15, 0.14) 0 16px 40px -8px;
  animation: bpAckRise 0.45s ease both;
}
@keyframes bpAckRise { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

.bp-ack-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: clamp(150px, 15vw, 230px);
  height: clamp(42px, 5vh, 60px);
  padding: 0 clamp(16px, 2vw, 28px);
  border-radius: 10px;
  border: 1px solid rgba(15, 15, 15, 0.08);
  background: #1aae39;
  color: #fff;
  font-size: clamp(13px, 1.4vw, 18px);
  font-weight: 700;
  letter-spacing: 2px;
  box-shadow: 0 4px 12px rgba(15, 15, 15, 0.1);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, opacity 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: inherit;
}
.bp-ack-btn svg { width: clamp(16px, 1.5vw, 22px); height: clamp(16px, 1.5vw, 22px); stroke-width: 2.2; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.bp-ack-btn:hover { background: #0f8f2e; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(26, 174, 57, 0.3); }
.bp-ack-btn:active { transform: translateY(1px) scale(0.985); }
.bp-ack-btn:disabled { cursor: default; opacity: 0.55; }
.bp-ack-btn.confirmed {
  background: #0075de;
  box-shadow: 0 4px 12px rgba(15, 15, 15, 0.1);
}
.bp-ack-countdown {
  margin-top: 2px;
  font-size: clamp(11px, 1.1vw, 13px);
  color: #793400;
  letter-spacing: 1px;
  font-weight: 500;
  white-space: nowrap;
}
.bp-ack-countdown.hidden { display: none !important; }
@media (max-width: 760px) {
  .bp-ack-layer { bottom: 78px; width: calc(100% - 40px); padding: 10px; }
  .bp-stage.ack-mode .bp-text-wrap { bottom: calc(78px + 108px); }
  .bp-ack-btn { width: auto; max-width: 320px; margin: 0 auto; height: 50px; font-size: 16px; letter-spacing: 3px; border-radius: 999px; padding: 0 24px; }
}
.bp-ack-layer.hidden,
.bp-text-wrap.hidden,
.bp-voice-card.hidden { display: none !important; }
.bp-stage.hidden { display: none !important; }

/* ---------- bigPreview 里的作业卡片（banner + 学科 tag + 毛玻璃） ---------- */
/* 隐藏顶部 live/meta/source 栏 —— 作业卡片自己就是主体 */
.bp-stage.homework-mode .bp-stage-top { display: none !important; }
.bp-stage.homework-mode .bp-stage-bottom { display: none !important; }

/* text-wrap 变成 flex column 容器 */
.bp-stage.homework-mode .bp-text-wrap {
  display: flex; flex-direction: column;
  gap: 12px; padding: 16px;
  overflow-y: auto;
}

/* banner */
#bigPreview .hw-banner { display: flex; align-items: baseline; gap: 14px; }
#bigPreview .hw-banner-title {
  font-size: clamp(20px, 3vw, 40px); font-weight: 700;
  background: linear-gradient(135deg, #3a2a99 0%, #5645d4 60%, #7b3ff2 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 2px;
}
#bigPreview .hw-banner-date { font-size: clamp(12px, 1.6vw, 18px); color: #787671; }

/* 白底作业卡 */
#bigPreview .hw-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e5e3df;
  border-radius: 16px;
  padding: clamp(12px, 1.4vw, 20px) clamp(14px, 1.8vw, 24px);
  box-shadow: rgba(15, 15, 15, 0.12) 0 12px 32px -8px;
  display: flex; flex-direction: column;
  max-width: 96%; width: min(720px, 96%); margin: 0 auto;
}
#bigPreview .hw-card-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid #ede9e4;
}
#bigPreview .hw-subject-tag {
  font-size: clamp(12px, 1.6vw, 16px);
  padding: 3px 12px; border-radius: 6px;
  font-weight: 600; color: #fff;
}
/* 学科颜色 */
#bigPreview .hw-subject-tag.s-语文 { background: linear-gradient(135deg, #e53935, #b71c1c); }
#bigPreview .hw-subject-tag.s-数学 { background: linear-gradient(135deg, #1e88e5, #0d47a1); }
#bigPreview .hw-subject-tag.s-英语 { background: linear-gradient(135deg, #43a047, #1b5e20); }
#bigPreview .hw-subject-tag.s-物理 { background: linear-gradient(135deg, #8e24aa, #4a148c); }
#bigPreview .hw-subject-tag.s-化学 { background: linear-gradient(135deg, #fb8c00, #e65100); }
#bigPreview .hw-subject-tag.s-生物 { background: linear-gradient(135deg, #00acc1, #006064); }
#bigPreview .hw-subject-tag.s-历史 { background: linear-gradient(135deg, #6d4c41, #3e2723); }
#bigPreview .hw-subject-tag.s-地理 { background: linear-gradient(135deg, #546e7a, #263238); }
#bigPreview .hw-subject-tag.s-政治 { background: linear-gradient(135deg, #d81b60, #880e4f); }
#bigPreview .hw-subject-tag.s-综合实践 { background: linear-gradient(135deg, #5c6bc0, #283593); }
#bigPreview .hw-subject-tag.s-default { background: linear-gradient(135deg, #7c4dff, #512da8); }

/* 卡片正文 */
#bigPreview .hw-card-body { display: flex; flex-direction: column; gap: 6px; }
#bigPreview .hw-card-body .hw-item {
  display: flex; align-items: flex-start;
  color: #37352f;
  font-size: clamp(14px, 1.8vw, 22px);
  line-height: 1.65; font-weight: 400;
  padding: 4px 0;
}

/* 窄屏：三个入口收紧间距，保持单行不折字 */
@media (max-width: 560px) {
  .tab { height: 36px; padding: 0 11px; gap: 5px; font-size: 13px; }
  .tab svg { width: 15px; height: 15px; }
}
@media (max-width: 380px) {
  .tab { padding: 0 8px; gap: 4px; font-size: 12.5px; }
}

/* 明亮主题：指定终端、常用语、记录状态统一提高可读性 */
:root[data-theme^="light"] .dev-check {
  color: #2f3b4d; border-color: rgba(15, 23, 42, 0.16); background: rgba(15, 23, 42, 0.035);
}
:root[data-theme^="light"] .dev-check:hover { color: var(--text); background: rgba(15, 23, 42, 0.07); }
:root[data-theme^="light"] .dev-check.on { color: #0f6b4a; border-color: rgba(16, 150, 105, 0.5); background: rgba(16, 150, 105, 0.12); }
:root[data-theme^="light"] .dev-check.offline { color: #7a8598; border-color: rgba(15, 23, 42, 0.12); }
:root[data-theme^="light"] .dev-check.offline::after { color: #7a8598; border-color: rgba(15, 23, 42, 0.14); }
:root[data-theme^="light"] .quick-chip {
  color: #2f3b4d; border-color: rgba(15, 23, 42, 0.18); background: rgba(15, 23, 42, 0.05);
}
:root[data-theme^="light"] .quick-chip:hover { color: var(--text); background: rgba(var(--accent-rgb), 0.1); }
:root[data-theme^="light"] .ack-tag { color: #3d4a5f; border-color: rgba(15, 23, 42, 0.2); background: rgba(15, 23, 42, 0.05); }
:root[data-theme^="light"] .ack-tag.ok { color: #0f6b4a; border-color: rgba(16, 150, 105, 0.45); background: rgba(16, 150, 105, 0.1); }
:root[data-theme^="light"] .ack-tag.warn { color: #a33b12; border-color: rgba(214, 110, 60, 0.45); background: rgba(214, 110, 60, 0.1); }
:root[data-theme^="light"] .h-meta { color: #5b6880; }
