:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warn: #b45309;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

.boot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--muted);
  font-size: 15px;
}

/* ---------------- 登录 / 注册 ---------------- */

.auth-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6fa 45%, #f8fafc 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.auth-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.auth-title { font-size: 20px; font-weight: 700; margin: 0; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 6px 0 22px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.auth-tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

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

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

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .3px; }

.topbar-nav { display: flex; gap: 4px; }

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
}
.nav-link:hover { background: var(--surface-soft); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-info { color: var(--muted); font-size: 13px; }
.user-info strong { color: var(--text-soft); font-weight: 600; }

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--text); }

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

.app-body { flex: 1; display: flex; align-items: stretch; min-height: 0; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

.side-section + .side-section { margin-top: 22px; }

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .6px;
  padding: 0 8px;
  margin-bottom: 8px;
}

.side-title button {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 0 2px;
}
.side-title button:hover { color: var(--primary-dark); }

.side-list { display: flex; flex-direction: column; gap: 2px; }

.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.side-item:hover { background: var(--surface-soft); }
.side-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .count {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
}
.side-item.active .count { background: #fff; color: var(--primary); border-color: #bfdbfe; }
.side-item .del { opacity: 0; color: var(--muted); font-size: 15px; padding: 0 2px; }
.side-item:hover .del { opacity: 1; }
.side-item .del:hover { color: var(--danger); }

.side-empty { color: var(--muted); font-size: 13px; padding: 4px 10px; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

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

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-desc { color: var(--muted); font-size: 13px; margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 18px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.field { display: flex; flex-direction: column; gap: 4px; }
/* 用 display:flex 的 .field 必须显式支持 hidden 属性（否则会覆盖 UA 的 [hidden]{display:none}，导致应隐藏的字段仍显示） */
.field[hidden] { display: none; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; }

input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
select { cursor: pointer; }
input.invalid, textarea.invalid, select.invalid { border-color: var(--danger); }

.btn {
  font-family: inherit;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-soft); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  border-radius: 999px;
  padding: 1px 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}
.badge.gray { background: var(--surface-soft); color: var(--muted); border-color: var(--border); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .empty-icon { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }

.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

/* ---------------- 课程卡片 ---------------- */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.course-card:hover { box-shadow: var(--shadow-md); border-color: #bfdbfe; transform: translateY(-1px); }
.course-card h3 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.45; }
.course-card .desc {
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
}
.course-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data tbody tr:hover { background: #fafcff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { white-space: nowrap; text-align: right; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.pagination .pages { display: flex; gap: 6px; align-items: center; }
.page-btn {
  min-width: 32px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-soft);
}
.page-btn:hover:not(:disabled) { background: var(--surface-soft); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 详情 ---------------- */

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.info-list { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 14px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; color: var(--text-soft); word-break: break-all; }

.content-block {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  line-height: 1.8;
  font-size: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 16px; margin: 0; font-weight: 700; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--primary); }

/* ---------------- 表单 ---------------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* 标签输入 */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  min-height: 36px;
  background: var(--surface);
  cursor: text;
}
.tags-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.tags-input input {
  border: 0;
  outline: none;
  flex: 1;
  min-width: 120px;
  padding: 2px 0;
  box-shadow: none !important;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 1px 6px 1px 10px;
  font-size: 13px;
}
.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: .7;
}
.chip button:hover { opacity: 1; }

/* 附件 */
.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.dropzone strong { color: var(--primary); }

.att-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--surface);
}
.att-item .att-icon { font-size: 16px; }
.att-item .att-name { font-weight: 600; word-break: break-all; }
.att-item .att-meta { color: var(--muted); font-size: 12px; }
.att-item .att-ops { margin-left: auto; display: flex; gap: 6px; }
.att-item.uploading { opacity: .7; }

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

.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 460px;
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- 模态框 ---------------- */

.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 150;
}
.modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .modal-desc { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* ============================================================
   演示文稿 / 放映 子系统样式
   此前这些 class 在 styles.css 中完全缺失，导致编辑器与放映页只剩
   裸文本。以下全部复用 :root 设计变量，未引入新的硬编码色值；
   幻灯片四套主题配色为「内容色」，按需求显式定义于 .theme-* 局部变量。
   ============================================================ */

/* ---------- 编辑器骨架 ---------- */
.deck-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.deck-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.deck-toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.deck-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deck-title-input {
  flex: 1; min-width: 140px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit; font-size: 16px; font-weight: 600; color: var(--text);
  padding: 6px 8px; border-radius: var(--radius-sm);
}
.deck-title-input:hover { border-color: var(--border); }
.deck-title-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.deck-select { font-size: 13px; padding: 5px 8px; max-width: 220px; }
.deck-select:focus { border-color: var(--primary); outline: none; }
.dirty-dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  animation: dirty-pulse 1.4s ease-in-out infinite;
}
@keyframes dirty-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.deck-body { display: flex; gap: 0; flex: 1; min-height: 0; }
.deck-thumbs {
  width: 220px; flex: 0 0 220px;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-soft);
  border-right: 1px solid var(--border);
}
.deck-thumbs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .6px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.deck-thumbs-list {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.thumb-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 6px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.thumb-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.thumb-item.active { border-color: var(--primary); background: var(--primary-soft); }
.thumb-no { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.thumb-canvas { border-radius: 4px; overflow: hidden; background: var(--surface); pointer-events: none; }
.thumb-title {
  font-size: 12px; color: var(--text-soft); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-ops { display: flex; gap: 4px; margin-top: 6px; }
.thumb-ops button {
  flex: 1; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); font-size: 13px; line-height: 1; padding: 3px 0;
  cursor: pointer; color: var(--text-soft);
}
.thumb-ops button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.thumb-ops button:disabled { opacity: .4; cursor: not-allowed; }

.deck-stage { flex: 1; min-width: 0; overflow: auto; padding: 24px; }
.deck-stage-inner { width: 100%; max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.deck-preview { display: flex; justify-content: center; }

/* ---------- 幻灯片画布（缩略图与舞台共用同一结构，字号用 cqw 自适应） ---------- */
.slide-canvas {
  position: relative;
  width: 100%; max-width: 960px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  background: var(--slide-bg, #ffffff);
  color: var(--slide-fg, #0f172a);
  container-type: inline-size;
}
.slide-inner {
  position: absolute; inset: 0;
  padding: 6cqw 7cqw;
  display: flex; flex-direction: column; justify-content: center; gap: 2cqw;
}
.s-title { font-size: 7cqw; font-weight: 800; line-height: 1.15; color: var(--slide-fg); }
.s-sub { font-size: 3.4cqw; color: var(--slide-sub); margin-top: 1cqw; }
.s-heading { font-size: 5cqw; font-weight: 700; line-height: 1.2; color: var(--slide-fg); margin: 0 0 1cqw; }
.s-body { font-size: 3.2cqw; line-height: 1.6; color: var(--slide-fg); }
.s-bullets { margin: 0; padding-left: 5cqw; display: flex; flex-direction: column; gap: 1.2cqw; }
.s-bullets li { font-size: 3.4cqw; line-height: 1.5; color: var(--slide-fg); }
.s-bullets li::marker { color: var(--slide-accent); }
.s-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; }
.s-col { font-size: 3.2cqw; line-height: 1.6; color: var(--slide-fg); }
.s-figure { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; align-items: center; }
.s-image { width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: color-mix(in srgb, var(--slide-fg) 5%, transparent); }
.s-image-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 28cqw; border: 1px dashed var(--slide-sub); border-radius: 6px;
  color: var(--slide-sub); font-size: 3cqw; text-align: center;
}
.s-figure-text { font-size: 3.2cqw; line-height: 1.6; color: var(--slide-fg); }
.s-quote {
  font-size: 5cqw; line-height: 1.4; font-style: italic; color: var(--slide-fg);
  border-left: 0.8cqw solid var(--slide-accent); padding-left: 3cqw;
}
.s-quote-by { font-size: 3.2cqw; color: var(--slide-sub); margin-top: 1.5cqw; text-align: right; }
.s-section-title { font-size: 7cqw; font-weight: 800; color: var(--slide-fg); }
.s-section-sub { font-size: 3.4cqw; color: var(--slide-sub); margin-top: 1cqw; }
.s-placeholder { color: var(--slide-sub); opacity: .7; }

/* 封面（title）版式：大标题 + 副标题水平垂直居中（与 PPTX 导出封面一致；不影响其它版式） */
.slide-inner.layout-title { align-items: center; text-align: center; }
.slide-inner.layout-title .s-title { max-width: 100%; overflow-wrap: break-word; line-height: 1.2; }
.slide-inner.layout-title .s-sub { max-width: 82%; margin-top: 0.4cqw; }
.slide-inner.layout-title .s-bullets { list-style-position: inside; padding-left: 0; }

/* 四套主题：仅定义局部变量，画布内部统一引用，新增主题只需加一行 */
.theme-default { --slide-bg: #ffffff; --slide-fg: #0f172a; --slide-sub: #475569; --slide-accent: #2563eb; }
.theme-blue    { --slide-bg: #0b1f4d; --slide-fg: #e8efff; --slide-sub: #9bb6e8; --slide-accent: #60a5fa; }
.theme-dark    { --slide-bg: #0b0f1a; --slide-fg: #e5e7eb; --slide-sub: #94a3b8; --slide-accent: #818cf8; }
.theme-green   { --slide-bg: #062b1f; --slide-fg: #e6f7ef; --slide-sub: #9fd9c2; --slide-accent: #34d399; }

/* ---------- 编辑器右侧表单辅助 ---------- */
.layout-group { display: flex; flex-wrap: wrap; gap: 6px; }
.bullet-row { display: flex; align-items: center; gap: 8px; }
.bullet-row input { flex: 1; }
.deck-image-field { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.deck-image-body { display: flex; flex-direction: column; gap: 6px; min-width: 200px; flex: 1; }
.deck-image-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); flex: 0 0 auto; }
.deck-image-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.deck-img-hint { line-height: 1.5; }

/* ============================================================
   浮动配图图层（slide.imageStyle 归一几何；预览/缩略图/放映共用）
   ============================================================ */
.slide-img {
  position: absolute;
  z-index: 4;
  overflow: visible;
}
.slide-img-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2px;
}
.slide-img-el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform-origin: 50% 50%;
  transform: scale(1);
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
/* 图文版式启用浮动后，文字居左，宽度留给右侧图片 */
.s-float-caption {
  width: 48%;
  font-size: 3.2cqw;
  line-height: 1.6;
  color: var(--slide-fg);
}
.s-float-caption .s-bullets { padding-left: 4cqw; }
.s-float-caption .s-bullets li { font-size: 3.2cqw; }

/* ============================================================
   编辑器浮动图片交互层（仅 #dePreview，放映/缩略图不受影响）
   ============================================================ */
.deck-preview-box .slide-canvas { cursor: default; }
.deck-preview-box .slide-img { cursor: move; touch-action: none; }

.img-edit-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  touch-action: none;
}
.img-edit-overlay * { touch-action: none; }

.img-box-outline {
  position: absolute;
  border: 1.5px solid var(--primary);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9);
  pointer-events: none;
}
.img-hnd {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 3px;
  box-sizing: border-box;
  pointer-events: auto;
}
.img-hnd.box:hover { background: var(--primary-soft); }
.img-move-cue {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

.crop-shade {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .38);
  pointer-events: auto;
  cursor: default;
}
.crop-rect {
  position: absolute;
  border: 2px solid #fff;
  outline: 1px solid var(--primary);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .38);
  cursor: move;
  pointer-events: auto;
}
.img-hnd.crop { cursor: crosshair; }
.crop-tip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

body.gesture-active { user-select: none; -webkit-user-select: none; cursor: grabbing; }

/* ---------- 放映模式（必须 fixed 全屏，层级高于 modal） ---------- */
.presenter {
  position: fixed; inset: 0; z-index: 300;
  background: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.presenter-stage {
  flex: 1; width: 100%; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.presenter-canvas { width: 100%; max-width: 1100px; margin: 0 auto; }
.presenter-canvas .slide-canvas { max-width: 100%; box-shadow: var(--shadow-lg); }
.presenter-notes { color: color-mix(in srgb, var(--surface) 82%, transparent); font-size: 14px; text-align: center; max-width: 820px; }
.presenter-page { position: absolute; top: 16px; right: 20px; color: var(--surface); font-size: 13px; opacity: .7; }
.presenter-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--surface) 18%, transparent);
  color: var(--surface); font-size: 24px; cursor: pointer; opacity: .5;
  transition: opacity .15s;
}
.presenter-nav:hover { opacity: 1; }
.presenter-nav.prev { left: 16px; }
.presenter-nav.next { right: 16px; }
.presenter-close {
  position: absolute; bottom: 16px; right: 20px;
  border: 0; background: color-mix(in srgb, var(--surface) 18%, transparent);
  color: var(--surface); font-size: 13px; padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; opacity: .5; transition: opacity .15s;
}
.presenter-close:hover { opacity: 1; }
.presenter-full {
  position: absolute; bottom: 16px; left: 20px;
  border: 0; background: color-mix(in srgb, var(--surface) 18%, transparent);
  color: var(--surface); font-size: 13px; padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; opacity: .5; transition: opacity .15s;
}
.presenter-full:hover, .presenter-full.active { opacity: 1; }
/* 浏览器全屏目标元素：纯黑背景，避免 letterbox 出现白边 */
.presenter:fullscreen,
.presenter:-webkit-full-screen,
.presenter:full-screen,
.presenter:-moz-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
  padding: 24px;
}
.presenter:fullscreen::backdrop,
.presenter:-webkit-full-screen::backdrop {
  background: #000;
}

/* ---------- 列表页与其他子系统遗漏项 ---------- */
.deck-ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.stat-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.stat {
  flex: 1; min-width: 120px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 22px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.enroll-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: 0; }

/* 滑动开关：复用现有 checkbox 结构，不改 HTML/JS */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-slider {
  position: absolute; inset: 0; background: var(--border-strong);
  border-radius: 999px; transition: background .15s;
}
.switch-slider::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: var(--surface); border-radius: 50%; transition: transform .15s;
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch input:focus-visible + .switch-slider { box-shadow: 0 0 0 3px var(--primary-soft); }

/* 语义徽章（在 .badge 基础上补 ok / warn / danger） */
.badge.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, white); }
.badge.warn { background: color-mix(in srgb, var(--warn) 14%, white); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, white); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, white); }

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

@media (max-width: 900px) {
  .app-body { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }
  .sidebar.collapsed { display: none; }
  .side-list { flex-direction: row; flex-wrap: wrap; }
  .side-item { width: auto; }
  .side-section + .side-section { margin-top: 14px; }

  .main { padding: 16px 14px 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-nav { order: 3; }
  .brand-name { display: none; }
  .user-info { display: none; }
  table.data th, table.data td { padding: 9px 10px; }
}

/* 平板：顶栏导航横向滚动；编辑器转单列、缩略图置顶横滑 */
@media (max-width: 768px) {
  .topbar-nav {
    order: 3;
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav .nav-link { flex: 0 0 auto; white-space: nowrap; }

  .deck-body { flex-direction: column; }
  .deck-thumbs {
    width: auto;
    flex: none;
    max-height: 92px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .deck-thumbs-list { flex-direction: row; }
  .thumb-item { width: 140px; flex: 0 0 140px; justify-content: center; }
  .thumb-item .thumb-canvas,
  .thumb-item .thumb-ops { display: none; }
  .deck-stage { padding: 14px; }

  .btn { min-height: 40px; }
  .side-item { min-height: 40px; }
}

@media (max-width: 560px) {
  .topbar-nav { margin-left: auto; }
  .auth-card { padding: 24px 20px; }
}

/* 手机：单列网格、收窄内边距、模态接近全屏 */
@media (max-width: 480px) {
  .course-grid { grid-template-columns: 1fr; }
  .main { padding: 12px 10px 40px; }
  .card-pad { padding: 14px; }
  .page-title { font-size: 18px; }
  .deck-toolbar { gap: 6px; }
  .modal-root { padding: 0; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
}

/* 触屏无 hover：分类删除按钮常显 */
@media (hover: none) {
  .side-item .del { opacity: 1; }
}
