:root {
  color-scheme: dark;
  font-family: Inter, "Noto Sans", "Noto Sans SC", "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 16px;
  --brand-primary: #6254e7;
  --brand-hover: #5144d4;
  --brand-light: #9185ff;
  --brand-soft: #edeaff;
  --success: #22b98b;
  --error: #ef6262;
  --warning: #f2b544;
  --info: #5595f5;
  --on-brand: #fff;
  --page: #12121a;
  --subtle: #181821;
  --surface: #1c1c28;
  --hover: #272738;
  --line: #30303f;
  --ink: #f5f5fa;
  --muted: #a5a5b8;
  --accent: #b3a9ff;
  --accent-soft: #2e284c;
  --input-line: #454458;
  --danger: #ff9a9a;
  --danger-soft: #3d252d;
  --warning-text: #f6c86a;
  --focus: var(--brand-light);
  --overlay: #0b0916aa;
  --sidebar: var(--subtle);
  --hero: linear-gradient(118deg, #2c244e, #221b3a 68%, #332855);
  color: var(--ink);
  background: var(--page);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f5fa;
  --subtle: #f0eff8;
  --surface: #fff;
  --hover: #ebe9f7;
  --line: #e5e5ef;
  --ink: #202031;
  --muted: #65657d;
  --accent: #5144d4;
  --accent-soft: var(--brand-soft);
  --input-line: #c9c7da;
  --danger: #aa303f;
  --danger-soft: #ffecee;
  --warning-text: #805019;
  --focus: var(--brand-hover);
  --overlay: #14112782;
  --sidebar: var(--surface);
  --hero: linear-gradient(118deg, #e8e4fb, #f1effc 72%, #ede8ff);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--input-line); background: var(--hover); }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--on-brand); }
.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.text-button { min-height: 32px; padding: .25rem .55rem; background: transparent; }
.quiet { color: var(--muted); }
.danger { color: var(--danger); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.25rem; line-height: 1.4; }
h3 { font-size: 1.03rem; }
p { line-height: 1.65; }
.loading { padding: 3rem; text-align: center; }
.layout { display: grid; grid-template-columns: 234px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 1.8rem 1.15rem 1.2rem; background: var(--sidebar); color: var(--ink);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; font-weight: 750; }
.brand-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; overflow: hidden; }
.brand-icon img { width: 100%; height: 100%; object-fit: cover; object-position: 46% center; transform: scale(1.18); }
.brand small { display: block; margin-top: .18rem; color: var(--muted); font-weight: 500; }
.nav { display: grid; gap: .4rem; margin-top: 2.3rem; }
.nav a { padding: .7rem .75rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .94rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-mark { display: inline-block; width: 1.7rem; color: var(--accent); }
.profile { display: flex; align-items: center; gap: .65rem; margin-top: auto; padding-top: 1.2rem; min-width: 0; }
.profile span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.profile button { color: var(--ink); border-color: var(--line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-weight: 700; }
.main { min-width: 0; width: 100%; max-width: 1460px; margin: 0 auto; padding: 2.25rem clamp(1.1rem, 4vw, 3.5rem) 3rem; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1.3rem; }
.hero {
  position: relative; isolation: isolate; overflow: hidden; margin-bottom: 1.5rem; padding: clamp(1.6rem, 4vw, 3rem);
  border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--hero);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; right: -20px; top: -110px; width: 320px; height: 320px;
  border: 24px solid #9185ff30; border-radius: 48% 52% 57% 43%; transform: rotate(-25deg);
  box-shadow: 0 0 0 24px #9185ff19, 0 0 0 52px #9185ff10; pointer-events: none;
}
.hero p { color: var(--ink); margin-top: .65rem; max-width: 48ch; }
.hero .button, .hero button { margin-top: 1.25rem; }
.eyebrow { margin-bottom: .55rem; color: var(--accent); font-size: .88rem; font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.6rem; }
.metric, .panel, .class-card { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.metric { padding: 1rem 1.15rem; }
.metric span { display: block; color: var(--muted); font-size: .925rem; }
.metric strong { display: block; margin-top: .22rem; font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin: 1.45rem 0 .85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 1rem; }
.class-card { display: grid; justify-items: start; padding: 1.2rem; gap: .55rem; color: var(--ink); text-decoration: none; }
.class-card:hover { border-color: var(--brand-light); }
.class-icon, .badge { background: var(--accent-soft); color: var(--accent); }
.class-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; font-weight: 750; }
.badge { display: inline-flex; border-radius: 7px; padding: .2rem .45rem; font-size: .82rem; font-weight: 700; }
.badge.closed { background: var(--subtle); color: var(--muted); }
.exam-clock { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .7rem; }
.exam-settings { display: grid; gap: .8rem; min-inline-size: 0; padding: 0; border: 0; }
.exam-settings legend { margin-block-end: .6rem; font-weight: 700; }
.exam-setting-group { display: grid; padding: 0 .85rem; border: 1px solid var(--line); border-radius: 10px; }
.exam-setting-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding: .6rem 0; }
.exam-setting-row + .exam-setting-row { border-top: 1px solid var(--line); }
.exam-setting-row select { width: auto; max-width: 100%; }
.exam-setting-row input[type="number"] { width: 6rem; }
.exam-setting-row input[role="switch"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.exam-setting-extra { padding-block-end: .65rem; }
.exam-release-setting { border-top: 1px solid var(--line); }
.exam-release-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .75rem; }
.exam-release-controls > .exam-setting-row { flex: 1 1 15rem; }
.exam-release-controls > button { flex: none; }
.exam-publish-classes { display: grid; gap: .45rem; min-inline-size: 0; margin-block: .5rem .85rem; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; }
.exam-candidate-notice { padding: .8rem; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; }
.exam-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .5rem .9rem; margin: 0; }
.exam-info > div { display: grid; gap: .15rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.exam-info dt { color: var(--muted); font-size: .85rem; }
.exam-info dd { margin: 0; overflow-wrap: anywhere; }
.exam-preview-options { padding-inline-start: 1.5rem; }
.exam-review-layout { margin-block-start: .65rem; }
.exam-review-page { min-width: 0; }
.exam-review-page [data-review-heading] { scroll-margin-block-start: 8rem; }
.exam-question-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); align-items: start; gap: 1rem; }
.exam-question-pages { min-width: 0; }
.exam-question-page { position: relative; isolation: isolate; overflow: hidden; min-height: 18rem; }
.exam-question-page > :not(.exam-watermark) { position: relative; }
.exam-question-page h2 { scroll-margin-block-start: 8rem; }
.exam-palette { position: sticky; top: 7.25rem; min-width: 0; }
.exam-palette :is(h2, h3) { margin: 0; font-size: 1rem; }
.exam-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.55rem, 1fr)); gap: .4rem; }
.exam-palette-grid button { min-width: 0; min-height: 2.55rem; padding: .2rem; }
.exam-palette [data-state="answered"] { border-color: #2e9a6c; }
.exam-palette [data-state="blank"] { border-color: #c65862; }
.exam-palette button[aria-current="step"] { box-shadow: inset 0 0 0 1px currentColor; font-weight: 750; }
.exam-palette-key { display: flex; flex-wrap: wrap; gap: .4rem; }
.exam-palette-key span { border: 1px solid; border-radius: 6px; padding: .15rem .4rem; }
.exam-watermark {
  position: absolute; z-index: 1; inset: -12%; pointer-events: none; user-select: none;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); place-items: center; gap: 1.1rem;
  transform: rotate(-20deg); color: var(--ink); opacity: .1; font-weight: 700; font-size: clamp(.6rem, 1.3vw, .85rem);
}
.exam-watermark span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-screen-away, .exam-capture-block .exam-question-pages { visibility: hidden; }
.exam-dialog { width: min(29rem, calc(100vw - 2rem)); }
.exam-dialog .actions { justify-content: flex-end; }
@media (max-width: 700px) {
  .exam-question-layout { grid-template-columns: minmax(0, 1fr); }
  .exam-palette { position: static; grid-row: 1; }
  .exam-question-page { min-height: 14rem; }
}
@media print {
  body:has(.exam-protected) > * { display: none !important; }
  body:has(.exam-protected)::after { content: "考试内容禁止打印"; display: block; }
}
.exam-table { overflow-x: auto; }
.exam-table table { width: 100%; min-width: 540px; border-collapse: collapse; text-align: left; }
.exam-table th, .exam-table td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
.exam-table th { background: var(--accent-soft); color: var(--accent); font-size: .9rem; }
.gradebook-header { margin: 0; }
.gradebook-scroll { overflow: auto; max-height: min(68vh, 46rem); }
.gradebook-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
.gradebook-table th, .gradebook-table td {
  min-width: 8rem; max-width: 14rem; padding: .65rem .75rem; vertical-align: top;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
}
.gradebook-table thead th { position: sticky; top: 0; z-index: 1; background: var(--accent-soft); color: var(--accent); }
.gradebook-table th:first-child { position: sticky; left: 0; min-width: 9rem; }
.gradebook-table thead th:first-child { z-index: 2; }
.gradebook-table tbody th { background: var(--subtle); }
.gradebook-table .details, .grade-cell-note { display: block; margin-top: .15rem; font-weight: 400; }
.grade-cell-note { color: var(--muted); font-size: .85rem; }
.grade-cell-note.pending { color: var(--warning-text); }
.grade-cell-note.missed { color: var(--danger); }
.grade-trend { list-style: none; padding: 0; margin: 0; }
.grade-trend li {
  display: grid; grid-template-columns: minmax(8rem, 1.3fr) minmax(4rem, 1fr) minmax(3rem, auto);
  align-items: center; gap: .7rem; padding: .5rem 0; border-top: 1px solid var(--line);
}
.grade-trend-label { display: grid; min-width: 0; gap: .16rem; overflow-wrap: anywhere; }
.grade-trend meter { width: 100%; height: 1.1rem; }
.grade-trend meter::-webkit-meter-optimum-value { background: var(--brand-primary); }
.assignment-prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.assignment-dialog { width: min(44rem, calc(100vw - 2rem)); }
.assignment-files { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.assignment-files li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; overflow-wrap: anywhere; }
.assignment-feedback { background: var(--accent-soft); border-radius: 10px; padding: .75rem; }
.empty { padding: 1.65rem; color: var(--muted); border: 1px dashed var(--input-line); border-radius: 15px; background: var(--subtle); }
.panel { padding: clamp(1rem, 2.6vw, 1.6rem); }
.stack { display: grid; gap: 1rem; }
.page-title { margin: .45rem 0 .8rem; overflow-wrap: anywhere; }
.invite { padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--accent-soft); }
.invite code { font: 750 1.2rem ui-monospace, monospace; letter-spacing: .13em; }
.activity-row { display: flex; align-items: center; gap: 1rem; justify-content: space-between; text-decoration: none; color: var(--ink); }
.activity-row h3 { margin-bottom: .25rem; overflow-wrap: anywhere; }
.activity-row:hover { border-color: var(--brand-light); }
.inline { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
label.field { display: grid; align-content: start; gap: .4rem; font-weight: 650; min-width: 0; }
input:not([type="checkbox"], [type="radio"]), textarea, select {
  min-width: 0; width: 100%; padding: .58rem .7rem; border: 1px solid var(--input-line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-weight: 400;
}
textarea { min-height: 85px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: .85rem; }
.details { font-size: .9rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; }
dialog {
  width: min(28rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto;
  padding: 1.3rem; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface);
}
dialog::backdrop { background: var(--overlay); }
.question-title { font-size: 1.2rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.question-image { display: block; max-width: 100%; max-height: 450px; object-fit: contain; }
.question-card { display: grid; gap: .9rem; margin: 0; min-width: 0; }
.choices { display: grid; gap: .55rem; }
.choice { display: flex; align-items: flex-start; gap: .7rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; overflow-wrap: anywhere; }
.choice:has(input:checked) { background: var(--accent-soft); border-color: var(--brand-light); }
.choice input { accent-color: var(--brand-primary); margin-top: .28rem; }
.timer { display: inline-grid; align-content: center; border-radius: 12px; background: var(--accent-soft); padding: .55rem .8rem; min-width: 86px; text-align: center; color: var(--accent); }
.timer strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.timer.urgent { background: var(--danger-soft); color: var(--danger); }
.quiz { max-width: 780px; }
.results-grid { display: grid; gap: .6rem; }
.results-grid details { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; }
summary { cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.results-grid details > div { margin-top: .7rem; }
.option-count { display: flex; gap: .45rem; align-items: flex-start; overflow-wrap: anywhere; }
.option-count b { flex: 0 0 auto; }
.grade-form { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; margin: .5rem 0; }
.grade-form input { max-width: 9rem; }
.question-meta { color: var(--muted); font-size: .9rem; }
.class-tools { margin-top: 1rem; }
.paper-importer {
  display: block; width: 100%; height: clamp(36rem, 72vh, 54rem); margin-top: 1rem;
  border: 1px solid var(--line); border-radius: 15px; background: var(--surface);
}
.room-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(270px, 2fr); align-items: start; gap: 1rem; }
.room-title { margin: 0; }
.room-front {
  width: min(100%, 270px); margin: 0 auto; padding: .5rem .8rem;
  color: var(--accent); background: var(--accent-soft); border-radius: 0 0 12px 12px;
  text-align: center; font-weight: 700;
}
.room-scroll { overflow-x: auto; padding: 4px; }
.seat-grid {
  display: grid; grid-template-columns: repeat(var(--room-columns), minmax(76px, 1fr)); gap: .55rem;
}
.columns-1 { --room-columns: 1; }
.columns-2 { --room-columns: 2; }
.columns-3 { --room-columns: 3; }
.columns-4 { --room-columns: 4; }
.columns-5 { --room-columns: 5; }
.columns-6 { --room-columns: 6; }
.columns-7 { --room-columns: 7; }
.columns-8 { --room-columns: 8; }
.columns-9 { --room-columns: 9; }
.columns-10 { --room-columns: 10; }
.columns-11 { --room-columns: 11; }
.columns-12 { --room-columns: 12; }
.desk {
  display: grid; min-height: 64px; align-content: center; gap: .15rem; padding: .35rem;
  border-style: dashed; background: var(--subtle); color: var(--muted); overflow-wrap: anywhere;
}
.desk.occupied { border-style: solid; border-color: var(--input-line); background: var(--accent-soft); color: var(--ink); }
.desk[aria-pressed="true"] { background: var(--brand-primary); border-style: solid; border-color: var(--brand-primary); color: var(--on-brand); }
.desk-number { font: 600 .8rem ui-monospace, monospace; opacity: .85; }
.room-names { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.room-names li { overflow-wrap: anywhere; }
.room-names span { color: var(--muted); font-size: .85rem; }
.topic-results details { padding: .9rem; }
.topic-results summary span:first-child { padding-right: .8rem; }
.topic-results summary span:last-child { font-weight: 600; color: var(--accent); }
.topic-results details > p { margin-top: .5rem; }
.topic-meter { display: block; width: min(100%, 440px); height: 18px; margin: .55rem 0 0; }
.topic-meter::-webkit-meter-optimum-value { background: var(--brand-primary); }
.topic-activity { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .35rem 1rem; border-top: 1px solid var(--line); padding-top: .65rem; }
#notice { position: fixed; right: 1rem; bottom: 1rem; z-index: 5; max-width: min(440px, calc(100% - 2rem)); }
#notice:not(:empty) { padding: .75rem 1rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 8px 30px #110d2635; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: .85rem 1rem; display: grid; grid-template-columns: 1fr auto; gap: .65rem; }
  .nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; margin-top: 0; }
  .nav a { padding: .4rem .55rem; }
  .profile { padding-top: 0; margin-top: 0; }
  .profile span { display: none; }
  .main { padding-top: 1.2rem; }
}
@media (max-width: 1050px) {
  .room-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .metrics { gap: .4rem; }
  .metric { padding: .55rem; }
  .metric span { font-size: .82rem; }
  .metric strong { font-size: 1.35rem; }
  .avatar { display: none; }
}
