:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #f1f4f2;
  --line: #d8ddd8;
  --text: #1e2420;
  --muted: #68736c;
  --accent: #1f6f54;
  --accent-strong: #155c43;
  --accent-soft: #dceee7;
  --blue: #245fba;
  --amber: #946000;
  --red: #b33535;
  --shadow: 0 18px 40px rgba(29, 38, 33, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 64px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.brand strong,
.brand span:not(.brand-mark) {
  display: block;
}

.brand span:not(.brand-mark) {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.tab {
  min-width: 112px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(31, 39, 34, 0.12);
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

main {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 22px;
  flex: 1;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.surface.compact {
  align-self: start;
}

.section-head,
.workspace-head,
.task-editor-head,
.side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.variant-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.variant-summary div {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.variant-summary span,
.field span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.variant-summary strong {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.instructions,
.statement {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.instructions {
  padding: 16px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.home-surface {
  display: grid;
  gap: 12px;
}

body[data-mode="home"] {
  background-color: #edf7ff;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(232, 247, 253, 0.16)),
    url("assets/koge-home-background.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body[data-mode="home"] .topbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: rgba(190, 216, 229, 0.76);
  box-shadow: 0 8px 30px rgba(51, 104, 139, 0.1);
}

body[data-mode="home"] .home-surface {
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(193, 221, 234, 0.74);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(247, 253, 255, 0.42));
  box-shadow: 0 24px 70px rgba(62, 120, 154, 0.14);
  backdrop-filter: blur(4px);
}

body[data-mode="home"] .home-head {
  color: #173b57;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.92);
}

body[data-mode="home"] .home-head .eyebrow {
  color: #147b76;
}

body[data-mode="home"] .home-widget {
  border-color: rgba(194, 218, 230, 0.88);
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 14px 34px rgba(62, 111, 143, 0.13);
  backdrop-filter: blur(12px);
}

body[data-mode="home"] .home-widget-primary {
  border-color: rgba(147, 215, 201, 0.9);
  background: rgba(245, 255, 251, 0.93);
}

.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-head h1 {
  font-size: 26px;
}

.home-widgets {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.home-core-widgets,
.home-teacher-widgets {
  display: grid;
  gap: 10px;
  align-items: start;
}

.home-teacher-widgets {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.home-widget {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(29, 38, 33, 0.06);
}

.home-widget-primary {
  background: #f8fbf6;
  border-color: #cfdccf;
}

.home-widget h2 {
  margin-top: 2px;
  font-size: 21px;
}

.home-widget p {
  margin-top: 4px;
  color: var(--muted);
  max-width: 680px;
}

.home-widget-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.home-widget-meta span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.teacher-widget {
  min-height: 0;
}

.home-widget .button {
  justify-self: start;
  min-height: 34px;
  padding: 7px 14px;
}

.home-widget-primary .button {
  min-width: 132px;
}

.empty-teacher-widget {
  border-style: dashed;
}

.field {
  display: block;
  margin-bottom: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 84, 0.14);
}

.button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.button:hover {
  border-color: #b9c3bc;
  background: #f8faf8;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: #e8caca;
  color: var(--red);
}

.button.full {
  width: 100%;
  margin-top: 16px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.status-pill,
.timer {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.timer {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.exam-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.task-nav {
  align-self: start;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.task-item:hover,
.task-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.task-item .num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.task-item .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item .state {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c7cec8;
}

.task-item.answered .state {
  background: var(--accent);
}

.learning-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.learning-side {
  align-self: start;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.learning-topic-list {
  display: grid;
  gap: 8px;
}

.learning-topic {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.learning-topic:hover,
.learning-topic.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.learning-topic-num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  font-weight: 700;
}

.learning-topic-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.learning-topic-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.learning-content {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.learning-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.learning-summary {
  max-width: 720px;
  margin-top: 4px;
  color: var(--muted);
}

.learning-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: #203961;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.learning-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.learning-nav-row strong {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.learning-nav-row .button {
  min-height: 34px;
  padding: 7px 12px;
}

.learning-pages {
  display: grid;
  gap: 10px;
}

.learning-workspace {
  display: grid;
  gap: 10px;
}

.learning-practice-shell {
  display: grid;
  gap: 10px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.learning-practice-head,
.learning-practice-task-head,
.learning-practice-actions,
.learning-practice-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.learning-practice-head,
.learning-practice-task-head {
  justify-content: space-between;
}

.learning-practice-head h2 {
  margin: 0;
  font-size: 18px;
}

.learning-practice-stats {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.learning-practice-stats span,
.learning-practice-counter,
.learning-practice-task-head span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.learning-practice-card {
  display: grid;
  gap: 10px;
}

.learning-practice-statement {
  min-height: 0;
  padding: 12px;
}

.learning-practice-answer {
  display: grid;
  gap: 8px;
}

.learning-practice-actions {
  justify-content: flex-start;
}

.learning-practice-result {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.learning-practice-result.correct {
  border-color: #a8d8c0;
  background: #eef8f3;
  color: #176542;
}

.learning-practice-result.wrong {
  border-color: #efb5b5;
  background: #fff4f4;
  color: #9f1f1f;
}

.learning-practice-materials {
  margin: 0;
}

.learning-editor-shell,
.learning-pdf-shell,
.learning-archive-shell {
  min-width: 0;
}

.learning-section-head,
.learning-pdf-head,
.learning-archive-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.learning-section-head h2,
.learning-pdf-head h2,
.learning-archive-head h2 {
  margin: 0;
  font-size: 18px;
}

.learning-editor-status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}

.learning-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-auth input {
  width: 180px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.learning-pdf-actions,
.learning-archive-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-archive-card {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.learning-archive-card strong {
  overflow-wrap: anywhere;
}

.learning-archive-card span {
  color: var(--muted);
  white-space: nowrap;
}

.learning-editor {
  width: 100%;
  min-height: 270px;
  resize: vertical;
}

.learning-note-view {
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  line-height: 1.4;
}

.learning-note-view > :first-child {
  margin-top: 0;
}

.learning-note-view > :last-child {
  margin-bottom: 0;
}

.learning-pdf-viewer {
  width: 100%;
  height: min(72vh, 820px);
  min-height: 540px;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.learning-content .tox-tinymce {
  border-color: var(--line);
  border-radius: var(--radius);
}

.learning-page {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.learning-page img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.learning-page figcaption {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-height: 620px;
}

.statement {
  min-height: 160px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.statement p {
  margin: 0 0 12px;
}

.statement-table {
  width: 100%;
  margin: 12px 0 14px;
  border-collapse: collapse;
  white-space: normal;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}

.statement-table th,
.statement-table td {
  border: 1px solid #777;
  padding: 7px 9px;
  vertical-align: top;
}

.statement-table th {
  background: #f1f4f2;
  font-weight: 700;
}

.statement-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0 14px;
}

.statement-image-frame {
  display: block;
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: 12px 0 14px;
  vertical-align: top;
}

.statement-image-frame .statement-image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  margin: 0;
}

.materials {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.material-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  text-decoration: none;
  background: #fff;
}

.material-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.material-card .material-link {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.material-preview {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #fff;
}

.answer-area {
  margin-top: 18px;
}

.answer-title {
  margin: 0 0 8px;
  color: #28324a;
  font-weight: 700;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 8px;
}

.choice input {
  width: auto;
  margin-top: 4px;
}

.exam-question-choice {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

.exam-question-choice h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.exam-question-choice p {
  margin: 0 0 14px;
}

.exam-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.exam-choice-grid button {
  min-height: 150px;
  border: 1px solid #9fb2c9;
  border-radius: 2px;
  background: #f6f9ff;
  color: #1b2d49;
  padding: 14px;
  text-align: left;
}

.exam-choice-grid button:hover {
  border-color: #133863;
  background: #e5effc;
}

.exam-choice-grid strong,
.exam-choice-grid span {
  display: block;
}

.exam-choice-grid strong {
  margin-bottom: 8px;
}

.exam-choice-grid span {
  color: #41516b;
  font-size: 14px;
}

.builder-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.builder-side {
  align-self: start;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.builder-view-tabs {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.builder-view-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
}

.builder-view-tabs button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(31, 39, 34, 0.12);
}

.builder-view-area[hidden] {
  display: none;
}

.assignment-builder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcf7;
}

.assignment-builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.assignment-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px minmax(220px, 1fr) 140px;
  gap: 10px;
}

.assignment-actions {
  justify-content: flex-start;
}

.assignment-task-sample {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cbd8c9;
  border-radius: var(--radius);
  background: #fff;
}

.assignment-task-sample-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.assignment-task-sample h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.assignment-sample-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.assignment-sample-meta span,
.assignment-sample-materials span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.assignment-sample-question {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.assignment-sample-statement {
  padding: 10px;
  border: 1px solid #e2e6df;
  border-radius: 6px;
  background: #fbfcf7;
  overflow-wrap: anywhere;
}

.assignment-sample-statement img,
.assignment-sample-statement .statement-image-frame {
  max-width: 100%;
}

.assignment-sample-statement img {
  height: auto;
}

.assignment-sample-options {
  margin: 0;
  padding-left: 22px;
}

.assignment-sample-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assignment-selection-list,
.teacher-assignment-list {
  display: grid;
  gap: 8px;
}

.assignment-list-title {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.25;
}

.assignment-selection-row,
.teacher-assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.teacher-assignment-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.side-assignments {
  margin-top: 12px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  padding-right: 4px;
}

.side-assignments .teacher-assignment-row {
  grid-template-columns: 1fr;
  gap: 5px;
  padding: 6px;
}

.assignment-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.assignment-row-actions .button {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 13px;
}

.teacher-assignment-row strong,
.teacher-assignment-row span {
  display: block;
}

.teacher-assignment-row span {
  color: var(--muted);
  font-size: 13px;
}

.compact-empty {
  padding: 10px;
}

.editor-grid,
.task-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.task-form-grid {
  grid-template-columns: 100px minmax(160px, 1fr) 180px 130px;
}

.editor-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.option-row,
.material-row,
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 8px;
}

.option-row.with-check {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.option-row input[type="checkbox"],
.option-row input[type="radio"] {
  width: auto;
}

.results-content {
  display: grid;
  gap: 14px;
}

.result-summary {
  display: grid;
  grid-template-columns: minmax(140px, 0.65fr) minmax(220px, 1.35fr) minmax(160px, 0.8fr);
  gap: 12px;
}

.result-summary div,
.empty-state {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.result-summary div {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}

.result-summary .muted,
.result-meta .muted {
  display: block;
}

.result-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.result-nav strong {
  text-align: center;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.result-card-body {
  padding: 14px;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.result-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.result-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.result-table th {
  color: var(--muted);
  font-weight: 600;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.result-card .result-table {
  width: 100%;
  margin: 0;
}

.result-answer-block {
  margin-top: 8px;
}

.result-answer-pair {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.result-answer-item {
  display: grid;
  gap: 4px;
}

.result-answer-item > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-answer-text {
  display: inline-block;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #d8dfc8;
  background: #fbfcf7;
  white-space: pre-wrap;
}

.result-answer-text.correct {
  border-color: #c7d7ef;
  background: #f6f9ff;
}

.result-task-detail-row td {
  padding-top: 0;
  border-top: 0;
  background: #fbfcf7;
}

.result-task-preview {
  margin: 0 0 8px;
}

.result-task-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-task-image-actions button {
  padding: 6px 9px;
  border: 1px solid #c7d7ef;
  background: #f6f9ff;
  color: var(--primary);
  font-weight: 700;
}

.result-image-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(17, 24, 39, 0.62);
}

.result-image-modal-window {
  position: relative;
  max-width: min(1120px, 100%);
  max-height: min(820px, 100%);
  padding: 18px;
  border: 1px solid #d9e0d7;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  overflow: auto;
}

.result-image-modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin: 0 0 10px 10px;
  border: 1px solid #d8ddd8;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 22px;
  line-height: 1;
  z-index: 1;
}

.result-image-modal img {
  display: block;
  max-width: 100%;
  height: auto;
  clear: both;
}

.result-file-list {
  display: grid;
  gap: 8px;
}

.result-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #d8dfc8;
  background: #fbfcf7;
}

.result-file-row span {
  min-width: 0;
}

.result-file-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-file-row small {
  display: block;
  color: var(--muted);
}

.result-file-row a {
  color: var(--accent-strong);
  font-weight: 700;
}

.manual-score-field {
  display: inline-grid;
  grid-template-columns: 74px auto;
  gap: 6px;
  align-items: center;
}

.manual-score-field input {
  width: 74px;
  min-width: 0;
}

.muted {
  color: var(--muted);
}

.warn {
  color: var(--amber);
}

.instruction-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 16, 28, 0.45);
}

.instruction-viewer[hidden] {
  display: none;
}

.instruction-window {
  width: min(100%, 980px);
  max-height: min(92vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid #6f7f96;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.instruction-window-head,
.instruction-window-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #17325b;
  color: #fff;
}

.instruction-window-head strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instruction-window-head button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.instruction-image-wrap {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #eef2f7;
}

.instruction-image-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
}

.instruction-window-foot {
  justify-content: flex-end;
  background: #f7f8fb;
}

.instruction-window-foot button {
  min-width: 100px;
  min-height: 34px;
  border: 1px solid #9fb2c9;
  background: #fff;
  color: #203961;
  font-weight: 700;
}

.instruction-window-foot button:disabled {
  opacity: 0.45;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top-button {
  position: fixed;
  right: 22px;
  bottom: 76px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #c8d7c7;
  border-radius: 50%;
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(29, 38, 33, 0.16);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease, background 160ms ease;
  z-index: 35;
}

.scroll-top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

body[data-mode="station"] .scroll-top-button {
  right: 18px;
  bottom: 18px;
}

[hidden] {
  display: none !important;
}

body[data-mode="station"] {
  background: #edf1dd;
  overflow: hidden;
}

body[data-mode="station"] .topbar {
  display: none;
}

body[data-mode="station"] main {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
}

body[data-mode="station"] #stationPanel {
  height: 100vh;
}

.exam-station {
  height: 100vh;
  display: grid;
  grid-template-rows: 32px minmax(0, 1fr);
  background: #eef2df;
  color: #111;
  font-size: 14px;
}

.exam-system-bar {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  background: #1d355f;
  color: #dce7f8;
  border-bottom: 2px solid #7191bd;
  font-size: 12px;
}

.exam-clock {
  height: 22px;
  min-width: 88px;
  display: grid;
  place-items: center;
  color: #89f0ff;
  border: 1px solid #2d6680;
  background: #17304d;
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.exam-clock.is-low {
  color: #fff;
  border-color: #d23535;
  background: #8f1f2b;
}

.exam-code {
  white-space: nowrap;
}

.exam-code strong {
  color: #fff;
  letter-spacing: 0;
}

.exam-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c6d3e5;
}

.exam-link,
.exam-icon {
  height: 24px;
  border: 0;
  background: transparent;
  color: #dce7f8;
  padding: 0 6px;
  font-size: 12px;
}

.exam-link:hover,
.exam-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

.exam-link.finish {
  color: #ffffff;
}

.exam-icon {
  width: 24px;
  border-radius: 50%;
  font-weight: 700;
}

.exam-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  border-top: 1px solid #d6dfc0;
}

.exam-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 28px minmax(0, 1fr) 28px;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: #f2f6e4;
  border-right: 1px solid #d8dfc8;
}

.answers-box {
  width: 44px;
  text-align: center;
  color: #697168;
  font-size: 10px;
  line-height: 1.15;
}

.answers-box strong {
  display: block;
  margin-top: 2px;
  color: #23324f;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.side-step {
  width: 24px;
  height: 24px;
  border: 1px solid #ccd5c2;
  border-radius: 3px;
  background: #24446e;
  color: #fff;
  padding: 0;
  line-height: 1;
}

.side-step.bottom {
  align-self: end;
}

.station-numbers {
  width: 100%;
  display: grid;
  gap: 5px;
  align-content: start;
  justify-items: center;
  overflow: auto;
  padding: 2px 0;
}

.station-numbers .task-item {
  width: 26px;
  min-height: 24px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 0;
  border-radius: 3px;
  border: 1px solid #d5dcca;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 39, 34, 0.08);
}

.station-numbers .task-item.active {
  border-color: #183a69;
  background: #1f4c83;
  color: #fff;
}

.station-numbers .task-item.answered {
  border-color: #8da4c4;
}

.station-numbers .task-item.answered:not(.active) {
  background: #e7effb;
}

.station-numbers .task-item .num {
  width: auto;
  height: auto;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}

.station-numbers .task-item .title,
.station-numbers .task-item .state {
  display: none;
}

.exam-content {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  background: #f7f8f2;
}

.exam-scroll {
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid #eef1e1;
  border-right: 1px solid #eef1e1;
  background: #fff;
}

.exam-paper {
  width: min(1080px, calc(100% - 36px));
  min-height: calc(100vh - 54px);
  margin: 0 auto;
  padding: 64px 70px 80px;
  background: #fff;
  color: #111;
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.25;
  box-shadow: none;
}

.intro-paper {
  display: grid;
  align-content: start;
  gap: 36px;
}

.paper-center {
  width: min(760px, 100%);
  margin: 0 auto;
  text-align: center;
}

.paper-center h1 {
  font-family: "Times New Roman", Times, serif;
  font-size: 21px;
  line-height: 1.15;
  margin: 0 0 28px;
  font-weight: 700;
}

.paper-center h2 {
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  margin: 0 0 26px;
  font-weight: 700;
}

.paper-center h3 {
  font-size: 17px;
  margin: 0 0 18px;
  font-weight: 700;
}

.paper-center p {
  margin: 0 0 10px;
  text-align: justify;
  text-indent: 24px;
}

.paper-center .wish {
  margin-top: 26px;
  text-align: center;
  text-indent: 0;
  font-style: italic;
  font-weight: 700;
}

.paper-note {
  display: none;
}

.participant-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid #d8d8d8;
  background: #fbfbfb;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

.participant-panel > strong {
  display: block;
  margin-bottom: 12px;
  color: #27324d;
}

.participant-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px auto;
  gap: 10px;
  align-items: end;
}

.participant-grid .field {
  margin-bottom: 0;
}

.participant-grid input {
  min-height: 34px;
  padding: 7px 9px;
}

.participant-actions {
  align-self: end;
  flex-wrap: nowrap;
}

.task-paper .workspace-head {
  margin-bottom: 22px;
  display: block;
  font-family: "Times New Roman", Times, serif;
}

.task-paper .workspace-head h2 {
  display: none;
}

.task-paper .workspace-head .eyebrow {
  color: #111;
  font-size: 22px;
  font-weight: 700;
  text-transform: none;
}

.task-paper .workspace-head .status-pill {
  display: none;
}

.task-paper .statement {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: "Times New Roman", Times, serif;
  font-size: 20px;
  line-height: 1.28;
}

.task-paper .statement-table {
  font-size: 18px;
  line-height: 1.25;
}

.task-paper .answer-area {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #d9d9d9;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.task-paper .materials {
  margin-top: 22px;
  font-family: Arial, Helvetica, sans-serif;
}

.task-paper .material-preview {
  max-height: 700px;
}

.page-arrow {
  align-self: center;
  justify-self: center;
  width: 28px;
  height: 28px;
  border: 1px solid #d4dfec;
  border-radius: 50%;
  background: #fff;
  color: #a7b7cd;
  font-size: 27px;
  line-height: 22px;
  padding: 0;
}

.page-arrow:hover {
  color: #1f4c83;
  border-color: #9bb4d0;
}

body[data-mode="station"] .exam-station {
  grid-template-rows: 40px minmax(0, 1fr);
  background: #eff4e5;
  font-family: Arial, Helvetica, sans-serif;
}

body[data-station-phase="registration"] .exam-station,
body[data-station-phase="activation"] .exam-station,
body[data-station-phase="confirm"] .exam-station,
body[data-station-phase="finished"] .exam-station {
  grid-template-rows: minmax(0, 1fr);
}

.koge-screen {
  position: relative;
  min-height: 100vh;
  background: #eff4e5;
  color: #1f2c45;
}

.koge-auth-head,
.section-title-line {
  padding: 22px 16px 10px;
}

.koge-auth-head h1,
.koge-auth-head h2,
.section-title-line h1 {
  margin: 0;
  font-weight: 400;
  color: #111;
}

.koge-auth-head h1,
.section-title-line h1 {
  font-size: 30px;
}

.koge-auth-head h2 {
  margin-top: 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid #2da4c2;
  font-size: 30px;
}

.section-title-line {
  border-bottom: 3px solid #2da4c2;
  margin-right: 10px;
}

.registration-center {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  width: 370px;
}

.registration-center label {
  display: block;
  margin: 12px 0 4px;
  color: #4c5663;
  font-size: 13px;
}

.student-name-input {
  height: 42px;
  border: 1px solid #c4c8c1;
  border-radius: 0;
  background: #f6f7f2;
  color: #111;
  font-size: 18px;
}

.student-class-input {
  max-width: 120px;
  text-align: center;
}

.registration-inputs,
.big-number-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.registration-inputs input,
.big-number-row strong {
  display: grid;
  place-items: center;
  height: 60px;
  border: 1px solid #c4c8c1;
  background: #f6f7f2;
  color: #111;
  font-size: 32px;
  font-weight: 400;
  text-align: center;
}

.registration-inputs input:nth-child(1),
.big-number-row strong:nth-child(1) {
  width: 40px;
}

.registration-inputs input:nth-child(2),
.registration-inputs input:nth-child(3),
.big-number-row strong:nth-child(2),
.big-number-row strong:nth-child(3) {
  width: 160px;
}

.kim-number-row .kim-part-a {
  flex: 0 0 96px;
  width: 96px !important;
  min-width: 96px;
  box-sizing: border-box;
}

.station-service-link {
  border: 0;
  background: transparent;
  color: #2996b6;
  text-decoration: none;
  font-size: 12px;
}

.station-service-link:hover {
  text-decoration: underline;
}

.top-service {
  position: absolute;
  right: 16px;
  top: 10px;
}

.top-learning {
  position: absolute;
  right: 132px;
  top: 10px;
  white-space: nowrap;
}

.bottom-service {
  position: absolute;
  left: 10px;
  bottom: 18px;
}

.bottom-right {
  position: absolute;
  right: 10px;
  bottom: 12px;
}

.koge-primary,
.koge-success,
.koge-danger {
  min-height: 36px;
  border: 0;
  padding: 8px 24px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}

.koge-primary {
  background: linear-gradient(#2eb7d2, #248bad);
}

.koge-success {
  background: linear-gradient(#35c678, #19a960);
}

.koge-danger {
  background: linear-gradient(#ee5f65, #df3f4e);
}

.activation-fields {
  margin: 24px 0 0 8px;
  display: grid;
  gap: 8px;
  width: max-content;
}

.activation-fields span {
  display: block;
  margin-bottom: 4px;
  color: #111;
  font-size: 12px;
  font-weight: 700;
}

.activation-help {
  width: 502px;
  margin: 0 0 0 8px;
  padding: 20px 10px;
  background: #fff;
  display: grid;
  gap: 12px;
}

.activation-help div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.activation-help b {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #25a2c7;
  color: #fff;
  font-size: 24px;
  font-weight: 400;
}

.activation-help span {
  color: #5c6570;
  font-size: 13px;
}

.activation-message {
  position: absolute;
  left: 50%;
  top: 70%;
  transform: translateX(-50%);
  margin: 0;
  color: #111;
  font-size: 24px;
  text-align: center;
}

.activation-footer {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-columns: auto 315px 170px;
  gap: 0;
  align-items: center;
}

.activation-footer input {
  height: 30px;
  border: 2px solid #e33d32;
  border-right: 0;
  border-radius: 0;
  padding: 4px 8px;
  text-align: center;
  font-size: 12px;
}

.exam-system-bar {
  grid-template-columns: auto auto auto minmax(0, 1fr) auto auto auto auto;
  height: 40px;
  padding: 0 10px 0 112px;
  background: #203961;
  border-bottom: 0;
  color: #dce7f8;
}

.exam-code {
  font-size: 20px;
  color: #d7e2f2;
}

.exam-code strong {
  font-weight: 400;
}

.exam-link.finish {
  padding: 0 14px;
  border: 1px solid transparent;
  font-size: 11px;
}

.exam-link.finish:hover {
  border-color: #d23535;
}

.window-mark {
  color: #b6c4d9;
  font-size: 22px;
  line-height: 1;
}

.exam-work-screen {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  background: #eff4e5;
}

.exam-work-screen .exam-sidebar {
  grid-template-rows: auto 52px 32px 32px minmax(0, 1fr) 32px;
  gap: 8px;
  padding-top: 16px;
  background: #f1f6e6;
  border-right: 0;
}

.expand-button,
.info-button {
  width: 32px;
  height: 32px;
  border: 1px solid #c5dcff;
  border-radius: 4px;
  background: #fff;
  color: #4485d5;
  font-weight: 700;
}

.info-button {
  border-radius: 50%;
  background: linear-gradient(#78b9ff, #1c5f9d);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 20px;
}

.answers-box {
  width: 72px;
  color: #a4aab5;
  font-size: 12px;
}

.answers-box strong {
  color: #203961;
  font-size: 20px;
}

.station-numbers .task-item {
  width: 27px;
  min-height: 27px;
  border-color: transparent;
  color: #21324e;
}

.station-numbers .task-item.active {
  background: #133863;
  border-color: #133863;
}

.station-numbers .task-item.answered:not(.active) {
  background: #e5effc;
  border-color: #77a7df;
}

.side-step {
  width: 28px;
  height: 28px;
  background: #12375e;
  border-radius: 2px;
  font-size: 20px;
}

.exam-content {
  grid-template-columns: 84px minmax(0, 1fr) 84px;
  grid-template-rows: minmax(0, 1fr);
  background: #fff;
}

.exam-scroll {
  border: 0;
}

.exam-paper {
  width: 100%;
  min-height: calc(100vh - 98px);
  padding: 44px 84px 70px;
}

.intro-paper .paper-center {
  width: min(930px, 100%);
}

.intro-paper .paper-center h1 {
  font-size: 21px;
}

.task-paper .statement {
  font-size: 22px;
}

.page-arrow {
  width: 42px;
  height: 42px;
  color: #b6d4ff;
  border-color: #b6d4ff;
  font-size: 42px;
}

.official-answer-area {
  grid-column: auto;
  grid-row: auto;
  margin: 28px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #d9d9d9;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.official-answer-area .field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.official-answer-area .field span {
  margin: 0;
  white-space: nowrap;
}

.official-answer-area input,
.official-answer-area textarea,
.official-answer-area button {
  pointer-events: auto;
}

.official-answer-area input[type="file"] {
  max-width: 360px;
  padding: 5px;
}

.file-answer-panel {
  display: grid;
  gap: 10px;
}

.file-answer-drop {
  display: grid;
  gap: 4px;
  width: min(100%, 520px);
  padding: 12px;
  border: 1px solid #9fb2c9;
  background: #f5f9ff;
  cursor: pointer;
}

.file-answer-drop span {
  color: #203961;
  font-weight: 700;
}

.file-answer-drop small {
  color: #697168;
}

.file-answer-drop input {
  margin-top: 6px;
}

.answer-file-list {
  display: grid;
  gap: 6px;
}

.official-answer-area .materials {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  vertical-align: middle;
}

.answer-save-row {
  display: grid;
  grid-template-columns: minmax(120px, 210px) 116px;
  justify-content: end;
}

.answer-save-row input {
  height: 42px;
  border: 1px solid #777;
  border-radius: 0;
}

.answer-save-button {
  border: 0;
  background: #08d7a1;
  color: #08705e;
  font-weight: 700;
}

.change-choice-button {
  min-height: 28px;
  margin: 0 12px 0 0;
  border: 1px solid #9fb2c9;
  background: #eef5ff;
  color: #203961;
}

.finish-confirm-screen {
  background: #fff;
  color: #293650;
}

.finish-title-bar {
  height: 40px;
  padding-left: 100px;
  display: flex;
  align-items: center;
  background: #203961;
  color: #dce7f8;
  font-size: 20px;
}

.finish-kim-line {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 10px;
  border-bottom: 1px solid #e2e8da;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
}

.finish-warning {
  margin: 8px 16px;
}

.finish-answer-card {
  width: 344px;
  min-height: 214px;
  margin: 18px auto;
  padding: 12px;
  border: 1px solid #526079;
  background: #eaf1fc;
  text-align: center;
}

.finish-answer-card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 400;
}

.finish-task-grid {
  display: grid;
  grid-template-columns: repeat(8, 32px);
  gap: 10px 9px;
  justify-content: center;
  margin-bottom: 12px;
}

.finish-task-grid button {
  height: 28px;
  border: 1px solid transparent;
  background: #fff;
  color: #3b4658;
}

.finish-task-grid button.answered {
  border-color: #7c879b;
  background: #dfe9f8;
}

.finish-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
}

.finish-legend span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #7c879b;
  background: #dfe9f8;
}

.finish-legend.empty span {
  border-color: transparent;
  background: #fff;
}

.confirm-left,
.confirm-right {
  position: absolute;
  bottom: 16px;
}

.confirm-left {
  left: 28px;
}

.confirm-right {
  right: 28px;
}

.exam-finished-screen {
  display: grid;
  place-items: center;
}

.finish-center {
  width: 720px;
  text-align: center;
  color: #2a3855;
}

.finish-center h1 {
  margin-bottom: 18px;
  font-size: 40px;
  font-weight: 400;
}

.finished-kim,
.checksum-box,
.finish-export-row {
  background: #fff;
}

.finished-kim {
  padding: 8px 12px;
  font-size: 26px;
}

.finish-center h2 {
  margin: 28px 0;
  font-size: 25px;
  font-weight: 400;
}

.finish-center p {
  margin: 8px 0;
  font-size: 20px;
}

.finish-center p.skipped {
  color: #b3261e;
  font-weight: 600;
}

.checksum-box {
  margin: 26px 0 16px;
  padding: 12px;
}

.checksum-box span,
.checksum-box strong {
  display: block;
  font-size: 26px;
}

.finish-export-row {
  display: grid;
  grid-template-columns: minmax(220px, 330px);
  justify-content: center;
  gap: 0;
  padding: 16px;
}

.finish-export-row input,
.finish-export-row button {
  min-height: 68px;
  border: 1px solid #999;
  background: #fff;
  color: #111;
  font-size: 20px;
  text-align: center;
}

.finish-export-row button {
  border: 0;
  background: #e6ecfb;
  color: #1f2c45;
}

body[data-mode="builder"] {
  background: #eff4e5;
  overflow: hidden;
}

body[data-mode="builder"] .topbar {
  min-height: 40px;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  padding: 0 10px;
  background: #203961;
  color: #dce7f8;
  border-bottom: 0;
  box-shadow: none;
}

body[data-mode="builder"] .brand-mark {
  width: 56px;
  height: 28px;
  background: #15345d;
  border: 1px solid #476b9b;
  border-radius: 2px;
  color: #fff;
  font-size: 13px;
}

body[data-mode="builder"] .brand strong,
body[data-mode="builder"] .brand span:not(.brand-mark) {
  color: #dce7f8;
}

body[data-mode="builder"] .tabs {
  height: 30px;
  padding: 0;
  background: #1a3154;
  border-color: #42658f;
  border-radius: 2px;
}

body[data-mode="builder"] .tab {
  height: 28px;
  min-width: 118px;
  border-radius: 0;
  color: #c7d6eb;
}

body[data-mode="builder"] .tab.active {
  background: #e8f0fb;
  color: #1f2c45;
  box-shadow: none;
}

body[data-mode="builder"] .top-actions .button {
  min-height: 28px;
  border-color: transparent;
  border-radius: 2px;
  background: transparent;
  color: #dce7f8;
  padding: 4px 8px;
}

body[data-mode="builder"] main {
  width: 100%;
  height: calc(100vh - 40px);
  margin: 0;
  padding: 0;
}

body[data-mode="builder"] #builderPanel {
  height: 100%;
  min-height: 0;
}

body[data-mode="builder"] .builder-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: 292px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  background: #eff4e5;
  overflow: hidden;
}

body[data-mode="builder"] .builder-side {
  position: static;
  height: 100%;
  max-height: 100%;
  max-height: calc(100dvh - 40px);
  min-height: 0;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  border: 0;
  border-right: 1px solid #d8dfc8;
  border-radius: 0;
  box-shadow: none;
  background: #f1f6e6;
  padding: 14px 12px;
}

body[data-mode="builder"] .builder-side h1 {
  color: #203961;
  font-size: 18px;
}

body[data-mode="builder"] .builder-side .eyebrow {
  color: #6d7581;
}

body[data-mode="builder"] .builder-side .button-grid {
  grid-template-columns: 1fr 1fr;
}

body[data-mode="builder"] .builder-side .button,
body[data-mode="builder"] .editor .button {
  min-height: 32px;
  border-radius: 2px;
}

body[data-mode="builder"] .builder-side .button.primary {
  border-color: #2da4c2;
  background: linear-gradient(#2eb7d2, #248bad);
}

body[data-mode="builder"] .task-list.builder {
  display: grid;
  gap: 6px;
}

body[data-mode="builder"] .task-list.builder .task-item {
  min-height: 34px;
  grid-template-columns: 34px minmax(0, 1fr) 26px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #fff;
  color: #21324e;
}

body[data-mode="builder"] .task-list.builder .task-item.active {
  border-color: #133863;
  background: #e5effc;
}

body[data-mode="builder"] .task-list.builder .task-item .num {
  width: 27px;
  height: 27px;
  border-radius: 2px;
  background: #f5f8ee;
  color: #21324e;
}

body[data-mode="builder"] .task-list.builder .task-item .state {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dfe9f8;
  color: #203961;
  font-size: 12px;
  font-weight: 700;
}

body[data-mode="builder"] .editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100dvh - 40px);
  min-height: 0;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  padding: 4px 10px 12px;
}

body[data-mode="builder"] .builder-view-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: 0 0 auto;
  margin: 4px 0 6px;
  padding: 0;
  border-color: #d8dfc8;
  border-radius: 2px;
  background: #f1f6e6;
}

body[data-mode="builder"] .builder-view-tabs button {
  min-height: 30px;
  border-radius: 0;
  color: #203961;
}

body[data-mode="builder"] .builder-view-tabs button.active {
  background: #203961;
  color: #fff;
  box-shadow: none;
}

body[data-mode="builder"][data-builder-view="assignments"] .bank-control,
body[data-mode="builder"][data-builder-view="assignments"] #builderTaskList {
  display: none;
}

body[data-mode="builder"][data-builder-view="bank"] #builderAssignmentList {
  display: none;
}

body[data-mode="builder"][data-builder-view="assignments"] .builder-side .button-grid {
  grid-template-columns: 1fr;
}

body[data-mode="builder"] .builder-view-area {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

body[data-mode="builder"] .editor-grid,
body[data-mode="builder"] .task-form-grid,
body[data-mode="builder"] .assignment-form-grid {
  background: #f7f8f2;
  border: 1px solid #d8dfc8;
  padding: 4px 8px;
  gap: 6px;
}

body[data-mode="builder"] .editor-grid {
  grid-template-columns: minmax(260px, 1fr) 180px;
  align-items: end;
}

body[data-mode="builder"] .assignment-builder {
  flex: 0 0 auto;
  max-height: 34vh;
  overflow: auto;
  margin-bottom: 4px;
  padding: 8px;
  border-radius: 2px;
  background: #fbfcf7;
}

body[data-mode="builder"][data-builder-view="assignments"] .assignment-builder {
  max-height: none;
}

body[data-mode="builder"] .assignment-builder-head h2 {
  font-size: 17px;
}

body[data-mode="builder"] .assignment-form-grid {
  grid-template-columns: minmax(180px, 1fr) 118px minmax(180px, 1fr) 118px;
}

body[data-mode="builder"] .assignment-selection-row,
body[data-mode="builder"] .teacher-assignment-row {
  border-radius: 2px;
  padding: 5px;
}

body[data-mode="builder"] .side-assignments {
  max-height: calc(100vh - 162px);
  gap: 6px;
  padding-right: 5px;
}

body[data-mode="builder"] .side-assignments .teacher-assignment-row {
  padding: 5px;
}

body[data-mode="builder"] .side-assignments strong {
  font-size: 14px;
  line-height: 1.2;
}

body[data-mode="builder"] .side-assignments span {
  font-size: 12px;
}

body[data-mode="builder"] .assignment-row-actions .button {
  min-height: 26px;
  padding: 3px 5px;
}

body[data-mode="builder"] .assignment-task-sample {
  border-radius: 2px;
  padding: 8px;
}

body[data-mode="builder"] .assignment-task-sample h3 {
  font-size: 16px;
}

body[data-mode="builder"] .assignment-sample-question {
  max-height: 300px;
}

body[data-mode="builder"] .assignment-sample-statement {
  border-radius: 2px;
  padding: 8px;
}

body[data-mode="builder"] input,
body[data-mode="builder"] textarea,
body[data-mode="builder"] select {
  border-radius: 2px;
}

body[data-mode="builder"] input,
body[data-mode="builder"] select {
  min-height: 30px;
  padding: 5px 8px;
}

body[data-mode="builder"] .field {
  margin-bottom: 4px;
}

body[data-mode="builder"] .field span {
  margin-bottom: 3px;
  font-size: 12px;
}

body[data-mode="builder"] .editor-divider {
  display: none;
}

body[data-mode="builder"] .task-editor-head {
  display: none;
}

body[data-mode="builder"] .task-editor-head .eyebrow {
  display: none;
}

body[data-mode="builder"] .task-editor-head h2 {
  font-size: 18px;
  margin: 0;
}

.variant-instructions-panel {
  margin-top: 20px;
  border: 1px solid #d8dfc8;
  background: #f7f8f2;
  padding: 10px 12px;
}

body[data-mode="builder"] .variant-instructions-panel {
  display: none;
}

body[data-mode="builder"] #taskEditor {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-mode="builder"] #taskEditor > .task-form-grid,
body[data-mode="builder"] #taskEditor > .question-pool,
body[data-mode="builder"] #taskEditor > .field:not(.question-statement-field) {
  flex: 0 0 auto;
}

body[data-mode="builder"] #taskEditor > .question-statement-field {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

body[data-mode="builder"] #taskEditor > .question-statement-field .rich-question-editor {
  flex: 0 0 auto;
  height: 240px;
  min-height: 240px;
  max-height: 240px;
  overflow-y: auto;
}

body[data-mode="builder"] .field-label-row {
  gap: 4px;
  margin-bottom: 2px;
}

body[data-mode="builder"] .question-statement-field .field-label-row {
  gap: 2px;
}

body[data-mode="builder"] .editor-toolbar {
  gap: 4px;
  padding: 3px;
}

body[data-mode="builder"] .editor-row {
  gap: 4px;
}

body[data-mode="builder"] .question-pool {
  position: sticky;
  top: 0;
  z-index: 12;
  grid-template-columns: minmax(210px, auto) minmax(0, 1fr);
  grid-template-areas: "head tabs";
  margin: 4px 0;
  padding: 4px 6px;
  gap: 6px;
  box-shadow: 0 6px 10px rgba(31, 39, 34, 0.08);
}

body[data-mode="builder"] .question-pool .section-head {
  gap: 8px;
  min-width: 0;
}

body[data-mode="builder"] .question-pool .section-head h2 {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

body[data-mode="builder"] .question-pool-actions {
  flex-wrap: wrap;
  gap: 6px;
}

body[data-mode="builder"] .question-pool .section-head .button,
body[data-mode="builder"] .question-tabs button {
  min-height: 26px;
  padding: 3px 8px;
}

body[data-mode="builder"] .question-tabs button {
  max-width: 130px;
}

.variant-instructions-panel summary {
  cursor: pointer;
  color: #203961;
  font-weight: 700;
}

.variant-instructions-panel .field {
  margin: 12px 0 0;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.field-label-row > span {
  margin-bottom: 0;
}

.question-statement-field .field-label-row {
  align-items: stretch;
  flex-direction: column;
}

.question-editor-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.editor-toolbar {
  display: grid;
  gap: 6px;
  justify-content: stretch;
  width: 100%;
  padding: 4px;
  border: 1px solid #d1d8df;
  border-radius: 6px 6px 0 0;
  background: #f7f9fb;
}

.editor-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.editor-button-group {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.editor-button-group > .button,
.editor-button-group > .editor-setting {
  border-radius: 0;
  border-color: #c7d0d8;
}

.editor-button-group .button {
  min-width: 38px;
}

.editor-button-group > :first-child {
  border-radius: 4px 0 0 4px;
}

.editor-button-group > :last-child {
  border-radius: 0 4px 4px 0;
}

.editor-button-group .button + .button,
.editor-button-group .button + .editor-setting,
.editor-button-group .editor-setting + .button,
.editor-button-group .editor-setting + .editor-setting {
  margin-left: -1px;
}

.editor-toolbar .button:disabled {
  color: #203961;
  opacity: 1;
  cursor: default;
}

.question-editor-tools .button {
  min-height: 30px;
  padding: 5px 9px;
}

.editor-tool {
  width: auto;
  min-width: 34px;
  font-weight: 600;
}

.editor-tool.text-tool {
  min-width: 0;
  white-space: nowrap;
}

.editor-setting {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #c7cdd3;
  background: #fff;
  color: #526079;
  font-size: 13px;
  white-space: nowrap;
}

.editor-setting input {
  width: 52px;
  min-height: 24px;
  border: 0;
  padding: 2px 4px;
  text-align: center;
}

.editor-setting.compact input {
  width: 60px;
}

.rich-question-editor {
  height: clamp(240px, calc(100vh - 520px), 560px);
  min-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 2px;
  background: #fff;
  padding: 12px;
  outline: none;
  line-height: 1.45;
}

.rich-question-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 84, 0.14);
}

.rich-question-editor p,
.rich-question-editor div {
  margin: 0 0 8px;
}

.rich-question-editor .statement-table {
  font-size: 15px;
}

.rich-question-editor .statement-image {
  display: block;
  height: auto;
  max-height: none;
  max-width: 100%;
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.rich-question-editor .statement-image.is-selected,
.fullscreen-rich-editor .statement-image.is-selected,
.statement-image-frame.is-selected {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.rich-question-editor .statement-image-frame .statement-image {
  max-width: none;
  margin: 0;
}

.image-edit-overlay {
  position: absolute;
  z-index: 3000;
  border: 3px solid #0f7a5a;
  box-sizing: border-box;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
}

.image-edit-overlay[data-mode="crop"] {
  border-style: dashed;
}

.image-resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #0f7a5a;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  touch-action: none;
  z-index: 2;
}

.image-crop-handle {
  position: absolute;
  border: 1px solid #fff;
  border-radius: 2px;
  background: #111827;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  touch-action: none;
  z-index: 3;
}

.image-resize-e {
  top: 50%;
  right: -28px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.image-resize-s {
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.image-resize-se {
  right: -28px;
  bottom: -28px;
  cursor: nwse-resize;
}

.image-crop-n,
.image-crop-s {
  width: 30px;
  height: 8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.image-crop-e,
.image-crop-w {
  width: 8px;
  height: 30px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.image-crop-n {
  top: -6px;
}

.image-crop-e {
  right: -6px;
}

.image-crop-s {
  bottom: -6px;
}

.image-crop-w {
  left: -6px;
}

.image-crop-nw,
.image-crop-ne,
.image-crop-sw,
.image-crop-se {
  width: 14px;
  height: 14px;
}

.image-crop-nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.image-crop-ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.image-crop-sw {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}

.image-crop-se {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.image-edit-dragging {
  user-select: none;
}

.image-edit-dragging,
.image-edit-dragging * {
  cursor: crosshair !important;
}

.question-pool {
  margin: 6px 0 8px;
  padding: 6px 8px;
  border: 1px solid #d8dfc8;
  background: #f5f8ee;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "tabs";
  gap: 6px 10px;
  align-items: center;
}

.question-pool .section-head {
  grid-area: head;
  align-items: center;
  margin-bottom: 0;
}

.question-pool .section-head .eyebrow {
  display: none;
}

.question-pool .section-head h2 {
  font-size: 16px;
}

.question-pool .section-head .button {
  min-height: 30px;
  padding: 5px 10px;
}

.question-pool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.question-tabs {
  grid-area: tabs;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.question-tabs button {
  flex: 0 0 auto;
  min-height: 28px;
  max-width: 220px;
  border: 1px solid #c8d3bf;
  border-radius: 2px;
  background: #fff;
  color: #203961;
  padding: 4px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-tabs button.active {
  border-color: #133863;
  background: #203961;
  color: #fff;
}

.question-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  background: #fff;
}

.question-fullscreen-bar {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #d8dfc8;
  background: #f1f6e6;
}

.question-fullscreen-bar .fullscreen-toolbar {
  border-radius: 6px;
}

.fullscreen-actions {
  justify-content: flex-end;
}

.question-fullscreen-bar strong {
  color: #203961;
}

.question-fullscreen .fullscreen-rich-editor {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 18px;
  overflow-y: auto;
  font-size: 18px;
  line-height: 1.45;
  box-shadow: none;
}

body.question-fullscreen-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    min-width: 0;
  }

  .start-grid,
  .home-widgets,
  .exam-layout,
  .learning-layout,
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .home-teacher-widgets {
    grid-template-columns: 1fr;
  }

  .task-nav,
  .learning-side,
  .builder-side {
    position: static;
    max-height: none;
  }

  .variant-summary,
  .result-summary,
  .result-meta,
  .editor-grid,
  .task-form-grid,
  .assignment-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  body[data-mode="home"] {
    background-attachment: scroll;
    background-position: 48% center;
  }

  body[data-mode="home"] .home-surface {
    padding: 16px;
    border-radius: 14px;
  }

  main {
    padding: 12px;
  }

  .surface {
    padding: 14px;
  }

  .variant-summary,
  .result-summary,
  .result-meta,
  .editor-grid,
  .task-form-grid,
  .assignment-form-grid,
  .assignment-selection-row,
  .teacher-assignment-row {
    grid-template-columns: 1fr;
  }

  .section-head,
  .home-head,
  .workspace-head,
  .learning-head,
  .learning-section-head,
  .learning-pdf-head,
  .learning-archive-head,
  .task-editor-head,
  .side-head {
    display: grid;
  }

  .button-row,
  .top-actions,
  .assignment-actions,
  .result-actions {
    justify-content: stretch;
  }

  .button-row .button,
  .top-actions .button,
  .learning-nav-row .button,
  .result-actions .button {
    flex: 1;
  }

  .learning-nav-row {
    flex-wrap: wrap;
  }

  .learning-nav-row strong {
    order: -1;
    width: 100%;
    text-align: center;
  }

  .learning-auth {
    justify-content: stretch;
  }

  .learning-auth input,
  .learning-editor-actions .button,
  .learning-auth .button,
  .learning-pdf-actions .button,
  .learning-archive-actions .button {
    flex: 1 1 150px;
  }

  .learning-editor-actions,
  .learning-pdf-actions,
  .learning-archive-actions {
    justify-content: stretch;
  }

  .learning-archive-card {
    display: grid;
  }

  .learning-pdf-viewer {
    min-height: 420px;
  }

  .exam-system-bar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .exam-system-bar .exam-code:nth-of-type(2),
  .exam-system-bar .exam-status,
  .exam-system-bar .exam-link:not(.finish) {
    display: none;
  }

  .exam-link.finish {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .exam-stage {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .exam-content {
    grid-template-columns: 28px minmax(0, 1fr) 28px;
  }

  .exam-paper {
    width: 100%;
    min-width: 0;
    padding: 40px 20px 64px;
    font-size: 16px;
  }

  .paper-center h1 {
    font-size: 18px;
  }

  .task-paper .statement {
    font-size: 17px;
  }

  .participant-grid {
    grid-template-columns: 1fr;
  }

  .participant-actions {
    justify-content: stretch;
  }

  .page-arrow {
    width: 24px;
    height: 24px;
    font-size: 22px;
  }

  .scroll-top-button {
    right: 14px;
    bottom: 70px;
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  body[data-mode="station"] .scroll-top-button {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 620px) {
  body[data-mode="station"] main {
    padding: 0;
  }

  body[data-mode="station"] .surface {
    padding: 0;
  }

  .exam-system-bar {
    grid-template-columns: auto auto minmax(12px, 1fr) auto auto;
    gap: 6px;
    padding: 0 6px;
  }

  .exam-system-bar .exam-code:nth-of-type(2) {
    display: block;
  }

  .exam-code {
    font-size: 12px;
  }

  .exam-code strong {
    font-size: 12px;
  }

  .exam-link.finish {
    max-width: 28px;
    padding: 0;
    font-size: 0;
  }

  .exam-link.finish::after {
    content: "×";
    font-size: 20px;
  }

  .window-mark {
    display: none;
  }

  .exam-work-screen {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .exam-content {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    grid-template-rows: minmax(0, 1fr);
  }

  .exam-paper {
    padding: 34px 26px 70px;
  }

  .registration-center {
    width: 320px;
  }

  .registration-inputs input:nth-child(2),
  .registration-inputs input:nth-child(3),
  .big-number-row strong:nth-child(2),
  .big-number-row strong:nth-child(3) {
    width: 132px;
  }

  .activation-footer {
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .activation-footer input {
    border-right: 2px solid #e33d32;
  }

  .activation-message {
    width: calc(100% - 24px);
    font-size: 18px;
  }

  .finish-center {
    width: min(720px, calc(100% - 28px));
  }

  .finish-export-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .exam-choice-grid {
    grid-template-columns: 1fr;
  }
}
