/* ==========================================================================
   FLYIOI · 深色科技风样式
   深蓝底 + 青色高亮 + 细网格 + 微光晕
   ========================================================================== */

: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;
  --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; }

.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: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.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; }
.theme-toggle .t-icon { width: 17px; height: 17px; display: inline-block; }
.theme-toggle .t-moon { display: none; }
html[data-theme="light"] .theme-toggle .t-sun { display: none; }
html[data-theme="light"] .theme-toggle .t-moon { 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;
}

.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; }

.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); }

.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); }

.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; }

/* 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; }

.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-theme="light"]）
   ========================================================================== */
html[data-theme="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;
}

/* 背景网格与光晕（浅色版更柔和） */
html[data-theme="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-theme="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-theme="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-theme="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-theme="light"] .brand-text h1 {
  background: linear-gradient(92deg, #0f172a, var(--cyan) 75%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* 按钮 */
html[data-theme="light"] .btn {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.16);
}
html[data-theme="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-theme="light"] .btn.primary {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(8, 145, 178, 0.3);
}
html[data-theme="light"] .btn.primary:hover { color: #ffffff; }
html[data-theme="light"] .btn.ghost { background: rgba(255, 255, 255, 0.6); color: var(--text-dim); }
html[data-theme="light"] .icon-btn:hover { background: rgba(8, 145, 178, 0.1); }

/* 搜索 / 输入 / 下拉 */
html[data-theme="light"] .search-wrap,
html[data-theme="light"] .segmented,
html[data-theme="light"] .select,
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea,
html[data-theme="light"] .inline-field select,
html[data-theme="light"] .tag-add input,
html[data-theme="light"] .page-btn {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}
html[data-theme="light"] .search-wrap input::placeholder,
html[data-theme="light"] .text-input::placeholder { color: #9aa7b8; }
html[data-theme="light"] .seg.active { color: #0f172a; }
html[data-theme="light"] .page-btn.active { color: #0f172a; }

/* 标签筛选 chip */
html[data-theme="light"] .chip { background: rgba(255, 255, 255, 0.82); }
html[data-theme="light"] .chip.active { color: #0f172a; }

/* 卡片 */
html[data-theme="light"] .title-cn { color: #1e293b; }
html[data-theme="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-theme="light"] .empty { background: rgba(255, 255, 255, 0.6); }

/* 弹窗 */
html[data-theme="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-theme="light"] dialog::backdrop { background: rgba(15, 23, 42, 0.4); }
html[data-theme="light"] .dialog-head { background: rgba(246, 248, 251, 0.9); }
html[data-theme="light"] .dialog-foot { background: rgba(246, 248, 251, 0.9); }

/* 代码块 */
html[data-theme="light"] .field textarea.code-input,
html[data-theme="light"] .code-block {
  background: #f8fafc;
  color: #334155;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .tok-kw { color: #7c3aed; }
html[data-theme="light"] .tok-type { color: #0369a1; }
html[data-theme="light"] .tok-str { color: #16a34a; }
html[data-theme="light"] .tok-num { color: #b45309; }
html[data-theme="light"] .tok-com { color: #94a3b8; }
html[data-theme="light"] .tok-pre { color: #0e7490; }
html[data-theme="light"] .tok-fn { color: #2563eb; }

/* 提示框 / 导入结果 / 同步面板 */
html[data-theme="light"] .hint-box,
html[data-theme="light"] .import-result,
html[data-theme="light"] .tag-editor,
html[data-theme="light"] .text-input,
html[data-theme="light"] .md-preview {
  background: rgba(255, 255, 255, 0.78);
}
html[data-theme="light"] .hint-pre { color: #475569; }
html[data-theme="light"] .error-list,
html[data-theme="light"] .sync-errors { color: #be123c; }
html[data-theme="light"] .sync-box { background: rgba(8, 145, 178, 0.05); }
html[data-theme="light"] .sync-head strong { color: #0f172a; }

/* 统计卡片 */
html[data-theme="light"] .stat-card {
  background: linear-gradient(160deg, #ffffff, #f6f8fb);
}

/* Markdown 正文 */
html[data-theme="light"] .md-body,
html[data-theme="light"] .detail-text { color: #334155; }
html[data-theme="light"] .md-body h1,
html[data-theme="light"] .md-body h2,
html[data-theme="light"] .md-body h3,
html[data-theme="light"] .md-body h4,
html[data-theme="light"] .md-body h5 { color: #1e293b; }
html[data-theme="light"] .md-body code {
  background: rgba(8, 145, 178, 0.1);
  color: #0e7490;
}
html[data-theme="light"] .md-body th { background: rgba(8, 145, 178, 0.06); color: #0f172a; }
html[data-theme="light"] .md-body strong { color: #0f172a; }
html[data-theme="light"] .md-body .katex { color: #1e293b; }

/* 难度评分徽章（浅色下加深文字） */
html[data-theme="light"] .rating.r-grey   { color: #6b7280; }
html[data-theme="light"] .rating.r-green  { color: #059669; }
html[data-theme="light"] .rating.r-cyan   { color: #0891b2; }
html[data-theme="light"] .rating.r-blue   { color: #2563eb; }
html[data-theme="light"] .rating.r-violet { color: #7c3aed; }
html[data-theme="light"] .rating.r-orange { color: #ea580c; }
html[data-theme="light"] .rating.r-red    { color: #e11d48; }

/* 平台徽章 / 状态徽章（浅色下加深文字，避免白底上发糊） */
html[data-theme="light"] .badge.cf    { color: #0369a1; background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.45); }
html[data-theme="light"] .badge.at    { color: #6d28d9; background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.45); }
html[data-theme="light"] .badge.luogu { color: #a16207; background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.5); }
html[data-theme="light"] .badge.other { color: #4b5563; background: rgba(156, 163, 175, 0.18); border-color: rgba(156, 163, 175, 0.45); }
html[data-theme="light"] .status.ac    { color: #047857; }
html[data-theme="light"] .status.todo  { color: #b45309; }

/* Toast */
html[data-theme="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-theme="light"] .toast.error { color: #be123c; }

/* 滚动条 */
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); background-clip: content-box; }
html[data-theme="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-theme="light"] .role-admin   { color: #dc2626; }
html[data-theme="light"] .role-teacher { color: #2563eb; }
html[data-theme="light"] .role-student { color: #059669; }

/* 单列表单 */
.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-theme="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-theme="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-theme="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;
}
.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-theme="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-theme="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-theme="light"] .student-link { color: #0e7490; border-bottom-color: rgba(8, 145, 178, 0.45); }
html[data-theme="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-theme="light"] .teacher-chip { background: rgba(255, 255, 255, 0.9); }
html[data-theme="light"] .teacher-chip:hover { border-color: rgba(8, 145, 178, 0.5); }
html[data-theme="light"] .teacher-chip input { accent-color: #0891b2; }
html[data-theme="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; }
}

/* 用户管理：检索栏 */
.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-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-theme="light"] .set-row.clickable:hover { background: rgba(8, 145, 178, 0.08); }
html[data-theme="light"] .set-enter { color: #0e7490; }

/* 题单题目：添加区 */
.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-theme="light"] .add-set-problem { background: rgba(8, 145, 178, 0.06); }
html[data-theme="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-theme="light"] .set-problem:hover { background: rgba(8, 145, 178, 0.08); }

.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-theme="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-theme="light"] .status.reviewing { color: #c2410c; }
html[data-theme="light"] .status.reviewed { color: #0e7490; }

/* SFLSOJ 平台徽章 */
.badge.sfls { color: #86efac; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.32); }
html[data-theme="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; }

/* ==========================================================================
   做题记录：在线评测（SFLSOJ）
   ========================================================================== */
.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-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); }
.judge-badge.wait { color: #38bdf8; border-color: rgba(56, 189, 248, 0.4);  background: rgba(56, 189, 248, 0.12); }
.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-theme="light"] .judge-box { background: rgba(8, 145, 178, 0.06); }
html[data-theme="light"] .judge-badge.ok   { color: #15803d; }
html[data-theme="light"] .judge-badge.bad  { color: #b91c1c; }
html[data-theme="light"] .judge-badge.ce   { color: #b45309; }
html[data-theme="light"] .judge-badge.wait { color: #0369a1; }
html[data-theme="light"] .judge-link { color: #0e7490; }
html[data-theme="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-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}
.record-auto-toggle input { accent-color: var(--cyan); cursor: pointer; }
.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-theme="light"] .growth-chart .g-tick { fill: #64748b; }
