:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f0f3f8;
  --text: #18202c;
  --muted: #5d6675;
  --line: #d7dee8;
  --accent: #1d5fa7;
  --accent-strong: #174c86;
  --green: #1f7a4d;
  --red: #b3261e;
  --amber: #9a6400;
  --focus: #111827;
  --shadow: 0 8px 24px rgba(24, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Helvetica Neue", sans-serif;
  line-height: 1.45;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  min-height: 38px;
  padding: 8px 12px;
}

button:hover {
  border-color: #9eadbf;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(29, 95, 167, 0.25);
  outline-offset: 2px;
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

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

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

.button-danger {
  background: #ffffff;
  border-color: #e1aaa6;
  color: var(--red);
}

.button-quiet {
  background: transparent;
}

.button-wide {
  width: 100%;
}

.app {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px clamp(16px, 3vw, 36px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--text);
  display: flex;
  font-weight: 700;
  gap: 10px;
  text-decoration: none;
}

.brand-mark,
.brand-logo {
  align-items: center;
  background: var(--accent);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  font-size: 13px;
  height: 34px;
  justify-content: center;
  object-fit: cover;
  width: 34px;
}

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

.nav-user {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px clamp(16px, 3vw, 36px) 48px;
}

.page-narrow {
  max-width: 860px;
}

.home-page {
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(135deg, #0b4db3 0%, #1248a0 42%, #c61036 100%);
  color: #ffffff;
  min-height: calc(100vh - 62px);
  max-width: none;
  padding: 34px clamp(16px, 3vw, 36px) 54px;
}

.home-shell {
  margin: 0 auto;
  max-width: 1180px;
}

.home-hero {
  align-items: center;
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  min-height: 440px;
}

.home-brandline {
  align-items: center;
  display: flex;
  gap: 12px;
  font-weight: 800;
  margin-bottom: 18px;
}

.home-logo {
  border-radius: 50%;
  height: 44px;
  object-fit: cover;
  width: 44px;
}

.home-title {
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: 0;
  line-height: 1.04;
  margin: 0 0 16px;
  max-width: 800px;
}

.home-page .lead {
  color: rgba(255, 255, 255, 0.88);
  font-size: 19px;
  margin: 0 0 24px;
  max-width: 720px;
}

.primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-actions button {
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  min-height: 54px;
  padding-inline: 22px;
}

.home-dashboard {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(5, 15, 36, 0.24);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.home-stat {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  color: #162033;
  display: grid;
  gap: 4px;
  padding: 18px;
}

.home-stat strong {
  color: #c61036;
  font-size: 34px;
  line-height: 1;
}

.home-feature-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-feature-grid article {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  color: #18202c;
  padding: 18px;
}

.home-feature-grid h2 {
  margin: 0 0 8px;
}

.home-feature-grid p {
  color: #4a5364;
  margin: 0;
}

.lead {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 22px;
  max-width: 760px;
}

.panel,
.tool-panel,
.info-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.auth-panel {
  margin: 42px auto 0;
  max-width: 460px;
}

.tool-panel {
  padding: 16px;
}

.info-panel {
  padding: 18px;
}

.panel-title {
  font-size: 18px;
  margin: 0 0 12px;
}

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

.small {
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid-three {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.label {
  color: #263244;
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.checkbox-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-row,
.radio-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
}

.check-row input,
.radio-row input {
  flex: 0 0 auto;
}

.section {
  margin-top: 18px;
}

.section-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2,
.section-header h3 {
  margin: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #263244;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.badge-green {
  background: #e9f6ef;
  border-color: #b9dec8;
  color: var(--green);
}

.badge-red {
  background: #fff0ef;
  border-color: #e8b4b0;
  color: var(--red);
}

.badge-amber {
  background: #fff6df;
  border-color: #e5c980;
  color: var(--amber);
}

.code-box {
  align-items: center;
  background: #f7f9fc;
  border: 1px dashed #9eadbf;
  border-radius: 6px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.code {
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

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

th {
  background: #f3f6fa;
  color: #263244;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.question-list {
  display: grid;
  gap: 10px;
}

.question-row {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.question-row.is-editing {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.question-row-header {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.question-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  margin-top: 6px;
}

.question-row-details {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
}

.option-rows {
  display: grid;
  gap: 8px;
}

.option-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: 92px minmax(0, 1.2fr) minmax(0, 1fr) 112px 38px;
  padding: 8px;
}

.option-row-matching {
  grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr) 38px;
}

.option-index {
  color: #3b485a;
  font-size: 13px;
  font-weight: 700;
}

.option-row input {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 7px 9px;
  width: 100%;
}

.option-remove {
  font-size: 18px;
  min-height: 36px;
  padding: 4px 0;
}

.correct-cell {
  min-height: 38px;
}

.correct-pick {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 7px;
  height: 100%;
  justify-content: center;
  min-height: 38px;
  padding: 6px 8px;
}

.correct-pick span {
  color: #263244;
  font-size: 13px;
  font-weight: 700;
}

.compact-empty {
  padding: 10px;
  text-align: left;
}

.is-hidden {
  display: none;
}

.question-image,
.option-image {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.question-image {
  max-height: 280px;
  margin: 12px 0;
}

.option-image {
  max-height: 120px;
  margin-top: 8px;
}

.validation-list {
  background: #fff8eb;
  border: 1px solid #e7c77d;
  border-radius: 8px;
  color: #634000;
  margin: 12px 0;
  padding: 12px 14px;
}

.validation-list ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

.empty {
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.toast {
  background: #18202c;
  border-radius: 6px;
  bottom: 18px;
  color: #ffffff;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  z-index: 80;
}

.toast.is-visible {
  opacity: 1;
}

.exam-shell {
  background: #eef2f7;
  min-height: 100vh;
  padding-top: 70px;
}

.exam-bar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  left: 0;
  min-height: 62px;
  padding: 9px clamp(12px, 2vw, 26px);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 50;
}

.exam-title {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer {
  background: #f7f9fc;
  border: 1px solid #b8c4d4;
  border-radius: 6px;
  color: #101828;
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  min-width: 114px;
  padding: 8px 10px;
  text-align: center;
}

.timer.is-low {
  border-color: #e3a2a0;
  color: var(--red);
}

.exam-main {
  margin: 0 auto;
  max-width: 1120px;
  padding: 20px clamp(12px, 2.4vw, 30px) 36px;
}

.progress-wrap {
  background: #dbe3ee;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  width: 0;
}

.question-surface {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: clamp(16px, 2.4vw, 26px);
}

.question-text {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 14px;
}

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

.answer-option {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 12px;
}

.answer-option:has(input:checked) {
  border-color: var(--accent);
  background: #f2f7fc;
}

.matching-grid {
  display: grid;
  gap: 10px;
}

.matching-row {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
}

.matching-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.matching-row select,
.fill-input,
.short-input,
.combined-input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.sequence-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sequence-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 6px 8px;
}

.drag-handle {
  background: #f1f4f8;
  border-radius: 4px;
  color: var(--muted);
  min-height: 34px;
  text-align: center;
}

.exam-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-top: 14px;
}

.exam-actions-left,
.exam-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.warning-overlay {
  align-items: center;
  background: rgba(24, 32, 44, 0.64);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 90;
}

.warning-overlay.is-visible {
  display: flex;
}

.warning-dialog {
  background: #ffffff;
  border-radius: 8px;
  max-width: 520px;
  padding: 22px;
  width: 100%;
}

.result-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
}

.author-answer-key {
  border-radius: 6px;
}

body.author-reveal .author-answer-key {
  background: rgba(31, 122, 77, 0.035);
  outline: 1px solid rgba(31, 122, 77, 0.12);
}

.author-correct-key {
  align-items: start;
  background: rgba(31, 122, 77, 0.035);
  border: 1px solid rgba(31, 122, 77, 0.12);
  border-left: 2px solid rgba(31, 122, 77, 0.22);
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 8px 10px;
  user-select: text;
}

.author-correct-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  width: 100%;
}

.author-correct-head button {
  background: transparent;
  border-color: rgba(31, 122, 77, 0.18);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 28px;
  padding: 4px 8px;
  user-select: none;
}

.author-correct-head span,
.author-inline-key,
.author-sequence-position {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.author-correct-key strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.matching-answer-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.author-inline-key {
  display: block;
  user-select: text;
}

.sequence-item.has-author-key {
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
}

.author-sequence-position {
  background: rgba(31, 122, 77, 0.055);
  border: 1px solid rgba(31, 122, 77, 0.14);
  border-radius: 999px;
  padding: 3px 7px;
  user-select: text;
  white-space: nowrap;
}

.nmt-exam-bar {
  background: #e8edf4;
  border-bottom: 1px solid #8fa1b7;
  color: #152033;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 68px;
}

.nmt-title-block {
  min-width: 0;
}

.nmt-kicker {
  color: #52647a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nmt-timer-block {
  align-items: center;
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.nmt-timer-block span {
  color: #3d4b5f;
  font-size: 13px;
  font-weight: 700;
}

.nmt-exam-main {
  display: grid;
  gap: 14px;
  grid-template-columns: 238px minmax(0, 1fr);
  max-width: 1280px;
  padding-top: 14px;
}

.nmt-nav-panel,
.nmt-workspace {
  background: #ffffff;
  border: 1px solid #aeb8c6;
  border-radius: 2px;
}

.nmt-nav-panel {
  align-self: start;
  padding: 10px;
  position: sticky;
  top: 82px;
}

.nmt-nav-head {
  align-items: center;
  border-bottom: 1px solid #d4dbe5;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.nmt-task-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(5, 1fr);
}

.nmt-task-btn {
  background: #f4f6f9;
  border-color: #aeb8c6;
  border-radius: 2px;
  font-weight: 700;
  min-height: 34px;
  padding: 4px;
}

.nmt-task-btn.is-current {
  background: #1d5fa7;
  border-color: #174c86;
  color: #ffffff;
}

.nmt-task-btn.is-answered:not(.is-current) {
  background: #dff0e7;
  border-color: #7eb495;
}

.nmt-legend {
  color: #52647a;
  display: grid;
  font-size: 12px;
  gap: 6px;
  margin-top: 12px;
}

.nmt-legend span {
  align-items: center;
  display: flex;
  gap: 6px;
}

.nmt-legend i {
  border: 1px solid #aeb8c6;
  display: inline-block;
  height: 12px;
  width: 12px;
}

.legend-current {
  background: #1d5fa7;
}

.legend-answered {
  background: #dff0e7;
}

.nmt-workspace {
  padding: 0;
}

.nmt-question-head {
  align-items: center;
  background: #f1f4f8;
  border-bottom: 1px solid #c4ceda;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, auto) minmax(180px, 1fr);
  padding: 12px 14px;
}

.nmt-question-number {
  font-size: 18px;
  font-weight: 700;
}

.nmt-question-meta {
  color: #52647a;
  font-size: 13px;
}

.nmt-workspace .question-surface {
  border: 0;
  border-radius: 0;
  margin: 0;
  min-height: 380px;
  padding: 18px 20px;
}

.nmt-workspace .exam-actions {
  background: #f1f4f8;
  border-top: 1px solid #c4ceda;
  margin: 0;
  padding: 10px 14px;
}

.nmt-workspace .answer-option {
  border-color: #b8c4d4;
  border-radius: 2px;
  grid-template-columns: 22px minmax(0, 1fr);
  padding: 10px 12px;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.event-item {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.event-item:last-child {
  border-bottom: 0;
}

@media (max-width: 880px) {
  .home-layout,
  .grid-two,
  .grid-three,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .exam-bar .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  .nmt-nav-panel {
    position: static;
  }

  .nmt-task-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .nmt-question-head {
    grid-template-columns: 1fr;
  }

  .matching-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .question-row-header,
  .section-header,
  .exam-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .option-row,
  .option-row-matching {
    grid-template-columns: 1fr;
  }

  .exam-actions-left,
  .exam-actions-right {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .exam-actions button {
    width: 100%;
  }

  .nmt-timer-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .nmt-task-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.nmt-real-shell {
  --nmt-red: #c61036;
  --nmt-red-dark: #a00d2b;
  --nmt-gray: #f5f5f5;
  --nmt-border: #e0e0e0;
  --nmt-text: #333333;
  background: #f3f4f6;
  color: var(--nmt-text);
  font-family: "Open Sans", Arial, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.nmt-real-shell input,
.nmt-real-shell textarea,
.nmt-real-shell select,
.nmt-real-shell .author-correct-key,
.nmt-real-shell .author-inline-key,
.nmt-real-shell .author-sequence-position {
  -webkit-user-select: text;
  user-select: text;
}

.nmt-watermarks {
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  left: 0;
  opacity: 0.03;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 1;
}

.nmt-watermarks span {
  font-size: 24px;
  font-weight: 700;
  padding: 40px;
  transform: rotate(-45deg);
  white-space: nowrap;
}

.keyboard-layout-badge {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--nmt-border);
  border-radius: 999px;
  color: #222222;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.nmt-real-header,
.nmt-real-topnav,
.nmt-info-band,
.nmt-real-layout {
  position: relative;
  z-index: 2;
}

.nmt-real-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--nmt-border);
  display: flex;
  justify-content: space-between;
  min-height: 66px;
  padding: 14px 40px;
}

.nmt-real-logo,
.nmt-real-user {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.nmt-real-logo {
  color: #555555;
  font-size: 16px;
  font-weight: 700;
}

.nmt-real-logo span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nmt-logo-mark {
  align-items: center;
  background: var(--nmt-red);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.nmt-logo-img {
  border-radius: 50%;
  flex: 0 0 auto;
  height: 36px;
  object-fit: cover;
  width: 36px;
}

.nmt-real-user {
  color: #333333;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
}

.nmt-real-topnav {
  background: #ffffff;
  border-bottom: 1px solid var(--nmt-border);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0 40px;
}

.nmt-topnav-link {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #555555;
  font-size: 14px;
  font-weight: 600;
  min-height: 48px;
  padding: 12px 5px;
}

.nmt-topnav-link.active,
.nmt-topnav-link:hover {
  color: var(--nmt-red);
}

.nmt-topnav-link.active {
  border-bottom-color: var(--nmt-red);
}

.nmt-info-band {
  background: #f3f4f6;
  padding: 20px 40px;
}

.nmt-info-banner {
  align-items: center;
  background: #ffffff;
  border-left: 4px solid var(--nmt-red);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 15px 20px;
}

.nmt-info-text {
  color: #444444;
  font-size: 13px;
  line-height: 1.5;
  max-width: 68%;
}

.nmt-info-text strong {
  color: var(--nmt-red);
}

.nmt-timer-controls {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
}

.nmt-finish-btn {
  background: var(--nmt-red);
  border: 0;
  border-radius: 20px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
}

.nmt-finish-btn:hover {
  background: var(--nmt-red-dark);
}

.nmt-main-timer {
  background: transparent;
  border: 0;
  color: #333333;
  font-size: 16px;
  min-width: 74px;
  padding: 0;
}

.nmt-main-timer.is-hidden-value {
  color: transparent;
  position: relative;
}

.nmt-main-timer.is-hidden-value::after {
  color: #555555;
  content: "--:--";
  left: 0;
  position: absolute;
}

.nmt-timer-toggle {
  background: var(--nmt-red);
  border: 0;
  border-radius: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  padding: 6px 10px;
}

.nmt-real-layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 280px;
  padding: 0 40px 40px;
}

.nmt-real-left,
.nmt-real-right {
  background: #ffffff;
  border: 1px solid var(--nmt-border);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nmt-real-right {
  position: sticky;
  top: 20px;
}

.nmt-breadcrumbs {
  align-items: center;
  border-bottom: 1px solid var(--nmt-border);
  color: #888888;
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
  min-height: 49px;
  padding: 12px 20px;
}

.nmt-breadcrumbs .active-bread {
  color: var(--nmt-red);
  font-weight: 700;
}

.nmt-subject-tabs {
  background: #fafafa;
  border-bottom: 1px solid var(--nmt-border);
  display: flex;
}

.nmt-stage-tabs {
  background: #f3f5f8;
  border-bottom: 1px solid var(--nmt-border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nmt-stage-tabs.is-single-stage {
  display: block;
}

.nmt-stage-tabs.is-single-stage .nmt-stage-title {
  border-bottom: 1px solid var(--nmt-border);
}

.nmt-stage-group {
  border-right: 1px solid var(--nmt-border);
  min-width: 0;
}

.nmt-stage-group:last-child {
  border-right: 0;
}

.nmt-stage-title {
  background: #ffffff;
  border-bottom: 1px solid var(--nmt-border);
  color: #666666;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  text-align: center;
}

.nmt-stage-group.is-active .nmt-stage-title {
  color: var(--nmt-red);
}

.nmt-stage-group .nmt-subject-tabs {
  border-bottom: 0;
}

.nmt-subject-tab {
  background: transparent;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--nmt-border);
  color: #555555;
  flex: 1 1 0;
  font-size: 14px;
  font-weight: 700;
  min-height: 52px;
  padding: 14px 8px;
  text-transform: none;
}

.nmt-subject-tab.active {
  background: #ffffff;
  border-bottom: 3px solid var(--nmt-red);
  color: var(--nmt-text);
}

.nmt-content-area {
  min-height: 500px;
  padding: 28px 30px 30px;
}

.nmt-question-title-row {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.nmt-subject-title {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 5px;
}

.nmt-question-meta,
.nmt-warning-pill {
  color: #666666;
  font-size: 13px;
  font-weight: 700;
}

.nmt-warning-pill {
  background: #fff6df;
  border: 1px solid #e5c980;
  border-radius: 999px;
  color: #8a5b00;
  flex: 0 0 auto;
  padding: 6px 10px;
}

.nmt-real-shell .progress-wrap {
  background: #eeeeee;
  height: 6px;
  margin-bottom: 24px;
}

.nmt-real-shell .progress-fill {
  background: var(--nmt-red);
}

.nmt-question-slide {
  animation: fadeIn 0.18s ease-in;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-left: 4px solid var(--nmt-red);
  border-radius: 2px;
  margin-bottom: 20px;
  padding: 18px 20px 28px;
}

.nmt-real-shell .nmt-question-number {
  border-bottom: 1px solid #eeeeee;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
}

.nmt-real-shell .question-text {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  margin-bottom: 20px;
  overflow-x: auto;
}

.nmt-real-shell .answer-stack {
  gap: 12px;
  margin-bottom: 18px;
}

.nmt-real-shell .answer-option {
  align-items: center;
  background: #ffffff;
  border-color: #dadde2;
  border-radius: 2px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 11px 12px;
}

.nmt-real-shell .answer-option:hover {
  background: #f0f0f0;
}

.nmt-real-shell .answer-option:has(input:checked) {
  background: #fff4f6;
  border-color: var(--nmt-red);
}

.nmt-real-shell .answer-option input {
  cursor: pointer;
  transform: scale(1.25);
}

.nmt-real-shell .is-correct-option {
  background: rgba(31, 122, 77, 0.035);
  border-color: rgba(31, 122, 77, 0.14);
  box-shadow: inset 2px 0 0 rgba(31, 122, 77, 0.14);
  outline: 0;
}

.nmt-real-shell .matching-row select,
.nmt-real-shell .fill-input,
.nmt-real-shell .short-input,
.nmt-real-shell .combined-input {
  border-radius: 4px;
}

.nmt-real-shell .matching-grid {
  gap: 8px;
}

.nmt-real-shell .matching-row {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

.nmt-real-shell .matching-row strong {
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
  padding-top: 8px;
}

.nmt-real-shell .matching-answer-cell {
  min-width: 0;
}

.nmt-bottom-actions {
  align-items: center;
  border-top: 1px solid var(--nmt-border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 20px;
}

.nmt-real-shell .btn-save {
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 4px;
  color: #666666;
  font-weight: 700;
  padding: 10px 20px;
}

.nmt-real-shell .btn-save.is-dirty {
  border-color: var(--nmt-red);
  color: var(--nmt-red);
}

.nmt-real-shell .btn-save.is-saved {
  background: #dff0e7;
  border-color: #7eb495;
  color: #1f7a4d;
}

.nmt-real-shell .btn-save:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.nmt-real-right .grid-title {
  border-bottom: 1px solid var(--nmt-border);
  font-weight: 700;
  padding: 15px;
  text-align: center;
}

.nmt-real-right .nmt-task-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  padding: 20px;
}

.nmt-real-right .nmt-task-btn {
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 4px;
  color: #333333;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 0;
}

.nmt-real-right .nmt-task-btn:hover {
  border-color: var(--nmt-red);
}

.nmt-real-right .nmt-task-btn.is-current {
  background: #333333;
  border: 2px solid #333333;
  box-shadow: inset 0 0 0 1px #ffffff;
  color: #ffffff;
}

.nmt-real-right .nmt-task-btn.is-answered:not(.is-current) {
  background: var(--nmt-red);
  border-color: var(--nmt-red);
  color: #ffffff;
}

.nmt-grid-summary {
  border-top: 1px solid var(--nmt-border);
  color: #666666;
  display: grid;
  font-size: 13px;
  gap: 6px;
  padding: 14px 20px 18px;
}

.nmt-start-main {
  display: grid;
  min-height: calc(100vh - 66px);
  place-items: center;
  padding: 28px;
}

.nmt-start-card {
  background: #ffffff;
  border: 1px solid var(--nmt-border);
  border-top: 5px solid var(--nmt-red);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 16px;
  max-width: 760px;
  padding: 28px;
  width: 100%;
}

.nmt-start-card h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.12;
  margin: 0;
}

.nmt-kicker {
  color: var(--nmt-red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.nmt-start-notice {
  background: #f8fafc;
  border: 1px solid #d7dee8;
  display: grid;
  gap: 5px;
  padding: 14px 16px;
}

.nmt-start-button {
  justify-self: start;
  min-height: 46px;
}

.nmt-break-main {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 66px);
  padding: 40px;
}

.nmt-break-card {
  background: #ffffff;
  border: 1px solid var(--nmt-border);
  border-top: 4px solid var(--nmt-red);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 620px;
  padding: 28px;
  width: 100%;
}

.nmt-break-card h1 {
  font-size: 30px;
  line-height: 1.15;
  margin: 0;
}

.nmt-break-timer {
  color: var(--nmt-red);
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0;
}

.nmt-break-success {
  color: #3f4a59;
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.nmt-break-rules {
  background: #f8fafc;
  border: 1px solid #d7dee8;
  display: grid;
  gap: 7px;
  padding: 14px 16px;
}

.nmt-break-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nmt-break-skip {
  background: transparent;
  border: 1px solid #c7ccd5;
  color: #555555;
  font-weight: 700;
}

.site-confirm-overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 100000;
}

.site-confirm-overlay.is-visible {
  display: flex;
}

.site-confirm-dialog {
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  max-width: 460px;
  padding: 22px;
  width: 100%;
}

.site-confirm-dialog h2 {
  font-size: 22px;
  margin: 0 0 8px;
}

.site-confirm-dialog p {
  color: #555555;
  margin: 0 0 18px;
}

.nmt-unanswered-box {
  border: 2px solid var(--nmt-red);
  color: #333333;
  display: grid;
  gap: 5px;
  line-height: 1.45;
  margin: 12px 0 18px;
  padding: 14px 16px;
}

.nmt-unanswered-box strong {
  color: #333333;
}

.site-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.site-confirm-danger {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.site-confirm-danger:hover {
  background: #8f1e18;
  border-color: #8f1e18;
}

@media (max-width: 940px) {
  .nmt-real-header,
  .nmt-real-topnav,
  .nmt-info-band,
  .nmt-real-layout {
    padding-left: 20px;
    padding-right: 20px;
  }

  .nmt-info-banner,
  .nmt-real-layout {
    grid-template-columns: 1fr;
  }

  .nmt-info-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .nmt-info-text {
    max-width: none;
  }

  .nmt-real-right {
    position: static;
  }

  .nmt-real-right .nmt-task-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 600px) {
  .nmt-real-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nmt-real-topnav,
  .nmt-timer-controls,
  .nmt-question-title-row,
  .nmt-bottom-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .nmt-subject-tabs {
    overflow-x: auto;
  }

  .nmt-subject-tab {
    flex-basis: 160px;
  }

  .nmt-content-area {
    padding: 22px 18px;
  }

  .nmt-real-right .nmt-task-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .nmt-bottom-actions button,
  .nmt-timer-controls button {
    width: 100%;
  }
}

body[data-theme="dark"] {
  --bg: #15171c;
  --panel: #20242c;
  --panel-2: #2a303a;
  --text: #f1f4f8;
  --muted: #aeb8c6;
  --line: #3b4350;
  --accent: #e0375d;
  --accent-strong: #ff4d73;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  background: var(--bg);
  color-scheme: dark;
  color: var(--text);
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .tool-panel,
body[data-theme="dark"] .info-panel,
body[data-theme="dark"] .question-row,
body[data-theme="dark"] .question-row-details,
body[data-theme="dark"] .metric,
body[data-theme="dark"] .empty,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .site-confirm-dialog {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] button {
  background-color: #1a1e25;
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #7f8ba0;
}

body[data-theme="dark"] .home-page {
  background:
    radial-gradient(circle at 18% 16%, rgba(224, 55, 93, 0.22), transparent 30%),
    linear-gradient(135deg, #0b1020 0%, #121827 48%, #3a0b24 100%);
  color: var(--text);
}

body[data-theme="dark"] .home-page .lead {
  color: #d8deea;
}

body[data-theme="dark"] .home-dashboard {
  background: rgba(10, 15, 28, 0.62);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .home-stat,
body[data-theme="dark"] .home-feature-grid article {
  background: rgba(25, 30, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

body[data-theme="dark"] .home-stat strong {
  color: #ff6f91;
}

body[data-theme="dark"] .home-feature-grid p {
  color: #c1cad8;
}

body[data-theme="dark"] .home-page .primary-actions button:not(.button-primary) {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

body[data-theme="dark"] .field span,
body[data-theme="dark"] .label,
body[data-theme="dark"] th,
body[data-theme="dark"] .badge,
body[data-theme="dark"] .nav-user,
body[data-theme="dark"] .option-index,
body[data-theme="dark"] .correct-pick span,
body[data-theme="dark"] .site-confirm-dialog p {
  color: var(--text);
}

body[data-theme="dark"] th,
body[data-theme="dark"] .code-box,
body[data-theme="dark"] .question-surface,
body[data-theme="dark"] .option-row,
body[data-theme="dark"] .correct-pick,
body[data-theme="dark"] .sequence-item,
body[data-theme="dark"] .drag-handle,
body[data-theme="dark"] .exam-shell,
body[data-theme="dark"] .exam-bar,
body[data-theme="dark"] .timer {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] .badge-green {
  background: rgba(31, 122, 77, 0.18);
  border-color: rgba(126, 180, 149, 0.48);
  color: #9ee2bd;
}

body[data-theme="dark"] .badge-red {
  background: rgba(179, 38, 30, 0.18);
  border-color: rgba(255, 138, 128, 0.44);
  color: #ffb4ab;
}

body[data-theme="dark"] .badge-amber,
body[data-theme="dark"] .validation-list {
  background: rgba(154, 100, 0, 0.2);
  border-color: rgba(229, 201, 128, 0.42);
  color: #f6d98f;
}

body[data-theme="dark"] .answer-option {
  background: #252b35;
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] .answer-option:has(input:checked) {
  background: #2f3745;
  border-color: #627086;
}

body[data-theme="dark"] .button-primary,
body[data-theme="dark"] .nmt-finish-btn,
body[data-theme="dark"] .nmt-timer-toggle {
  background: #d11141;
  border-color: #d11141;
  color: #ffffff;
}

body[data-theme="dark"] .button-danger {
  background: rgba(179, 38, 30, 0.14);
  border-color: rgba(255, 138, 128, 0.42);
  color: #ffb4ab;
}

.theme-toggle,
.nmt-theme-btn {
  font-weight: 700;
}

.nmt-theme-btn {
  background: #ffffff;
  border: 1px solid #d7d7d7;
  border-radius: 999px;
  color: #444444;
  min-height: 30px;
  padding: 5px 12px;
}

.create-workspace {
  gap: 18px;
}

.create-hero {
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f6f8fb);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 22px;
}

.create-hero h2 {
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 8px;
}

.create-hero-stat {
  align-items: center;
  background: #fff0f4;
  border: 1px solid #f0b7c4;
  border-radius: 8px;
  color: #a00d2b;
  display: grid;
  min-width: 132px;
  padding: 16px;
  text-align: center;
}

.create-hero-stat span {
  font-size: 34px;
  font-weight: 800;
}

.create-panel {
  border-radius: 8px;
  padding: 20px;
}

.subject-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subject-chip {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #263244;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
}

.subject-chip input {
  accent-color: #c61036;
  flex: 0 0 auto;
  height: 16px;
  min-height: 0;
  width: 16px;
}

.subject-chip.is-selected {
  background: #fff0f4;
  border-color: #df8da0;
  color: #a00d2b;
}

.subject-score-panel {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.subject-score-panel .section-header {
  margin-bottom: 0;
}

.subject-score-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.subject-score-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 92px 112px;
  padding: 12px;
}

.subject-score-card strong,
.subject-score-card small {
  display: block;
}

.compact-field {
  gap: 4px;
}

.compact-field span {
  font-size: 12px;
}

.create-subject-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.create-subject-tab {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #263244;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
}

.create-subject-tab strong {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe2ec;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  min-width: 26px;
  padding: 4px 7px;
}

.create-subject-tab.is-active {
  background: #c61036;
  border-color: #c61036;
  color: #ffffff;
}

.create-subject-tab.is-active strong {
  background: #ffffff;
  border-color: #ffffff;
  color: #a00d2b;
}

.active-subject-card {
  background: #fff7f9;
  border: 1px solid #efbdc8;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 12px;
}

.active-subject-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.active-subject-card strong {
  color: #a00d2b;
  font-size: 18px;
  line-height: 1.25;
}

.template-panel {
  align-items: end;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, auto);
  padding: 16px;
}

.template-panel h3 {
  margin: 0 0 4px;
}

.template-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px 150px minmax(260px, 1fr) auto;
}

.ai-controls {
  grid-template-columns: minmax(220px, 1fr) 110px auto;
}

.ai-topic-field {
  min-width: 0;
}

.trial-page {
  max-width: 1080px;
}

.trial-panel {
  padding: 22px;
}

.trial-subjects .subject-chip.is-locked {
  cursor: default;
}

.trial-source-note {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.trial-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trial-source-links a {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
  text-decoration: none;
}

.desktop-only-warning {
  border-radius: 12px;
}

.image-uploader {
  display: grid;
  gap: 8px;
}

.image-dropzone {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #aeb8c6;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 116px;
  overflow: hidden;
  padding: 12px;
  text-align: center;
}

.image-uploader.is-dragover .image-dropzone {
  background: #fff0f4;
  border-color: #c61036;
}

.image-preview {
  border-radius: 6px;
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
}

.image-drop-text {
  color: #52647a;
  display: grid;
  gap: 4px;
}

.image-drop-text strong {
  color: #263244;
}

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

.option-row {
  grid-template-columns: 92px minmax(0, 1.1fr) minmax(180px, 0.9fr) 112px 38px;
}

.option-image-cell .image-dropzone {
  min-height: 74px;
  padding: 8px;
}

.option-image-cell .image-drop-text span {
  font-size: 12px;
}

.option-image-cell .image-preview {
  max-height: 88px;
}

.warning-overlay {
  background: #c61036;
  color: #ffffff;
  z-index: 100000;
}

.warning-dialog {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #ffffff;
  max-width: 760px;
  text-align: center;
}

.warning-dialog h2 {
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
  margin: 0 0 18px;
  text-transform: uppercase;
}

.warning-dialog .muted {
  color: #ffffff;
  font-size: 20px;
}

.warning-dialog button {
  background: #ffffff;
  border-color: #ffffff;
  color: #b10e31;
  font-size: 18px;
  font-weight: 800;
  margin-top: 18px;
  min-height: 48px;
  padding-inline: 28px;
}

.results-page {
  max-width: 1220px;
}

.result-hero {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px;
}

.result-hero h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  margin: 0 0 8px;
}

.result-hero.is-passed {
  border-left: 6px solid var(--green);
}

.result-hero.is-failed {
  border-left: 6px solid var(--red);
}

.result-score-ring {
  align-items: center;
  background: conic-gradient(#c61036 var(--score), #edf0f4 0);
  border-radius: 50%;
  display: grid;
  flex: 0 0 auto;
  height: 160px;
  justify-items: center;
  padding: 16px;
  place-content: center;
  position: relative;
  width: 160px;
}

.result-score-ring::before {
  background: #ffffff;
  border-radius: 50%;
  content: "";
  inset: 14px;
  position: absolute;
}

.result-score-ring strong,
.result-score-ring span {
  position: relative;
  z-index: 1;
}

.result-score-ring strong {
  font-size: 34px;
}

.result-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 16px;
}

.result-subjects {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  padding: 18px;
}

.result-subject-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.result-subject-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.result-subject-card.is-passed {
  border-left-color: var(--green);
}

.result-subject-head {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.result-subject-score {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.result-review {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  padding: 18px;
}

.result-answer-list {
  display: grid;
  gap: 12px;
}

.result-answer-card {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 14px;
}

.result-answer-card.is-correct {
  border-left-color: var(--green);
}

.result-answer-card.is-wrong {
  border-left-color: var(--red);
}

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

.result-answer-head h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 4px 0;
}

.result-answer-body {
  background: #f8fafc;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
}

body[data-theme="dark"] .create-hero,
body[data-theme="dark"] .template-panel,
body[data-theme="dark"] .subject-score-panel,
body[data-theme="dark"] .subject-score-card,
body[data-theme="dark"] .image-dropzone,
body[data-theme="dark"] .active-subject-card,
body[data-theme="dark"] .result-hero,
body[data-theme="dark"] .result-subjects,
body[data-theme="dark"] .result-subject-card,
body[data-theme="dark"] .result-review,
body[data-theme="dark"] .result-answer-body {
  background: var(--panel);
  border-color: var(--line);
}

body[data-theme="dark"] .subject-chip,
body[data-theme="dark"] .create-subject-tab,
body[data-theme="dark"] .create-hero-stat {
  background: #252b35;
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] .subject-chip.is-selected {
  background: rgba(209, 17, 65, 0.2);
  border-color: #d11141;
  color: #ffd9e2;
}

body[data-theme="dark"] .create-subject-tab.is-active {
  background: #d11141;
  border-color: #d11141;
  color: #ffffff;
}

body[data-theme="dark"] .create-subject-tab strong {
  background: #1a1e25;
  border-color: var(--line);
  color: var(--text);
}

body[data-theme="dark"] .create-subject-tab.is-active strong {
  background: #ffffff;
  border-color: #ffffff;
  color: #a00d2b;
}

body[data-theme="dark"] .active-subject-card strong {
  color: #ffd9e2;
}

body[data-theme="dark"] .image-drop-text,
body[data-theme="dark"] .image-drop-text strong {
  color: var(--text);
}

body[data-theme="dark"] .nmt-real-shell {
  --nmt-gray: #242933;
  --nmt-border: #3b4350;
  --nmt-text: #f1f4f8;
  --nmt-panel: #1d222b;
  --nmt-panel-soft: #242933;
  --nmt-field: #151a23;
  background: #15171c;
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-logo,
body[data-theme="dark"] .nmt-real-user,
body[data-theme="dark"] .nmt-topnav-link,
body[data-theme="dark"] .nmt-info-text,
body[data-theme="dark"] .nmt-main-timer,
body[data-theme="dark"] .nmt-main-timer.is-hidden-value::after,
body[data-theme="dark"] .nmt-breadcrumbs,
body[data-theme="dark"] .nmt-subject-tab,
body[data-theme="dark"] .nmt-question-meta,
body[data-theme="dark"] .nmt-real-shell .nmt-question-number,
body[data-theme="dark"] .nmt-real-shell .question-text,
body[data-theme="dark"] .nmt-grid-summary {
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-header,
body[data-theme="dark"] .nmt-real-topnav,
body[data-theme="dark"] .nmt-info-band,
body[data-theme="dark"] .nmt-real-left,
body[data-theme="dark"] .nmt-real-right,
body[data-theme="dark"] .nmt-subject-tab.active,
body[data-theme="dark"] .nmt-content-area,
body[data-theme="dark"] .nmt-start-card,
body[data-theme="dark"] .nmt-break-card {
  background: var(--nmt-panel);
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-topnav-link,
body[data-theme="dark"] .nmt-subject-tab {
  background: transparent;
  border-color: var(--nmt-border);
}

body[data-theme="dark"] .nmt-topnav-link.active,
body[data-theme="dark"] .nmt-topnav-link:hover,
body[data-theme="dark"] .nmt-breadcrumbs .active-bread {
  color: #ff6f91;
}

body[data-theme="dark"] .nmt-info-banner,
body[data-theme="dark"] .nmt-subject-tabs,
body[data-theme="dark"] .nmt-stage-tabs,
body[data-theme="dark"] .nmt-stage-title,
body[data-theme="dark"] .nmt-bottom-actions,
body[data-theme="dark"] .nmt-breadcrumbs,
body[data-theme="dark"] .nmt-start-notice,
body[data-theme="dark"] .nmt-break-rules,
body[data-theme="dark"] .nmt-real-shell .badge {
  background: var(--nmt-panel-soft);
  border-color: var(--nmt-border);
}

body[data-theme="dark"] .nmt-stage-group {
  border-color: var(--nmt-border);
}

body[data-theme="dark"] .nmt-stage-group.is-active .nmt-stage-title {
  color: #ff9eb6;
}

body[data-theme="dark"] .nmt-info-banner {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .nmt-start-card,
body[data-theme="dark"] .nmt-break-card {
  border-top-color: #ff6f91;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

body[data-theme="dark"] .nmt-start-card h1,
body[data-theme="dark"] .nmt-start-card strong,
body[data-theme="dark"] .nmt-break-card h1,
body[data-theme="dark"] .nmt-break-card strong,
body[data-theme="dark"] .nmt-break-timer,
body[data-theme="dark"] .nmt-kicker,
body[data-theme="dark"] .nmt-info-text strong {
  color: #ff9eb6;
}

body[data-theme="dark"] .nmt-break-success,
body[data-theme="dark"] .nmt-break-rules,
body[data-theme="dark"] .nmt-break-card .muted {
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-break-skip,
body[data-theme="dark"] .nmt-unanswered-box {
  background: var(--nmt-field);
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-unanswered-box strong {
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell .answer-option {
  background: #202632;
  border-color: #364253;
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell .answer-option:hover,
body[data-theme="dark"] .nmt-real-shell .answer-option:has(input:checked) {
  background: #2f3745;
  border-color: #59687c;
}

body[data-theme="dark"] .nmt-real-shell .is-correct-option {
  background: rgba(31, 122, 77, 0.08);
  border-color: rgba(126, 180, 149, 0.2);
  box-shadow: inset 2px 0 0 rgba(126, 180, 149, 0.18);
}

body[data-theme="dark"] .author-correct-key {
  background: rgba(31, 122, 77, 0.08);
  border-color: rgba(126, 180, 149, 0.18);
  border-left-color: rgba(126, 180, 149, 0.26);
}

body[data-theme="dark"] .author-correct-key strong {
  color: var(--nmt-text, var(--text));
}

body[data-theme="dark"] .author-correct-head button {
  background: transparent;
  border-color: rgba(126, 180, 149, 0.22);
  color: var(--muted);
}

body[data-theme="dark"] .author-sequence-position {
  background: rgba(31, 122, 77, 0.08);
  border-color: rgba(126, 180, 149, 0.18);
}

body[data-theme="dark"] .nmt-real-shell .matching-row strong,
body[data-theme="dark"] .nmt-real-shell label,
body[data-theme="dark"] .nmt-real-right .grid-title {
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell .matching-row select,
body[data-theme="dark"] .nmt-real-shell .fill-input,
body[data-theme="dark"] .nmt-real-shell .short-input,
body[data-theme="dark"] .nmt-real-shell .combined-input,
body[data-theme="dark"] .nmt-real-shell .btn-save,
body[data-theme="dark"] .nmt-real-right .nmt-task-btn,
body[data-theme="dark"] .nmt-theme-btn,
body[data-theme="dark"] .nmt-bottom-actions button,
body[data-theme="dark"] .warning-dialog {
  background: var(--nmt-field);
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell .btn-save.is-dirty {
  border-color: #ff6f91;
  color: #ff9eb6;
}

body[data-theme="dark"] .nmt-real-shell .btn-save.is-saved {
  background: rgba(31, 122, 77, 0.18);
  border-color: rgba(126, 180, 149, 0.48);
  color: #9ee2bd;
}

body[data-theme="dark"] .nmt-real-shell .btn-save:hover,
body[data-theme="dark"] .nmt-real-right .nmt-task-btn:hover,
body[data-theme="dark"] .nmt-theme-btn:hover {
  border-color: #ff6f91;
}

body[data-theme="dark"] .nmt-real-right .nmt-task-btn.is-current {
  background: #ffffff;
  border-color: #ffffff;
  color: #15171c;
}

body[data-theme="dark"] .nmt-real-right .nmt-task-btn.is-answered:not(.is-current) {
  background: #d11141;
  border-color: #d11141;
  color: #ffffff;
}

body[data-theme="dark"] .nmt-real-shell .progress-wrap {
  background: #313949;
}

body[data-theme="dark"] .nmt-question-slide,
body[data-theme="dark"] .nmt-real-shell .nmt-question-number {
  background: #202632;
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-question-slide {
  border-left-color: #ff6f91;
}

body[data-theme="dark"] .nmt-real-shell .matching-row,
body[data-theme="dark"] .nmt-real-shell .sequence-item {
  background: var(--nmt-field);
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell .sequence-item.has-author-key {
  background: rgba(31, 122, 77, 0.12);
}

body[data-theme="dark"] .nmt-real-shell .question-image,
body[data-theme="dark"] .nmt-real-shell .option-image {
  background: #ffffff;
  border-color: var(--nmt-border);
}

body[data-theme="dark"] .warning-overlay {
  background: #c61036;
  color: #ffffff;
}

body[data-theme="dark"] .warning-overlay .warning-dialog {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #ffffff;
}

body[data-theme="dark"] .warning-dialog .muted {
  color: #ffffff;
}

body[data-theme="dark"] .warning-dialog button {
  background: #ffffff;
  border-color: #ffffff;
  color: #b10e31;
}

body[data-theme="dark"] .keyboard-layout-badge {
  background: rgba(32, 38, 50, 0.96);
  border-color: var(--nmt-border);
  color: var(--nmt-text);
}

body[data-theme="dark"] .nmt-real-shell input[type="radio"],
body[data-theme="dark"] .nmt-real-shell input[type="checkbox"] {
  accent-color: #ff6f91;
}

body[data-theme="dark"] .nmt-warning-pill {
  background: rgba(154, 100, 0, 0.2);
  border-color: rgba(229, 201, 128, 0.42);
  color: #f6d98f;
}

body[data-theme="dark"] .result-score-ring::before {
  background: var(--panel);
}

@media (max-width: 940px) {
  .home-hero,
  .home-feature-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: 0;
  }

  .template-panel,
  .template-controls,
  .ai-controls,
  .subject-score-card,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .create-subject-tab {
    justify-content: space-between;
    width: 100%;
  }

  .create-hero,
  .result-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .nmt-real-shell .matching-row {
    grid-template-columns: 1fr;
  }
}
