:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #e8f0fe;
  --accent-2: #0ea5e9;
  --done: #16a34a;
  --done-soft: #dcfce7;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}

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

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; color: var(--accent); }
.search { flex: 1; max-width: 320px; }
.search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--surface-2);
}
.search input:focus { border-color: var(--accent); background: #fff; }
.filters { display: flex; gap: 6px; }
.filters button {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: all .15s;
}
.filters button:hover { border-color: var(--accent); color: var(--accent); }
.filters button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.progress { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* 移动端课单抽屉（桌面隐藏，≤820px 显示） */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 19px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text);
  touch-action: manipulation;
}
.menu-btn:active { background: var(--accent-soft); }
.drawer-backdrop { display: none; }

/* ---------- Layout ---------- */
main { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}
#lessonList { list-style: none; margin: 0; padding: 8px; }
#lessonList li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .12s;
}
#lessonList li:hover { background: var(--surface-2); }
#lessonList li.active { background: var(--accent-soft); }
#lessonList li .lid { font-weight: 600; font-variant-numeric: tabular-nums; }
#lessonList li .ltag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--muted);
}
#lessonList li .doc-dot {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
#lessonList li.done .lid::after { content: " ✓"; color: var(--done); }
.list-empty { padding: 24px; text-align: center; color: var(--muted); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  /* 给底部悬浮播放条留出空间，避免遮挡内容 */
  padding-bottom: 92px;
}
.empty { color: var(--muted); font-size: 16px; padding: 80px 0; text-align: center; }

/* ---------- Lesson head ---------- */
.lesson-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lesson-head h1 { margin: 0 0 6px; font-size: 22px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.green { background: var(--done-soft); color: var(--done); }
.head-actions { display: flex; gap: 8px; }
.btn-ghost {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-complete {
  padding: 8px 14px;
  border: 1px solid var(--done);
  background: var(--surface);
  color: var(--done);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn-complete.on { background: var(--done); color: #fff; }

/* ---------- Player ---------- */
.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.track-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.track-tabs button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.track-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.track-tabs button .dur { font-weight: 400; font-size: 12px; opacity: .8; margin-left: 6px; }

/* ---------- 底部悬浮播放控制条 ---------- */
.player-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(16, 24, 40, .12);
  padding: 10px 18px;
}
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.play-btn:hover { background: #1d4ed8; }
.time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.seek { flex: 1 1 120px; min-width: 80px; accent-color: var(--accent); cursor: pointer; }
#speed {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
}
.btn-ab {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.btn-ab.active { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.ab-state { font-size: 12px; color: #b45309; min-width: 70px; }

/* ---------- 循环 / 定时控制 ---------- */
#loopBtn.active, #sleepBtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#sleepState.ticking { color: #b45309; font-variant-numeric: tabular-nums; }
.sleep-panel {
  position: absolute;
  right: 18px;
  bottom: 62px;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(16, 24, 40, .18);
  padding: 14px;
  width: 320px;
  max-width: calc(100vw - 24px);
}
.sleep-panel .sleep-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.sleep-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sleep-chips button {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.sleep-chips button:hover { border-color: var(--accent); color: var(--accent); }
.sleep-custom { display: flex; gap: 8px; align-items: center; }
.sleep-custom input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.sleep-start {
  padding: 7px 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.sleep-start:hover { background: #1d4ed8; }
.sleep-cancel {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.sleep-cancel:hover { color: #dc2626; border-color: #dc2626; }

/* ---------- 轻量提示 toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  text-align: center;
}
#toast.show { opacity: 1; }

/* ---------- Tabs & panels ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button {
  padding: 10px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.panel { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.hidden { display: none !important; }

/* subtitle */
.sub-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.cue {
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.6;
  border-left: 3px solid transparent;
  transition: background .1s;
  white-space: pre-wrap;
}
.cue:hover { background: var(--surface-2); }
.cue .ct { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 10px; }
.cue.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* transcript */
#transcriptPanel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  line-height: 1.85;
  white-space: pre-wrap;
  font-size: 15px;
  box-shadow: var(--shadow);
}

/* pdf */
.pdf-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.pdf-toolbar a { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
.pdf-toolbar a:hover { text-decoration: underline; }
.pdf-hint { font-size: 12px; color: var(--muted); }
#pdfFrame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.panel-note { color: var(--muted); padding: 30px; text-align: center; }

/* scrollbars */
.sidebar::-webkit-scrollbar, .content::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 4px;
}

/* responsive */
@media (max-width: 820px) {
  body { height: 100dvh; }
  .menu-btn { display: inline-flex; }
  main { flex-direction: column; }

  /* 课单抽屉：左侧滑出 + 遮罩 */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 85vw);
    height: 100%;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 0 6px 30px rgba(16, 24, 40, .28);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform .25s ease;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 55;
  }

  /* 顶栏换行 + 触控热区 */
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .filters { flex-wrap: wrap; }
  .filters button { padding: 10px 14px; min-height: 42px; }
  #speed, .btn-ab { min-height: 42px; }
  .btn-ghost, .btn-complete { padding: 11px 15px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs button { padding: 12px 16px; white-space: nowrap; }
  .track-tabs button { padding: 10px 16px; }
  .play-btn { width: 54px; height: 54px; font-size: 20px; }
  .seek { height: 36px; }
  #lessonList li { padding: 13px 14px; }
  .content { padding: 14px; padding-bottom: 100px; }
  .cue { padding: 12px 14px; }
  .word { touch-action: manipulation; }

  /* 底部悬浮播放条：窄屏紧凑布局 */
  .player-bar { padding: 8px 10px; }
  .player-bar .time { min-width: 36px; font-size: 12px; }
  .player-bar .controls { gap: 8px; }
  .player-bar .ab-state { min-width: 0; }
}

/* ---------- 顶部：主题切换 ---------- */
.theme-btn {
  margin-left: 4px;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  cursor: pointer;
  font-size: 17px;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--accent); }

/* ---------- 单词高亮 ---------- */
.word {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background .1s;
}
.word:hover { background: rgba(37, 99, 235, .12); }
.word.vocab {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
}
.word.vocab:hover { background: var(--accent-soft); }

/* ---------- 生词释义弹窗 ---------- */
.word-popup {
  position: absolute;
  z-index: 1000;
  max-width: 320px;
  min-width: 160px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, .18);
  padding: 12px 14px;
  font-size: 14px;
  display: none;
}
.word-popup.show { display: block; }
.wp-word { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.wp-def { line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.wp-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.wp-input {
  width: 100%;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
}
.wp-input:focus { border-color: var(--accent); }
.wp-actions { display: flex; gap: 8px; margin-top: 8px; }
.wp-actions button {
  flex: 1;
  padding: 7px;
  border-radius: 7px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.wp-actions #wpSave { background: var(--accent); color: #fff; border-color: var(--accent); }
.wp-actions #wpCancel { background: var(--surface-2); }
.wp-example {
  margin-top: 6px;
  padding: 6px 9px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent-2);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
}
.wp-dict { margin-top: 6px; line-height: 1.6; word-break: break-word; }
.wp-dict .wp-phon { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.wp-mean { padding: 3px 0; }
.wp-pos {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 6px;
}
.wp-dex { color: var(--muted); font-style: italic; font-size: 12.5px; }
.wp-loading { color: var(--muted); font-size: 13px; }
.wp-note { color: var(--muted); font-size: 13px; font-style: italic; }
.wp-sug { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.wp-sug-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.wp-sug-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 词典标签页（学习词典 / 大学词典 / 英汉词典） */
.wp-dict-tabs {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
}
.wp-dict-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 5px 4px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
}
.wp-dict-tab:hover { color: var(--accent); }
.wp-dict-tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1);
}
.wp-dict-body { margin-top: 8px; }
.wp-manual {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 6px 9px;
  margin-bottom: 6px;
  word-break: break-word;
}
/* ECDICT 离线英汉词典 */
.wp-en { margin-top: 8px; font-size: 13px; line-height: 1.8; }
.wp-en-label { font-weight: 600; color: var(--accent); margin-right: 6px; }
.wp-en-line {
  border-left: 2px solid var(--border);
  padding-left: 8px;
  margin: 2px 0 2px 4px;
  color: var(--muted);
}
.wp-chips { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.wp-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.wp-exch { margin-top: 8px; font-size: 13px; line-height: 1.9; }

/* ---------- 生词本面板 ---------- */
.vocab-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.vocab-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.vt-btn {
  padding: 7px 13px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.vt-btn:hover:not(:disabled) { background: var(--accent-soft); }
.vt-btn:disabled { opacity: .45; cursor: not-allowed; }
.vt-hint { font-size: 12px; color: var(--muted); }
.vocab-list { list-style: none; margin: 0; padding: 0; }
.vocab-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--surface);
}
.vi-word { font-weight: 700; min-width: 90px; color: var(--accent); flex-shrink: 0; }
.vi-body { flex: 1; min-width: 0; }
.vi-def {
  line-height: 1.55;
  outline: none;
  border-radius: 6px;
  padding: 2px 4px;
  min-height: 22px;
}
.vi-def:focus { background: var(--surface-2); }
.vi-example {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
  word-break: break-word;
}
.vi-example-clickable {
  cursor: pointer;
  transition: background .12s, color .12s;
  padding: 3px 6px;
  border-radius: 6px;
  margin-left: -6px;
  margin-right: -6px;
}
.vi-example-clickable:hover { background: var(--accent-soft); color: var(--accent); }
.vi-play {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0 8px;
  vertical-align: 1px;
}
.vocab-search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.vocab-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.vocab-lesson-filter {
  flex: 0 0 auto;
  max-width: 45%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  cursor: pointer;
}
.vocab-search:focus, .vocab-lesson-filter:focus { border-color: var(--accent); background: var(--surface); }
.vi-lesson { margin-top: 2px; font-size: 11px; color: var(--muted); }
.vi-del {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}
.vi-del:hover { color: #dc2626; }

/* ---------- 夜间模式 ---------- */
:root[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a212b;
  --surface-2: #232c38;
  --border: #2e3947;
  --text: #e6edf3;
  --muted: #93a1b0;
  --accent: #4f9bff;
  --accent-soft: #1e3656;
  --accent-2: #38bdf8;
  --done: #34d399;
  --done-soft: #143a2e;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .3);
}
:root[data-theme="dark"] #pdfFrame { background: #11161d; }
:root[data-theme="dark"] .word:hover { background: rgba(79, 155, 255, .18); }
:root[data-theme="dark"] .sub-note {
  background: #3a2f12; border-color: #6b5410; color: #f0c674;
}

/* ---------- 多用户：登录 / 管理后台 ---------- */
.userbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  white-space: nowrap;
}
.ub-user {
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}
.ub-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}
.ub-btn:hover { border-color: var(--accent); color: var(--accent); }
.ub-role {
  font-size: 11px;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* 登录 / 后台 模态 */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.auth-card {
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-brand { font-weight: 700; font-size: 18px; color: var(--accent); text-align: center; }
.auth-sub { font-size: 13px; color: var(--muted); margin: 0; text-align: center; line-height: 1.5; }
.auth-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-err { min-height: 18px; font-size: 13px; color: #dc2626; text-align: center; }

/* 管理后台卡片 */
.admin-card {
  width: 720px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.admin-head { display: flex; align-items: center; justify-content: space-between; }
.admin-tabs { display: flex; gap: 8px; }
.atab {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
}
.atab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-body { display: flex; flex-direction: column; gap: 12px; }
.ub-add { display: flex; gap: 8px; flex-wrap: wrap; }
.ub-add .auth-input { flex: 1; min-width: 140px; }
.ub-add .auth-btn { width: auto; flex-shrink: 0; }
.ub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ub-table th, .ub-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.ub-table th { color: var(--muted); font-weight: 600; }
.ub-table tr:hover td { background: var(--surface-2); }
.ub-ops { display: flex; gap: 6px; }
.ub-ops button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
}
.ub-ops button:hover { border-color: var(--accent); color: var(--accent); }
.ub-ops button.ub-danger:hover { border-color: #dc2626; color: #dc2626; }
.ub-hint { font-size: 12px; color: var(--muted); }
.ub-empty { color: var(--muted); text-align: center; padding: 20px; }
