:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --ink: #182230;
  --muted: #667488;
  --border: #dbe3ee;
  --primary: #1f5bd5;
  --primary-soft: #e9f0ff;
  --success: #0b9a6e;
  --success-soft: #ebfbf5;
  --danger: #d03244;
  --danger-soft: #fff1f3;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 32px 20px 72px;
}

.page-shell-form {
  max-width: 920px;
}

.page-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-header-copy {
  max-width: 720px;
}

.page-kicker {
  color: var(--primary);
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.page-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.85rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.page-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin-top: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.section-head,
.modal-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.section-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.question-form {
  display: grid;
  gap: 18px;
}

.question-form-modal {
  max-height: min(78vh, 860px);
  overflow: auto;
  padding-right: 4px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-grid-details {
  grid-template-columns: 1.3fr 0.9fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field label .hint {
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.required {
  color: var(--danger);
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  min-height: 46px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #98a5b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 91, 213, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 91, 213, 0.1);
  outline: none;
}

textarea {
  min-height: 124px;
  resize: vertical;
}

.textarea-compact {
  min-height: 110px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23667488'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.options-list {
  display: grid;
  gap: 10px;
}

.option-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
}

.option-letter {
  align-items: center;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.option-letter.correct {
  background: var(--success-soft);
  color: var(--success);
}

.option-fixed {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 12px 14px;
}

.option-toggle,
.option-remove,
.text-action,
.icon-button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  min-height: 44px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.option-toggle {
  font-size: 12px;
  font-weight: 700;
}

.option-toggle:hover {
  border-color: var(--success);
  color: var(--success);
}

.option-toggle.active {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.option-remove {
  font-size: 16px;
  min-width: 44px;
  padding: 0;
}

.option-remove:hover {
  background: var(--danger-soft);
  border-color: #f3c6d0;
  color: var(--danger);
}

.text-action {
  align-self: flex-start;
  background: transparent;
  border-style: dashed;
  border-radius: 999px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  min-height: auto;
}

.text-action:hover {
  background: var(--primary-soft);
  border-color: rgba(31, 91, 213, 0.35);
}

.tag-editor {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 110px;
  padding: 10px;
}

.tag-editor:focus-within {
  border-color: rgba(31, 91, 213, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 91, 213, 0.1);
}

.tag-editor input {
  border: 0;
  box-shadow: none;
  min-height: 30px;
  min-width: 120px;
  padding: 6px 4px;
}

.tag-editor input:focus {
  box-shadow: none;
}

.tag-chip {
  align-items: center;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  padding: 6px 10px;
}

.tag-chip button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.tag-chip button:hover {
  color: var(--danger);
}

.form-footer {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.form-actions,
.toolbar-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  max-width: 360px;
}

.btn {
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #194ebe;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}

.btn-outline:hover:not(:disabled) {
  border-color: rgba(31, 91, 213, 0.38);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #0a8b64;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: #f3c6d0;
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #ffe7ec;
}

.manage-toolbar {
  display: grid;
  gap: 16px;
}

.toolbar-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(160px, 1fr));
}

.toolbar-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.toolbar-field select,
.toolbar-field input {
  min-width: 0;
  width: 100%;
}

.toolbar-field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toolbar-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.results-summary {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.table-frame {
  margin-top: 18px;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.questions-table {
  border-collapse: collapse;
  width: 100%;
}

.questions-table thead th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 12px 14px;
  text-align: left;
  text-transform: uppercase;
}

.questions-table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 13px 14px;
  vertical-align: top;
}

.questions-table tbody tr:last-child td {
  border-bottom: 0;
}

.question-title {
  font-weight: 700;
  line-height: 1.45;
}

.question-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.difficulty-pill {
  align-items: center;
  background: var(--surface-muted);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  margin-right: 8px;
  padding: 4px 8px;
  text-transform: uppercase;
}

.row-action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
}

.row-action:hover {
  border-color: rgba(31, 91, 213, 0.38);
  color: var(--primary);
}

.row-action-danger:hover {
  border-color: #f3c6d0;
  color: var(--danger);
}

.preview-row td {
  background: var(--surface-muted);
  padding: 0;
}

.preview-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.preview-block {
  display: grid;
  gap: 10px;
}

.preview-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.preview-question {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
}

.preview-options {
  display: grid;
  gap: 8px;
}

.preview-option {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 10px 12px;
}

.preview-option.correct {
  background: var(--success-soft);
  border-color: rgba(11, 154, 110, 0.28);
}

.preview-option-letter {
  align-items: center;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.preview-option.correct .preview-option-letter {
  background: #d3f7ea;
  color: var(--success);
}

.preview-stack {
  display: grid;
  gap: 8px;
}

.preview-answer {
  font-weight: 700;
  line-height: 1.6;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  align-items: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 56px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 40px;
}

.empty-state-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.empty-state-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 360px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 30;
}

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.26);
  max-width: 980px;
  padding: 24px;
  width: min(980px, 100%);
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.icon-button:hover {
  border-color: rgba(31, 91, 213, 0.38);
  color: var(--primary);
}

.toast {
  border-radius: 14px;
  bottom: 24px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  padding: 14px 18px;
  pointer-events: none;
  position: fixed;
  right: 24px;
  transform: translateY(80px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.info {
  background: var(--primary);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .toolbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .field-grid-meta,
  .field-grid-details,
  .toolbar-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 22px 12px 56px;
  }

  .card,
  .modal-card {
    padding: 18px;
  }

  .field-grid-meta,
  .field-grid-details,
  .toolbar-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-meta,
  .form-footer,
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .questions-table,
  .questions-table thead,
  .questions-table tbody,
  .questions-table tr,
  .questions-table th,
  .questions-table td {
    display: block;
    width: 100%;
  }

  .questions-table thead {
    display: none;
  }

  .questions-table tbody td {
    border-bottom: 0;
    padding: 10px 14px;
  }

  .questions-table tbody tr {
    border-bottom: 1px solid var(--border);
  }

  .preview-row td {
    padding-top: 0;
  }

  .option-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .option-toggle,
  .option-remove {
    grid-column: 2;
    justify-self: start;
  }
}

/* ---- Rich text, tables, GMAT Data Insights ---- */

.rich-editor {
  display: grid;
}

.rich-editor textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.format-toolbar {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  gap: 4px;
  padding: 4px 6px;
}

.format-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  min-width: 32px;
  padding: 2px 8px;
}

.format-button:hover {
  background: var(--surface);
  border-color: var(--border);
}

mark,
.format-swatch {
  background: #fff176;
  border-radius: 2px;
  color: inherit;
  padding: 0 2px;
}

.checkbox-label {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  white-space: nowrap;
}

.checkbox-label input {
  min-height: 0;
}

.table-list-editor,
.source-list-editor {
  display: grid;
  gap: 12px;
}

.table-editor,
.source-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.table-editor-head,
.source-card-head {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.source-card-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.table-grid-scroll,
.data-table-scroll {
  overflow-x: auto;
}

.table-grid {
  border-collapse: collapse;
}

.table-grid th,
.table-grid td {
  padding: 2px;
}

.table-grid input {
  min-height: 36px;
  min-width: 110px;
  padding: 6px 8px;
}

.table-grid thead input {
  background: var(--surface-muted);
  font-weight: 700;
}

.table-grid-cell {
  align-items: center;
  display: flex;
  gap: 2px;
}

.table-grid-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px;
}

.table-grid-remove:hover {
  color: var(--danger);
}

.table-editor-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-table {
  display: grid;
  gap: 8px;
}

.data-table-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.data-table-title {
  font-weight: 700;
}

.data-table-sort {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
}

.data-table-sort select {
  min-height: 36px;
  padding: 6px 32px 6px 10px;
}

.data-table table,
.choice-grid {
  background: var(--surface);
  border-collapse: collapse;
  width: 100%;
}

.data-table th,
.data-table td,
.choice-grid th,
.choice-grid td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.data-table th,
.choice-grid th {
  background: var(--surface-muted);
  font-size: 13px;
}

.choice-grid th:nth-child(-n + 2),
.choice-grid td:nth-child(-n + 2) {
  text-align: center;
  width: 96px;
}

.choice-grid input {
  min-height: 0;
}

.grid-mark {
  color: var(--muted);
}

.grid-mark.on {
  color: var(--success);
  font-weight: 800;
}

.dropdown-blank {
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.9em;
  font-weight: 700;
  padding: 1px 8px;
  white-space: nowrap;
}

.dropdown-select {
  display: inline-block;
  min-height: 34px;
  padding: 4px 30px 4px 10px;
}

.try-statement {
  line-height: 2.4;
}

.statement-labels {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr auto auto auto;
}

.source-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.source-tab-list {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
}

.source-tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
}

.source-tab.active {
  background: var(--surface);
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.source-panel {
  background: var(--surface);
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

/* ---- Question types, sets, figures and try-it ---- */

.form-fieldset {
  border: 0;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.section-head-split {
  flex-wrap: wrap;
}

.mode-tabs {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.mode-tab {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}

.mode-tab.active {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
  color: var(--primary);
}

.hint-text {
  color: var(--muted);
  font-size: 12px;
}

.field-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid-numeric {
  grid-template-columns: 1.4fr 1fr 1fr;
}

.field-grid-child {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-inline {
  max-width: 340px;
}

.textarea-small {
  min-height: 72px;
}

.textarea-tall {
  min-height: 220px;
}

.type-editor {
  display: grid;
  gap: 16px;
}

.type-editor:empty {
  display: none;
}

.option-row-media,
.option-row-statement {
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
}

.option-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.option-row-compact {
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
}

.option-input {
  display: grid;
  gap: 6px;
}

.option-thumb {
  align-items: center;
  display: flex;
  gap: 10px;
}

.option-thumb img {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 64px;
}

.image-editor {
  display: grid;
  gap: 10px;
}

.image-item {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 12px;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  padding: 10px;
}

.image-item img {
  background: var(--surface);
  border-radius: 8px;
  max-height: 80px;
  object-fit: contain;
  width: 96px;
}

.image-item-fields {
  display: grid;
  gap: 6px;
}

.image-item-fields input {
  min-height: 38px;
  padding: 8px 12px;
}

.text-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.form-preview {
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.form-preview summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 12px 14px;
  text-transform: uppercase;
}

.form-preview .preview-panel {
  padding-top: 0;
}

.rich-text {
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.rich-text .katex-display {
  margin: 0.4em 0;
}

.stimulus-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 420px;
  overflow: auto;
  padding: 14px 16px;
}

.figure-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 6px;
  max-width: 100%;
  padding: 8px;
}

.figure img {
  display: block;
  max-height: 360px;
  max-width: 100%;
  object-fit: contain;
}

.figure figcaption {
  color: var(--muted);
  font-size: 12px;
}

.figure-list-option .figure img {
  max-height: 140px;
}

.question-body {
  display: grid;
  gap: 12px;
}

.qc-centered {
  font-weight: 600;
  text-align: center;
}

.qc-table {
  border-collapse: collapse;
  width: 100%;
}

.qc-table th,
.qc-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: center;
  width: 50%;
}

.qc-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tc-blank {
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  padding: 0 4px;
  white-space: nowrap;
}

.tc-columns {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tc-column {
  display: grid;
  gap: 8px;
}

.numeric-answer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.numeric-unit {
  font-weight: 700;
}

.numeric-box,
.fraction-answer span {
  background: var(--success-soft);
  border: 1px solid rgba(11, 154, 110, 0.28);
  border-radius: 8px;
  font-weight: 800;
  min-width: 64px;
  padding: 6px 12px;
  text-align: center;
}

.fraction-answer,
.fraction-input {
  display: inline-grid;
  gap: 4px;
}

.fraction-answer span:first-child,
.fraction-input input:first-child {
  border-bottom: 3px solid var(--ink);
}

.fraction-input input,
.numeric-input {
  max-width: 140px;
  text-align: center;
}

.sentence-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.9;
  padding: 12px 14px;
}

.sentence-option {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 1px 3px;
  text-align: left;
}

.sentence-option:hover {
  background: var(--primary-soft);
}

.sentence-option.selected {
  background: var(--success-soft);
  box-shadow: inset 0 -2px 0 var(--success);
}

.sentence-number {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  margin-right: 4px;
  vertical-align: super;
}

.set-children-head {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.set-children {
  display: grid;
  gap: 16px;
}

.child-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 14px;
  padding: 14px 16px 18px;
}

.child-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.child-card-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.child-card-actions {
  display: flex;
  gap: 6px;
}

.modal-card-wide {
  max-width: 1100px;
  width: min(1100px, 100%);
}

.set-badge {
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  margin-right: 6px;
  padding: 2px 8px;
  vertical-align: middle;
}

.set-preview {
  gap: 14px;
}

.set-child-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.preview-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.try-it {
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.try-options {
  display: grid;
  gap: 8px;
}

.try-option {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 28px minmax(0, 1fr);
  padding: 8px 12px;
}

.try-option input {
  min-height: 0;
}

.try-it-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-small {
  font-size: 13px;
  padding: 8px 16px;
}

.try-it-result {
  font-weight: 700;
}

.try-it-result.correct {
  color: var(--success);
}

.try-it-result.incorrect {
  color: var(--danger);
}

.import-report {
  background: var(--danger-soft);
  border: 1px solid rgba(208, 50, 68, 0.25);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 16px;
}

.import-report-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.import-report ul {
  display: grid;
  font-size: 13px;
  gap: 4px;
  padding-left: 18px;
}

@media (max-width: 720px) {
  .field-grid-two,
  .field-grid-numeric,
  .field-grid-child {
    grid-template-columns: 1fr;
  }

  .option-row-media,
  .option-row-statement {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .option-row-media > .option-actions,
  .option-row-media > .option-remove,
  .option-row-statement > .option-actions,
  .option-row-statement > .option-remove {
    grid-column: 2;
    justify-self: start;
  }

  .statement-labels {
    grid-template-columns: 1fr 1fr;
  }

  .image-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}
