:root {
  color-scheme: light;
  --paper: #f2f4fc;
  --white: #fff;
  --ink: #131a39;
  --muted: #4e5c7c;
  --line: #dce3f4;
  --blue: #253bd6;
  --accent: #253bd6;
  --accent-hover: #1c29ab;
  --field: #f8faff;
  --field-line: #c5d1e7;
  --soft: #eef3fc;
  --quiet: #edf1ff;
  --quiet-hover: #dde5ff;
  --quiet-line: #ccd8f8;
  --quiet-ink: #2234ad;
  --focus: #4962ff;
  --good: #0e6543;
  --good-bg: #e8f8ef;
  --bad: #a6233b;
  --bad-bg: #fff0f2;
  --soon: #6337a1;
  --warning: #81511a;
  --warning-bg: #fff3d7;
  --warning-line: #ecd69c;
  --shadow: rgb(27 48 110 / 7%);
  --navy: #17204f;
  --lime: #dcf871;
  --radius: 22px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --paper: #0e1729;
  --white: #17243a;
  --ink: #edf3ff;
  --muted: #b6c5df;
  --line: #394b67;
  --blue: #b0c1ff;
  --accent: #4961dd;
  --accent-hover: #3e55cc;
  --field: #111d32;
  --field-line: #526984;
  --soft: #202f49;
  --quiet: #233454;
  --quiet-hover: #30466d;
  --quiet-line: #475e86;
  --quiet-ink: #d5dfff;
  --focus: #a6b7ff;
  --good: #a2edc1;
  --good-bg: #1b3a37;
  --bad: #ffb5c1;
  --bad-bg: #452938;
  --soon: #dbc0ff;
  --warning: #ffd899;
  --warning-bg: #3c2f24;
  --warning-line: #765839;
  --shadow: rgb(0 0 0 / 19%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--blue); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
:where(button, input, select, textarea, a, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { width: min(1120px, calc(100% - 42px)); margin-inline: auto; }
.site-head { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.head-actions > .quiet { min-height: 38px; padding: .42rem .72rem; font-size: .86rem; }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.theme-icon { font-size: 1.15em; line-height: 1; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 760; letter-spacing: -.025em; font-size: 1.18rem; color: var(--ink); text-decoration: none; }
.brand-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: var(--lime); font-size: 1.35rem; }
main { flex: 1; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.12; letter-spacing: -.04em; }
.welcome { min-height: min(580px, 78vh); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; align-items: stretch; }
.intro { position: relative; overflow: hidden; isolation: isolate; min-height: 460px; padding: clamp(30px, 5.6vw, 70px); display: flex; align-items: flex-start; color: #fff; border-radius: var(--radius); background: radial-gradient(ellipse at 76% 89%, #3b49be 0, transparent 52%), #161e4e; }
.intro::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .26; background: radial-gradient(circle, #8898fc 1px, transparent 1.5px) 4px 4px / 22px 22px; mask-image: linear-gradient(125deg, transparent 30%, #000); }
.intro-copy { z-index: 1; }
.intro h1 { font-size: clamp(2.4rem, 5.6vw, 5rem); font-weight: 790; line-height: .98; letter-spacing: -.065em; }
.intro h1 span { color: var(--lime); }
.intro p { margin-top: 18px; color: #d2dcff; font-size: clamp(1rem, 1.6vw, 1.18rem); }
.cover { position: absolute; z-index: 0; bottom: 11%; inset-inline-end: 17%; width: min(50%, 240px); aspect-ratio: 1.52; transform: rotate(-13deg) skew(-10deg); display: grid; place-items: center; background: linear-gradient(128deg, #cddcff, #7379ff); border: 1px solid #c4d4ff; border-radius: 15px; box-shadow: 5px 10px #515ccd, 7px 17px #283b9c, 12px 30px 36px #091233a6; }
.cover b { color: var(--navy); font: bold clamp(2.5rem, 7vw, 5rem) / 1 ui-monospace, Consolas, monospace; letter-spacing: -.14em; margin-inline-end: .13em; }
.cover em { color: #293bc4; font-style: normal; }
.cover i { position: absolute; inset-block-start: 13px; width: 5px; height: 5px; border-radius: 50%; background: var(--navy); }
.cover i:nth-child(1) { inset-inline-start: 14px; }
.cover i:nth-child(2) { inset-inline-start: 23px; }
.cover i:nth-child(3) { inset-inline-start: 32px; }
.cover span { position: absolute; top: -38%; right: -18%; color: var(--lime); font-size: clamp(3rem, 7vw, 6.3rem); text-shadow: 4px 5px #293792; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 32px var(--shadow); min-width: 0; }
.login { display: grid; align-content: center; gap: 17px; padding: clamp(24px, 4.7vw, 60px); }
.login h2, .login h1 { margin-bottom: 4px; font-size: clamp(1.65rem, 3vw, 2.25rem); }
label { font-weight: 650; font-size: .94rem; display: grid; gap: 6px; min-width: 0; }
input, select, textarea {
  width: 100%; min-width: 0; color: var(--ink); background: var(--field); border: 1px solid var(--field-line);
  border-radius: 11px; padding: .69rem .8rem; min-height: 46px; font-size: 1rem; font-weight: 450;
}
select { appearance: none; padding-inline-end: 31px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 17px center, right 11px center; background-size: 6px 6px; background-repeat: no-repeat; }
textarea { resize: vertical; }
.pair, .trio { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.trio { grid-template-columns: repeat(3, minmax(0,1fr)); }
.primary, .quiet, .teacher-nav button { border-radius: 11px; min-height: 44px; padding: .65rem 1rem; font-weight: 720; line-height: 1.25; }
.primary { border: 1px solid transparent; color: #fff; background: var(--accent); }
.primary:hover:enabled { background: var(--accent-hover); }
.enter { width: 100%; min-height: 53px; font-size: 1.12rem; margin-top: 2px; }
.quiet, .teacher-nav button { border: 1px solid var(--quiet-line); background: var(--quiet); color: var(--quiet-ink); }
.quiet:hover:enabled, .teacher-nav button:hover { background: var(--quiet-hover); }
.feedback { font-size: .92rem; color: var(--muted); padding: .35rem 0; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.error { color: var(--bad); }
.site-footer { padding-block: 25px; text-align: right; font-size: .95rem; }
.site-footer a { color: var(--muted); }
.desk, .work { max-width: 820px; margin: 10px auto; }
main.wrap:has(.work:not([hidden])), body:has(.work:not([hidden])) .site-head.wrap { width: min(1280px, calc(100% - 40px)); }
.work:has(.work-layout) { max-width: 1280px; }
.desk-head, .work-head { margin-bottom: 20px; }
.desk-head h1, .work h1 { font-size: clamp(2rem, 4vw, 3.4rem); overflow-wrap: anywhere; }
.desk-head p { margin-top: 7px; color: var(--muted); }
.task-list { display: grid; gap: 12px; }
.task, .empty, .receipt, .question, .editor { padding: clamp(15px, 3vw, 24px); }
.task { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.task h2 { font-size: 1.24rem; margin-bottom: 5px; overflow-wrap: anywhere; }
.task button { flex: none; }
.muted { color: var(--muted); }
.state, .timer { font-weight: 740; font-size: .9rem; color: var(--blue); }
.state { margin-bottom: 4px; }
.state.closed { color: var(--muted); }
.state.upcoming { color: var(--soon); }
.state.submitted { color: var(--good); }
.work-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-items: start; gap: 9px; }
.work-head > :not(button):not(.timer) { grid-column: 1 / -1; }
.work-head > .timer { grid-column: 2; grid-row: 1; justify-self: end; font-variant-numeric: tabular-nums; }
.work-head h1 { font-size: clamp(1.75rem, 3.1vw, 2.75rem); }
.instructions { margin: 0 0 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.question { display: grid; gap: 8px; margin: 0; min-inline-size: 0; }
.worksheet-part { --conversion-columns: 4.4rem minmax(0, 2.3fr) minmax(0, 1fr); gap: 10px; padding: clamp(12px, 1.45vw, 19px); border-radius: 17px; }
.worksheet-part h2 { font-size: 1.04rem; font-weight: 760; letter-spacing: -.014em; line-height: 1.3; }
.worksheet-expression, .worksheet-number, .reference-formula, .math-preview { font-variant-numeric: tabular-nums; }
.worksheet-expression { color: var(--ink); background: var(--soft); border-radius: 9px; padding: 7px 10px; overflow-wrap: anywhere; }
.worksheet-conversion, .worksheet-conversion-head { display: grid; grid-template-columns: var(--conversion-columns); gap: 10px; align-items: start; }
.worksheet-conversion-head { font-weight: 680; color: var(--muted); font-size: .78rem; line-height: 1.25; padding: 1px 0 5px; border-bottom: 1px solid var(--line); }
.worksheet-number { padding-block-start: 9px; line-height: 1.15; }
.worksheet-field { min-width: 0; gap: 4px; }
.worksheet-field-label { font-size: .81rem; color: var(--muted); font-weight: 650; }
.worksheet-conversion .worksheet-field-label { display: none; }
.worksheet-field input { min-height: 39px; padding: .42rem .55rem; border-radius: 8px; }
.math-preview { display: block; color: var(--muted); font-size: .88rem; font-weight: 500; overflow-wrap: anywhere; padding: 1px 3px; }
.math-editor { display: block; position: relative; min-width: 0; }
.math-editor:has(.math-preview:not([hidden])) input:not(:focus) { color: transparent; }
.math-editor:not(:focus-within) .math-preview { position: absolute; inset: 0; padding: .43rem .55rem; color: var(--ink); font-size: 1rem; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
:where(.work, .work-preview) :is(sup, sub) { position: relative; font-size: .72em; line-height: 0; vertical-align: baseline; }
:where(.work, .work-preview) sup { top: -.48em; }
:where(.work, .work-preview) sub { bottom: -.19em; }
.worksheet-scroll { min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.worksheet-table { width: 100%; min-width: 257px; table-layout: fixed; border-collapse: separate; border-spacing: 0; text-align: center; font-variant-numeric: tabular-nums; }
.worksheet-table:has(.given-column:nth-child(3)) { min-width: 294px; }
.worksheet-table .given-column { width: clamp(23px, 2.65vw, 38px); }
.worksheet-table :is(th, td) { padding: 4px; border-inline-end: 1px solid var(--line); border-block-end: 1px solid var(--line); }
.worksheet-table :is(th, td):last-child { border-inline-end: 0; }
.worksheet-table tr:last-child td { border-block-end: 0; }
.worksheet-table th { background: var(--soft); font-size: .85rem; font-weight: 730; height: 33px; line-height: 1.2; overflow-wrap: anywhere; }
.worksheet-table .given-cell { background: var(--soft); color: var(--ink); padding-inline: 2px; }
.worksheet-table input { display: block; text-align: center; min-width: 0; min-height: 34px; padding: 0 2px; border-radius: 6px; font-weight: 650; font-variant-numeric: tabular-nums; }
.worksheet-table input:focus-visible { outline-offset: 0; }
.work-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.work-questions, .work-reference, .work-calculator { min-width: 0; }
.work-tool { padding: 14px; border-radius: 17px; font-size: .9rem; }
.work-tool summary, .guide-group summary { cursor: pointer; font-weight: 740; }
.work-tool > :not(summary), .work-tool .symbol-pad { margin-top: 8px; }
.reference-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .81rem; }
.reference-table :is(td, th) { border-bottom: 1px solid var(--line); padding: 5px 4px; text-align: start; overflow-wrap: anywhere; }
.reference-table th { color: var(--muted); font-size: .73rem; line-height: 1.2; }
.logic-terms :is(td, th):first-child { width: 2.4rem; text-align: center; }
.logic-terms td:first-child { color: var(--blue); font-size: 1.12rem; font-weight: 700; }
.logic-term { display: grid; gap: 1px; line-height: 1.27; }
.logic-term span { font-size: .76rem; }
.reference-values :is(td, th) { text-align: center; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.reference-values th { background: var(--soft); color: var(--ink); }
.reference-example { background: var(--soft); border-radius: 9px; padding: 7px 8px; }
.reference-example p { font-size: .76rem; margin-top: 3px; }
.reference-formula { line-height: 1.65; overflow-wrap: anywhere; }
.calculator input { padding: .5rem; font-size: .94rem; }
.calc-pad, .symbol-pad { display: grid; gap: 4px; }
.calc-pad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.symbol-pad { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.calc-key { min-height: 35px; padding: 3px; color: var(--quiet-ink); background: var(--quiet); border: 1px solid var(--quiet-line); border-radius: 8px; font-weight: 700; }
.calc-key:hover { background: var(--quiet-hover); }
.calculator strong { display: block; }
@media (min-width: 640px) and (max-width: 1119px) {
  .work-layout.with-reference { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .work-questions { grid-column: 1 / -1; }
}
@media (min-width: 1120px) {
  .work-layout { grid-template-columns: minmax(0, 1fr) 230px; align-items: start; }
  .work-layout.with-reference { grid-template-columns: 224px minmax(0, 1fr) 230px; }
  .work-reference { grid-column: 1; grid-row: 1; }
  .work-calculator { grid-column: 2; grid-row: 1; }
  .with-reference .work-calculator { grid-column: 3; }
  .work-questions { grid-column: 1; grid-row: 1; }
  .with-reference .work-questions { grid-column: 2; }
  .work-reference, .work-calculator { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; }
}
@media (max-width: 540px) {
  .worksheet-conversion-head { display: none; }
  .worksheet-conversion { grid-template-columns: minmax(0, 1.85fr) minmax(85px, 1fr); column-gap: 8px; row-gap: 3px; padding-top: 6px; border-top: 1px solid var(--line); }
  .worksheet-number { padding-top: 0; grid-column: 1 / -1; }
  .worksheet-conversion .worksheet-field-label { display: flex; align-items: end; min-height: 2.3em; font-size: .76rem; line-height: 1.15; }
  .worksheet-table :is(th, td) { padding: 3px 2px; }
  .worksheet-table th { font-size: .78rem; }
  .worksheet-table { min-width: 224px; }
  .worksheet-table:has(.given-column:nth-child(3)) { min-width: 250px; }
}
.question legend, .question-editor legend { padding: 0 6px; font-weight: 730; }
.question label.choice, .check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.choice { border: 1px solid var(--line); border-radius: 9px; min-height: 44px; padding: .5rem .7rem; }
.choice:has(input:checked) { background: var(--quiet); border-color: var(--focus); }
input:is([type=radio], [type=checkbox]) { accent-color: var(--accent); min-height: auto; width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.receipt { display: flex; gap: 15px; align-items: center; margin-bottom: 18px; }
.grade { font-size: 2rem; color: var(--blue); }
.work-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.student-task-actions, .edit-control { display: grid; gap: 5px; justify-items: end; }
.edit-control { justify-items: start; }
.student-task-actions .edit-control { justify-items: end; text-align: end; }
.edit-control .quiet { text-align: center; white-space: normal; }
#editRequestRows .student-work-row { flex-wrap: wrap; }
.teacher-login { max-width: 480px; margin: min(9vh, 55px) auto; }
.teacher-desk { max-width: 890px; margin: 10px auto; }
.teacher-nav { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
.teacher-nav button[aria-pressed=true] { color: #fff; background: var(--accent); }
.teacher-panel, .editor, .question-editor { display: grid; gap: 13px; }
.editor h2 { font-size: 1.45rem; }
.editor > button { justify-self: start; }
.question-editor { margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.question-editor button { justify-self: start; }
.student-result { padding: 8px 0; border-bottom: 1px solid var(--line); }
.student-work-row, .work-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.student-work-row .muted { font-size: .87rem; }
.open-student-work { flex: 0 0 auto; }
.work-file-icon { margin-inline-end: .4em; }
.focus-history summary, .guide-group summary { cursor: pointer; }
.guide-group { border-top: 1px solid var(--line); padding-top: 8px; }
.guide-group p, .guide-group strong { margin-top: 5px; }
.guide-group strong { display: block; }
.guide-group :is(ul, ol) { margin-block: 6px; padding-inline-start: 1.4em; }
.work-preview { width: min(860px, calc(100% - 22px)); max-height: 90dvh; border: 1px solid var(--line); border-radius: 18px; padding: 0; color: var(--ink); background: var(--white); }
.work-preview::backdrop { background: #121b42a6; }
.work-preview-head { position: sticky; top: 0; z-index: 1; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--field); flex-wrap: wrap; }
.work-preview-head h2 { font-size: 1.2rem; }
#workPreviewContent { padding: 12px 14px; }
#workPreviewNotice, #workVersionList { padding-inline: 14px; }
#workVersionList:not([hidden]) { padding-top: 9px; }
.preview-title { font-weight: 750; }
.preview-body { display: grid; gap: 8px; margin-top: 10px; }
.preview-body .question, .preview-question { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.preview-choices { display: grid; gap: 2px; margin: 4px 0; padding-inline-start: 1.35em; }
.review-answer { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 3px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.worksheet-table .review-answer { justify-content: center; min-height: 26px; padding: 2px; }
.review-answer small { font-size: .8em; }
.review-answer.correct, .correct-label { color: var(--good); }
.review-answer.correct { background: var(--good-bg); }
.review-answer.incorrect, .incorrect-label { color: var(--bad); }
.review-answer.incorrect { background: var(--bad-bg); }
.review-answer.missing { color: var(--muted); background: var(--soft); }
@media print {
  body:has(#workPreview[open]) > :not(#workPreview) { display: none !important; }
  #workPreview[open] {
    position: static; max-height: none; width: 100%; max-width: none; margin: 0; overflow: visible; border: 0;
    color-scheme: light; --white: #fff; --ink: #131a39; --muted: #4e5c7c; --field: #f8faff; --soft: #eef3fc; --line: #dce3f4;
    --good: #0e6543; --good-bg: #e8f8ef; --bad: #a6233b; --bad-bg: #fff0f2; --shadow: transparent;
  }
  #workPreview::backdrop { display: none; }
  #workPreview .work-preview-head { position: static; }
  #workPreview .work-preview-head .form-actions { display: none; }
  #workPreview .preview-body > * { break-inside: avoid; }
  #workPreview .worksheet-scroll { overflow: visible; }
}
.desk-tabs { margin-bottom: 16px; }
.lesson-head, .lesson-assignment { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.lesson-overview, .lesson-assignment { padding: 12px 0; border-top: 1px solid var(--line); }
.lesson-overview h3 { margin: 0 0 3px; }
#meshStatus { margin-top: -5px; }
.focus-warning { color: var(--warning); background: var(--warning-bg); border: 1px solid var(--warning-line); border-radius: 9px; padding: 8px 11px; font-size: .94rem; }
.student-result .focus-warning { margin: 9px 0; }
.focus-timeline { margin: 8px 0 12px; padding-left: 23px; }
.visible-password { font-family: ui-monospace, Consolas, monospace; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; user-select: all; overflow-wrap: anywhere; }
.manual-student summary { cursor: pointer; font-weight: 650; }
.manual-student form { margin-top: 13px; }
@media (max-width: 760px) {
  .wrap { width: min(530px, calc(100% - 26px)); }
  main.wrap:has(.work:not([hidden])), body:has(.work:not([hidden])) .site-head.wrap { width: min(680px, calc(100% - 24px)); }
  .site-head { min-height: 62px; }
  .welcome { grid-template-columns: 1fr; gap: 12px; min-height: auto; }
  .intro { min-height: 203px; padding: 23px 20px 25px; align-items: center; }
  .intro h1 { font-size: clamp(2.22rem, 8.2vw, 3.45rem); }
  .intro p { max-width: 67%; margin-top: 11px; font-size: .96rem; }
  .cover { width: 32%; bottom: 23%; inset-inline-end: 9%; opacity: .9; }
  .login { padding: 22px 17px; gap: 12px; }
  .task { gap: 9px; }
  .task button { padding-inline: .65rem; }
}
@media (max-width: 420px) { .theme-word { display: none; } }
@media (max-width: 360px) {
  .theme-toggle .theme-label { display: none; }
  .work-preview-head .quiet { min-height: 38px; padding: .45rem .6rem; font-size: .82rem; }
}
@media (max-width: 350px) {
  .intro { min-height: 174px; }
  .cover { width: 26%; inset-inline-end: 9%; bottom: 17%; }
  .cover b { font-size: clamp(1.8rem, 8vw, 2.5rem); }
  .trio { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .task { align-items: flex-start; flex-direction: column; }
}
