/* ==========================================================================
   JZCJOI · 深色科技风样式
   深蓝底 + 青色高亮 + 细网格 + 微光晕
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #05070d;
  --bg-soft: #070b14;
  --panel: rgba(12, 19, 33, 0.86);
  --panel-solid: #0b1220;
  --panel-hover: #101a2c;
  --line: rgba(56, 189, 248, 0.13);
  --line-strong: rgba(34, 211, 238, 0.32);
  --text: #dbe7f5;
  --text-dim: #9fb0c6;
  --muted: #6f819a;
  --cyan: #22d3ee;
  --sky: #38bdf8;
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  /* 用户管理列表行的状态底色（深色方案：低饱和暗调，避免刺眼） */
  --row-pending-bg: rgba(251, 113, 133, 0.13);
  --row-pending-line: rgba(251, 113, 133, 0.36);
  --row-pending-bar: rgba(251, 113, 133, 0.78);
  --row-archived-bg: rgba(148, 163, 184, 0.10);
  --row-archived-line: rgba(148, 163, 184, 0.22);
  --row-archived-bar: rgba(148, 163, 184, 0.5);
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 56px;
}

/* 背景：网格 + 光晕 */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(760px 420px at 12% -8%, rgba(34, 211, 238, 0.16), transparent 62%),
    radial-gradient(680px 420px at 88% -6%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(900px 600px at 50% 108%, rgba(34, 211, 238, 0.07), transparent 65%);
  pointer-events: none;
}

/* ------------------------------ 顶部栏 ------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 13, 23, 0.94), rgba(6, 10, 18, 0.72));
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(150deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.08));
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.22), inset 0 0 18px rgba(34, 211, 238, 0.08);
}

.brand-mark svg { display: block; }
/* 顶栏品牌图标同样换成站点 favicon */
.brand-mark.has-logo {
  background: #ffffff;
  border-color: var(--line-strong);
  box-shadow: none;
  overflow: hidden;
}
.brand-mark.has-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

.brand-text h1 {
  margin: 0;
  font-family: "Arial Black", "Arial Bold", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  letter-spacing: 0.2em;
  font-weight: 900;
  background: linear-gradient(92deg, #e6f7ff, var(--cyan) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.14em; /* 中文标语，字距稍宽一点更好看 */
  font-family: var(--sans);
}

.stat-strip { display: flex; align-items: center; gap: 18px; margin-left: 6px; }
.stat { display: flex; flex-direction: column; line-height: 1.15; }
.stat-value { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--text); }
.stat-value.ok { color: var(--ok); }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.divider { width: 1px; height: 26px; background: var(--line); }

.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(16, 26, 44, 0.7);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--cyan);
  color: #eafcff;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.09), 0 6px 18px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.9), rgba(56, 189, 248, 0.85));
  border-color: transparent;
  color: #04121b;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.24);
}

.btn.primary:hover { box-shadow: 0 10px 30px rgba(34, 211, 238, 0.36); color: #021017; }

.btn.ghost { background: rgba(9, 15, 26, 0.6); border-color: var(--line); color: var(--text-dim); }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn.tiny { padding: 3px 8px; font-size: 11px; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 8px;
  transition: 0.15s;
}
.icon-btn:hover { background: rgba(34, 211, 238, 0.1); color: var(--cyan); }

/* 主题切换按钮：显示当前主题的图标（深夜 / 晴日 / 森林 / 星际 / 游乐园） */
.theme-toggle { padding: 8px; position: relative; }
.theme-toggle .t-icon { width: 17px; height: 17px; display: none; }
html[data-theme="dark"] .theme-toggle .t-dark,
html[data-theme="light"] .theme-toggle .t-light,
html[data-theme="forest"] .theme-toggle .t-forest,
html[data-theme="space"] .theme-toggle .t-space,
html[data-theme="carnival"] .theme-toggle .t-carnival { display: inline-block; }

/* ------------------------------ 工具栏 ------------------------------ */
.toolbar {
  padding: 20px 32px 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1560px;
  margin: 0 auto;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(10, 16, 28, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  transition: 0.2s;
}

.search-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08), 0 0 34px rgba(34, 211, 238, 0.12);
}

.search-icon { color: var(--muted); font-size: 17px; margin-right: 10px; }

.search-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: 12px 0;
  font-family: inherit;
}
.search-wrap input::placeholder { color: #4d5f77; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 16, 28, 0.85);
}

.seg {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.16s;
}
.seg:hover { color: var(--text); }
.seg.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(59, 130, 246, 0.16));
  color: #d5fbff;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35);
}

.select, .field input, .field select, .field textarea, .inline-field select {
  background: rgba(10, 16, 28, 0.9);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: 0.18s;
}

.select { cursor: pointer; }
.select:focus, .field input:focus, .field select:focus, .field textarea:focus, .inline-field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

/* 标签筛选条 */
.tag-bar { display: flex; gap: 10px; align-items: flex-start; }
.tag-bar-label { font-size: 12px; color: var(--muted); padding-top: 5px; white-space: nowrap; }
.tag-bar-list { display: flex; gap: 7px; flex-wrap: wrap; }

.chip {
  border: 1px solid var(--line);
  background: rgba(12, 20, 34, 0.75);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.16s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(56, 189, 248, 0.12));
  border-color: rgba(34, 211, 238, 0.5);
  color: #ccfaff;
}
.chip .chip-count { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.chip.active .chip-count { color: var(--cyan); }

/* ------------------------------ 内容区 ------------------------------ */
.content { padding: 10px 32px 40px; max-width: 1560px; margin: 0 auto; }

.list-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 8px 0 14px;
}
.list-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.14em; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.count {
  font-family: var(--mono);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.24);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
}

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

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: 0.2s ease;
  overflow: hidden;
  cursor: pointer; /* 整张卡片点击即可查看详情 */
}

/* 键盘 Tab 到卡片时的可见焦点（鼠标点击不出现） */
.card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5), transparent);
  opacity: 0;
  transition: 0.25s;
}

.card:hover {
  border-color: rgba(34, 211, 238, 0.34);
  background: linear-gradient(180deg, rgba(16, 26, 44, 0.95), rgba(11, 18, 32, 0.92));
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(34, 211, 238, 0.06);
}
.card:hover::before { opacity: 1; }

/**
 * 卡片按「我」的做题状态着色（学生主界面）：
 *   进行中 = 浅红 · 已 AC = 浅绿 · 已复盘 = 浅蓝 · 未进行 = 默认灰蓝
 * 深色主题用低透明度叠色，保证浅色文字仍可读；浅色主题见文件下方 light 段。
 */
.card.card-doing {
  border-color: rgba(248, 113, 113, 0.3);
  background-image: linear-gradient(180deg, rgba(248, 113, 113, 0.14), rgba(248, 113, 113, 0.02) 72%);
}
.card.card-ac {
  border-color: rgba(52, 211, 153, 0.3);
  background-image: linear-gradient(180deg, rgba(52, 211, 153, 0.14), rgba(52, 211, 153, 0.02) 72%);
}
.card.card-reviewed {
  border-color: rgba(56, 189, 248, 0.3);
  background-image: linear-gradient(180deg, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0.02) 72%);
}
.card.card-doing:hover {
  border-color: rgba(248, 113, 113, 0.55);
  background-image: linear-gradient(180deg, rgba(248, 113, 113, 0.22), rgba(248, 113, 113, 0.05) 72%);
}
.card.card-ac:hover {
  border-color: rgba(52, 211, 153, 0.55);
  background-image: linear-gradient(180deg, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.05) 72%);
}
.card.card-reviewed:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background-image: linear-gradient(180deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.05) 72%);
}

.card-head { display: flex; align-items: center; gap: 8px; }

.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-transform: uppercase;
}
.badge.cf { color: #7dd3fc; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.28); }
.badge.at { color: #c4b5fd; background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.3); }
.badge.luogu { color: #fcd34d; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.3); }
.badge.other { color: #9ca3af; background: rgba(156, 163, 175, 0.12); border-color: rgba(156, 163, 175, 0.28); }
.badge.qoj { color: #fda4af; background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.3); }
.badge.uoj { color: #a5b4fc; background: rgba(129, 140, 248, 0.12); border-color: rgba(129, 140, 248, 0.32); }

.pid {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.status {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
}
.status.ac { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }
.status.todo { color: var(--warn); border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }

/* 卡片上的做题状态文字（与卡片底色对应：红 / 绿 / 蓝） */
.status.rec-doing { color: #f87171; border-color: rgba(248, 113, 113, 0.38); background: rgba(248, 113, 113, 0.1); }
.status.rec-ac { color: var(--ok); border-color: rgba(52, 211, 153, 0.38); background: rgba(52, 211, 153, 0.1); }
.status.rec-reviewed { color: #60a5fa; border-color: rgba(96, 165, 250, 0.38); background: rgba(96, 165, 250, 0.1); }

.title-cn {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #e8f4ff;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.title-en {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.tag-pill {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.09);
  border: 1px solid rgba(34, 211, 238, 0.2);
  font-family: var(--mono);
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(56, 189, 248, 0.12);
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

.diff { color: var(--violet); }

/* 难度评分徽章（按 CF 段位配色） */
.rating {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid;
  letter-spacing: 0.02em;
  display: inline-block;
}
.rating.r-grey   { color: #9ca3af; border-color: rgba(156, 163, 175, 0.35); background: rgba(156, 163, 175, 0.1); }
.rating.r-green  { color: #34d399; border-color: rgba(52, 211, 153, 0.38); background: rgba(52, 211, 153, 0.1); }
.rating.r-cyan   { color: #22d3ee; border-color: rgba(34, 211, 238, 0.38); background: rgba(34, 211, 238, 0.1); }
.rating.r-blue   { color: #60a5fa; border-color: rgba(96, 165, 250, 0.38); background: rgba(96, 165, 250, 0.1); }
.rating.r-violet { color: #a78bfa; border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.12); }
.rating.r-orange { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); background: rgba(251, 146, 60, 0.12); }
.rating.r-red    { color: #f43f5e; border-color: rgba(244, 63, 94, 0.42); background: rgba(244, 63, 94, 0.12); }
.card-foot .spacer { margin-left: auto; }

.card-actions { display: flex; gap: 4px; }
.card-actions button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.card-actions button:hover { color: var(--cyan); background: rgba(34, 211, 238, 0.08); border-color: rgba(34, 211, 238, 0.2); }
.card-actions button[data-act="delete"]:hover { color: var(--danger); background: rgba(251, 113, 133, 0.08); border-color: rgba(251, 113, 133, 0.24); }

/* 空状态 */
.empty {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(9, 14, 24, 0.5);
}
.empty-mark { font-size: 34px; color: var(--cyan); opacity: 0.6; }
.empty h3 { margin: 8px 0 6px; font-size: 16px; }
.empty p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

/* 分页 */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 26px; flex-wrap: wrap; }
.page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.8);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12.5px;
  transition: 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.page-btn.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.24), rgba(56, 189, 248, 0.14));
  border-color: rgba(34, 211, 238, 0.5);
  color: #d5fbff;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 0 8px; }

/* ------------------------------ 弹窗 ------------------------------ */
dialog.dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, #0b1322, #070c16);
  color: var(--text);
  padding: 0;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 60px rgba(34, 211, 238, 0.08);
  overflow: hidden;
}
dialog.dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(2, 5, 10, 0.72); backdrop-filter: blur(4px); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 27, 0.7);
}
.dialog-head h3 { margin: 0; font-size: 15px; letter-spacing: 0.06em; }

.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 220px); }

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: rgba(8, 13, 23, 0.7);
}
.foot-actions { display: flex; gap: 8px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field > span { font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.05em; }
.field > span em { color: var(--danger); font-style: normal; }
.field textarea { resize: vertical; line-height: 1.55; font-size: 13px; }
.field textarea.code-input { font-family: var(--mono); font-size: 12.5px; background: #05090f; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.textarea-tools { display: flex; gap: 6px; justify-content: flex-end; margin-top: -2px; }

.checkbox-field { flex-direction: row; align-items: center; gap: 9px; }
.checkbox-field input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--cyan); cursor: pointer;
}
.checkbox-field span { font-size: 12.5px; color: var(--text-dim); }

/* 标签编辑 */
.tag-editor { display: flex; gap: 7px; flex-wrap: wrap; padding: 9px; min-height: 42px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(8, 13, 23, 0.6); }
.tag-editor .empty-hint { color: var(--muted); font-size: 12px; }

.tag-add { display: flex; gap: 8px; margin-top: 2px; }
.tag-add input {
  flex: 1; background: rgba(10, 16, 28, 0.9); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12.5px; outline: none;
}
.tag-add input:focus { border-color: var(--cyan); }

/* 代码块 */
.code-block {
  margin: 0;
  background: #05080f;
  border: 1px solid rgba(56, 189, 248, 0.14);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #cfe3f8;
  max-height: 420px;
}
.code-block code { white-space: pre; }

.tok-kw { color: #c792ea; }
.tok-type { color: #7dd3fc; }
.tok-str { color: #a5e884; }
.tok-num { color: #fbbf24; }
.tok-com { color: #5b7089; font-style: italic; }
.tok-pre { color: #22d3ee; }
.tok-fn { color: #93c5fd; }

/* 提示框 */
.hint-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 23, 0.65);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.hint-box summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); outline: none; }
.hint-pre {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
  color: #8fa7c2;
  white-space: pre-wrap;
  word-break: break-all;
}

.import-result {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(8, 13, 23, 0.7);
  font-size: 13px;
}
.import-result.ok { border-color: rgba(52, 211, 153, 0.35); }
.import-result.bad { border-color: rgba(251, 113, 133, 0.35); }
.result-line { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; }
.result-line b { color: var(--cyan); }
.error-list { margin: 10px 0 0; padding-left: 18px; color: #f8a5b3; font-size: 12px; max-height: 180px; overflow-y: auto; }
.error-list li { margin-bottom: 3px; }

/* 统计面板 */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, rgba(16, 26, 44, 0.9), rgba(9, 14, 24, 0.85));
  padding: 14px;
}
.stat-card .label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }
.stat-card .value { font-family: var(--mono); font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-card .value.cyan { color: var(--cyan); }
.stat-card .value.ok { color: var(--ok); }
.stat-card .value.violet { color: var(--violet); }

.panel-section { margin-bottom: 22px; }
.panel-section h4 {
  margin: 0 0 12px;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 62px; align-items: center; gap: 12px; font-size: 12.5px; }
.bar-row .bar-name { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 9px; background: rgba(56, 189, 248, 0.08); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.9), rgba(56, 189, 248, 0.55));
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
  transition: width 0.5s ease;
}
.bar-fill.violet { background: linear-gradient(90deg, rgba(167, 139, 250, 0.9), rgba(129, 140, 248, 0.5)); }
.bar-row .bar-value { font-family: var(--mono); color: var(--text); text-align: right; font-size: 12px; }
.bar-row .bar-value span { color: var(--muted); font-size: 11px; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 110px;
  padding: 10px 4px 0;
  border-bottom: 1px solid var(--line);
}
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.chart-bar {
  width: 100%;
  max-width: 16px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--cyan), rgba(56, 189, 248, 0.25));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}
.chart-label { font-family: var(--mono); font-size: 9px; color: var(--muted); }

/* 详情 */
.detail-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.detail-section { margin-bottom: 16px; }
.detail-section h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.detail-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 13px; color: #c6d7e8; line-height: 1.75; }
.detail-link { color: var(--cyan); font-size: 12.5px; text-decoration: none; font-family: var(--mono); }
.detail-link:hover { text-decoration: underline; }

/* 题目详情 → 在线 IDE（做成小按钮，和「打开原题」并排） */
.detail-ide-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.16s;
}
.detail-ide-link::before { content: '</>'; font-family: var(--mono); font-size: 10px; opacity: 0.8; }
.detail-ide-link:hover { background: rgba(34, 211, 238, 0.2); border-color: var(--cyan); }
html[data-scheme="light"] .detail-ide-link { color: #0e7490; border-color: rgba(14, 116, 144, 0.4); background: rgba(8, 145, 178, 0.08); }

/* AtCoder 自动拉取面板 */
.sync-box {
  border: 1px dashed rgba(34, 211, 238, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(34, 211, 238, 0.045);
  padding: 13px 15px;
  margin-bottom: 14px;
}

.sync-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sync-head strong { font-size: 13px; color: #d9f7ff; letter-spacing: 0.04em; }

.sync-tip { margin: 9px 0 0; line-height: 1.6; }

.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field > span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.inline-field.grow { flex: 1 1 240px; }

.text-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(8, 13, 23, 0.6);
  color: var(--text);
  font-size: 12.5px;
  font-family: var(--mono);
}
.text-input:focus { outline: none; border-color: rgba(34, 211, 238, 0.55); }
.text-input::placeholder { color: var(--muted); opacity: 0.75; }

.filter-row[hidden] { display: none !important; }

.inline-field input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--cyan); cursor: pointer; }
.num-input { width: 74px; text-align: center; font-family: var(--mono); }

.sync-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.9;
}
.sync-list b { color: var(--cyan); font-family: var(--mono); }

.sync-errors { margin-top: 10px; font-size: 12.5px; color: #f8a5b3; }
.sync-errors strong { color: var(--danger); }

/* ------------------------------ Markdown ------------------------------ */
/* 左右分栏：左输入 / 右实时预览 */
.md-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.md-pane { min-width: 0; }

.md-pane-input { display: flex; }
.md-pane-input textarea { flex: 1; width: 100%; min-height: 150px; height: 100%; }

.md-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 23, 0.6);
  padding: 12px 14px;
  min-height: 150px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
}

.md-body { font-size: 13px; line-height: 1.78; color: #c6d7e8; white-space: normal; }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }

.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5 {
  margin: 16px 0 8px;
  color: #e8f4ff;
  font-weight: 650;
  line-height: 1.4;
  border-left: 3px solid rgba(34, 211, 238, 0.55);
  padding-left: 9px;
}
.md-body h1 { font-size: 17px; }
.md-body h2 { font-size: 15.5px; }
.md-body h3 { font-size: 14.5px; }
.md-body h4, .md-body h5 { font-size: 13.5px; border-left-color: rgba(167, 139, 250, 0.55); }

.md-body p { margin: 9px 0; }
.md-body ul, .md-body ol { margin: 9px 0; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body li::marker { color: var(--cyan); }

.md-body blockquote {
  margin: 10px 0;
  padding: 8px 13px;
  border-left: 3px solid rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.md-body blockquote p { margin: 4px 0; }

.md-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(56, 189, 248, 0.12);
  color: #a5e8ff;
  padding: 1px 5px;
  border-radius: 4px;
}
.md-body pre { margin: 10px 0; }
.md-body pre code { background: none; padding: 0; color: inherit; }

/* 题面「样例输入」：右上角复制按钮 */
.copyable-block { position: relative; margin: 10px 0; }
.copyable-block > pre { margin: 0; padding-right: 62px; }
.copyable-block .md-copy {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  padding: 3px 9px;
  color: var(--text-dim);
  background: rgba(8, 16, 28, 0.78);
  border-color: rgba(56, 189, 248, 0.28);
  opacity: 0.78;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
html[data-scheme="light"] .copyable-block .md-copy { background: rgba(255, 255, 255, 0.9); border-color: rgba(15, 23, 42, 0.16); color: #475569; }
.copyable-block .md-copy:hover { color: var(--cyan); border-color: rgba(56, 189, 248, 0.5); }
.copyable-block:hover .md-copy,
.copyable-block .md-copy:focus-visible { opacity: 1; }
.copyable-block .md-copy.copied { color: #4ade80; border-color: rgba(74, 222, 128, 0.5); opacity: 1; }
html[data-scheme="light"] .copyable-block .md-copy.copied { color: #15803d; border-color: rgba(21, 128, 61, 0.45); }

.md-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.5px; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.md-body th { background: rgba(34, 211, 238, 0.07); color: #cdeefe; font-weight: 600; }

.md-body a { color: var(--cyan); text-decoration: none; }
.md-body a:hover { text-decoration: underline; }
.md-body hr { border: none; border-top: 1px dashed rgba(56, 189, 248, 0.22); margin: 16px 0; }
.md-body img { max-width: 100%; border-radius: 8px; }
.md-body strong { color: #eaf6ff; }

/* KaTeX 公式 */
.md-body .katex { font-size: 1.06em; color: #e8f4ff; }
.md-body .katex-display { margin: 12px 0; padding: 2px 0; overflow-x: auto; overflow-y: hidden; }
.md-body .math-block { overflow-x: auto; margin: 12px 0; }

/* 详情里的 Markdown 区块需要覆盖 pre-wrap，否则块级结构会被打散 */
.md-body.detail-text { white-space: normal; }

/* 窄屏：分栏改为上下堆叠 */
@media (max-width: 820px) {
  .md-split { grid-template-columns: 1fr; }
  .md-preview { max-height: 240px; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: rgba(11, 18, 32, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 100;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 26px rgba(34, 211, 238, 0.16);
  max-width: min(560px, calc(100vw - 40px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(251, 113, 133, 0.55); color: #ffd7de; }
.toast.ok { border-color: rgba(52, 211, 153, 0.45); }

/* 工具类 */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.18); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(34, 211, 238, 0.35); background-clip: content-box; }

/* 响应式 */
@media (max-width: 900px) {
  .topbar, .toolbar, .content { padding-left: 16px; padding-right: 16px; }
  .stat-strip { display: none; }
  .actions { width: 100%; margin-left: 0; }
  .problem-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: 88px 1fr 52px; }
}

/* ==========================================================================
   浅色主题（html[data-scheme="light"]）
   ========================================================================== */
html[data-scheme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-soft: #edf1f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-hover: #f1f5f9;
  --line: rgba(15, 23, 42, 0.13);
  --line-strong: rgba(8, 145, 178, 0.4);
  --text: #1e293b;
  --text-dim: #475569;
  --muted: #94a3b8;
  --cyan: #0891b2;
  --sky: #0284c7;
  --violet: #7c3aed;
  --ok: #059669;
  --warn: #d97706;
  --danger: #e11d48;
  /* 用户管理列表行的状态底色（浅色方案：真正的浅红 / 浅灰）。
     取色偏深一点，避免和「糖果粉 / 星光银」等主题的普通行撞色 */
  --row-pending-bg: #fce1e8;
  --row-pending-line: rgba(225, 29, 72, 0.30);
  --row-pending-bar: rgba(225, 29, 72, 0.72);
  --row-archived-bg: #e5eaf1;
  --row-archived-line: rgba(100, 116, 139, 0.26);
  --row-archived-bar: rgba(100, 116, 139, 0.45);
}

/* 背景网格与光晕（浅色版更柔和） */
html[data-scheme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
}
html[data-scheme="light"] .bg-glow {
  background:
    radial-gradient(760px 420px at 12% -8%, rgba(8, 145, 178, 0.12), transparent 62%),
    radial-gradient(680px 420px at 88% -6%, rgba(2, 132, 199, 0.1), transparent 60%),
    radial-gradient(900px 600px at 50% 108%, rgba(8, 145, 178, 0.06), transparent 65%);
}

/* 顶部栏 */
html[data-scheme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 247, 251, 0.82));
  border-bottom-color: rgba(15, 23, 42, 0.1);
}
html[data-scheme="light"] .brand-mark {
  background: linear-gradient(150deg, rgba(8, 145, 178, 0.14), rgba(2, 132, 199, 0.06));
  box-shadow: 0 0 22px rgba(8, 145, 178, 0.16), inset 0 0 14px rgba(8, 145, 178, 0.06);
}
html[data-scheme="light"] .brand-text h1 {
  background: linear-gradient(92deg, #0f172a, var(--cyan) 75%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* 按钮 */
html[data-scheme="light"] .btn {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.16);
}
html[data-scheme="light"] .btn:hover {
  color: #0f172a;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1), 0 6px 18px rgba(15, 23, 42, 0.1);
}
html[data-scheme="light"] .btn.primary {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(8, 145, 178, 0.3);
}
html[data-scheme="light"] .btn.primary:hover { color: #ffffff; }
html[data-scheme="light"] .btn.ghost { background: rgba(255, 255, 255, 0.6); color: var(--text-dim); }
html[data-scheme="light"] .icon-btn:hover { background: rgba(8, 145, 178, 0.1); }

/* 搜索 / 输入 / 下拉 */
html[data-scheme="light"] .search-wrap,
html[data-scheme="light"] .segmented,
html[data-scheme="light"] .select,
html[data-scheme="light"] .field input,
html[data-scheme="light"] .field select,
html[data-scheme="light"] .field textarea,
html[data-scheme="light"] .inline-field select,
html[data-scheme="light"] .tag-add input,
html[data-scheme="light"] .page-btn {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}
html[data-scheme="light"] .search-wrap input::placeholder,
html[data-scheme="light"] .text-input::placeholder { color: #9aa7b8; }
html[data-scheme="light"] .seg.active { color: #0f172a; }
html[data-scheme="light"] .page-btn.active { color: #0f172a; }

/* 标签筛选 chip */
html[data-scheme="light"] .chip { background: rgba(255, 255, 255, 0.82); }
html[data-scheme="light"] .chip.active { color: #0f172a; }

/* 卡片 */
html[data-scheme="light"] .title-cn { color: #1e293b; }
html[data-scheme="light"] .card:hover {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(8, 145, 178, 0.08);
}

/* 卡片做题状态配色（浅色主题：真正的浅红 / 浅绿 / 浅蓝） */
html[data-scheme="light"] .card.card-doing { border-color: #fecaca; background: linear-gradient(180deg, #fff1f2, #ffffff 70%); }
html[data-scheme="light"] .card.card-ac { border-color: #bbf7d0; background: linear-gradient(180deg, #f0fdf4, #ffffff 70%); }
html[data-scheme="light"] .card.card-reviewed { border-color: #bfdbfe; background: linear-gradient(180deg, #eff6ff, #ffffff 70%); }
html[data-scheme="light"] .card.card-doing:hover {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #ffe4e6, #ffffff 70%);
  box-shadow: 0 14px 34px rgba(185, 28, 28, 0.12), 0 0 0 1px rgba(248, 113, 113, 0.12);
}
html[data-scheme="light"] .card.card-ac:hover {
  border-color: #86efac;
  background: linear-gradient(180deg, #dcfce7, #ffffff 70%);
  box-shadow: 0 14px 34px rgba(4, 120, 87, 0.12), 0 0 0 1px rgba(52, 211, 153, 0.14);
}
html[data-scheme="light"] .card.card-reviewed:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #dbeafe, #ffffff 70%);
  box-shadow: 0 14px 34px rgba(29, 78, 216, 0.12), 0 0 0 1px rgba(96, 165, 250, 0.14);
}
html[data-scheme="light"] .status.rec-doing { color: #b91c1c; border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.12); }
html[data-scheme="light"] .status.rec-ac { color: #047857; border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.12); }
html[data-scheme="light"] .status.rec-reviewed { color: #1d4ed8; border-color: rgba(96, 165, 250, 0.45); background: rgba(96, 165, 250, 0.12); }

/* 空状态 */
html[data-scheme="light"] .empty { background: rgba(255, 255, 255, 0.6); }

/* 弹窗 */
html[data-scheme="light"] dialog.dialog {
  background: linear-gradient(180deg, #ffffff, #f6f8fb);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22), 0 0 40px rgba(8, 145, 178, 0.06);
}
html[data-scheme="light"] dialog::backdrop { background: rgba(15, 23, 42, 0.4); }
html[data-scheme="light"] .dialog-head { background: rgba(246, 248, 251, 0.9); }
html[data-scheme="light"] .dialog-foot { background: rgba(246, 248, 251, 0.9); }

/* 代码块 */
html[data-scheme="light"] .field textarea.code-input,
html[data-scheme="light"] .code-block {
  background: #f8fafc;
  color: #334155;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-scheme="light"] .tok-kw { color: #7c3aed; }
html[data-scheme="light"] .tok-type { color: #0369a1; }
html[data-scheme="light"] .tok-str { color: #16a34a; }
html[data-scheme="light"] .tok-num { color: #b45309; }
html[data-scheme="light"] .tok-com { color: #94a3b8; }
html[data-scheme="light"] .tok-pre { color: #0e7490; }
html[data-scheme="light"] .tok-fn { color: #2563eb; }

/* 提示框 / 导入结果 / 同步面板 */
html[data-scheme="light"] .hint-box,
html[data-scheme="light"] .import-result,
html[data-scheme="light"] .tag-editor,
html[data-scheme="light"] .text-input,
html[data-scheme="light"] .md-preview {
  background: rgba(255, 255, 255, 0.78);
}
html[data-scheme="light"] .hint-pre { color: #475569; }
html[data-scheme="light"] .error-list,
html[data-scheme="light"] .sync-errors { color: #be123c; }
html[data-scheme="light"] .sync-box { background: rgba(8, 145, 178, 0.05); }
html[data-scheme="light"] .sync-head strong { color: #0f172a; }

/* 统计卡片 */
html[data-scheme="light"] .stat-card {
  background: linear-gradient(160deg, #ffffff, #f6f8fb);
}

/* Markdown 正文 */
html[data-scheme="light"] .md-body,
html[data-scheme="light"] .detail-text { color: #334155; }
html[data-scheme="light"] .md-body h1,
html[data-scheme="light"] .md-body h2,
html[data-scheme="light"] .md-body h3,
html[data-scheme="light"] .md-body h4,
html[data-scheme="light"] .md-body h5 { color: #1e293b; }
html[data-scheme="light"] .md-body code {
  background: rgba(8, 145, 178, 0.1);
  color: #0e7490;
}
html[data-scheme="light"] .md-body th { background: rgba(8, 145, 178, 0.06); color: #0f172a; }
html[data-scheme="light"] .md-body strong { color: #0f172a; }
html[data-scheme="light"] .md-body .katex { color: #1e293b; }

/* 难度评分徽章（浅色下加深文字） */
html[data-scheme="light"] .rating.r-grey   { color: #6b7280; }
html[data-scheme="light"] .rating.r-green  { color: #059669; }
html[data-scheme="light"] .rating.r-cyan   { color: #0891b2; }
html[data-scheme="light"] .rating.r-blue   { color: #2563eb; }
html[data-scheme="light"] .rating.r-violet { color: #7c3aed; }
html[data-scheme="light"] .rating.r-orange { color: #ea580c; }
html[data-scheme="light"] .rating.r-red    { color: #e11d48; }

/* 平台徽章 / 状态徽章（浅色下加深文字，避免白底上发糊） */
html[data-scheme="light"] .badge.cf    { color: #0369a1; background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.45); }
html[data-scheme="light"] .badge.at    { color: #6d28d9; background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.45); }
html[data-scheme="light"] .badge.luogu { color: #a16207; background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.5); }
html[data-scheme="light"] .badge.other { color: #4b5563; background: rgba(156, 163, 175, 0.18); border-color: rgba(156, 163, 175, 0.45); }
html[data-scheme="light"] .badge.qoj   { color: #be123c; background: rgba(251, 113, 133, 0.16); border-color: rgba(251, 113, 133, 0.45); }
html[data-scheme="light"] .badge.uoj   { color: #4338ca; background: rgba(99, 102, 241, 0.14); border-color: rgba(99, 102, 241, 0.4); }
html[data-scheme="light"] .status.ac    { color: #047857; }
html[data-scheme="light"] .status.todo  { color: #b45309; }

/* Toast */
html[data-scheme="light"] .toast {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18), 0 0 22px rgba(8, 145, 178, 0.12);
}
html[data-scheme="light"] .toast.error { color: #be123c; }

/* 滚动条 */
html[data-scheme="light"] ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); background-clip: content-box; }
html[data-scheme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(8, 145, 178, 0.4); background-clip: content-box; }

/* ==========================================================================
   登录 / 权限 / 做题记录 / 管理面板
   ========================================================================== */

/* 顶栏认证区 */
.auth-area { display: flex; gap: 8px; align-items: center; }
.user-area { display: flex; gap: 8px; align-items: center; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }

.role-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid;
  letter-spacing: 0.04em;
}
.role-admin   { color: #f87171; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); }
.role-teacher { color: #60a5fa; background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.3); }
.role-student { color: #34d399; background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.3); }
html[data-scheme="light"] .role-admin   { color: #dc2626; }
html[data-scheme="light"] .role-teacher { color: #2563eb; }
html[data-scheme="light"] .role-student { color: #059669; }
.role-expert { color: #fbbf24; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.34); }
html[data-scheme="light"] .role-expert { color: #b45309; background: rgba(251, 191, 36, 0.18); border-color: rgba(217, 119, 6, 0.4); }

/* 专家拉取额度（导入弹窗顶部） */
.expert-quota {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.07);
}
.expert-quota-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.expert-quota-label { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; }
.expert-quota-main b { font-family: var(--mono); font-size: 15px; color: #fbbf24; }
.expert-quota-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.expert-quota-bar > i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  transition: width 0.25s ease;
}
.expert-quota.is-low .expert-quota-main b { color: #fb923c; }
.expert-quota.is-low .expert-quota-bar > i { background: linear-gradient(90deg, #fb923c, #f97316); }
.expert-quota.is-empty { border-color: rgba(248, 113, 113, 0.42); background: rgba(248, 113, 113, 0.08); }
.expert-quota.is-empty .expert-quota-main b { color: #f87171; }
.expert-quota.is-empty .expert-quota-bar > i { background: #f87171; }
html[data-scheme="light"] .expert-quota { background: rgba(251, 191, 36, 0.1); border-color: rgba(217, 119, 6, 0.35); }
html[data-scheme="light"] .expert-quota-main b { color: #b45309; }
html[data-scheme="light"] .expert-quota.is-empty { background: rgba(248, 113, 113, 0.1); border-color: rgba(220, 38, 38, 0.35); }
html[data-scheme="light"] .expert-quota.is-empty .expert-quota-main b { color: #dc2626; }

/* 单列表单 */
.form-grid.single { grid-template-columns: 1fr; }

/* 做题记录 */
.record-form { display: flex; flex-direction: column; gap: 10px; }
.record-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.record-row .select { min-width: 110px; }
.record-row input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--cyan); }
.record-row b { font-family: var(--mono); font-size: 12px; }

/* 我的做题记录：搜索工具栏 */
.record-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 145, 178, 0.05);
}
.record-search .text-input { flex: 1 1 220px; }
.record-search .select { min-width: 108px; }
.record-search-count { margin-bottom: 8px; }
html[data-scheme="light"] .record-search { background: rgba(8, 145, 178, 0.06); }

.record-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 9px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.record-item.open { border-color: rgba(34, 211, 238, 0.4); }

/* 列表行：平台 · 题号 · 标题 · 状态 · 展开提示 */
.record-item-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.record-item-summary:hover { background: rgba(8, 145, 178, 0.07); }
.record-item-summary:focus-visible { outline: 2px solid var(--sky); outline-offset: -2px; }
.record-item-summary .record-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-item-summary .status { flex: 0 0 auto; }
.record-item-caret { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
html[data-scheme="light"] .record-item-summary:hover { background: rgba(8, 145, 178, 0.08); }

.record-detail { padding: 4px 13px 12px; border-top: 1px dashed var(--line); }
.record-note-empty { font-size: 12.5px; color: var(--muted); }
.record-detail-actions { display: flex; gap: 8px; margin-top: 12px; }
.record-pid { font-family: var(--mono); font-size: 12.5px; color: var(--cyan); cursor: pointer; }
.record-title { font-size: 13px; color: var(--text-dim); }
.record-note { margin-top: 10px; line-height: 1.6; }
.record-note-label {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--cyan);
  font-weight: 600;
  margin-bottom: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
}
.record-note .md-body { margin-top: 4px; }
.status.doing { color: #60a5fa; border-color: rgba(96, 165, 250, 0.35); background: rgba(96, 165, 250, 0.1); }
html[data-scheme="light"] .status.doing { color: #2563eb; }

.record-item .bar-track { margin-top: 8px; }

/* 数据表 */
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; }
.data-table th { color: var(--text-dim); font-weight: 600; font-size: 11.5px; letter-spacing: 0.05em; }
.data-table .num { font-family: var(--mono); text-align: right; }
.data-table .num.ok { color: var(--ok); }
.bar-track.mini { display: inline-block; width: 70px; vertical-align: middle; }

.record-line { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.record-line b { color: var(--cyan); font-family: var(--mono); }

/* 用户管理 */
.user-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  margin-bottom: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* 待审核：浅红底 + 左侧红条，提示需要立刻处理。
   用 inset box-shadow 而不是 border-left，避免行内容左右位移 */
.user-row.is-pending {
  background: var(--row-pending-bg);
  border-color: var(--row-pending-line);
  box-shadow: inset 3px 0 0 var(--row-pending-bar);
}
/* 已归档：灰色底 + 左侧灰条，视觉上沉到最后 */
.user-row.is-archived {
  background: var(--row-archived-bg);
  border-color: var(--row-archived-line);
  box-shadow: inset 3px 0 0 var(--row-archived-bar);
}
.user-row.is-archived .user-row-main b { color: var(--text-dim); }
.user-row-main { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.user-row-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.select.tiny { padding: 4px 8px; font-size: 11.5px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.1); }

/* 班级管理 */
.class-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 8px;
  background: var(--panel);
}
.class-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.class-row .muted { flex: 1; }

/* 归档状态（用户管理 / 班级管理） */
.class-row.archived { opacity: 0.62; }
.class-row.archived .class-name { text-decoration: line-through; text-decoration-color: var(--muted); }

/* 表单内联错误提示（注册等） */
.form-error { color: var(--danger) !important; margin-top: 6px; }
html[data-scheme="light"] .form-error { color: #be123c !important; }

/* 用户管理：添加用户表单 */
.add-user-box {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 145, 178, 0.05);
}
.add-user-box .text-input { flex: 1 1 120px; }
.add-user-box .select { min-width: 90px; }
html[data-scheme="light"] .add-user-box { background: rgba(8, 145, 178, 0.06); }

/* 表单校验错误态（登录 / 修改用户 / 修改班级） */
.field.invalid input,
.field.invalid select { border-color: var(--danger) !important; }
.field.invalid input:focus,
.field.invalid select:focus { box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.14); }
.field input[readonly] { opacity: 0.75; cursor: default; }

/* 学生姓名可点击（学生做题情况） */
.student-link {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dashed rgba(34, 211, 238, 0.45);
  cursor: pointer;
}
.student-link:hover { color: var(--sky); border-bottom-style: solid; }
html[data-scheme="light"] .student-link { color: #0e7490; border-bottom-color: rgba(8, 145, 178, 0.45); }
html[data-scheme="light"] .student-link:hover { color: #0369a1; }

/* 班级管理：管理教师多选 */
.teacher-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 2px;
}
.teacher-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  user-select: none;
}
.teacher-chip:hover { border-color: rgba(34, 211, 238, 0.45); }
.teacher-chip input { accent-color: var(--cyan); margin: 0; }
.teacher-chip input:checked ~ span:first-of-type { color: var(--cyan); font-weight: 600; }
.teacher-chip .muted { font-size: 11px; }

.class-teachers { max-width: 240px; }

html[data-scheme="light"] .teacher-chip { background: rgba(255, 255, 255, 0.9); }
html[data-scheme="light"] .teacher-chip:hover { border-color: rgba(8, 145, 178, 0.5); }
html[data-scheme="light"] .teacher-chip input { accent-color: #0891b2; }
html[data-scheme="light"] .teacher-chip input:checked ~ span:first-of-type { color: #0e7490; }

/* 学生做题情况：班级筛选栏 */
.record-search .stats-scope { margin-left: auto; }
.record-search .inline-field > span { font-size: 12px; }

/* 学生查看题目详情：加宽加大（宽 90%、高 95%），内容区自适应滚动 */
dialog.dialog.detail-xl {
  width: 90vw;
  max-width: 90vw;
  height: 95vh;
  max-height: 95vh;
}
dialog.dialog.detail-xl[open] {
  display: flex;
  flex-direction: column;
}
dialog.dialog.detail-xl .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

@media (max-width: 720px) {
  dialog.dialog.detail-xl { width: 94vw; max-width: 94vw; height: 92vh; max-height: 92vh; }
}

/* ------------------------- 题目详情独立窗口（/problem/?id=…） ------------------------- */
/* 从题库 / 我的记录 / 作业 / 题单点开：新开一个窗口，整页只放这道题，不再占用首页弹窗 */
html[data-solo="problem"] .sidebar,
html[data-solo="problem"] .topbar,
html[data-solo="problem"] .toolbar,
html[data-solo="problem"] .content { display: none !important; }

html[data-solo="problem"] dialog.dialog.detail-xl {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
/* 底色跟主题一致，避免窗口边缘露出半透明黑边 */
html[data-solo="problem"] #detailDialog::backdrop { background: var(--bg); }
html[data-solo="problem"] .dialog-head { padding: 14px 28px; }
html[data-solo="problem"] .dialog-body { padding: 22px 28px 30px; }
html[data-solo="problem"] .dialog-foot { padding: 12px 28px; }
/* 窗口靠关标签页退出，弹窗自己的关闭按钮没有意义 */
html[data-solo="problem"] #detailDialog [data-close] { display: none; }

/* 用户管理：检索栏 */
.user-search-count { margin-left: auto; white-space: nowrap; }

/* ==========================================================================
   题单管理 / 我的作业
   ========================================================================== */
.set-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  margin-bottom: 8px;
  background: var(--panel);
  text-align: left;
  font: inherit;
  color: var(--text);
}
.set-row.clickable { cursor: pointer; transition: 0.16s; }
.set-row.clickable:hover { border-color: rgba(34, 211, 238, 0.42); background: rgba(8, 145, 178, 0.07); }
.set-row.clickable:focus-visible { outline: 2px solid var(--sky); outline-offset: -2px; }
.set-row-main { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.set-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.set-desc { margin: 0; }
.set-classes { max-width: 320px; }
.set-row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.set-enter { margin-left: auto; font-size: 12px; color: var(--cyan); white-space: nowrap; }
.set-row.archived { opacity: 0.62; }
.set-row.archived .set-name { text-decoration: line-through; text-decoration-color: var(--muted); }
html[data-scheme="light"] .set-row.clickable:hover { background: rgba(8, 145, 178, 0.08); }
html[data-scheme="light"] .set-enter { color: #0e7490; }

/* 我的作业：三种状态底色
   新布置 → 红；有未完成 → 淡红；全部完成 → 淡绿
   hover 时统一提亮一点，避免盖掉状态色 */
.hw-flag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.hw-flag-new     { color: #fca5a5; background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.45); }
.hw-flag-pending { color: #fca5a5; background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.26); }
.hw-flag-done    { color: #86efac; background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.35); }

.set-row.hw-new {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.42);
}
.set-row.hw-pending {
  background: rgba(248, 113, 113, 0.06);
  border-color: rgba(248, 113, 113, 0.22);
}
.set-row.hw-done {
  background: rgba(74, 222, 128, 0.10);
  border-color: rgba(74, 222, 128, 0.34);
}
.set-row.hw-new.clickable:hover     { background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.6); }
.set-row.hw-pending.clickable:hover { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.36); }
.set-row.hw-done.clickable:hover    { background: rgba(74, 222, 128, 0.16); border-color: rgba(74, 222, 128, 0.5); }

html[data-scheme="light"] .hw-flag-new     { color: #b91c1c; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); }
html[data-scheme="light"] .hw-flag-pending { color: #b91c1c; background: rgba(239, 68, 68, 0.07); border-color: rgba(239, 68, 68, 0.24); }
html[data-scheme="light"] .hw-flag-done    { color: #15803d; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.38); }
html[data-scheme="light"] .set-row.hw-new     { background: rgba(239, 68, 68, 0.1);  border-color: rgba(239, 68, 68, 0.38); }
html[data-scheme="light"] .set-row.hw-pending { background: rgba(239, 68, 68, 0.045); border-color: rgba(239, 68, 68, 0.2); }
html[data-scheme="light"] .set-row.hw-done    { background: rgba(34, 197, 94, 0.09); border-color: rgba(34, 197, 94, 0.32); }
html[data-scheme="light"] .set-row.hw-new.clickable:hover     { background: rgba(239, 68, 68, 0.16); }
html[data-scheme="light"] .set-row.hw-pending.clickable:hover { background: rgba(239, 68, 68, 0.08); }
html[data-scheme="light"] .set-row.hw-done.clickable:hover    { background: rgba(34, 197, 94, 0.15); }

/* 导航栏「我的作业」按钮：沿用同一套三色规则（新布置 > 未完成 > 全部完成） */
.btn.hw-nav-new     { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.5);  color: #fecaca; }
.btn.hw-nav-pending { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.28); color: #fca5a5; }
.btn.hw-nav-done    { background: rgba(74, 222, 128, 0.12);  border-color: rgba(74, 222, 128, 0.38);  color: #86efac; }
.btn.hw-nav-new:hover     { background: rgba(248, 113, 113, 0.22); border-color: rgba(248, 113, 113, 0.68); color: #ffe4e6; }
.btn.hw-nav-pending:hover { background: rgba(248, 113, 113, 0.13); border-color: rgba(248, 113, 113, 0.44); color: #fecaca; }
.btn.hw-nav-done:hover    { background: rgba(74, 222, 128, 0.18);  border-color: rgba(74, 222, 128, 0.55);  color: #bbf7d0; }

.hw-nav-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  letter-spacing: 0;
}

html[data-scheme="light"] .btn.hw-nav-new     { background: rgba(239, 68, 68, 0.1);   border-color: rgba(239, 68, 68, 0.42); color: #b91c1c; }
html[data-scheme="light"] .btn.hw-nav-pending { background: rgba(239, 68, 68, 0.045); border-color: rgba(239, 68, 68, 0.24); color: #b91c1c; }
html[data-scheme="light"] .btn.hw-nav-done    { background: rgba(34, 197, 94, 0.1);   border-color: rgba(34, 197, 94, 0.36);  color: #15803d; }
html[data-scheme="light"] .btn.hw-nav-new:hover     { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.6); }
html[data-scheme="light"] .btn.hw-nav-pending:hover { background: rgba(239, 68, 68, 0.09); border-color: rgba(239, 68, 68, 0.4); }
html[data-scheme="light"] .btn.hw-nav-done:hover    { background: rgba(34, 197, 94, 0.16); border-color: rgba(34, 197, 94, 0.52); }

/* 题目卡片上的「贡献人：姓名」 */
.card .contributor { color: var(--muted); }
html[data-scheme="light"] .card .contributor { color: #64748b; }

/* 题单题目：添加区 */
.add-set-problem {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 145, 178, 0.05);
}
.set-add-tabs { align-self: flex-start; }
.set-add-row { display: flex; gap: 8px; align-items: flex-start; width: 100%; }
.set-add-row .text-input { flex: 1 1 auto; }
.set-add-row textarea {
  flex: 1 1 auto;
  min-height: 58px;
  resize: vertical;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: rgba(10, 16, 28, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: 0.18s;
}
.set-add-row textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08); }
html[data-scheme="light"] .add-set-problem { background: rgba(8, 145, 178, 0.06); }
html[data-scheme="light"] .set-add-row textarea { background: #fff; }

/* 题单题目行 / 作业题目行 */
.set-problem {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 7px;
  background: var(--panel);
  cursor: pointer;
  transition: 0.16s;
}
.set-problem:hover { border-color: rgba(34, 211, 238, 0.42); background: rgba(8, 145, 178, 0.07); }
.set-problem .record-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-problem .btn { flex: 0 0 auto; }
.set-idx {
  flex: 0 0 auto;
  min-width: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
}
html[data-scheme="light"] .set-problem:hover { background: rgba(8, 145, 178, 0.08); }

/* 作业题目的「同步OJ」按钮 + 同步完成标记 */
.btn.oj-sync-btn {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.32);
  background: rgba(34, 211, 238, 0.08);
}
.btn.oj-sync-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}
.btn.oj-sync-btn:disabled { opacity: 0.5; }

.oj-synced-tag {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  white-space: nowrap;
}
html[data-scheme="light"] .btn.oj-sync-btn { color: #0e7490; border-color: rgba(8, 145, 178, 0.34); background: rgba(8, 145, 178, 0.07); }
html[data-scheme="light"] .oj-synced-tag { color: #15803d; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.38); }

.set-detail-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }

/* 做题记录：我的代码 */
.record-row-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.field textarea.code-input {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
  background: #05080f;
}
html[data-scheme="light"] .field textarea.code-input {
  background: #f8fafc;
  color: #1e293b;
}
.record-code { position: relative; margin-top: 4px; }
.record-code .code-block { font-size: 12.5px; max-height: 420px; overflow: auto; }
.record-code-copy { position: absolute; top: 8px; right: 8px; z-index: 1; }

/* 做题状态：待复盘 / 已复盘 */
.status.reviewing { color: #fb923c; border-color: rgba(251, 146, 60, 0.38); background: rgba(251, 146, 60, 0.1); }
.status.reviewed { color: var(--cyan); border-color: rgba(34, 211, 238, 0.38); background: rgba(34, 211, 238, 0.1); }
html[data-scheme="light"] .status.reviewing { color: #c2410c; }
html[data-scheme="light"] .status.reviewed { color: #0e7490; }

/* JZCJOJ 平台徽章 */
.badge.sfls { color: #86efac; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.32); }
html[data-scheme="light"] .badge.sfls { color: #047857; background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.45); }

/* 题单加题：4 个平台分段更紧凑 */
.set-add-tabs .seg { padding: 5px 11px; font-size: 12px; }

/* ==========================================================================
   做题记录：在线评测（JZCJOJ）
   ========================================================================== */
.judge-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin: 2px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 145, 178, 0.05);
}
.judge-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.judge-title { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.judge-lang { width: 152px; padding: 5px 9px; font-size: 12.5px; }
.judge-saved { font-size: 11.5px; color: var(--muted); opacity: 0; transition: opacity 0.2s ease; }
.judge-saved.judge-saved-on { opacity: 1; color: var(--ok); }
.judge-account { font-size: 11.5px; }
.judge-result { font-size: 12.5px; line-height: 1.7; }
.judge-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.judge-meta { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.judge-meta b { color: var(--text); font-weight: 600; }
.judge-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.judge-badge.ok   { color: #4ade80; border-color: rgba(74, 222, 128, 0.4);  background: rgba(74, 222, 128, 0.12); }
.judge-badge.bad  { color: #f87171; border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.12); }
.judge-badge.ce   { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4);  background: rgba(251, 191, 36, 0.12); }
/* 进行中（Waiting / Compiling / Running / Judging…）统一用蓝色，和「出结果」的绿 / 黄 / 红区分开 */
.judge-badge.wait,
.judge-badge.run {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.16);
}
.judge-badge.is-live { padding-left: 7px; }
.judge-dot {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: judge-pulse 1.15s ease-in-out infinite;
}
@keyframes judge-pulse {
  0%   { opacity: 1;   transform: scale(1);    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55); }
  70%  { opacity: 0.55; transform: scale(0.86); box-shadow: 0 0 0 5px rgba(96, 165, 250, 0); }
  100% { opacity: 1;   transform: scale(1);    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .judge-dot { animation: none; }
}
.judge-link { font-size: 12px; color: var(--cyan); text-decoration: none; white-space: nowrap; }
.judge-link:hover { text-decoration: underline; }
.judge-message {
  margin: 6px 0 0;
  padding: 8px 10px;
  max-height: 190px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #fca5a5;
  background: rgba(5, 8, 15, 0.85);
  border: 1px solid rgba(248, 113, 113, 0.24);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
html[data-scheme="light"] .judge-box { background: rgba(8, 145, 178, 0.06); }
html[data-scheme="light"] .judge-badge.ok   { color: #15803d; }
html[data-scheme="light"] .judge-badge.bad  { color: #b91c1c; }
html[data-scheme="light"] .judge-badge.ce   { color: #b45309; }
html[data-scheme="light"] .judge-badge.wait,
html[data-scheme="light"] .judge-badge.run { color: #1d4ed8; border-color: rgba(37, 99, 235, 0.4); background: rgba(37, 99, 235, 0.12); }
html[data-scheme="light"] .judge-link { color: #0e7490; }
html[data-scheme="light"] .judge-message { color: #b91c1c; background: #fff5f5; border-color: rgba(185, 28, 28, 0.2); }

.judge-io-hint { margin: 2px 0 0; line-height: 1.6; }

/* 做题进度：只读徽章（由系统自动判定，不可手动修改） */
.record-status-view {
  margin-left: 0;
  font-size: 11.5px;
  padding: 3px 10px;
  line-height: 1.5;
}
.record-auto-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  cursor: default;
}
.record-auto-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.75;
}
.record-status-hint {
  margin: -4px 0 2px;
  line-height: 1.6;
}

/* ==========================================================================
   学生成长曲线
   ========================================================================== */
.growth-chart {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px 6px;
  background: var(--panel);
}
.growth-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.growth-chart-title { font-size: 13px; font-weight: 600; color: var(--text); }
.growth-legend { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.growth-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.growth-legend b { color: #a78bfa; font-weight: 600; }
.growth-chart svg { display: block; width: 100%; height: auto; }
.growth-chart .g-line { stroke: var(--line); stroke-width: 1; }
.growth-chart .g-axis { stroke: var(--line); stroke-width: 1.2; }
.growth-chart .g-tick { font-size: 10px; fill: var(--muted); font-family: var(--mono); }
.growth-chart .g-area { fill: rgba(167, 139, 250, 0.12); }
html[data-scheme="light"] .growth-chart .g-tick { fill: #64748b; }

/* ==========================================================================
   排行榜 + 题单学生完成情况
   ========================================================================== */
.leaderboard-table { margin-top: 6px; }
.leaderboard-table td { vertical-align: middle; }
.leaderboard-table .lb-ability { color: var(--cyan); font-weight: 700; }
.lb-tip { margin: 12px 0 0; line-height: 1.6; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
}
.rank-badge.rank-1 { color: #fbbf24; border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.12); }
.rank-badge.rank-2 { color: #cbd5e1; border-color: rgba(203, 213, 225, 0.45); background: rgba(203, 213, 225, 0.1); }
.rank-badge.rank-3 { color: #fb923c; border-color: rgba(251, 146, 60, 0.45); background: rgba(251, 146, 60, 0.1); }

.lb-me { background: rgba(34, 211, 238, 0.07); }
.lb-me-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  font-size: 10px;
}

.completion-table { margin-top: 14px; }
.completion-table td { vertical-align: middle; }
.completion-table .pct { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }

.bar-fill.ok { background: linear-gradient(90deg, rgba(52, 211, 153, 0.9), rgba(16, 185, 129, 0.5)); }
.bar-fill.warn { background: linear-gradient(90deg, rgba(251, 146, 60, 0.9), rgba(244, 63, 94, 0.45)); }

.btn.accent { color: var(--cyan); border-color: rgba(34, 211, 238, 0.34); }
.btn.accent:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1); }

html[data-scheme="light"] .rank-badge { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
html[data-scheme="light"] .rank-badge.rank-1 { color: #b45309; background: #fef3c7; border-color: #fde68a; }
html[data-scheme="light"] .rank-badge.rank-2 { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }
html[data-scheme="light"] .rank-badge.rank-3 { color: #c2410c; background: #ffedd5; border-color: #fed7aa; }
html[data-scheme="light"] .lb-me { background: #ecfeff; }
html[data-scheme="light"] .lb-me-tag { color: #0e7490; border-color: #a5f3fc; background: #cffafe; }
html[data-scheme="light"] .completion-table .pct { color: #64748b; }

/* 详情页：学生标签折叠按钮 / 教师记录提示 */
.detail-section h4 .btn { text-transform: none; letter-spacing: 0; margin-left: 6px; vertical-align: middle; }
.detail-section h4 .btn.tiny { padding: 2px 8px; }
.record-teacher-hint { margin: -2px 0 10px; }
html[data-scheme="light"] .record-teacher-hint { color: #64748b; }

/* 洛谷评测账号弹窗 */
.luogu-acc-status { font-size: 13px; margin-bottom: 12px; }
.luogu-acc-tabs { margin-bottom: 12px; }
.luogu-panel { display: flex; flex-direction: column; gap: 10px; }
.luogu-panel .field span { min-width: 0; }
.luogu-captcha-box { display: flex; flex-direction: column; gap: 8px; }
.luogu-captcha-box img { width: 180px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.luogu-acc-unbind { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.luogu-acc-status code { font-family: var(--mono); font-size: 11.5px; }

/* ------------------------------ 顶栏图标按钮 ------------------------------ */
/* 我的做题记录 / 我的成长记录 / 洛谷账号 / 登出 / 修改密码 / 排行榜 用图标，
   名称通过悬停提示（data-tip）与 title / aria-label 给出 */
.btn.icon-action {
  padding: 7px 9px;
  color: var(--text-dim);
  position: relative;
}
.btn.icon-action svg { width: 17px; height: 17px; display: block; }
.btn.icon-action:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.36);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}
.btn.icon-action:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(12, 20, 34, 0.97);
  color: #e8f2ff;
  border: 1px solid rgba(56, 189, 248, 0.28);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 70;
}
html[data-scheme="light"] [data-tip]::after {
  background: #0f172a;
  color: #f8fafc;
  border-color: rgba(15, 23, 42, 0.9);
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (hover: none) { [data-tip]::after { display: none; } }

/* ------------------------------ 顶栏身份区（导航最前面） ------------------------------ */
/* 角色 + 姓名放到导航按钮之前，右侧留一条细分隔线 */
.actions .user-area,
.actions .auth-area { order: -1; }
.user-area {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.auth-area {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

/* ------------------------------ 做题记录详情弹窗 ------------------------------ */
.record-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.record-detail-meta .status { margin-left: 0; }
.record-detail-meta .record-pid { margin: 0; }
.record-detail-dialog .dialog-body { max-height: calc(100vh - 210px); }

/* ------------------------------ Codeforces 评测 ------------------------------ */
/* 「去 Codeforces 提交」下方给的原站链接 */
.judge-extra-links { margin-top: 6px; font-size: 12px; }
.judge-extra-links .judge-link { margin-right: 2px; }
/* 语言下拉在 Codeforces 里由站内选择，这里隐藏但仍占位会留空隙，直接不显示 */
#judgeLang[hidden] { display: none; }


/* ------------------------------ 评测：粘贴提交链接 ------------------------------ */
.judge-link-lookup {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.judge-link-lookup .text-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  font-size: 12px;
}
.judge-link-lookup .btn { flex: 0 0 auto; white-space: nowrap; }
.judge-stale-hint { margin-top: 4px; }

/* ------------------------------ 洛谷提交验证码 ------------------------------ */
/* 洛谷风控要求提交时输验证码：图片 + 输入框，代码已保存，只需补一次 */
.judge-captcha {
  margin-top: 10px;
  padding: 10px 12px 11px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.07);
}
.judge-captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.judge-captcha-row + .judge-captcha-row { margin-top: 8px; }
.judge-captcha-img {
  height: 40px;
  min-width: 110px;
  max-width: 220px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  cursor: pointer;
}
.judge-captcha-img:not([src]) { display: none; }
.judge-captcha-row .text-input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 260px; /* 验证码只有 4 位，不用铺满整行 */
  height: 32px;
  letter-spacing: 0.14em;
  font-family: var(--mono);
}
.judge-captcha-row .btn { flex: 0 0 auto; white-space: nowrap; }
.judge-captcha p { margin: 8px 0 0; line-height: 1.6; }
html[data-scheme="dark"] .judge-captcha-img { background: #f8fafc; }

/* 讨论区 */
/* 弹窗宽度比通用弹窗（680px）宽 10%：680 × 1.1 = 748px */
dialog.dialog.discussion-dialog { width: min(748px, calc(100vw - 32px)); }
.discussion-dialog .dialog-body { min-height: 320px; }
.discussion-list { display: flex; flex-direction: column; gap: 9px; }
.discussion-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 11px 13px;
  cursor: pointer;
  transition: 0.16s;
}
.discussion-item:hover { border-color: rgba(34, 211, 238, 0.42); background: rgba(8, 145, 178, 0.07); }
.discussion-item.archived { opacity: 0.62; }
.discussion-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.discussion-item-title { font-size: 14px; font-weight: 600; }
.discussion-reply-count { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.discussion-item-preview {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.discussion-item-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.discussion-author { color: var(--text-dim); font-weight: 600; }
.discussion-last { margin-left: auto; }

.discussion-badge {
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.discussion-badge.pinned { color: #67e8f9; background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.4); }
.discussion-badge.archived { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.32); }
.discussion-badge.muted { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.32); }
html[data-scheme="light"] .discussion-badge.pinned { color: #0e7490; }
html[data-scheme="light"] .discussion-badge.muted { color: #b91c1c; }

.discussion-muted {
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font-size: 12.5px;
}
html[data-scheme="light"] .discussion-muted { color: #b91c1c; }

.discussion-empty { padding: 48px 12px; }
.discussion-back { margin-bottom: 12px; }
.discussion-topic {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.discussion-topic-content { margin-top: 10px; font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.discussion-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.discussion-replies-title { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.04em; }
.discussion-replies { display: flex; flex-direction: column; gap: 8px; }
.discussion-reply {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 9px 12px;
}
.discussion-reply-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.discussion-reply-delete { margin-left: auto; }
.discussion-reply-content { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.discussion-reply-form { margin-top: 12px; }
.discussion-reply-form textarea { width: 100%; resize: vertical; min-height: 76px; }
.discussion-reply-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* ==========================================================================
   登录首屏 + 侧边栏工作台（v106）
   参考布局：居中的浅色登录卡片 / 深色分组侧边栏 + 精简顶栏 + 卡片内容区
   ========================================================================== */
:root {
  --shell-w: 208px;
  --shell-bg: #151d3b;
  --shell-text: #aab6d4;
  --shell-active: #2b3f8f;
  /* 侧边栏跟随主题：以下变量由 themes.css 按皮肤覆盖，勿在业务样式里写死颜色 */
  --shell-active-text: #ffffff;
  --shell-hover: rgba(255, 255, 255, 0.06);
  --shell-hover-text: #ffffff;
  --shell-strong: #ffffff;
  --shell-heading: #6b789e;
  --shell-foot: #5d6b92;
  --shell-line: rgba(255, 255, 255, 0.06);
  --shell-accent: #4fc3e8;
  --shell-mark-from: #3b82f6;
  --shell-mark-to: #06b6d4;
  --shell-shadow: rgba(10, 18, 40, 0.22);
  --login-bg: #e9eeff;
  --login-ink: #142a63;
  --login-muted: #8792ad;
  --login-field: #f4f7ff;
  --login-line: #e3e9f8;
}

/* ------------------------------ 登录首屏 ------------------------------ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--login-bg);
}
html.auth-locked .login-screen { display: flex; }
html.auth-locked body { padding-left: 0 !important; overflow: hidden; }
html.auth-locked .topbar,
html.auth-locked .toolbar,
html.auth-locked .content,
html.auth-locked .sidebar,
html.auth-locked .theme-dock,
html.auth-locked .scene,
html.auth-locked .theme-stage,
html.auth-locked .bg-grid,
html.auth-locked .bg-glow { display: none !important; }

.login-card {
  width: min(380px, 100%);
  padding: 34px 30px 28px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(23, 42, 110, 0.12);
}
.login-title {
  margin: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--login-ink);
}
.login-subtitle {
  margin: 6px 0 28px;
  text-align: center;
  font-size: 12.5px;
  color: var(--login-muted);
}
.login-form { display: flex; flex-direction: column; }
.login-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #25325c;
}
.login-input {
  width: 100%;
  height: 46px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 1px solid var(--login-line);
  border-radius: 10px;
  outline: none;
  background: var(--login-field);
  color: #25325c;
  font: 14px var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input::placeholder { color: #a7b0c8; }
.login-input:focus { border-color: #7aa5ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10); }
.login-input.invalid { border-color: #f87171; }
.login-submit {
  height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(100deg, #2563eb, #06b6d4);
  color: #ffffff;
  font: 700 15px var(--sans);
  letter-spacing: 0.32em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.20);
}
.login-submit:hover { filter: brightness(1.06); }
.login-submit:disabled { opacity: 0.65; cursor: wait; }
.login-msg { min-height: 18px; margin: 10px 0 0; text-align: center; font-size: 12px; color: #dc2626; }
.login-register {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: #2563eb;
  font: 500 12.5px var(--sans);
  cursor: pointer;
}
.login-register:hover { text-decoration: underline; }

/* ------------------------------ 侧边栏 ------------------------------ */
html:not(.nav-collapsed):not(.auth-locked) body { padding-left: var(--shell-w); }
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--shell-w);
  background: var(--shell-bg);
  color: var(--shell-text);
  transition: transform 0.2s ease;
}
html.nav-collapsed .sidebar { transform: translateX(-100%); }
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--shell-line);
}
.sidebar-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--shell-mark-from), var(--shell-mark-to));
  color: #ffffff;
}
/* 品牌图标直接使用站点 favicon（与 jzcjoi 一致的红色校徽），白底裁圆角 */
.sidebar-mark.has-logo {
  background: #ffffff;
  border: 1px solid var(--shell-line);
  overflow: hidden;
}
.sidebar-mark.has-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { color: var(--shell-strong); font-size: 14px; letter-spacing: 0.03em; }
.sidebar-brand-text span { color: var(--shell-accent); font-size: 10px; letter-spacing: 0.02em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 0 12px; }
.nav-group-title {
  margin: 12px 0 4px;
  padding: 0 18px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--shell-heading);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 2px 8px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-text);
  font: 13px var(--sans);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--shell-hover); color: var(--shell-hover-text); }
.nav-item.active { background: var(--shell-active); color: var(--shell-active-text); font-weight: 600; }

/* 学生「我的作业」：有新布置 = 实红；有未完成 = 淡红；全部完成 = 回到主题默认色 */
.nav-item.hw-nav-new {
  background: var(--hw-nav-new-bg, #ef4444);
  color: var(--hw-nav-new-fg, #ffffff);
  font-weight: 600;
}
.nav-item.hw-nav-new:hover {
  background: var(--hw-nav-new-bg-hover, #dc2626);
  color: var(--hw-nav-new-fg, #ffffff);
}
.nav-item.hw-nav-pending {
  background: var(--hw-nav-pending-bg, rgba(239, 68, 68, 0.20));
  color: var(--hw-nav-pending-fg, #fca5a5);
}
.nav-item.hw-nav-pending:hover {
  background: var(--hw-nav-pending-bg-hover, rgba(239, 68, 68, 0.30));
  color: var(--hw-nav-pending-fg, #fca5a5);
}
.nav-ico { display: inline-block; width: 16px; text-align: center; font-size: 13px; opacity: 0.9; }
.sidebar-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--shell-line);
  font-size: 10px;
  color: var(--shell-foot);
}

/* ------------------------------ 精简顶栏 ------------------------------ */
.topbar {
  min-height: 56px;
  padding: 10px 22px !important;
  gap: 12px !important;
  flex-wrap: nowrap !important;
  background: var(--panel-solid) !important;
  border-bottom: 1px solid var(--line) !important;
  backdrop-filter: none !important;
}
.topbar-deco,
.topbar .brand,
.topbar .stat-strip,
.topbar .actions > .btn,
.topbar .actions > label,
.topbar .actions > .theme-toggle,
.topbar .user-area > .btn { display: none !important; }
.nav-toggle {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.nav-toggle:hover { color: var(--text); }
.topbar-page-title { font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap; }
.topbar-tools { display: flex; align-items: center; gap: 4px; }
.top-tool {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
}
.top-tool:hover { background: var(--panel-hover); color: var(--text); }
.top-tool.text { padding: 0 10px; font-size: 12.5px; }
.user-chip {
  padding: 4px 12px !important;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.09);
  color: #2563eb !important;
  font-size: 12px !important;
}
html[data-theme="dark"] .user-chip { background: rgba(56, 189, 248, 0.12); color: #7dd3fc !important; }
.user-chip .role-badge { background: transparent; border: 0; padding: 0; color: inherit; }

/* ------------------------------ 内容区页面头 ------------------------------ */
@media (max-width: 900px) {
  html:not(.nav-collapsed):not(.auth-locked) body { padding-left: 0; }
  .sidebar { box-shadow: 8px 0 30px var(--shell-shadow); }
}



/* 「自由练习」入口用 <a> 复用按钮 / 导航样式，去掉链接默认下划线 */
a.btn,
a.nav-item.nav-link { text-decoration: none; }
