:root {
  --bg: #fafaf8; --fg: #1d1d1b; --muted: #6b6b66; --line: #d9d9d2;
  --accent: #2f5d8a; --accent-fg: #fff; --card: #fff; --bad: #b3261e;
  --timer-track: #f1f2f2; --timer-fill: #cdd1d4; --timer-warning: #c97570;
}
/* «Найди и исправь ошибки»: ordinary prose, with only the pupil's own selections marked. */
.error-text-passage { white-space:pre-wrap; overflow-wrap:anywhere; line-height:2; margin:14px 0 20px; font-size:17px; }
.error-text-token { position:relative; border-radius:3px; }
.error-text-picker .error-text-token { cursor:pointer; padding:.14em 0; touch-action:manipulation; }
.error-text-picker .error-text-token:hover { background:var(--bg); }
.error-text-picker .error-text-token:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.error-text-token.error-text-selected { background:#dceafa; color:var(--fg); box-shadow:0 1px 0 var(--accent); }
.error-text-token.error-text-pending { outline:2px dashed var(--accent); outline-offset:2px; }
.error-text-token[data-fragment]::before { content:attr(data-fragment); position:absolute; left:0; top:-1.1em;
  color:var(--accent); font-size:.65em; font-weight:700; line-height:1; pointer-events:none; }
.error-text-help, .error-text-status { color:var(--muted); font-size:.85rem; line-height:1.45; margin:6px 0 10px; }
.error-text-status:empty { display:none; }
.error-text-tools { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0; }
button.error-text-control { background:transparent; color:var(--fg); border:1px solid var(--line); border-radius:7px;
  margin:0; padding:5px 9px; font-size:.8rem; line-height:1.4; min-height:32px; }
button.error-text-control[aria-pressed=true] { background:#dceafa; border-color:var(--accent); }
.error-text-control[hidden] { display:none; }
.error-text-corrections { margin:14px 0 20px; }
.error-text-answer { padding:12px 0; border-top:1px solid var(--line); }
.error-text-answer .error-text-fragment { white-space:pre-wrap; overflow-wrap:anywhere; font-size:.95rem; margin:0 0 8px; }
.error-text-answer label { display:block; }
.error-text-answer label > span { display:block; color:var(--muted); font-size:.8rem; margin-bottom:4px; }
.error-text-answer input { max-width:100%; }
.error-text-editor { min-width:0; }
.error-text-editor > .row > textarea { min-height:8em; }
.error-text-editor .error-text-key { margin:14px 0; }
.error-text-editor .error-text-key > button[aria-pressed=true] { border-color:var(--accent); background:#dceafa; }
.error-text-mark { display:flex; gap:10px; align-items:baseline; justify-content:space-between; margin:8px 0; }
.error-text-mark > span { min-width:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.error-text-advanced { margin-top:12px; font-size:.85rem; }
.error-text-advanced > summary { cursor:pointer; color:var(--muted); margin-bottom:8px; }
.error-text-review .error-text-target { padding:10px 0; border-top:1px solid var(--line); }
.error-text-review .error-text-quote { display:block; white-space:pre-wrap; overflow-wrap:anywhere; margin-bottom:6px; }
.error-text-review .answer-good { color:#2e7d32; }
.error-text-review .answer-bad { color:var(--bad); }
.error-text-review .error-text-token.answer-good { background:#e0f0e0; }
.error-text-review .error-text-token.answer-bad { background:#fbe5e3; }
@media (prefers-color-scheme: dark) {
  .error-text-token.error-text-selected, button.error-text-control[aria-pressed=true],
  .error-text-editor .error-text-key > button[aria-pressed=true] { background:#2a455d; }
  .error-text-review .answer-good { color:#a5d6a7; }
  .error-text-review .error-text-token.answer-good { background:#284530; }
  .error-text-review .error-text-token.answer-bad { background:#523330; }
}
@media (pointer:coarse) {
  .error-text-passage { line-height:2.4; }
  .error-text-picker .error-text-token { padding:.28em 0; }
  button.error-text-control { min-height:40px; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --fg: #ececea; --muted: #a0a09a; --line: #34363a;
          --accent: #6ea4d6; --accent-fg: #101214; --card: #1f2124; --bad: #f2877f; }
  :root { --timer-track: #292d32; --timer-fill: #5b626a; --timer-warning: #cf8a82; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 18px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.25rem; margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.bar { height: 4px; background: var(--timer-track); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.bar > i { position: relative; display: block; height: 100%; width: 100%; background: var(--timer-fill); }
.bar.low > i { background: var(--timer-warning); min-width: 4px; }
.bar.low > i::after { content: ""; position: absolute; right: 0; top: 0; width: 4px; height: 4px;
  border-radius: 2px; background: var(--timer-warning); }
.time-left { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.prompt { font-size: 1.1rem; margin: 0 0 14px; white-space: pre-wrap; }
#view .prompt { margin-bottom: 24px; }
.cols { color: var(--muted); margin: 0 0 10px; }
/* Подсказка ученику, как отвечать: мелко, чтобы не отвлекать от задания */
.cols.hint { font-size: .85rem; line-height: 1.4; }
/* Несколько полей для ответа: подпись следующего поля не прилипает к предыдущему */
#view .row { display: block; }
#view .row + .row { margin-top: 14px; }
.prompt ol, .prompt ul { margin: 4px 0; padding-left: 1.6em; white-space: normal; }
.prompt li { white-space: pre-wrap; }
/* Ссылка на материал в тексте задания: заметная и переносится, даже если название длинное */
.prompt a, .rich a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
/* «Вставка в текст»: строчка для ответа прямо в тексте */
input[type=text].gap { display: inline-block; width: 10ch; min-width: 10ch; max-width: 100%; padding: 0 4px;
  margin: 0 2px; font: inherit; color: var(--accent); background: transparent;
  border: 0; border-bottom: 2px solid var(--muted); border-radius: 0; }
input[type=text].gap:focus { outline: none; border-bottom-color: var(--accent); }
/* «Хронология»: список событий, которые ученик расставляет по порядку */
ol.order { margin: 0 0 12px; padding-left: 1.8em; }
ol.order li { padding: 6px 8px 6px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: grab; }
ol.order li::marker { color: var(--muted); }
ol.order li > .otext { display: inline-block; width: calc(100% - 92px); vertical-align: middle; }
ol.order li.drag { opacity: .5; }
ol.order button.mv { margin: 0 0 0 4px; padding: 2px 10px; vertical-align: middle; background: transparent;
  color: var(--fg); border: 1px solid var(--line); }
/* «Слово из букв»: рамка для слова и буквы-кубики */
.word { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 62px; padding: 8px;
  margin-bottom: 12px; border: 2px dashed var(--line); border-radius: 12px; }
.word.over { border-color: var(--accent); }
.word:empty::before { content: "Соберите слово здесь"; color: var(--muted); padding: 0 6px; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; min-height: 48px; margin-bottom: 4px; }
.tile { width: 42px; height: 42px; margin: 0; padding: 0; display: inline-flex; align-items: center;
  justify-content: center; font: 600 1.25rem/1 system-ui, -apple-system, sans-serif; color: #3d3418;
  background: #fdf3c4; border: 1px solid #e3d08a; border-radius: 8px; box-shadow: 0 3px 0 #e3d08a;
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.tile.space { color: #b8a76c; }
.tile.placeholder { opacity: .35; }
.tile.ghost { position: fixed; z-index: 10; pointer-events: none; cursor: grabbing;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .2); }
.phrase-response { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.phrase-response .phrase-target { flex: 1 1 min(100%, 360px); align-self: center; }
.phrase-target:empty::before { content: "Соберите определение"; }
.phrase-pool { padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.tile.phrase-tile { width: auto; max-width: 100%; min-height: 36px; height: auto; padding: 6px 10px;
  font-size: .95rem; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
button.plain { display: block; margin: 6px 0 4px; padding: 4px 12px; font-size: .88rem; background: transparent;
  color: var(--muted); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  .tile { color: #f3e9c2; background: #4a4226; border-color: #6b5f36; box-shadow: 0 3px 0 #6b5f36; }
  .tile.space { color: #9c8f63; }
}
/* Картинка задания — по центру; крупная уменьшается до ширины, выбранной в редакторе (по умолчанию 400 px) */
img.pic { display: block; max-width: 100%; border-radius: 8px; margin: 0 auto 14px; }
img.pic.w100 { max-width: min(100px, 100%); } img.pic.w200 { max-width: min(200px, 100%); }
img.pic.w250 { max-width: min(250px, 100%); } img.pic.w300 { max-width: min(300px, 100%); }
img.pic.w350 { max-width: min(350px, 100%); } img.pic.w400 { max-width: min(400px, 100%); }
img.pic.w450 { max-width: min(450px, 100%); } img.pic.w500 { max-width: min(500px, 100%); }
img.pic.w550 { max-width: min(550px, 100%); } img.pic.w600 { max-width: min(600px, 100%); }
/* Выпадающий список в «Вставке в текст» */
select.gap { width:auto; min-width:10ch; max-width:calc(100% - 4px); box-sizing:border-box; display:inline-block;
  padding:6px 32px 6px 10px; margin:3px 2px; font:inherit; color:var(--fg);
  background-color:var(--bg); border:1px solid var(--line); border-radius:7px; vertical-align:baseline; }
select.gap:focus { outline:2px solid var(--accent); outline-offset:2px; }
/* Preserve native selects on desktop; phones get a wrapping choice dialog. */
.test-question .mobile-select-field { display:contents; }
button.mobile-select-button { display:none; }
.mobile-choice-dialog, .finish-review-dialog { width:calc(100% - 24px); max-width:520px; max-height:calc(100dvh - 32px);
  padding:16px; color:var(--fg); background:var(--card); border:1px solid var(--line); border-radius:14px; }
.mobile-choice-dialog::backdrop, .finish-review-dialog::backdrop { background:rgba(0,0,0,.4); }
.mobile-choice-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.mobile-choice-heading h2 { margin:0; font-size:18px; }
button.mobile-choice-close { margin:0; padding:8px; color:var(--muted); background:transparent; font-size:14px; }
.mobile-choice-context { margin:10px 0; color:var(--muted); font-size:14px; overflow-wrap:anywhere; }
.mobile-choice-options { display:grid; gap:8px; }
.mobile-choice-options button { width:100%; min-width:0; margin:0; padding:12px; text-align:left;
  font-size:16px; white-space:normal; overflow-wrap:anywhere; color:var(--fg); background:var(--bg);
  border:1px solid var(--line); border-radius:9px; }
.mobile-choice-options button[aria-pressed=true] { border-color:var(--accent); box-shadow:inset 3px 0 var(--accent); }
:is(.mobile-choice-dialog,.finish-review-dialog) button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
@media (max-width:640px) {
  /* A grid's automatic minimum otherwise grows to the longest select option. */
  .mock { grid-template-columns:minmax(0,1fr); }
  .test-question { min-width:0; }
  .test-question .prompt, .test-question .row > span { overflow-wrap:anywhere; }
  .test-question select { min-width:0; max-width:100%; text-overflow:ellipsis; }
  .mobile-select-field > select { display:none; }
  .test-question button.mobile-select-button { display:inline-flex; width:100%; min-width:0; max-width:100%;
    min-height:44px; align-items:center; margin:0; padding:10px 32px 10px 12px; vertical-align:baseline; text-align:left; font:inherit; font-size:15px;
    color:var(--fg); background-color:var(--bg); border:1px solid var(--line); border-radius:10px;
    background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
    background-position:right 19px center,right 14px center; background-size:5px 5px; background-repeat:no-repeat; }
  .test-question button.mobile-select-button > span { display:block; min-width:0; margin:0; color:inherit;
    font:inherit; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .test-question button.mobile-select-button.gap { width:auto; max-width:calc(100% - 4px); padding:6px 32px 6px 10px;
    margin:3px 2px; border-radius:7px; }
  button.mobile-select-button:disabled { opacity:.65; }
  button.mobile-select-button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
}
/* Текст задания нельзя выделить и скопировать; поля для ответа — можно */
#view, #title { -webkit-user-select: none; user-select: none; }
#view input, #view select, #view textarea { -webkit-user-select: text; user-select: text; }
img.pic { -webkit-user-drag: none; }
@media print { #view { display: none; } }
/* Итог: какие задания решены верно */
ol.results { list-style: none; padding: 0; margin: 14px 0 6px; columns: 2; column-gap: 24px; }
ol.results li { padding: 3px 0; break-inside: avoid; }
ol.results li b { display: inline-block; width: 1.6em; }
ol.results li.ok b { color: #2e7d32; } ol.results li.part b { color: #b7791f; } ol.results li.bad b { color: var(--bad); }
@media (prefers-color-scheme: dark) { ol.results li.ok b { color: #a5d6a7; } ol.results li.part b { color: #e0b562; } }
@media (max-width: 480px) { ol.results { columns: 1; } }  /* на телефоне строки не ломаются */
label.opt { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 16px; align-items: start; padding: 10px 12px; margin-bottom: 8px;
            border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
label.opt:has(input:checked) { border-color: var(--accent); }
label.opt input { width: 18px; height: 18px; margin: 4px 0 0; flex: none; }
label.opt > span { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
input[type=text], input[type=password], select { width: 100%; font: inherit; padding: 10px 12px; color: var(--fg);
            background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
/* Списки выбора: своя галочка с отступом от правого края (у встроенной зазор слишком мал) */
select { -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 19px center, right 14px center; background-size: 5px 5px; background-repeat: no-repeat; }
/* Иерархия текста в задании; форма входа и элементы управления сохраняют свой размер. */
.test-question .prompt, .test-question .cols:not(.hint) { font-size:17px; }
.test-question .row > span { font-size:15px; }
.test-question label.opt > span, .test-question input[type=text], .test-question select,
.test-question .order .otext { font-size:15px; }
.row { margin-bottom: 10px; }
.row span { display: block; color: var(--muted); font-size: .9rem; margin-bottom: 4px; }
button { font: inherit; background: var(--accent); color: var(--accent-fg); border: 0;
         border-radius: 10px; padding: 11px 22px; cursor: pointer; margin-top: 8px; }
button:disabled { opacity: .5; cursor: default; }
.big { font-size: 2rem; margin: 8px 0; }
.err { color: var(--bad); margin-top: 8px; }
.answer-send-state { margin: 0; }
.answer-send-state:not(:empty) { margin-top: 8px; }
p.again { margin: 8px 0; }
.meta.left { margin: 12px 0 0; }

/* Форматирование текста вопроса (классы выставляет сервер, см. RichText в app.py) */
.fs-big { font-size: 1.3em; }
.fs-small { font-size: .85em; }
.c-red { color: #c62828; } .c-blue { color: #1565c0; } .c-green { color: #2e7d32; }
/* Маркеры — бледные пастельные */
.hl-yellow, .hl-green, .hl-pink, .hl-blue { color: #1d1d1b; border-radius: 3px; padding: 0 2px; }
.hl-yellow { background: #fff3b0; } .hl-green { background: #d5f0d6; } .hl-pink { background: #fbd5e2; }
.hl-blue { background: #cde6fb; }
/* Маркер, только что поставленный в редакторе: до сохранения у него встроенный стиль, а не класс.
   Текст на нём тоже тёмный, иначе в тёмной теме он сливается с бледным фоном. */
.rich [style*="background"], .qview [style*="background"] { color: #1d1d1b; }
@media (prefers-color-scheme: dark) {
  .c-red { color: #ef9a9a; } .c-blue { color: #90caf9; } .c-green { color: #a5d6a7; }
}
/* Цветной текст на маркере: всегда тёмные оттенки, чтобы читался на светлом фоне */
:is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) .c-red, .c-red :is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) { color: #c62828; }
:is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) .c-blue, .c-blue :is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) { color: #1565c0; }
:is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) .c-green, .c-green :is(.hl-yellow, .hl-green, .hl-pink, .hl-blue) { color: #2e7d32; }
/* Строка заголовка с возвратом в кабинет. */
.titlebar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin: 0 0 16px; }
.titlebar h1 { margin: 0; }
.titlebar .right { margin: 0 0 0 auto; display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.titlebar .right a[hidden] { display: none; }
/* Домик в кабинете ученика и в школьном режиме просмотра. */
a.home { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
  vertical-align: middle; background: #cde6fb; color: #173f66; border: 1px solid #a9cff0; border-radius: 10px; }
a.home:hover { background: #b9dcf8; }
a.home svg { width: 23px; height: 23px; }
@media (prefers-color-scheme: dark) {
  a.home { background: #2a4a66; color: #dcecfa; border-color: #3d6488; }
  a.home:hover { background: #335a7c; }
}
.nt-mark { display: block; flex: none; width: 34px; height: auto; }
a.home.cabinet-home {
  width: 44px;
  height: 44px;
  background: transparent;
  border-color: transparent;
}
a.home.cabinet-home:hover { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
a.cabinet-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Общая шапка учительского кабинета. */
.cabinet-header {
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.cabinet-header-row, .cabinet-tools, .cabinet-work-journals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cabinet-header-row { justify-content: space-between; }
.cabinet-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cabinet-header-row h1 { margin: 0; font-size: 1.35rem; overflow-wrap: anywhere; }
.cabinet-header-detail { max-width: 100%; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.cabinet-tools { margin-top: 12px; }
.cabinet-tool-pair {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.cabinet-tool-pair > a + a { border-inline-start: 1px solid var(--line); }
.cabinet-tool-pair > a:first-child { border-radius: 7px 0 0 7px; }
.cabinet-tool-pair > a:last-child { border-radius: 0 7px 7px 0; }
.cabinet-account { position: relative; margin-inline-start: auto; }
.cabinet-account summary {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.cabinet-account summary::-webkit-details-marker { display: none; }
.cabinet-account summary svg:last-child { width: 14px; height: 14px; }
.cabinet-account-links {
  position: absolute;
  z-index: 8;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  min-width: max-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 8px 22px #0002;
}
.cabinet-account-links > a { border-radius: 5px; }
.cabinet-account-links > a:last-child { border-top: 1px solid var(--line); }
.cabinet-work-journals { gap: 5px; }
.cabinet-report-link > a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  text-decoration: none;
}

:is(.cabinet-tool-pair > a, .cabinet-account summary, .cabinet-account-links > a, .cabinet-work-journals > a, .cabinet-report-link > a) {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--fg);
  font-size: 14px;
  white-space: nowrap;
}
:is(.cabinet-tools, .cabinet-account, .cabinet-work-journals) svg {
  flex: none;
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}
.cabinet-work-journals > a {
  border-radius: 8px;
  background: #e8f3ff;
  color: var(--accent);
}
.cabinet-work-journals > a:hover { background: #d9ebff; text-decoration: none; }
@media (prefers-color-scheme: dark) {
  .cabinet-work-journals > a { background: #203950; color: #a8d2fa; }
  .cabinet-work-journals > a:hover { background: #294965; }
}
.cabinet-tool-pair > a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
  color: var(--accent);
}
:is(.cabinet-tool-pair > a, .cabinet-account summary, .cabinet-account-links > a, .cabinet-report-link > a):hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  text-decoration: none;
}
:is(.cabinet-tool-pair > a, .cabinet-account summary, .cabinet-account-links > a, .cabinet-work-journals > a, .cabinet-report-link > a):focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cabinet-tools a[href="/cards"] svg, .cabinet-report-link svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
}
/* Общая палитра папок кабинета и учительского журнала. */
[data-tone=neutral],
:where(.journal-grades > a,.journal-folder) { --tab-pale:#f4f4f1; --tab-fill:#e9e9e3; --tab-edge:#b2b5aa; --tab-ink:#62685b; }
[data-tone=blue],
:is(.journal-grades > a,.journal-folder)[data-folder="6 класс"] { --tab-pale:#f0f6fc; --tab-fill:#dfedfa; --tab-edge:#81abd0; --tab-ink:#325e84; }
[data-tone=violet],
:is(.journal-grades > a,.journal-folder)[data-folder="7 класс"] { --tab-pale:#f6f2fb; --tab-fill:#ebe1f5; --tab-edge:#b298ca; --tab-ink:#6e5685; }
[data-tone=mint],
:is(.journal-grades > a,.journal-folder)[data-folder="8 класс"],
:is(.journal-grades > a,.journal-folder)[data-folder="10 класс"],
:is(.journal-grades > a,.journal-folder)[data-folder="11 класс"] { --tab-pale:#f0f7f2; --tab-fill:#deeee2; --tab-edge:#8ab59a; --tab-ink:#436c52; }
[data-tone=sand],
:is(.journal-grades > a,.journal-folder)[data-folder="9 класс"] { --tab-pale:#fbf7ed; --tab-fill:#f5ebd4; --tab-edge:#c5ab71; --tab-ink:#786335; }
[data-tone=rose],
:is(.journal-grades > a,.journal-folder)[data-folder="Частное"] { --tab-pale:#f9f2f3; --tab-fill:#efdee2; --tab-edge:#c19da6; --tab-ink:#815962; }
#cabinet-browser [data-subject], .journal-subjects, .journal-subjects > a { --subject-hue:#899587; --subject-ink:var(--fg);
  --subject-edge:color-mix(in srgb,var(--subject-hue) 48%,var(--card));
  --subject-active-edge:color-mix(in srgb,var(--subject-hue) 72%,var(--card));
  --subject-face:color-mix(in srgb,var(--subject-hue) 2%,var(--card));
  --subject-selected:color-mix(in srgb,var(--subject-hue) 5%,var(--card)); }
#cabinet-browser [data-subject=ВИ],
:is(.journal-subjects,.journal-subjects > a)[data-folder=ВИ] { --subject-hue:#6798bd; --subject-ink:#375d7b; }
#cabinet-browser [data-subject=ИР],
:is(.journal-subjects,.journal-subjects > a)[data-folder=ИР] { --subject-hue:#7ca489; --subject-ink:#476c53; }
#cabinet-browser [data-subject=Общ],
:is(.journal-subjects,.journal-subjects > a)[data-folder=Общ] { --subject-hue:#a28bbd; --subject-ink:#725d8a; }
@media (prefers-color-scheme: dark) {
  [data-tone=neutral],
  :where(.journal-grades > a,.journal-folder) { --tab-pale:#2b2d2b; --tab-fill:#3b3f39; --tab-edge:#858d80; --tab-ink:#d0d5cb; }
  [data-tone=blue],
  :is(.journal-grades > a,.journal-folder)[data-folder="6 класс"] { --tab-pale:#202c38; --tab-fill:#293f52; --tab-edge:#5d88ae; --tab-ink:#c0d8ed; }
  [data-tone=violet],
  :is(.journal-grades > a,.journal-folder)[data-folder="7 класс"] { --tab-pale:#2d2837; --tab-fill:#40364f; --tab-edge:#927da9; --tab-ink:#d6c4e8; }
  [data-tone=mint],
  :is(.journal-grades > a,.journal-folder)[data-folder="8 класс"],
  :is(.journal-grades > a,.journal-folder)[data-folder="10 класс"],
  :is(.journal-grades > a,.journal-folder)[data-folder="11 класс"] { --tab-pale:#253229; --tab-fill:#314537; --tab-edge:#729980; --tab-ink:#bfd9c7; }
  [data-tone=sand],
  :is(.journal-grades > a,.journal-folder)[data-folder="9 класс"] { --tab-pale:#332f24; --tab-fill:#48402c; --tab-edge:#a18d5c; --tab-ink:#e2d2a9; }
  [data-tone=rose],
  :is(.journal-grades > a,.journal-folder)[data-folder="Частное"] { --tab-pale:#33292d; --tab-fill:#48363c; --tab-edge:#9c7b85; --tab-ink:#ddc5cd; }
  #cabinet-browser [data-subject=ВИ],
  :is(.journal-subjects,.journal-subjects > a)[data-folder=ВИ] { --subject-hue:#96bad5; --subject-ink:#c2d9ea; }
  #cabinet-browser [data-subject=ИР],
  :is(.journal-subjects,.journal-subjects > a)[data-folder=ИР] { --subject-hue:#a6c8b0; --subject-ink:#c8dfce; }
  #cabinet-browser [data-subject=Общ],
  :is(.journal-subjects,.journal-subjects > a)[data-folder=Общ] { --subject-hue:#bea9d8; --subject-ink:#dfd0ef; }
}

.journal-grades, .journal-subjects {
  --folder-shadow:#24282010;
  position:relative; isolation:isolate; z-index:1; display:flex; align-items:flex-end;
  padding:3px 2px 2px; gap:0; min-width:0;
}
@media (prefers-color-scheme:dark) {
  .journal-grades, .journal-subjects { --folder-shadow:#00000030; }
}
.journal-grades { min-height:52px; margin-top:16px; overflow-x:auto; scrollbar-width:thin; }
.journal-folder {
  min-width:0; margin-top:-2px; padding:14px 16px 8px; border:1px solid var(--line);
  border-top:2px solid var(--tab-edge); border-radius:0 10px 10px 10px; background:var(--card);
}
.journal-subjects {
  min-height:72px;
  background:linear-gradient(var(--subject-active-edge),var(--subject-active-edge)) left bottom / 100% 2px no-repeat;
}
.journal-grades > a, .journal-subjects > a {
  position:relative; display:flex; flex-direction:column; justify-content:center;
  /* В старых браузерах сверху остаётся выбранная вкладка. */
  z-index:var(--folder-layer,0);
  z-index:calc(0 - sibling-index());
  border:1px solid var(--folder-edge); border-bottom:0; border-radius:12px 15px 0 0;
  background:var(--folder-face); box-shadow:2px 0 2px var(--folder-shadow); text-decoration:none;
}
.journal-grades > a + a, .journal-subjects > a + a { margin-left:-14px; }
.journal-grades > a {
  --folder-edge:var(--line); --folder-face:var(--tab-pale);
  min-height:44px; padding:9px 21px 12px; white-space:nowrap;
  font-size:14px; font-weight:500; line-height:1.3; color:color-mix(in srgb,var(--tab-ink) 84%,var(--tab-pale));
}
.journal-grades > a + a:where(:not(.journal-grade-end)) { padding-left:28px; }
@media (min-width:641px) {
  .journal-grades > .journal-grade-end { margin-left:auto; }
}
.journal-subjects > a {
  --folder-edge:var(--subject-edge); --folder-face:var(--subject-face);
  flex:0 1 180px; min-width:96px; min-height:64px; padding:9px 13px 12px;
  color:var(--muted); font-size:15px; font-weight:600; line-height:1.35;
}
.journal-subjects > a + a { padding-left:27px; }
.journal-subjects small {
  display:block; margin-top:2px; color:var(--muted); font-size:11px; font-weight:400;
  overflow-wrap:anywhere; hyphens:auto;
}
.journal-grades > a:hover { --folder-face:var(--tab-fill); }
.journal-subjects > a:hover { --folder-edge:var(--subject-hue); }
.journal-grades > a[aria-current] {
  --folder-edge:var(--tab-edge); --folder-face:var(--tab-fill);
  min-height:47px; color:var(--tab-ink); font-weight:650;
}
.journal-subjects > a[aria-current] {
  --folder-edge:var(--subject-active-edge); --folder-face:var(--subject-selected);
  min-height:67px; color:var(--subject-ink);
}
.journal-grades > a[aria-current], .journal-subjects > a[aria-current] { --folder-layer:1; border-top-width:2px; }
.journal-grades > a[aria-current]::after, .journal-subjects > a[aria-current]::after {
  content:""; position:absolute; left:0; right:0; bottom:-2px; height:3px; background:var(--folder-face); pointer-events:none;
}
.journal-grades > a:hover, .journal-folder .journal-subjects > a:hover { text-decoration:none; }
.journal-folder :is(.journal-modules,.journal-pupils) {
  display:flex; flex-wrap:wrap; gap:2px; align-items:center; margin:6px 0 8px; font-size:14px;
}
.journal-modules > span { margin-right:6px; color:var(--muted); font-size:13px; }
.journal-folder :is(.journal-modules,.journal-pupils) a {
  display:inline-flex; align-items:center; min-height:31px; padding:5px 9px; border-radius:5px;
  color:var(--muted); text-decoration:none; font-weight:500; line-height:1.3; overflow-wrap:anywhere;
  font-variant-numeric:tabular-nums;
}
.journal-folder :is(.journal-modules,.journal-pupils) a[aria-current] {
  color:var(--accent); background:color-mix(in srgb,var(--accent) 13%,var(--card)); font-weight:650;
}
.journal-folder :is(.journal-modules,.journal-pupils) a:hover { color:var(--fg); text-decoration:underline; }
.journal-grades > a:focus-visible, .journal-folder > nav a:focus-visible {
  z-index:2; outline:2px solid var(--accent); outline-offset:-3px;
}
@media (max-width:800px) {
  .journal-grades > a { padding-inline:14px; }
  .journal-grades > a + a:where(:not(.journal-grade-end)) { padding-left:21px; }
}
@media (max-width:640px) {
  .journal-folder { padding:12px 10px 8px; }
  .journal-grades, .journal-subjects {
    display:grid; align-items:end; gap:3px; padding-inline:0;
  }
  .journal-grades { grid-template-columns:repeat(auto-fit,minmax(84px,1fr)); }
  .journal-subjects { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .journal-grades > a, .journal-grades > a + a { margin:0; padding-inline:6px; text-align:center; }
  .journal-grades > .journal-grade-end { grid-column:-2 / -1; }
  .journal-subjects > a, .journal-subjects > a + a { margin:0; padding-inline:12px; min-width:0; }
  .journal-grades > a[aria-current]::after, .journal-subjects > a[aria-current]::after { display:none; }
}
@media(pointer:coarse) {
  .journal-folder :is(.journal-modules,.journal-pupils) a { min-height:44px; }
}
@media(forced-colors:active) {
  .journal-grades a[aria-current], .journal-folder > nav a[aria-current] { outline:2px solid Highlight; outline-offset:-2px; }
}
/* Кнопка «Открыть как ученик» в редакторе: глаз, светлая и небольшая, подпись появляется при наведении */
a.eye { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px;
  color: var(--muted); border: 1px solid var(--line); border-radius: 9px; }
a.eye:hover { color: var(--fg); border-color: var(--accent); }
a.eye svg { width: 22px; height: 22px; }
/* Кнопка копирования рядом со ссылкой для учеников (кабинет, редактор): маленькая, светлая, значок «два листочка» */
button.copy { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px;
  margin: 0 0 0 6px; padding: 0; border-radius: 7px; background: transparent; color: var(--muted);
  border: 1px solid var(--line); vertical-align: middle; }
button.copy svg { width: 15px; height: 15px; }
button.copy.fail { color: var(--bad); }
button.copy:hover { color: var(--fg); border-color: var(--accent); }
button.copy.done { background: #e3f4e4; color: #2d5a30; border-color: #c9e7cb; }
@media (prefers-color-scheme: dark) { button.copy.done { background: #243a26; color: #cfe8d0; border-color: #36553a; } }
/* Вошедший ученик на странице теста: «Вы — Имя», маленькое «Не вы? Выйти»; ссылка «Мои результаты» */
p.me { margin: 4px 0 2px; }
button.link { margin: 10px 0 0; padding: 0; font-size: .8rem; color: var(--muted); background: none; border: 0;
  text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: var(--fg); }
/* Макет теста для учителя: все задания сразу; пометка сверху светлая и мелкая */
p.mock-note { margin: 0 0 12px; font-size: .8rem; color: var(--muted); }
p.mock-note button.link { margin: 0; }
.mock { display: grid; gap: 14px; }
a.cab-link { display: inline-block; margin-top: 14px; font-size: .9rem; color: var(--accent); text-decoration: none; }
a.cab-link:hover { text-decoration: underline; }
.finish-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.finish-answers { display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  max-width: 100%; margin: 0; padding: 8px 14px; border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: var(--accent-fg); font-size: .9rem; font-weight: 600;
  text-align: center; text-decoration: none; }
.finish-correct { background: var(--card); color: var(--accent); border-color: var(--line); }
.finish-answers:hover { text-decoration: underline; }
.finish-answers:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.finish-review-dialog { max-width: 440px; padding: 20px; }
.finish-review-dialog h2 { margin: 0; font-size: 1.1rem; }
.finish-review-dialog p { margin: 10px 0 16px; font-size: 1rem; }
.finish-review-dialog form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.finish-review-dialog :is(button,.finish-review-cancel) { min-height: 44px; margin: 0; padding: 8px 14px; font-size: 1rem; }
.finish-review-dialog .finish-review-cancel { display:inline-flex; align-items:center; background:var(--bg); color:var(--fg);
  border:1px solid var(--line); border-radius:8px; text-decoration:none; }
.finish-review-dialog .finish-review-cancel:hover { border-color:var(--accent); }
.finish-review-dialog .finish-review-cancel:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.finish-review-dialog .review-debt { color:var(--bad); }
.finish-review-dialog[open]:not(:modal) { position:fixed; inset:0; z-index:10; box-shadow:0 0 0 100vmax rgba(0,0,0,.4); }

/* Written answers: a multiline field, with the existing theme and no effect on older inputs. */
textarea.essay-answer { display:block; width:100%; min-height:140px; resize:vertical; padding:10px; font:inherit; line-height:1.5; color:var(--fg); background:var(--card); border:1px solid var(--line); border-radius:8px; }
.essay-saved { margin-bottom:14px; }

.control-start h2 { margin: 0 0 12px; font-size: 1.12rem; }
.control-start p { margin: 0 0 12px; }
.control-start .control-start-notice { white-space: pre-wrap; overflow-wrap: anywhere; }
.control-start button { min-height: 44px; }
.control-start .err:empty { display: none; }

.teacher-review {
  color-scheme: light dark;
  --review-good: #286443;
  --review-good-border: #81ad93;
  --review-good-fill: #edf6ef;
  --review-bad: #983d38;
  --review-bad-border: #cb9590;
  --review-bad-fill: #fcf0ef;
  --review-part: #79501b;
  --review-part-border: #c7a66b;
  --review-part-fill: #fcf5e4;
  --review-active: #e6f0f9;
}
.teacher-review .bar2 { padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.teacher-review .review-pupil { margin-bottom: 22px; }
.teacher-review .review-pupil-head { align-items: center; margin-bottom: 8px; }
.teacher-review .review-pupil-head .total, .teacher-review .review-task-score { font-variant-numeric: tabular-nums; }
.teacher-review .review-pupil-picker { display: grid; min-width: 0; max-width: 100%; gap: 4px; }
.teacher-review .review-pupil-picker select {
  width: auto; min-width: 0; max-width: 100%; min-height: 31px; padding: 4px 28px 4px 9px; font-size: .875rem; text-overflow: ellipsis;
}
.teacher-review .review-question-nav { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; }
.teacher-review .review-question-nav :is(button,a) {
  display: inline-grid; place-items: center; text-decoration: none;
  min-width: 29px; min-height: 28px; margin: 0; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--fg); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.teacher-review .review-question-nav :is(button,a):hover { border-color: var(--accent); text-decoration: none; }
.teacher-review .review-question-nav .ok, .teacher-review .review-task-status.ok { color: var(--review-good); }
.teacher-review .review-question-nav .part, .teacher-review .review-task-status.part { color: var(--review-part); }
.teacher-review .review-question-nav .bad, .teacher-review .review-task-status.bad { color: var(--review-bad); }
.teacher-review .review-question-nav :is(.pending,.unanswered),
.teacher-review .review-task-status:is(.pending,.unanswered) { color: var(--muted); }
.teacher-review .review-question-nav .unanswered { border-style: dashed; }
.teacher-review .review-task-card {
  min-width: 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.teacher-review .review-task-list { display: grid; gap: 10px; }
.teacher-review .review-task-list .review-task-card { scroll-margin-top: 12px; }
.teacher-review .review-task-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.teacher-review .review-task-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 9px; }
.teacher-review .review-task-head :is(h2,h3,h4) { margin: 0; font-size: .9375rem; line-height: 1.3; }
.teacher-review .review-task-head .review-task-meta { margin: 0; }
.teacher-review .review-task-meta { display: block; margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.teacher-review .review-task-card > .review-task-meta { margin-top: 6px; }
.teacher-review .review-task-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: .8rem; font-weight: 600; }
.teacher-review .review-task-score strong { color: var(--fg); font-size: .9375rem; line-height: 1.3; }
.teacher-review .review-answer-form { margin-top: 8px; overflow-wrap: anywhere; }
.teacher-review .review-actions { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.teacher-review .review-actions p { margin: 0; }
.teacher-review .review-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 8px 16px; font-size: .85rem; }
.teacher-review .review-actions details { min-width: 0; max-width: 100%; }
.teacher-review .review-actions details[open] { flex-basis: 100%; }
.teacher-review :is(.review-actions,.answer-alternatives,.review-form-details) summary {
  width: fit-content; max-width: 100%; padding-block: 3px; color: var(--accent); font-weight: 600; cursor: pointer;
}
.teacher-review .review-form-details { margin-top: 6px; font-size: .85rem; }
.teacher-review .review-form-details .review-answer-form { margin-block: 8px 10px; }
.teacher-review .review-table-scroll { overflow-x: auto; }
.teacher-review .review-answer-groups { padding: 0; margin: 12px 0 0; list-style: none; }
.teacher-review .review-answer-group { padding-block: 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.teacher-review .review-answer-group:last-child { padding-bottom: 0; }
.teacher-review .review-answer-group .review-score-controls { margin-top: 0; }
.teacher-review .review-group-answer { margin: 5px 0 1px; }
.teacher-review .review-class-prompt { max-width: 70ch; margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.teacher-review :is(a,button,select,input,summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.teacher-review .tabs button:focus-visible { outline-offset: -3px; }
.teacher-review :is(.review-score-controls,.review-actions p) { margin-top: 7px; }
.teacher-review .review-score-controls button.apply { padding: 5px 10px; background: var(--review-active); border-color: var(--accent); }
.teacher-review .review-actions .manual { white-space: normal; }
.teacher-review .saved-question { min-width: 0; font-size: .9375rem; line-height: 1.45; }
.teacher-review .saved-question .prompt { max-width: 76ch; margin-bottom: 7px; overflow-wrap: anywhere; }
.teacher-review .saved-question .row { margin: 0 0 6px; }
.teacher-review .saved-question .answer-grid { margin-top: 8px; }
.teacher-review .saved-question .answer-grid .answer-row { padding-block: 8px; }
.teacher-review .saved-question .answer-stack-field + .answer-stack-field { margin-top: 8px; }
.teacher-review .saved-question label.opt { cursor: default; max-width: 76ch; margin: 4px 0; padding: 5px 8px; }
.teacher-review .saved-question label.opt input { opacity: 1; cursor: default; }
.teacher-review .saved-question ol.order > li { cursor: default; }
.teacher-review .saved-question ol.order .otext { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.teacher-review .saved-question .word { width: fit-content; max-width: 100%; min-height: 0; margin: 0; padding: 4px 6px; }
.teacher-review .saved-question .tiles { min-height: 0; margin: 3px 0 0; }
.teacher-review .saved-question :is(.word,.tiles) { gap: 4px; }
.teacher-review .saved-question .tile {
  width: 28px; height: 28px; border-radius: 5px; font-size: .875rem; color: var(--fg); background: var(--bg);
  border-color: var(--line); box-shadow: none; cursor: default;
}
.teacher-review .saved-question .tiles .tile { width: 24px; height: 24px; font-size: .8rem; color: var(--muted); }
.teacher-review .saved-question .read-value { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.teacher-review .saved-question .unanswered, .teacher-review .saved-question .hint { color: var(--muted); font-size: .88rem; }
.teacher-review .saved-question .answer-good { --review-border: var(--review-good-border); --review-fill: var(--review-good-fill); --review-ink: var(--review-good); }
.teacher-review .saved-question .answer-bad { --review-border: var(--review-bad-border); --review-fill: var(--review-bad-fill); --review-ink: var(--review-bad); }
.teacher-review .saved-question .answer-part { --review-border: var(--review-part-border); --review-fill: var(--review-part-fill); --review-ink: var(--review-part); }
.teacher-review .saved-question .answer-missed { --review-border: var(--review-good-border); --review-fill: var(--card); --review-ink: var(--review-good); }
.teacher-review .saved-question .answer-blank { --review-border: var(--line); --review-fill: var(--bg); --review-ink: var(--muted); }
.teacher-review .saved-question .answer-gap-field {
  display: inline-flex; flex-direction: column; align-items: flex-start; vertical-align: baseline;
  max-width: calc(100% - 6px); margin: 2px 3px; gap: 2px; white-space: normal;
}
.teacher-review .saved-question :is(.saved-input,.answer-value) {
  display: inline-block; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere;
}
.teacher-review .saved-question .answer-gap-field .gap { width: auto; min-width: 0; margin: 0; }
.teacher-review .saved-question :is(.saved-input,.answer-value,.read-value,.opt,.order > li,.word,.sort-review-card):is(.answer-good,.answer-bad,.answer-part,.answer-missed,.answer-blank) {
  border: 1px solid var(--review-border); background: var(--review-fill); color: var(--review-ink);
}
.teacher-review .saved-question :is(.answer-missed,.answer-blank):is(.opt,.saved-input,.answer-value,.read-value,.word) { border-style: dashed; }
.teacher-review .saved-question :is(.error-text-token,.error-text-status span):is(.answer-good,.answer-bad,.answer-part) { color: var(--review-ink); }
.teacher-review .saved-question .error-text-token:is(.answer-good,.answer-bad) { box-shadow: 0 0 0 1px var(--review-border); background: var(--review-fill); }
.teacher-review .saved-question .answer-field-status { display: inline; margin: 0 0 0 .3em; color: inherit; font-size: inherit; font-weight: 700; }
.teacher-review .saved-question .answer-field-status > svg { width: 1em; height: 1em; vertical-align: -.14em; }
.teacher-review .saved-question .answer-expected { margin-top: 4px; color: var(--review-good); font-size: .8rem; white-space: normal; }
.teacher-review .saved-question .answer-gap-field > .answer-expected { margin-top: 0; }
.teacher-review .saved-question .answer-alternatives { margin-top: 5px; overflow-wrap: anywhere; font-size: .85rem; }
.teacher-review .saved-question .answer-alternatives > :is(ol,ul) { margin: 5px 0 8px; padding-left: 1.35em; }
.teacher-review .saved-question .review-note { display: block; margin-top: 3px; font-size: .78rem; }
.teacher-review .saved-question label.opt:has(input:checked):not(.answer-good,.answer-bad,.answer-part) { border-color: var(--muted); }
.teacher-review .saved-question label.opt.answer-good input { accent-color: var(--review-good); }
.teacher-review .saved-question label.opt.answer-bad input { accent-color: var(--review-bad); }
.teacher-review .saved-question .answer-value:has(.answer-field-status)::before { content: none; }

main.attempt-review { max-width: 1040px; padding-top: 14px; font-size: .875rem; }
.attempt-overview {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 7px 16px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.attempt-overview .titlebar { margin: 0; gap: 6px 10px; }
.attempt-overview .titlebar h1 { margin: 0; font-size: 1.125rem; overflow-wrap: anywhere; }
.attempt-work, .attempt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.attempt-work { margin-top: 4px; overflow-wrap: anywhere; }
.attempt-work span { color: var(--muted); font-size: .8125rem; }
.attempt-overview-side { display: grid; justify-items: end; gap: 4px; }
.attempt-overview .total { font-weight: 650; font-variant-numeric: tabular-nums; }
.attempt-actions .attempt-primary {
  display: inline-flex; align-items: center; min-height: 29px; padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--review-active); font-weight: 600;
}
.attempt-review .review-task-card:target { border-color: var(--accent); }
.attempt-review .saved-question .prompt { font-size: inherit; }
.attempt-review .review-task-score .review-task-meta { margin: 0; font-weight: 400; }
.attempt-review .answer-activity { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 5px 0 0; }
.attempt-review .answer-activity dt { color: var(--muted); }
.attempt-review .answer-activity dd { margin: 0; font-weight: 600; }
.attempt-review .answer-activity small { margin-left: 6px; font-weight: 400; color: var(--muted); }
@media (max-width: 620px) {
  .attempt-overview { grid-template-columns: minmax(0, 1fr); }
  .attempt-overview-side { justify-items: start; }
}
@media (prefers-color-scheme: dark) {
  .teacher-review {
    --review-good: #a5dfb6;
    --review-good-border: #547e62;
    --review-good-fill: #26382c;
    --review-bad: #ffb8b4;
    --review-bad-border: #a26a65;
    --review-bad-fill: #3e2b2b;
    --review-part: #f1cd8d;
    --review-part-border: #8e754c;
    --review-part-fill: #3c3324;
    --review-active: #293c50;
  }
}
@media (pointer: coarse) {
  .teacher-review :is(.review-question-nav :is(button,a),.review-pupil-picker select,.review-actions summary,.answer-alternatives summary,.review-form-details summary,.review-score-controls input,.review-score-controls button) { min-height: 44px; }
  .teacher-review .review-question-nav :is(button,a) { min-width: 44px; }
  .teacher-review .review-score-controls input[type=number].sc { font-size: 16px; }
  .teacher-review :is(.review-actions,.answer-alternatives,.review-form-details) summary { align-content: center; }
  .attempt-actions a { display: inline-flex; align-items: center; min-height: 44px; }
}
