/* ============ 基础 ============ */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1b2333;
  --ink-2: #5a6478;
  --muted: #8b93a5;
  --line: #e6eaf2;
  --brand: #2f6bff;
  --brand-d: #1f50cc;
  --brand-l: #eaf0ff;
  --ok: #16a34a;
  --ok-l: #e8f7ee;
  --warn: #d97706;
  --warn-l: #fef4e6;
  --err: #dc2626;
  --err-l: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 .6em; line-height: 1.3; font-weight: 650; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: .5em 0; }
code, pre, .mono { font-family: var(--mono); }
pre {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px;
  overflow: auto; font-size: 13.5px; line-height: 1.55; margin: .6em 0;
}
pre code { background: none; color: inherit; padding: 0; }
:not(pre) > code {
  background: #eef1f7; color: #b02a37; padding: .12em .4em;
  border-radius: 5px; font-size: .9em;
}

/* ============ 布局 ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px; background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); font-size: 1rem; }
.brand:hover { text-decoration: none; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f6bff, #7aa2ff); color: #fff;
  font-size: .95rem; font-weight: 700;
}
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .9rem; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand-l);
  color: var(--brand-d); display: grid; place-items: center; font-weight: 650; font-size: .8rem;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 22px 80px; }
.wrap.wide { max-width: 1320px; }
.inline { display: inline; }

/* ============ 卡片 ============ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px;
}
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.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)); }
@media (max-width: 860px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .wrap { padding: 16px 14px 70px; }
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: .92rem; font-weight: 550;
  cursor: pointer; transition: .16s; text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--brand-d); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: #f7f9fd; color: var(--ink); border-color: #d3daea; }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #128a3e; }
.btn.danger { background: #fff; color: var(--err); border-color: #f3c9c9; }
.btn.danger:hover { background: var(--err-l); }
.btn.sm { padding: 5px 11px; font-size: .84rem; border-radius: 7px; }
.btn.lg { padding: 12px 24px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============ 表单 ============ */
label.field { display: block; margin-bottom: 14px; }
label.field > span.lbl { display: block; font-size: .86rem; color: var(--ink-2); margin-bottom: 5px; font-weight: 550; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font-size: .94rem; color: var(--ink); font-family: inherit;
  transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
textarea.code { font-family: var(--mono); font-size: 13.5px; tab-size: 4; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink-2); margin-bottom: 9px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }

/* ============ 提示 ============ */
.alert { padding: 11px 14px; border-radius: 9px; font-size: .9rem; margin-bottom: 14px; border: 1px solid; }
.alert.err { background: var(--err-l); border-color: #f6cdcd; color: #a31818; }
.alert.ok { background: var(--ok-l); border-color: #c6ead3; color: #14753a; }
.alert.warn { background: var(--warn-l); border-color: #f8ddb4; color: #96560a; }
.alert.info { background: var(--brand-l); border-color: #cfdcff; color: var(--brand-d); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ============ 徽标/标签 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: .78rem; font-weight: 600;
  background: #eef1f7; color: var(--ink-2); white-space: nowrap;
}
.badge.single { background: #e8f0ff; color: #2258c9; }
.badge.multiple { background: #f3e9ff; color: #7a3ec0; }
.badge.judge { background: #e6f7f0; color: #15805c; }
.badge.code { background: #fdf0e4; color: #a55b0a; }
.badge.ok { background: var(--ok-l); color: #14753a; }
.badge.err { background: var(--err-l); color: #a31818; }
.badge.warn { background: var(--warn-l); color: #96560a; }
.badge.muted { background: #eef1f7; color: var(--muted); }
.tag { font-size: .78rem; color: var(--muted); }

/* ============ 表格 ============ */
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: .82rem;
  padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfe;
  white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
table.data tr:hover td { background: #fafcff; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-size: .92rem; }

/* ============ 统计块 ============ */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { font-size: .82rem; color: var(--muted); }
.stat .v { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.stat .v small { font-size: .9rem; font-weight: 500; color: var(--muted); }

/* ============ 侧边导航 ============ */
.shell { display: grid; grid-template-columns: 208px minmax(0,1fr); gap: 26px; max-width: 1320px; margin: 0 auto; padding: 22px; }
.side { position: sticky; top: 74px; align-self: start; }
.side a {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px;
  color: var(--ink-2); font-size: .92rem; margin-bottom: 2px; font-weight: 500;
}
.side a:hover { background: #eef2fa; text-decoration: none; color: var(--ink); }
.side a.active { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.side .sec { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 5px; font-weight: 600; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .side { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side a { white-space: nowrap; }
  .side .sec { display: none; }
}

/* ============ 分页 ============ */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .88rem; color: var(--ink-2); background: #fff;
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ============ 正文块 ============ */
.stem { white-space: pre-wrap; word-break: break-word; }
.stem p { margin: .3em 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 10px; align-items: center; }
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ============ 登录页 ============ */
.login-body { background: #eef2fb; }
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #d9e6ff 0%, transparent 55%),
    radial-gradient(900px 500px at 105% 110%, #e8ddff 0%, transparent 55%),
    #eff4fc;
}
.login-card {
  display: grid; grid-template-columns: 1.05fr .95fr;
  width: min(880px, 100%); background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 70px -28px rgba(24,45,96,.34);
}
.login-hero {
  padding: 44px 40px; color: #fff;
  background: linear-gradient(150deg, #2f6bff 0%, #4c4ad8 55%, #6b3fd0 100%);
}
.login-hero h1 { color: #fff; font-size: 1.7rem; margin: 16px 0 8px; }
.login-hero p { color: rgba(255,255,255,.86); font-size: .95rem; }
.logo.big { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 14px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); }
.feat { list-style: none; padding: 0; margin: 22px 0 0; }
.feat li {
  position: relative; padding: 8px 0 8px 24px; font-size: .9rem;
  color: rgba(255,255,255,.92); border-top: 1px solid rgba(255,255,255,.14);
}
.feat li::before { content: "✓"; position: absolute; left: 0; color: #b8ffd0; font-weight: 700; }
.login-form { padding: 44px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { margin-bottom: 18px; }
.center { text-align: center; }
.login-form .hint.center { margin-top: 18px; }
@media (max-width: 760px) {
  .login-card { grid-template-columns: 1fr; }
  .login-hero { padding: 30px 26px; }
  .login-form { padding: 28px 24px 34px; }
}

/* ============ 学生考试列表 ============ */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.exam-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); transition: .18s; border-top: 3px solid #e3e9f4;
}
.exam-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -18px rgba(20,40,90,.4); }
.exam-card.open { border-top-color: var(--brand); }
.exam-card.doing { border-top-color: var(--warn); }
.exam-card.submitted { border-top-color: var(--ok); }
.exam-card h3 { margin: 2px 0 0; font-size: 1.06rem; }
.exam-card-top { display: flex; align-items: center; gap: 8px; }
.exam-card-top .tag { margin-left: auto; }
.exam-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: var(--muted); margin: 4px 0 2px; }
.exam-card-foot { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; }
.exam-card-foot form { flex: 1; display: flex; gap: 6px; }
.exam-card-foot .btn { flex: 1; }
.access-form input { flex: 1; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ 答题页 ============ */
.take-body { background: #f2f5fa; }
.take-timer {
  display: flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 1rem; font-weight: 650; color: var(--ink-2);
  background: #f1f5fd; border: 1px solid var(--line); padding: 5px 13px; border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.take-timer.warn { background: var(--warn-l); color: #a35b06; border-color: #f2d6a8; }
.take-timer.danger { background: var(--err-l); color: var(--err); border-color: #f5c4c4; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.62} }

.take-shell { display: grid; grid-template-columns: 232px minmax(0,1fr); gap: 20px; max-width: 1220px; margin: 0 auto; padding: 20px; align-items: start; }
.take-nav { position: sticky; top: 70px; }
.take-nav-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.take-nav-head strong { display: block; font-size: .95rem; line-height: 1.35; }
.save-hint { font-size: .78rem; color: var(--ok); margin-top: 5px; transition: .3s; }
.save-hint.saving { color: var(--muted); }
.save-hint.err { color: var(--err); }
.answer-sheet { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.sheet-btn {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: .86rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
  font-family: inherit; transition: .14s; position: relative;
}
.sheet-btn:hover { border-color: var(--brand); color: var(--brand); }
.sheet-btn.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.sheet-btn.cur { outline: 2px solid var(--brand); outline-offset: 2px; }
.sheet-btn.code::after {
  content: ""; position: absolute; right: 3px; top: 3px; width: 5px; height: 5px;
  border-radius: 50%; background: #f0a24a;
}
.sheet-btn.code.done::after { background: #ffe0b3; }
.legend { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; font-size: .76rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.single { background: #2258c9; } .dot.multiple { background: #7a3ec0; }
.dot.judge { background: #15805c; } .dot.code { background: #f0a24a; }
.take-nav-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.progress-line { height: 5px; border-radius: 4px; background: #eaeef7; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #2f6bff, #6b8cff); transition: width .3s; }
.take-nav-foot .btn { margin-top: 10px; }

.take-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.q-card { scroll-margin-top: 76px; }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-no {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand-l); color: var(--brand-d);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.q-card .stem { font-size: .98rem; line-height: 1.75; }

.options { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: .14s; background: #fff; font-size: .94rem;
}
.opt:hover { border-color: #c3d3f5; background: #fafcff; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-key {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #d3daea;
  display: grid; place-items: center; font-size: .8rem; font-weight: 650; color: var(--ink-2);
  transition: .14s; margin-top: 1px;
}
.opt-text { flex: 1; word-break: break-word; }
.opt.sel { border-color: var(--brand); background: var(--brand-l); }
.opt.sel .opt-key { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt.judge-opt .opt-key { border-radius: 7px; }
.judge .opt { max-width: 220px; }

.submit-bar { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
@media (max-width: 980px) {
  .take-shell { grid-template-columns: 1fr; padding: 14px; }
  .take-nav { position: static; }
  .answer-sheet { grid-template-columns: repeat(10, 1fr); }
  .submit-bar { flex-direction: column; align-items: stretch; }
}

/* ============ 代码编辑器 ============ */
.code-wrap { margin-top: 14px; }
.editor { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.editor-bar {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: #f7f9fd; border-bottom: 1px solid var(--line);
}
.editor-bar .lang { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.editor-bar .spacer { flex: 1; }
.editor-body { position: relative; display: flex; background: #0f172a; max-height: 480px; }
.gutter {
  flex: 0 0 auto; padding: 12px 8px 12px 12px; text-align: right; color: #4a5878;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  user-select: none; background: #0c1220; min-height: 120px; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.code-input {
  flex: 1; border: 0; outline: none; resize: none; padding: 12px 14px 12px 10px;
  background: #0f172a; color: #dbe4f3; font-family: var(--mono); font-size: 13.5px;
  line-height: 1.6; tab-size: 4; white-space: pre; overflow: auto; min-height: 120px;
  caret-color: #7aa2ff; display: block;
}
.code-input::placeholder { color: #48546e; }
.stdin-box { margin-top: 10px; }
.stdin-box summary, .cases-box summary {
  cursor: pointer; font-size: .85rem; color: var(--ink-2); font-weight: 550;
  padding: 6px 0; user-select: none;
}
.stdin-box summary:hover, .cases-box summary:hover { color: var(--brand); }
.stdin { margin-top: 6px; font-family: var(--mono); font-size: 13px; background: #fbfcfe; }

.run-result { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.run-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f7f9fd;
  border-bottom: 1px solid var(--line); font-size: .85rem;
}
.run-head .spacer { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--brand); font-size: .82rem; cursor: pointer; padding: 2px 4px; font-family: inherit; }
.linkbtn:hover { text-decoration: underline; }
.run-status { font-weight: 600; }
.run-status.ok { color: var(--ok); } .run-status.err { color: var(--err); }
.run-status.warn { color: var(--warn); }
.run-body { padding: 10px 12px; font-size: .86rem; }
.run-body pre { margin: 6px 0 10px; max-height: 300px; }
.out-lbl { font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: 8px; }
.out-empty { color: var(--muted); font-size: .84rem; font-style: italic; }

.case-item { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.case-lbl { font-size: .76rem; color: var(--muted); font-weight: 600; }
.case-pre {
  background: #f7f9fd; color: var(--ink); border: 1px solid var(--line);
  margin: 3px 0 0; font-size: 12.5px; max-height: 160px; border-radius: 8px;
}
.cases-box { margin-top: 10px; }

.judge-summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.case-row {
  display: grid; grid-template-columns: 54px 62px 1fr; gap: 8px; align-items: start;
  padding: 7px 0; border-bottom: 1px dashed #eef1f7; font-size: .84rem;
}
.case-row:last-child { border-bottom: 0; }
.case-st { font-weight: 600; font-size: .8rem; }
.case-st.pass { color: var(--ok); } .case-st.wrong { color: var(--err); }
.case-st.runtime, .case-st.timeout, .case-st.output_limit { color: var(--warn); }
.case-det { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.case-det .kv { display: flex; gap: 6px; font-family: var(--mono); font-size: 12px; }
.case-det .kv b { color: var(--muted); font-weight: 600; font-family: inherit; flex: 0 0 34px; }
.case-det .kv span { color: var(--ink); white-space: pre-wrap; word-break: break-all; }
.errbox { background: #2a1010; color: #ffb4b4; border: 1px solid #502121; }
@media (max-width: 700px) {
  .case-item { grid-template-columns: 1fr; }
  .case-row { grid-template-columns: 44px 56px 1fr; }
}

/* ============ 成绩页 ============ */
.result-hero { display: flex; gap: 30px; align-items: center; padding: 26px 28px; }
.score-ring { position: relative; flex: 0 0 148px; width: 148px; height: 148px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #eef2f9; stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--ok); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .8s ease; }
.score-ring.fail .ring-fg { stroke: var(--err); }
.score-inner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-num { font-size: 2.3rem; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.score-total { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.result-info { flex: 1; min-width: 0; }
.ri-title { display: flex; align-items: center; gap: 10px; }
.mini-stat .k { font-size: .78rem; color: var(--muted); }
.mini-stat .v { font-size: 1.28rem; font-weight: 700; }
.type-bars { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; }
.type-bar { display: grid; grid-template-columns: 66px 1fr 76px; gap: 10px; align-items: center; font-size: .84rem; }
.tb-name { color: var(--ink-2); }
.tb-track { height: 7px; background: #eef2f9; border-radius: 5px; overflow: hidden; }
.tb-fill { height: 100%; border-radius: 5px; background: var(--brand); transition: width .7s ease; }
.tb-fill.single { background: #2f6bff; } .tb-fill.multiple { background: #7a3ec0; }
.tb-fill.judge { background: #16a34a; } .tb-fill.code { background: #f0a24a; }
.tb-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.review-card { scroll-margin-top: 76px; }
.options.review .opt { cursor: default; }
.options.review .opt:hover { background: #fff; border-color: var(--line); }
.opt.picked { border-color: var(--brand); background: var(--brand-l); }
.opt.right { border-color: #9fd4b3; background: var(--ok-l); }
.opt.right .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong-pick { border-color: #f0b4b4; background: var(--err-l); }
.opt.wrong-pick .opt-key { background: var(--err); border-color: var(--err); color: #fff; }
.opt .mark { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.opt .mark.ok { color: var(--ok); font-weight: 600; }
.opt .mark.err { color: var(--err); font-weight: 600; }
.analysis {
  margin-top: 14px; padding: 11px 14px; background: #f8fafd; border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0; font-size: .9rem; color: var(--ink-2); white-space: pre-wrap;
}
.code-review { margin-top: 12px; }
.code-review summary { cursor: pointer; font-size: .86rem; color: var(--ink-2); padding: 5px 0; }
.code-review summary:hover { color: var(--brand); }
@media (max-width: 700px) {
  .result-hero { flex-direction: column; align-items: stretch; text-align: center; }
  .score-ring { margin: 0 auto; }
  .ri-title { justify-content: center; }
}

/* ============ 教师后台 ============ */
.admin-body { background: #f6f8fc; }
.admin-main { min-width: 0; }
.steps { margin: 0; padding-left: 20px; font-size: .92rem; color: var(--ink-2); line-height: 1.9; }
.steps li { margin-bottom: 4px; }
.steps b { color: var(--ink); }

.filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px 16px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 16px;
}
.filter-bar .f { display: flex; flex-direction: column; gap: 4px; }
.filter-bar .f label { font-size: .78rem; color: var(--muted); font-weight: 550; }
.filter-bar input, .filter-bar select { min-width: 130px; padding: 7px 10px; font-size: .88rem; }
.filter-bar .spacer { flex: 1; }

.q-row { display: flex; gap: 12px; align-items: flex-start; }
.q-row .q-main { flex: 1; min-width: 0; }
.q-row .q-stem { font-size: .92rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-row .q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: .78rem; color: var(--muted); align-items: center; }
.q-row .q-act { display: flex; gap: 6px; flex: 0 0 auto; }
.q-text { white-space: pre-wrap; }

.opt-editor { display: flex; flex-direction: column; gap: 9px; }
.opt-editor .orow { display: flex; align-items: center; gap: 9px; }
.opt-editor .okey {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: #eef2fa; color: var(--ink-2);
  display: grid; place-items: center; font-weight: 650; font-size: .85rem;
}
.opt-editor .orow.correct .okey { background: var(--brand); color: #fff; }
.opt-editor .orow input[type=text] { flex: 1; }

.case-editor { display: flex; flex-direction: column; gap: 8px; }
.case-edit-row {
  display: grid; grid-template-columns: 1fr 1fr 78px 34px; gap: 8px; align-items: start;
  padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe;
}
.case-edit-row textarea { font-family: var(--mono); font-size: 12.5px; min-height: 62px; }
.case-edit-row .del { background: #fff; border: 1px solid #f0caca; color: var(--err); border-radius: 7px; cursor: pointer; height: 30px; font-size: .8rem; }
.case-edit-row .hid { display: flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--ink-2); }
.case-edit-row .hid input { accent-color: var(--brand); }

.type-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.type-tabs a {
  padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  font-size: .86rem; color: var(--ink-2);
}
.type-tabs a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.type-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 550; }

.preview-list { display: flex; flex-direction: column; gap: 12px; max-height: 640px; overflow: auto; padding-right: 4px; }
.preview-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.preview-item .pv-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.preview-item .pv-stem { font-size: .9rem; white-space: pre-wrap; line-height: 1.6; }
.preview-item .pv-opts { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; font-size: .86rem; color: var(--ink-2); }
.preview-item .pv-ans { margin-top: 6px; font-size: .82rem; color: var(--ok); font-weight: 600; }

.dropzone {
  border: 2px dashed #ccd6ea; border-radius: 12px; padding: 34px 20px; text-align: center;
  background: #fafcff; cursor: pointer; transition: .18s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-l); }
.dropzone .dz-ico { font-size: 2rem; }
.dropzone .dz-main { font-weight: 600; margin-top: 8px; }
.dropzone .dz-sub { font-size: .84rem; color: var(--muted); margin-top: 4px; }
.dropzone input[type=file] { display: none; }
.file-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 20px;
  background: var(--brand-l); color: var(--brand-d); font-size: .86rem; font-weight: 550;
}

.picker-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.picked-list { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow: auto; }
.picked-item {
  display: flex; gap: 10px; align-items: center; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: .88rem;
}
.picked-item .pi-order { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.picked-item .pi-stem { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-item input[type=number] { width: 68px; padding: 4px 8px; font-size: .84rem; }
.picked-item .rm { background: none; border: 0; color: var(--err); cursor: pointer; font-size: .95rem; padding: 2px 6px; }

.two-col { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .two-col { grid-template-columns: 1fr; } }
.sticky-side { position: sticky; top: 74px; }

.hidden-pick { display: none; }
.answer-preview {
  margin-top: 8px; padding: 10px; background: var(--brand-l); border-radius: 9px;
  font-family: var(--mono); font-size: 1.1rem; font-weight: 650; color: var(--brand-d);
  text-align: center;
}
.tips { margin: 8px 0 0; padding-left: 18px; font-size: .84rem; color: var(--ink-2); line-height: 1.75; }
.narrow { max-width: 520px; margin: 40px auto; }

/* ============ 分数分布图 ============ */
.dist { display: flex; gap: 14px; align-items: flex-end; height: 150px; padding: 8px 4px 0; }
.dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.dist-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.dist-bar {
  width: 100%; background: linear-gradient(180deg, #6b93ff, #2f6bff); border-radius: 6px 6px 0 0;
  min-height: 2px; transition: height .6s ease;
}
.dist-n { font-size: .82rem; font-weight: 650; color: var(--ink-2); }
.dist-lbl { font-size: .74rem; color: var(--muted); }

.run-count { font-size: .76rem; color: var(--muted); margin-right: 4px; }

/* ============ 移动端顶栏修正 ============ */
@media (max-width: 860px) {
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: nowrap; }
  .topbar .brand > span:last-child { display: none; }
  .brand { flex: 0 0 auto; }
  .topbar .who-name { display: none; }
  .topbar .btn.sm { padding: 4px 9px; font-size: .8rem; }
  .take-timer { font-size: .88rem; padding: 4px 9px; }
  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 1.28rem; }
  .card { padding: 16px 15px; }
  .result-hero { padding: 20px 16px; gap: 18px; }
  .answer-sheet { grid-template-columns: repeat(10, 1fr); }
  .sheet-btn { font-size: .78rem; }
  .two-col { grid-template-columns: 1fr; }
  .sticky-side { position: static; }
  .filter-bar { padding: 10px 12px; }
  .filter-bar .f, .filter-bar input, .filter-bar select { min-width: 0; width: 100%; }
  table.data { font-size: .84rem; }
  table.data th, table.data td { padding: 8px 7px; }
  .q-row .q-act { flex-direction: column; }
}
@media (max-width: 520px) {
  .answer-sheet { grid-template-columns: repeat(6, 1fr); }
  .editor-body { max-height: 340px; }
  .dist { height: 120px; }
  .type-bar { grid-template-columns: 56px 1fr 62px; font-size: .8rem; }
}

.q-meta-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .q-meta-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 选项文字与右侧标记的间距 */
.opt .opt-text { flex: 1; min-width: 0; padding-right: 8px; }
.opt .mark { flex: 0 0 auto; margin-left: 8px; }
