/* ===== 设计变量 ===== */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-2: #4f46e5;
  --brand-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #e9f9ef;
  --red: #dc2626;
  --red-soft: #fdeeee;
  --amber: #d97706;
  --amber-soft: #fef6e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --sidebar: 236px;
}
body.dark {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #182338;
  --text: #e6edf7;
  --muted: #91a1b8;
  --line: #24324a;
  --brand: #5b8cff;
  --brand-2: #7c8cff;
  --brand-soft: #1b2a4d;
  --green-soft: #123324;
  --red-soft: #3a1a1c;
  --amber-soft: #3a2a12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.only-mobile { display: none !important; }
.boot { padding: 80px; text-align: center; color: var(--muted); }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr;
}
.login-hero {
  background: radial-gradient(1200px 600px at 10% 10%, #3b82f6 0%, #2563eb 35%, #1e3a8a 100%);
  color: #fff; padding: 64px 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px;
  background: rgba(255,255,255,.08); border-radius: 50%;
}
.login-hero h1 { font-size: 40px; margin: 0 0 12px; letter-spacing: 2px; }
.login-hero p { color: #dbeafe; max-width: 420px; line-height: 1.9; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; color: #e0ecff; }
.login-hero li { margin: 10px 0; }
.login-hero li::before { content: "✓"; color: #86efac; margin-right: 10px; font-weight: 700; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--panel); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { margin: 0 0 6px; font-size: 24px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; }
.login-tabs { display: flex; gap: 6px; background: var(--panel-2); padding: 5px; border-radius: 12px; margin-bottom: 22px; }
.login-tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.login-tabs button.on { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }
.demo-tip { margin-top: 22px; padding: 12px 14px; background: var(--brand-soft); border-radius: 10px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.demo-tip b { color: var(--brand); }

/* ===== 表单 ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); outline: none; transition: .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea.input { min-height: 92px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-weight: 600; transition: .15s;
}
.btn:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(37,99,235,.25); }
.btn.danger { color: var(--red); border-color: #fecaca; background: var(--red-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ===== 布局 ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; font-weight: 800; font-size: 17px; letter-spacing: .5px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1); font-size: 18px;
}
.nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav .ico { width: 20px; text-align: center; }
.nav .sep { margin: 14px 12px 6px; font-size: 11px; letter-spacing: 1px; color: var(--muted); opacity: .7; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.user-mini:hover { background: var(--panel-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #60a5fa, #818cf8); color: #fff; font-weight: 700;
}
.user-mini .nm { font-weight: 700; font-size: 14px; }
.user-mini .rl { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 24px 30px 60px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 22px; margin: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 17px;
}
.badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 4px;
}

/* ===== 卡片/网格 ===== */
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card .hd h3 { margin: 0; font-size: 15px; }
.card .hd .spacer { flex: 1; }
.card .bd { padding: 18px; }
.card .bd.tight { padding: 8px 10px; }
.stat { padding: 18px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: .5px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.blue .v { color: var(--brand); }
.stat.green .v { color: var(--green); }
.stat.amber .v { color: var(--amber); }
.stat.red .v { color: var(--red); }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; letter-spacing: .3px; background: var(--panel-2); }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; }

/* ===== 标签 ===== */
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ===== 弹窗/提示 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 80; padding: 20px;
}
.modal { background: var(--panel); border-radius: 16px; width: min(640px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal .mh { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .mh h3 { margin: 0; font-size: 16px; }
.modal .mh .x { margin-left: auto; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal .mb { padding: 20px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 99;
  opacity: 0; pointer-events: none; transition: .25s; font-size: 14px; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }

/* ===== 答题 ===== */
.exam-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.exam-top {
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 22px;
  display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20;
}
.exam-top h2 { margin: 0; font-size: 17px; }
.timer { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.timer.warn { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.exam-body { flex: 1; display: grid; grid-template-columns: 1fr 260px; gap: 18px; padding: 20px 22px 100px; max-width: 1180px; width: 100%; margin: 0 auto; }
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.q-stem { font-size: 16.5px; line-height: 1.8; margin: 10px 0 20px; }
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  display: flex; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px;
  margin-bottom: 10px; cursor: pointer; transition: .15s; background: var(--panel);
}
.opt:hover { border-color: #c7d2fe; background: var(--panel-2); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt .k {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--panel-2); font-weight: 700; font-size: 13px; border: 1px solid var(--line);
}
.opt.sel .k { background: var(--brand); color: #fff; border-color: var(--brand); }
.opt.right .k { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong .k { background: var(--red); color: #fff; border-color: var(--red); }
.explain { margin-top: 18px; padding: 14px 16px; border-radius: 11px; background: var(--panel-2); border-left: 4px solid var(--brand); }
.explain b { color: var(--brand); }
.result-line { display: flex; align-items: center; gap: 10px; margin: 16px 0; font-weight: 700; }
.result-line.right { color: var(--green); }
.result-line.wrong { color: var(--red); }
.nav-side { position: sticky; top: 90px; height: fit-content; }
.q-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.q-dot {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); display: grid; place-items: center;
}
.q-dot.done { background: var(--brand-soft); color: var(--brand); border-color: #c7d2fe; }
.q-dot.cur { outline: 2px solid var(--brand); outline-offset: 1px; }
.q-dot.flag { box-shadow: inset 0 -3px 0 var(--amber); }
.exam-foot {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 12px; z-index: 30;
}
.exam-foot .spacer { flex: 1; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.choice {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); font-size: 14px;
}
.choice.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }

/* ===== 分页/筛选 ===== */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 4px; }

/* ===== 图表 ===== */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding: 10px 4px 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.bars .bar i { width: 100%; max-width: 40px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #60a5fa, #2563eb); display: block; }
.bars .bar i.zero { background: var(--line); }
.bars .bar span { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ===== 列表 ===== */
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .ttl { font-weight: 600; }
.list-item .sub { font-size: 12.5px; color: var(--muted); }
.notice-item { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.notice-item.unread { background: var(--brand-soft); }
.notice-item .t { font-weight: 600; font-size: 14px; }
.notice-item .b { font-size: 13px; color: var(--muted); margin-top: 3px; }
.notice-item .d { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ===== 响应式 ===== */
@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .exam-body { grid-template-columns: 1fr; }
  .nav-side { position: static; }
}
@media (max-width: 760px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60;
    width: 100%; height: 60px; flex: 0 0 auto; flex-direction: row; align-items: center;
    padding: 4px 6px; border-right: 0; border-top: 1px solid var(--line); background: var(--panel);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
  }
  .brand { display: none; }
  .nav { flex-direction: row; gap: 0; width: 100%; overflow-x: auto; padding: 0 2px; justify-content: space-around; }
  .nav .sep, .sidebar-foot { display: none; }
  .nav a[href="#/s/stats"], .nav a[href="#/s/settings"], .nav a[href="#/t/settings"] { display: none; }
  .nav a {
    flex: 0 1 auto; flex-direction: column; gap: 1px; padding: 6px 5px;
    font-size: 10.5px; line-height: 1.2; white-space: nowrap; border-radius: 10px;
  }
  .nav a .ico { font-size: 16px; }
  .main { padding: 14px 12px 84px; }
  .topbar { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .topbar h1 { font-size: 19px; }
  .topbar .sub { font-size: 12.5px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .exam-foot { flex-wrap: wrap; }
  .q-grid { grid-template-columns: repeat(6, 1fr); }
  table { font-size: 13px; }
  th, td { padding: 9px 8px; }
  .modal { width: 100%; border-radius: 14px; }
  .modal .mb { padding: 16px; }
  .bars { height: 130px; }
  .card .hd { padding: 13px 14px; }
  .card .bd { padding: 14px; }
  .only-mobile { display: inline-flex !important; align-items: center; justify-content: center; }
}
