:root {
  color-scheme: light;
  --canvas: #f1f4ef;
  --paper: #fff;
  --ink: #182b24;
  --muted: #52655b;
  --line: #d9e3da;
  --green: #155d41;
  --deep: #0c3829;
  --mint: #e0f0e5;
  --amber: #8f5110;
  --amber-bg: #fff1db;
  --danger: #a12e32;
  --danger-bg: #fff0ef;
  --shadow: 0 14px 36px rgba(25, 58, 43, .07);
  --radius: 19px;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-width: 300px; }
a { color: var(--green); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, .btn, select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 3px solid #238b79; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: 1.38rem; }
h3 { font-size: 1rem; }
p { line-height: 1.56; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.preline { white-space: pre-wrap; overflow-wrap: anywhere; }
.line { height: 1px; background: var(--line); border: 0; margin: .3rem 0; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1480px; margin: 0 auto; height: 72px; padding: 0 clamp(16px, 4vw, 45px); display: flex; align-items: center; gap: .75rem; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: .72rem; text-decoration: none; font-weight: 750; color: var(--ink); letter-spacing: -.022em; line-height: 1.11; }
.brand small { display: block; color: var(--muted); font-size: .74rem; font-weight: 550; margin-top: .28rem; letter-spacing: 0; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; color: #fff; background: var(--green); display: grid; place-items: center; font-size: .92rem; font-weight: 800; }
.topbar-actions, .actions { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.subtle-link { font-size: .84rem; font-weight: 680; text-decoration-thickness: 1px; }
.topbar .subtle-link { text-decoration: none; }
.topbar .subtle-link:hover { text-decoration: underline; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: .48rem; min-height: 42px; border: 1px solid transparent; background: var(--green); color: white; padding: .57rem .95rem; font-size: .9rem; font-weight: 680; line-height: 1.23; border-radius: 10px; text-decoration: none; text-align: center; }
.btn:hover:not(:disabled) { background: var(--deep); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: #bccfc2; }
.btn-secondary:hover:not(:disabled), .btn-quiet:hover:not(:disabled) { background: var(--mint); }
.btn-quiet { background: transparent; color: var(--green); border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #7e2025; }
.btn-sm { min-height: 35px; padding: .39rem .65rem; font-size: .81rem; }
.status-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #35804e; box-shadow: 0 0 0 3px var(--mint); margin-right: .4rem; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; width: fit-content; font-size: .78rem; line-height: 1.2; font-weight: 690; border-radius: 999px; padding: .35rem .58rem; color: var(--muted); background: var(--canvas); }
.badge-open, .badge-done { color: var(--deep); background: var(--mint); }
.badge-warn { color: var(--amber); background: var(--amber-bg); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow); min-width: 0; }
.stack { display: grid; gap: 1rem; }
.stack-tight { display: grid; gap: .6rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.field { display: grid; gap: .42rem; }
.field-label { font-weight: 690; font-size: .88rem; }
input, select, textarea { width: 100%; min-width: 0; padding: .65rem .72rem; min-height: 43px; border: 1px solid #baccc0; border-radius: 9px; color: var(--ink); background: var(--paper); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: auto; margin: 0; accent-color: var(--green); flex-shrink: 0; padding: 0; }
input[type=file] { font-size: .87rem; }
input[type=file]::file-selector-button { border: 0; background: var(--mint); border-radius: 6px; color: var(--deep); padding: .35rem .65rem; margin-right: .65rem; font: inherit; font-weight: 650; cursor: pointer; }
.check { display: flex; align-items: center; gap: .63rem; font-size: .9rem; }
.error { background: var(--danger-bg); color: #7f2729; border: 1px solid #efcaca; padding: .68rem .85rem; border-radius: 9px; overflow-wrap: anywhere; font-size: .9rem; }
.notice { padding: .7rem .9rem; background: var(--amber-bg); color: #75450e; border: 1px solid #f2d8ae; border-radius: 9px; font-size: .89rem; }
.kicker { text-transform: uppercase; letter-spacing: .10em; font-weight: 750; font-size: .73rem; color: var(--green); }
.empty { padding: 1rem 0; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th { font-size: .77rem; color: var(--muted); font-weight: 750; background: #f5f8f3; white-space: nowrap; }
th, td { border-bottom: 1px solid var(--line); padding: .82rem .76rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8faf7; }
code { font-family: "IBM Plex Mono", Consolas, monospace; }
.stat { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.student-main { width: min(1160px, 100%); margin: 0 auto; padding: clamp(24px, 6vw, 72px) clamp(16px, 4vw, 40px) 52px; }
.entry-layout { display: grid; grid-template-columns: 1.15fr 1fr; align-items: stretch; gap: 18px; }
.entry-intro { display: flex; min-width: 0; flex-direction: column; justify-content: space-between; gap: 2.4rem; padding: clamp(24px, 5vw, 55px); background: radial-gradient(ellipse at 100% 0%, #21634a 0%, transparent 64%), var(--deep); border-radius: 22px; color: #fff; box-shadow: var(--shadow); }
.entry-intro .kicker { color: #b9e1c6; }
.entry-intro h1 { font-size: clamp(2.7rem, 6.6vw, 4.75rem); letter-spacing: -.068em; line-height: .98; }
.entry-intro .lede { color: #e2efe5; max-width: 34ch; font-size: 1rem; }
.entry-steps { display: grid; gap: .7rem; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.entry-steps li { counter-increment: step; display: flex; align-items: center; gap: .68rem; font-size: .9rem; color: #edf7ef; }
.entry-steps li::before { content: counter(step); display: grid; place-items: center; width: 1.65rem; height: 1.65rem; flex-shrink: 0; border-radius: 50%; border: 1px solid #66a68a; color: #d7f0dd; font-size: .78rem; font-weight: 750; }
.entry-card { display: grid; align-content: center; padding: clamp(23px, 4vw, 42px); }
.entry-card h2 { font-size: clamp(1.48rem, 3vw, 2.04rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.code-input { text-transform: uppercase; font-family: "IBM Plex Mono", Consolas, monospace; letter-spacing: .18em; font-weight: 700; font-size: 1.15rem; }
.code-input::placeholder { letter-spacing: .04em; font-weight: 500; }
.enter-button { width: 100%; min-height: 47px; }
.attempt-wrap { display: grid; gap: 1rem; }
.attempt-heading { display: flex; gap: .9rem; align-items: flex-start; justify-content: space-between; }
.attempt-heading h1 { font-size: clamp(1.66rem, 4vw, 2.85rem); overflow-wrap: anywhere; }
.timer { border: 1px solid #b7d4c3; border-radius: 15px; background: var(--mint); padding: .65rem 1rem; text-align: center; color: var(--deep); flex-shrink: 0; }
.timer strong { display: block; font-size: clamp(1.37rem, 3.4vw, 1.98rem); letter-spacing: -.042em; font-variant-numeric: tabular-nums; line-height: 1.14; }
.timer.urgent { border-color: #e5b47e; background: var(--amber-bg); color: #744211; }
.attempt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .34fr); align-items: start; gap: 16px; }
.attempt-question { display: grid; gap: 1.12rem; }
.question-title { font-size: clamp(1.28rem, 3vw, 1.85rem); line-height: 1.4; }
.answers { display: grid; gap: .6rem; }
.option { display: flex; align-items: center; gap: .75rem; padding: .87rem .95rem; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; min-height: 50px; background: #fcfdfc; }
.option:hover { border-color: #99bfaa; }
.option:has(input:checked) { border-color: #23835a; background: var(--mint); }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.26fr); gap: .65rem; align-items: center; padding: .52rem 0; border-bottom: 1px solid var(--line); }
.order-row { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .67rem; align-items: center; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 10px; }
.order-position { font-weight: 740; color: var(--green); text-align: center; }
.order-actions { display: flex; gap: .35rem; }
.order-actions .btn { min-width: 39px; }
.question-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; }
.question-chip { display: grid; place-items: center; padding: .4rem .12rem; border-radius: 7px; min-height: 36px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 650; }
.question-chip.answered { background: var(--mint); color: var(--deep); border-color: #95c6a5; }
.question-chip.current { outline: 2px solid #196547; outline-offset: 1px; }
.question-chip.partial { background: var(--amber-bg); color: var(--amber); border-color: #ebd0ad; }
progress { width: 100%; accent-color: var(--green); height: .7rem; }
.save-state { font-size: .81rem; min-height: 2.45em; }
.save-state[data-style=warning] { color: var(--amber); }
.receipt { max-width: 600px; margin: 0 auto; }
.receipt-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: var(--mint); color: var(--green); font-size: 1.45rem; font-weight: 800; }
.teacher-shell { max-width: 1480px; margin: 0 auto; display: grid; grid-template-columns: 225px minmax(0, 1fr); align-items: stretch; padding: 0 clamp(16px, 4vw, 45px); gap: clamp(18px, 3.5vw, 50px); }
.teacher-shell.entry { display: block; }
.teacher-shell.entry .teacher-main { width: min(100%, 530px); margin: 0 auto; }
.sidebar { display: flex; flex-direction: column; gap: 2rem; border-right: 1px solid var(--line); padding: 2.35rem 1.2rem 2rem 0; min-height: calc(100vh - 72px); }
.sidebar nav, .sidebar-footer { display: grid; gap: .5rem; align-content: start; }
.sidebar nav a { min-height: 43px; padding: .68rem .82rem; border-radius: 9px; font-size: .91rem; font-weight: 670; color: var(--muted); text-decoration: none; white-space: nowrap; }
.sidebar nav a:hover, .sidebar nav a[aria-current=page] { color: var(--deep); background: #e0ebdf; }
.sidebar-footer { margin-top: auto; padding: .6rem .8rem; color: var(--muted); font-size: .83rem; }
.teacher-main { min-width: 0; padding: 2.35rem 0 3rem; }
.teacher-main > .stack { gap: 1.2rem; }
.page-head { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.9rem, 4.3vw, 2.78rem); letter-spacing: -.05em; overflow-wrap: anywhere; }
.page-head > div:first-child { min-width: min(100%, 250px); }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; box-shadow: none; padding: 1.03rem 1.15rem; }
.metric strong { display: block; color: var(--deep); font-weight: 750; letter-spacing: -.04em; font-size: clamp(1.55rem, 4vw, 2.4rem); margin-bottom: .13rem; }
.metric span { color: var(--muted); font-size: .86rem; }
.intro-admin { background: radial-gradient(ellipse at 95% 0%, #215f44 0%, transparent 60%), var(--deep); color: #fff; border-color: transparent; }
.intro-admin p { color: #e1f0e5; }
.intro-admin .kicker { color: #b9e1c6; }
.intro-admin .btn-secondary { color: var(--deep); }
.url-list { display: flex; gap: .6rem; flex-wrap: wrap; }
.url-list code { user-select: all; background: var(--mint); color: var(--deep); border-radius: 8px; padding: .35rem .6rem; overflow-wrap: anywhere; }
.teacher-cols { display: grid; grid-template-columns: minmax(0, .52fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.class-list { display: grid; gap: .42rem; }
.class-link { display: block; color: var(--ink); text-decoration: none; padding: .59rem .67rem; border: 1px solid transparent; border-radius: 8px; }
.class-link:hover, .class-link[aria-current=true] { background: var(--mint); border-color: #c6dacc; }
.exam-list { display: grid; gap: .74rem; }
.exam-row { border: 1px solid var(--line); border-radius: 12px; padding: .82rem .88rem; }
.exam-row h3 { overflow-wrap: anywhere; }
.exam-row code { user-select: all; font-size: .93rem; color: var(--deep); }
.filters { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(145px, 1fr) minmax(112px, .65fr); gap: .65rem; align-items: end; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.form-grid .full { grid-column: 1 / -1; }
.question-list { display: grid; gap: .62rem; }
.bank-row { border: 1px solid var(--line); border-radius: 12px; padding: .74rem .83rem; min-width: 0; }
.bank-row .row { align-items: flex-start; }
.bank-row .meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .35rem; }
.bank-row p { overflow-wrap: anywhere; }
.bank-check { display: flex; align-items: flex-start; gap: .7rem; cursor: pointer; }
.bank-check input { margin-top: .28rem; }
.bank-check:has(input:checked) { background: #edf6ee; border-color: #94bea0; }
.bank-check-input { min-width: 0; }
.q-fields { align-items: center; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .52rem; }
.q-fields.pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.dialog { width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 34px); padding: clamp(17px, 4vw, 30px); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 20px 75px #102a2155; }
.dialog::backdrop { background: #102a2166; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: 1rem; }
.dialog-header h2 { overflow-wrap: anywhere; }
.dialog-body { display: grid; gap: .85rem; }
.toast { position: fixed; z-index: 2; right: clamp(12px, 4vw, 42px); bottom: 16px; padding: .83rem 1rem; max-width: min(420px, calc(100vw - 24px)); border-radius: 11px; background: var(--deep); color: #fff; box-shadow: var(--shadow); font-size: .91rem; }
@media (max-width: 940px) {
  .teacher-shell { grid-template-columns: 170px minmax(0, 1fr); gap: 18px; }
  .teacher-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .entry-layout, .attempt-grid { grid-template-columns: 1fr; }
  .entry-intro { min-height: 0; gap: 1.45rem; }
  .entry-steps { display: none; }
  .entry-card { padding: 1.45rem; }
  .teacher-shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; padding: .65rem 0; gap: .45rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .08rem; }
  .sidebar nav a { min-height: 36px; padding: .48rem .65rem; }
  .sidebar-footer { display: flex; gap: .9rem; flex-wrap: wrap; padding: .25rem .65rem; }
  .teacher-main { padding: 1.55rem 0 2.4rem; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters input { grid-column: 1 / -1; }
}
@media (max-width: 410px) {
  .topbar-inner { height: auto; min-height: 65px; padding: .62rem 12px; }
  .topbar-actions { gap: .2rem; justify-content: flex-end; }
  .topbar-actions .btn { padding-inline: .35rem; }
  .metrics { gap: 6px; }
  .metric { padding: .72rem; }
  .student-main { padding-top: 20px; }
  .match-row, .form-grid { grid-template-columns: 1fr; }
}
@media print {
  body:has(dialog[open]) > :not(dialog) { display: none !important; }
  dialog[open] { position: static; display: block; max-height: none; width: auto; margin: 0; border: 0; box-shadow: none; }
  dialog[open]::backdrop { display: none; }
  .no-print { display: none !important; }
}
