*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #656d76;
  --accent: #0969da;
  --ielts-red: #c8102e;
  --ielts-header: #ffffff;
  --orange-pill: #d4740a;
  --success: #1a7f37;
  --error: #cf222e;
  --warning: #bf8700;
  --radius: 6px;
  --transition: 0.2s ease;
  --test-header-height: 48px;
  --part-header-height: 42px;
  --bottom-nav-height: 54px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── INPUT VIEW ── */
.input-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.input-container {
  width: 100%;
  max-width: 780px;
  animation: fadeUp .5s ease both;
}

.config-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.config-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

@media (max-width: 1100px) {
  .result-breakdown {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: 24px;
  transition: color .2s;
}

.back-link:hover {
  color: var(--text);
}

.back-link:hover svg {
  transform: translateX(-3px);
}

.back-link svg {
  transition: transform .2s;
}

/* ── Mode Selector ── */
.mode-selector {
  display: inline-flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin: 0 0 24px;
}

.mode-btn {
  padding: 8px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.mode-btn:first-child {
  border-right: 1.5px solid var(--border);
}

.mode-btn.active {
  background: var(--accent);
  color: white;
}

.mode-btn:hover:not(.active) {
  background: #f0f3f6;
}

.practice-menu-panel {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}

.practice-menu-panel.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.input-title {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.input-subtitle {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
  margin-bottom: 28px;
}

.input-field-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.raw-textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: .87rem;
  line-height: 1.65;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.raw-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .12);
}

/* ── CREATOR PASSAGE REDESIGN (Seamless Interface) ── */
.creator-editor {
  padding: 0;
  background: #ffffff;
  min-height: 100%;
}

.creator-editor-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 60px 80px;
}

/* Ghost Inputs for Title/Subtitle */
.creator-ghost-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s, box-shadow 0.2s;
  font-family: Arial, sans-serif;
}

.creator-ghost-input:hover {
  background: #f8fafc;
}

.creator-ghost-input:focus {
  outline: none;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(9, 105, 218, 0.1);
}

.creator-ghost-title {
  font-size: 22px;
  font-weight: 700;
  color: #1f2328;
  margin-bottom: 2px;
}

.creator-ghost-subtitle {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 16px;
}

/* Section Rows */
.creator-passage-section {
  position: relative;
  margin-bottom: 16px;
  padding-left: 0;
  padding-right: 0;
  transition: padding-left 0.3s ease, padding-right 0.3s ease;
}

.creator-editor.show-sections .creator-passage-section {
  padding-left: 20px;
  padding-right: 40px;
}

.creator-section-marker-wrap {
  position: absolute;
  left: -48px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.creator-editor.show-sections .creator-section-marker-wrap {
  opacity: 1;
  pointer-events: auto;
}

.creator-section-marker {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.creator-passage-section:focus-within .creator-section-marker {
  border-color: #0969da;
  background: #eff6ff;
  color: #0969da;
}

.creator-section-marker.is-unlabelled {
  background: #f8fafc;
  color: #cbd5e1;
  border: 2px dashed #e2e8f0;
}

.creator-section-connector-line {
  width: 2px;
  background: #e2e8f0;
  flex: 1;
  min-height: 16px;
  border-radius: 1px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.creator-editor.show-sections .creator-section-connector-line {
  background: #cbd5e1;
}

/* Section Textarea */
.creator-section-textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1f2328;
  padding: 0;
  resize: none;
  overflow: hidden;
  transition: background 0.2s;
}

.creator-section-textarea:hover {
  background: rgba(248, 250, 252, 0.5);
  border-radius: 4px;
}

.creator-section-textarea:focus {
  outline: none;
}

/* Side Actions */
.creator-section-side-actions {
  position: absolute;
  right: 6px;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.creator-editor.show-sections .creator-passage-section:hover .creator-section-side-actions,
.creator-editor.show-sections .creator-passage-section:focus-within .creator-section-side-actions {
  opacity: 1;
  pointer-events: auto;
}

.creator-side-btn {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creator-side-btn:hover {
  background: #f1f5f9;
  color: #64748b;
}

.creator-side-btn.is-active {
  background: #eff6ff;
  color: #0969da;
  border-color: #dbeafe;
}

.creator-side-btn.is-danger:hover {
  background: #fef2f2;
  color: #ef4444;
}

/* Toolbar Styling */
.test-view.creator-active .passage-toolbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 10px 20px !important;
}

.creator-toolbar-group {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}

.creator-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.creator-toolbar-btn.is-active {
  background: #ffffff;
  color: #0969da;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.creator-toolbar-btn svg {
  color: #0969da;
}

.creator-add-btn-wrap {
  margin-top: 20px;
  padding-left: 20px;
  position: relative;
}

.creator-add-section-placeholder {
  width: 100%;
  padding: 30px;
  border: 2px dashed #f1f5f9;
  border-radius: 12px;
  background: transparent;
  color: #94a3b8;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.creator-add-section-placeholder:hover {
  border-color: #0969da;
  background: rgba(9, 105, 218, 0.02);
  color: #0969da;
}

/* ── Question Mapping Redesign ── */
.wysiwyg-section-row-redesign {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  margin-bottom: 8px;
}

.mapping-quest-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.mapping-quest-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.mapping-quest-num {
  font-size: 14px;
  font-weight: 900;
  color: #1f2328;
}

.mapping-connector {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  position: relative;
}

.mapping-connector-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(9, 105, 218, 0.2);
  border-radius: 10px;
}

.mapping-connector-dot {
  position: absolute;
  right: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  background: #0969da;
  border-radius: 50%;
}

.mapping-section-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mapping-section-pills {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.mapping-pill {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}

.mapping-pill:hover:not(:disabled) {
  background: #f1f5f9;
  color: #64748b;
}

.mapping-pill.is-active {
  border-color: #0969da;
  background: #eff6ff;
  color: #0969da;
}

.mapping-pill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.mapping-remove-btn {
  color: #cbd5e1;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.mapping-remove-btn:hover {
  color: #ef4444;
  background: #fef2f2;
}

/* Mini toolbar buttons */
.creator-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  padding: 4px 9px;
  transition: all .15s ease;
  white-space: nowrap;
}

.creator-mini-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f6f9ff;
}

.creator-mini-btn:active {
  transform: scale(.96);
}

.creator-mini-btn.is-danger:hover {
  border-color: var(--error);
  color: var(--error);
  background: #fff5f5;
}

/* ── Right Panel: WYSIWYG Question Builder (Overhauled) ── */
.creator-builder {
  padding: 18px 20px 24px;
  background: var(--surface);
  min-height: 100%;
}

.creator-builder-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef0f3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.creator-builder-header-left h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.creator-builder-header-left h3 svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-builder-header-left p {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
  margin: 0;
}

/* ── Empty State ── */
.creator-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  text-align: center;
  padding: 30px 20px;
  border: 2px dashed #dce0e6;
  border-radius: 14px;
  background: #fafbfc;
  transition: border-color .25s, background .25s;
}

.creator-empty-state:hover {
  border-color: #b0b8c4;
  background: #f6f8fa;
}

.creator-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent);
  transition: transform .2s, box-shadow .2s;
}

.creator-empty-state:hover .creator-empty-icon {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(9, 105, 218, .12);
}

.creator-empty-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.creator-empty-desc {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 300px;
  margin-bottom: 22px;
}

.creator-btn-big {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(9, 105, 218, .18);
}

.creator-btn-big:hover {
  background: #0559b8;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(9, 105, 218, .22);
}

.creator-btn-big:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(9, 105, 218, .15);
}

.creator-btn-big svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Type Picker Overlay (inline) ── */
.creator-type-picker {
  border: 1.5px solid #dce0e6;
  border-radius: 12px;
  background: #fff;
  padding: 20px 22px;
  margin-bottom: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.creator-type-picker-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.creator-type-picker-title svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.creator-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  border: 1.5px solid #e2e5ea;
  border-radius: 8px;
  background: #fafbfc;
  color: #4b5563;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
  text-align: center;
  line-height: 1.25;
}

.creator-type-btn:hover {
  border-color: var(--accent);
  background: #f0f5ff;
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(9, 105, 218, .08);
}

.creator-type-btn:active {
  transform: translateY(0);
}

.creator-type-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-type-btn-small-label {
  font-size: .62rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ── Question Set Cards ── */
.creator-qs-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.creator-qs-card {
  border: 1.5px solid #e2e5ea;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}

.creator-qs-card:hover {
  border-color: #d0d5dd;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .05);
}

.creator-qs-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f4f6f9;
  border-bottom: 1px solid #eef0f3;
  min-height: 40px;
}

.creator-qs-card-range {
  font-weight: 700;
  font-size: .84rem;
  color: var(--accent);
  background: #e6f0ff;
  border-radius: 4px;
  padding: 2px 10px;
}

.creator-qs-card-type {
  font-size: .76rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex: 1;
}

.creator-qs-card-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.creator-qs-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all .15s;
}

.creator-qs-icon-btn:hover {
  background: #e8ecf0;
  color: var(--accent);
}

.creator-qs-icon-btn.is-danger:hover {
  background: #fee2e2;
  color: var(--error);
}

.creator-qs-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-qs-card-body {
  padding: 14px 16px 16px;
}

/* Editable fields within a question set */
.creator-qs-field {
  margin-bottom: 12px;
}

.creator-qs-field-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 5px;
}

.creator-qs-input {
  width: 100%;
  border: 1.5px solid #dce0e6;
  border-radius: 6px;
  background: #fafbfc;
  color: var(--text);
  font: inherit;
  font-size: .86rem;
  padding: 8px 10px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.creator-qs-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .08);
  background: #fff;
}

.creator-qs-input:hover {
  border-color: #b0b8c4;
}

.creator-qs-textarea {
  width: 100%;
  border: 1.5px solid #dce0e6;
  border-radius: 6px;
  background: #fafbfc;
  color: var(--text);
  font: inherit;
  font-size: .84rem;
  padding: 9px 10px;
  resize: vertical;
  min-height: 48px;
  line-height: 1.55;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.creator-qs-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .08);
  background: #fff;
}

.creator-qs-textarea:hover {
  border-color: #b0b8c4;
}

.creator-qs-textarea.passage-text {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: .88rem;
  line-height: 1.7;
  min-height: 60px;
}

/* Mini gap insert row */
.creator-qs-gap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
}

.creator-qs-gap-row button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.creator-qs-gap-row button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f6f9ff;
}

.creator-qs-gap-row button svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-qs-gap-row span {
  font-size: .74rem;
  color: var(--muted);
  font-weight: 600;
}

/* Answer key row inline */
.creator-qs-answer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f2f5;
}

.creator-qs-answer-row:last-child {
  border-bottom: none;
}

.creator-qs-answer-num {
  font-weight: 700;
  font-size: .78rem;
  color: var(--text);
  min-width: 20px;
}

.creator-qs-answer-input {
  flex: 1;
  border: 1px solid #dce0e6;
  border-radius: 4px;
  background: #fafbfc;
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  padding: 5px 8px;
  transition: border-color .2s;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.creator-qs-answer-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(9, 105, 218, .08);
  background: #fff;
}

/* Toggle for answers section */
.creator-qs-answers-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  margin-top: 8px;
}

.creator-qs-answers-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f6f9ff;
}

.creator-qs-answers-toggle svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.creator-qs-answers-panel {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid #eef0f3;
  border-radius: 6px;
  display: none;
}

.creator-qs-answers-panel.is-open {
  display: block;
}

/* ══════════════════════════════════════════════════════
   WYSIWYG Creator Preview Styles
   Mirror the exam-taking interface for live editing
   ══════════════════════════════════════════════════════ */

/* ── Heading Match WYSIWYG ── */
.wysiwyg-heading-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.wysiwyg-heading-pill {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 5px;
  padding: 4px 16px;
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  transition: background .15s, box-shadow .15s, transform .15s;
  cursor: default;
}

.wysiwyg-heading-pill:hover {
  background: #fafafa;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .16);
}

.wysiwyg-heading-pill .pill-letter {
  font-weight: 800;
  font-size: 1rem;
  color: #1f2328;
  min-width: 18px;
}

.wysiwyg-heading-pill .pill-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding: 0;
}

.wysiwyg-heading-pill .pill-input:focus {
  outline: none;
}

.wysiwyg-heading-pill .pill-remove {
  opacity: 0;
  transition: opacity .15s;
}

.wysiwyg-heading-pill:hover .pill-remove {
  opacity: 1;
}

/* ── Section mapping grid for heading_match ── */
.wysiwyg-section-map {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.wysiwyg-section-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .86rem;
}

.wysiwyg-section-row .q-num {
  font-weight: 800;
  font-size: .86rem;
  color: var(--text);
  min-width: 34px;
}

/* ── MCQ WYSIWYG ── */
.wysiwyg-mcq-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .02);
}

.wysiwyg-mcq-stem {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.wysiwyg-mcq-stem strong {
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
}

.wysiwyg-mcq-stem input {
  flex: 1;
  border: none;
  border-bottom: 1.5px dashed #cbd5e1;
  background: transparent;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  padding: 2px 4px;
}

.wysiwyg-mcq-stem input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.wysiwyg-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 10px;
}

.wysiwyg-option-row input[type="radio"],
.wysiwyg-option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent, #0969da);
}

.wysiwyg-option-row .opt-letter {
  font-weight: 700;
  font-size: .86rem;
  color: #374151;
  min-width: 18px;
}

.wysiwyg-option-row .opt-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: .86rem;
  padding: 4px;
  color: var(--text);
}

.wysiwyg-option-row .opt-input:focus {
  outline: none;
  background: #f8fafc;
  border-radius: 3px;
}

/* ── T/F/NG WYSIWYG ── */
.wysiwyg-tfng-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .02);
}

.wysiwyg-tfng-stem {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.wysiwyg-tfng-stem strong {
  font-weight: 800;
  font-size: .9rem;
}

.wysiwyg-tfng-stem input {
  flex: 1;
  border: none;
  border-bottom: 1.5px dashed #cbd5e1;
  background: transparent;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  padding: 2px 4px;
}

.wysiwyg-tfng-stem input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.wysiwyg-tfng-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 12px;
}

.wysiwyg-tfng-choices label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: .86rem;
  padding: 2px 0;
}

.wysiwyg-tfng-choices input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #0969da);
}

/* ── Summary / Sentence / Note Completion WYSIWYG ── */
.wysiwyg-summary-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-top: 4px;
  line-height: 1.8;
  font-size: .88rem;
}

.wysiwyg-gap-inline {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 80px;
  background: #fff;
  margin: 0 3px;
  vertical-align: middle;
}

.wysiwyg-gap-inline .gap-num {
  font-weight: 800;
  font-size: .82rem;
  color: var(--text);
  min-width: 22px;
  text-align: center;
}

/* ── Word Bank Pills ── */
.wysiwyg-wordbank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 12px;
}

.wysiwyg-wordbank-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: .84rem;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .15s;
}

.wysiwyg-wordbank-pill:hover {
  border-color: #94a3b8;
}

.wysiwyg-wordbank-pill .pill-input {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  padding: 0;
  width: 80px;
  color: var(--text);
}

.wysiwyg-wordbank-pill .pill-input:focus {
  outline: none;
}

/* ── Table Completion WYSIWYG ── */
.wysiwyg-table-wrap {
  overflow-x: auto;
  margin-top: 4px;
}

.creator-table-toolbar,
.creator-table-row-sizes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: .78rem;
  color: var(--muted);
}

.creator-table-size-control,
.creator-cell-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: .7rem;
  color: var(--muted);
}

.creator-table-size-control input,
.creator-table-row-sizes input,
.creator-cell-tools select,
.creator-cell-tools input[type="color"] {
  max-width: 72px;
  padding: 2px 4px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font: inherit;
}

.creator-cell-tools button {
  min-width: 24px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.creator-cell-tools button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: #eef6ff;
}

.creator-table-cell-display {
  line-height: 1.8;
}

.creator-empty-inline {
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: .84rem;
}

.creator-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-top: 10px;
}

.wysiwyg-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  overflow: auto;
  position: relative;
}

.wysiwyg-table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .86rem;
}

.wysiwyg-table-wrap th,
.wysiwyg-table-wrap td {
  padding: 10px 12px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  position: relative;
}

.wysiwyg-table-wrap th:last-child,
.wysiwyg-table-wrap td:last-child {
  border-right: none;
}

.wysiwyg-table-wrap th {
  background: #f1f5f9;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .04em;
  border-bottom: 2px solid #e2e8f0;
}

.wysiwyg-table-wrap th input,
.wysiwyg-table-wrap td input {
  border: none;
  background: transparent;
  font: inherit;
  width: 100%;
  padding: 2px;
  color: var(--text);
}

.wysiwyg-table-wrap th input {
  font-weight: 700;
}

.wysiwyg-table-wrap td input:focus,
.wysiwyg-table-wrap th input:focus {
  outline: none;
  background: #f8fafc;
}

/* ── Matching Features/Information WYSIWYG ── */
.wysiwyg-matching-grid {
  display: grid;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.wysiwyg-matching-grid .mg-header {
  background: #f1f5f9;
  font-weight: 700;
  font-size: .82rem;
  text-align: center;
  padding: 8px 4px;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
}

.wysiwyg-matching-grid .mg-stem {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  background: #fff;
}

.wysiwyg-matching-grid .mg-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  background: #fff;
}

.wysiwyg-matching-grid .mg-cell input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent, #0969da);
}

/* ── Flowchart Builder WYSIWYG ── */
.wysiwyg-flowchart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 16px;
  background: #fafafa;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 4px;
}

.wysiwyg-flow-box {
  background: #fff;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 200px;
  max-width: 400px;
  text-align: left;
  position: relative;
  box-shadow: 0 2px 6px rgba(59, 130, 246, .08);
  transition: border-color .15s, box-shadow .15s;
}

.wysiwyg-flow-box:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, .12);
}

.wysiwyg-flow-box .flow-box-label {
  font-weight: 700;
  font-size: .78rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.wysiwyg-flow-box .flow-box-input {
  width: 100%;
  border: none;
  border-bottom: 1.5px dashed #cbd5e1;
  background: transparent;
  font: inherit;
  font-size: .86rem;
  padding: 2px 0;
  color: var(--text);
}

.wysiwyg-flow-box .flow-box-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.wysiwyg-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #94a3b8;
  font-size: 1.2rem;
  padding: 4px 0;
}

.wysiwyg-flow-arrow svg {
  width: 20px;
  height: 20px;
  stroke: #94a3b8;
  fill: none;
  stroke-width: 2;
}

/* ── Sentence Completion Inline ── */
.wysiwyg-sentence-item {
  padding: 8px 0;
  font-size: .88rem;
  line-height: 1.8;
  border-bottom: 1px solid #f0f2f5;
}

.wysiwyg-sentence-item:last-child {
  border-bottom: none;
}

/* ── Note Completion WYSIWYG ── */
.wysiwyg-note-block {
  background: #fafafa;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 16px;
  margin-top: 4px;
}

.wysiwyg-note-block ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.wysiwyg-note-block li {
  margin-bottom: 6px;
}

/* ── WYSIWYG preview wrapper ── */
.creator-wysiwyg-section {
  margin-bottom: 4px;
}

.creator-wysiwyg-section:empty {
  display: none;
}

/* Editable summary area inside wysiwyg */
.wysiwyg-editable-summary {
  line-height: 2.2;
  min-height: 60px;
  padding: 4px;
  border-radius: 4px;
  outline: none;
  background: transparent;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 0.9rem;
  transition: background .15s;
}

.wysiwyg-editable-summary:focus {
  background: #f8fafc;
}

.wysiwyg-editable-summary .wysiwyg-gap-inline {
  user-select: none;
  cursor: default;
}

/* Raw fields toggle area */
.creator-qs-raw-fields {
  margin-top: 10px;
  padding: 12px;
  background: #f8f9fb;
  border: 1px solid #eef0f3;
  border-radius: 6px;
}

/* Fix for gap inline inside contenteditable */
[contenteditable] .wysiwyg-gap-inline {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 32px;
  background: #fff;
  margin: 0 2px;
  vertical-align: middle;
}

/* ── Creator Table Cell Editable ── */
.creator-table-cell-editable {
  min-height: 24px;
  padding: 4px;
  outline: none;
  border-radius: 2px;
  transition: background 0.2s;
  cursor: text;
}

.creator-table-cell-editable:focus {
  background: #f1f5f9;
}

.creator-table-cell-editable[placeholder]:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
  font-style: italic;
}
.flowchart-builder {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}

.flowchart-builder-canvas {
  position: relative;
  min-height: 300px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
}

.flowchart-node {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 8px;
  min-width: 140px;
  position: relative;
  cursor: move;
  transition: box-shadow .15s;
}

.flowchart-node:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.flowchart-node-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .7;
}

.flowchart-node-text {
  border: none;
  background: transparent;
  font: inherit;
  font-size: .86rem;
  padding: 2px;
  color: inherit;
  width: 100%;
}

.flowchart-node-text:focus {
  outline: none;
  background: rgba(255, 255, 255, .3);
  border-radius: 3px;
}

.flowchart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.flowchart-toolbar-note {
  align-self: center;
  color: var(--muted);
  font-size: .76rem;
}

.flowchart-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: #4b5563;
}

.flowchart-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f6f9ff;
}

.flowchart-toolbar button svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

.flowchart-props {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: #f1f5f9;
  border-radius: 6px;
}

.flowchart-props label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.flowchart-props input,
.flowchart-props select {
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font: inherit;
  font-size: .82rem;
}

.flowchart-props input:focus,
.flowchart-props select:focus {
  outline: none;
  border-color: var(--accent);
}

.flowchart-props-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: .72rem;
}

.flowchart-props-inline label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 700;
}

.flowchart-props-inline input,
.flowchart-props-inline select {
  max-width: 86px;
  padding: 3px 5px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font: inherit;
}

.creator-diagram-preview img {
  max-width: 100%;
  max-height: 220px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

/* ── Shared secondary button in creator ── */
.creator-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.creator-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f6f9ff;
}

.creator-pin-toggle {
  display: flex;
  margin-bottom: 14px;
}

.creator-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Contrast mode overrides for creator */
.test-view.contrast-white-black .creator-editor,
.test-view.contrast-white-black .creator-builder,
.test-view.contrast-white-black .creator-section-card,
.test-view.contrast-white-black .creator-group-card,
.test-view.contrast-white-black .creator-empty,
.test-view.contrast-white-black .creator-mini-btn,
.test-view.contrast-white-black .creator-btn-primary,
.test-view.contrast-white-black .creator-btn-secondary,
.test-view.contrast-white-black .creator-input,
.test-view.contrast-white-black .creator-textarea,
.test-view.contrast-white-black .creator-form-section,
.test-view.contrast-yellow-black .creator-editor,
.test-view.contrast-yellow-black .creator-builder,
.test-view.contrast-yellow-black .creator-section-card,
.test-view.contrast-yellow-black .creator-group-card,
.test-view.contrast-yellow-black .creator-empty,
.test-view.contrast-yellow-black .creator-mini-btn,
.test-view.contrast-yellow-black .creator-btn-primary,
.test-view.contrast-yellow-black .creator-btn-secondary,
.test-view.contrast-yellow-black .creator-input,
.test-view.contrast-yellow-black .creator-textarea,
.test-view.contrast-yellow-black .creator-form-section {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .creator-title-input,
.test-view.contrast-yellow-black .creator-title-input {
  background: transparent !important;
  color: var(--text) !important;
}

.test-view.contrast-white-black .creator-section-badge,
.test-view.contrast-yellow-black .creator-section-badge {
  background: var(--border) !important;
  color: #000 !important;
}

.test-view.contrast-white-black .creator-questions-badge,
.test-view.contrast-yellow-black .creator-questions-badge {
  background: #000 !important;
  border: 1px solid var(--border) !important;
}

.test-view.contrast-white-black .creator-qs-card,
.test-view.contrast-white-black .creator-qs-card-header,
.test-view.contrast-white-black .creator-qs-card-body,
.test-view.contrast-white-black .creator-qs-input,
.test-view.contrast-white-black .creator-qs-textarea,
.test-view.contrast-white-black .creator-qs-answers-panel,
.test-view.contrast-white-black .creator-type-picker,
.test-view.contrast-white-black .creator-type-btn,
.test-view.contrast-white-black .creator-qs-answers-toggle,
.test-view.contrast-white-black .creator-qs-gap-row button,
.test-view.contrast-white-black .creator-empty-state,
.test-view.contrast-yellow-black .creator-qs-card,
.test-view.contrast-yellow-black .creator-qs-card-header,
.test-view.contrast-yellow-black .creator-qs-card-body,
.test-view.contrast-yellow-black .creator-qs-input,
.test-view.contrast-yellow-black .creator-qs-textarea,
.test-view.contrast-yellow-black .creator-qs-answers-panel,
.test-view.contrast-yellow-black .creator-type-picker,
.test-view.contrast-yellow-black .creator-type-btn,
.test-view.contrast-yellow-black .creator-qs-answers-toggle,
.test-view.contrast-yellow-black .creator-qs-gap-row button,
.test-view.contrast-yellow-black .creator-empty-state {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .creator-qs-card-range,
.test-view.contrast-yellow-black .creator-qs-card-range {
  background: var(--border) !important;
  color: #000 !important;
}

.test-view.contrast-white-black .creator-qs-icon-btn,
.test-view.contrast-yellow-black .creator-qs-icon-btn {
  color: var(--text) !important;
}

.test-view.contrast-white-black .creator-qs-icon-btn:hover,
.test-view.contrast-yellow-black .creator-qs-icon-btn:hover {
  background: #222 !important;
}

.test-view.contrast-white-black .creator-qs-icon-btn.is-danger:hover,
.test-view.contrast-yellow-black .creator-qs-icon-btn.is-danger:hover {
  background: #400 !important;
  color: var(--error) !important;
}

.test-view.contrast-white-black .creator-btn-big,
.test-view.contrast-yellow-black .creator-btn-big {
  background: var(--border) !important;
  color: #000 !important;
}

.test-view.contrast-white-black .creator-empty-icon,
.test-view.contrast-yellow-black .creator-empty-icon {
  background: #111 !important;
  color: var(--text) !important;
}

.test-view.contrast-white-black .creator-qs-answer-input,
.test-view.contrast-yellow-black .creator-qs-answer-input {
  background: #111 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

@media (max-width: 900px) {
  .creator-form-grid {
    grid-template-columns: 1fr;
  }

  .creator-editor-inner {
    padding: 14px 16px 30px;
  }
}

.raw-textarea::placeholder {
  color: #a0a8b4;
}

.task-input-section {
  margin-bottom: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}

.label-hint {
  color: var(--muted);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: 0;
  text-transform: none;
}

.writing-diagram-label {
  margin-top: 16px;
}

.diagram-drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  background: #fafbfc;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  min-height: 178px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.diagram-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.diagram-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(9, 105, 218, .05);
}

.drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .84rem;
  padding: 10px;
  pointer-events: none;
  width: 100%;
}

.drop-hint svg {
  opacity: .62;
}

.diagram-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: .88rem;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.diagram-file-name {
  color: var(--muted);
  font-size: .82rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagram-preview {
  max-width: 100%;
  max-height: 300px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.ai-config-details {
  margin-bottom: 20px;
}

.ai-config-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 0;
  user-select: none;
}

.ai-config-summary:hover {
  color: var(--accent);
}

.writing-ai-row {
  margin-top: 12px;
}

.config-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.config-field {
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.config-field--grow {
  flex: 1;
}

.config-select,
.config-input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .87rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
}

.config-select:focus,
.config-input:focus {
  outline: none;
  border-color: var(--accent);
}

.emergency-pin-row {
  max-width: 320px;
  margin-top: -4px;
  margin-bottom: 6px;
}

.emergency-pin-row .config-input {
  width: 100%;
  margin-top: 6px;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Action Cards (Reading/Listening menu) ── */
.action-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  box-sizing: border-box;
}

.action-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 16px rgba(15,23,42,0.08);
  background: #f8fafc;
}

.action-card--primary {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.action-card--primary:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 20px rgba(59,130,246,0.15);
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
}

.action-card--deprecated {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border-color: #e2e8f0;
  background: #fafafa;
}

.action-card--deprecated:hover {
  border-color: #cbd5e1;
  box-shadow: none;
  background: #fafafa;
}

.action-card-trigger {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: none;
  border: none;
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
}

.action-card-trigger:hover .action-card-title { color: #374151; }

.action-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
}

.action-card--primary .action-card-icon {
  background: #dbeafe;
  color: #2563eb;
}

.action-card--deprecated .action-card-icon {
  background: #f1f5f9;
  color: #94a3b8;
}

.action-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.action-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-card--deprecated .action-card-title { color: #64748b; }

.action-card-desc {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.4;
}

.action-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 6px;
}

.action-card-arrow {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.2s;
}

.action-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.action-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 1000;
  margin-top: 4px;
  overflow: hidden;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition);
}

.action-dropdown-item:first-child {
  border-top: none;
}

.action-dropdown-item:hover {
  background-color: #f5f6f8;
}

.action-dropdown-item:active {
  background-color: #e8eaed;
}

.action-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}

.btn-primary,
.btn-secondary,
.btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: #0559b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(9, 105, 218, .25);
}

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--success);
  color: #fff;
}

.btn-secondary:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-tertiary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-tertiary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Validation */
.validation-feedback {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-size: .86rem;
  line-height: 1.5;
}

.validation-error {
  background: #fdf0f0;
  border: 1px solid #f5c6cb;
  color: var(--error);
}

.validation-warning {
  background: #fef8e7;
  border: 1px solid #f5e0a0;
  color: var(--warning);
}

.validation-success {
  background: #eef8f0;
  border: 1px solid #a3d9b1;
  color: var(--success);
}

/* Loading */
.loading-overlay {
  text-align: center;
  padding: 40px 20px;
  margin-top: 20px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 4px;
}

.loading-subtext {
  color: var(--muted);
  font-size: .84rem;
}

/* ══════════════════════════════════════════════
   TEST VIEW — Inspera Assessment Style
   ══════════════════════════════════════════════ */
.test-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: #e8eaed;
  position: relative;
  overflow: hidden;
}

/* Header */
.ielts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--test-header-height);
  background: var(--ielts-header);
  color: var(--text);
  flex-shrink: 0;
  z-index: 100;
  border-bottom: 1px solid #d0d0d0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

.ielts-header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.ielts-header-right {
  display: flex;
  gap: 4px;
  align-items: center;
}

.header-icon-btn {
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-btn:hover {
  background: #eef2f7;
  color: var(--text);
}

.header-icon-btn:disabled {
  opacity: .45;
  cursor: default;
  pointer-events: none;
}

.timer-display {
  font-size: .84rem;
  color: var(--text);
  padding: 0;
  white-space: nowrap;
  font-weight: 700;
}

.timer-display.warning {
  color: #a16207;
}

.timer-display.danger {
  color: var(--error);
  font-weight: 700;
}

/* Part Header */
.part-header {
  padding: 8px 20px;
  min-height: var(--part-header-height);
  background: #f0f0f0;
  border-bottom: 1px solid #d0d0d0;
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-shrink: 0;
}

.part-label {
  font-weight: 700;
  font-size: .92rem;
}

.part-instruction {
  font-size: .86rem;
  color: #555;
}

/* Split Pane */
.split-pane {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.passage-panel {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid #d0d0d0;
  position: relative;
}

.passage-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 16px;
  border-bottom: 1px solid #eee;
}

.help-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: .78rem;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}

.annotation-popover {
  position: absolute;
  z-index: 80;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}

.annotation-popover.visible {
  display: flex;
}

.annotation-popover button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: #fff;
  border-radius: 4px;
  min-width: 104px;
  justify-content: flex-start;
  padding: 7px 9px;
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  color: var(--text);
}

.annotation-popover button:hover {
  background: #f3f4f6;
}

.annotation-popover span.annotation-icon {
  display: none;
}

.annotation-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.annotation-icon-note {
  stroke: currentColor;
}

.passage-content {
  padding: 16px 24px 40px;
  font-size: .9rem;
  line-height: 1.7;
}

.passage-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.4;
}

.passage-content h3 {
  font-size: .9rem;
  font-weight: 700;
  margin: 18px 0 6px;
  line-height: 1.4;
}

.passage-content p {
  margin-bottom: 12px;
  text-align: justify;
}

.passage-highlight {
  background: #f5a400;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(175, 105, 0, .18);
  border-radius: 1px;
}

.passage-note-anchor {
  border-bottom: 2px solid var(--accent);
  cursor: text;
  text-decoration: none;
}

.notes-panel {
  display: none;
  margin: 0 24px 24px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.floating-note-panel {
  position: fixed;
  z-index: 5000;
  display: none;
  width: min(320px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}

.note-card {
  border: 0;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 0;
  background: #fafafa;
}

.note-excerpt {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.4;
}

.note-textarea {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  font-family: inherit;
  font-size: .84rem;
}

.note-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .12);
  background: #fff;
}

.note-delete-btn {
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--error);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}

.note-delete-btn:hover {
  background: #fff5f5;
  border-color: var(--error);
}

.options-menu {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: #fff;
  color: #000;
  padding: 72px 24px;
}

.options-panel h2 {
  text-align: center;
  font-size: 1.95rem;
  font-weight: 400;
  margin-bottom: 38px;
}

.options-close {
  position: absolute;
  top: 24px;
  right: 34px;
  border: 0;
  background: none;
  color: #000;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.options-close svg {
  width: 26px;
  height: 26px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.options-stack {
  width: min(875px, 100%);
  margin: 0 auto;
}

.options-primary,
.options-row {
  width: 100%;
  min-height: 94px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 110px 32px;
  align-items: center;
  column-gap: 22px;
  border: 1px solid #c9c9c9;
  background: #fff;
  color: #000;
  padding: 0 38px;
  font: inherit;
  font-size: 1.2rem;
  text-align: left;
  cursor: pointer;
}

.options-primary {
  min-height: 96px;
  margin-bottom: 20px;
  border-color: #ed1746;
  background: #ed1746;
  color: #fff;
}

.options-primary .options-arrow {
  grid-column: 4;
}

.options-row+.options-row {
  border-top: 0;
}

.options-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: inherit;
  opacity: .75;
  justify-self: center;
}

.options-icon svg,
.options-arrow svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.options-icon-text {
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0;
}

.options-arrow {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  justify-self: center;
}

.options-value {
  color: #666;
  font-size: .9rem;
  justify-self: end;
  white-space: nowrap;
}

.options-primary .options-value {
  color: #fff;
}

.options-choice-list {
  width: min(875px, 100%);
  margin: 0 auto;
  border: 1px solid #c9c9c9;
  border-radius: 5px;
  overflow: hidden;
}

.options-choice {
  width: 100%;
  min-height: 94px;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 104px;
  align-items: center;
  column-gap: 22px;
  border: 0;
  border-bottom: 1px solid #c9c9c9;
  background: #fff;
  color: #000;
  padding: 0 28px 0 22px;
  font: inherit;
  font-size: 1.07rem;
  text-align: left;
  cursor: pointer;
}

.options-choice:last-child {
  border-bottom: 0;
}

.choice-check {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  color: #000;
  opacity: 0;
}

.choice-check svg {
  width: 26px;
  height: 26px;
  display: block;
}

.options-choice.selected .choice-check {
  opacity: 1;
}

.options-preview-normal,
.options-preview-dark,
.options-preview-yellow {
  width: 72px;
  height: 48px;
  justify-self: end;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.options-preview-normal {
  background: #fff;
  color: #111;
}

.options-preview-normal span,
.options-preview-dark span,
.options-preview-yellow span {
  display: block;
  height: 3px;
  width: 100%;
  background: currentColor;
}

.options-preview-dark {
  background: #000;
  color: #fff;
}

.options-preview-yellow {
  background: #000;
  color: #ffd400;
}

.test-view.contrast-white-black {
  --surface: #000;
  --text: #fff;
  --muted: #d1d5db;
  --border: #ffffff;
  --accent: #ffffff;
  --ielts-header: #000;
  background: #000;
  color: #fff;
}

.test-view.contrast-yellow-black {
  --surface: #000;
  --text: #ffd400;
  --muted: #ffe680;
  --border: #ffd400;
  --accent: #ffd400;
  --ielts-header: #000;
  background: #000;
  color: #ffd400;
}

.test-view.contrast-white-black .ielts-header,
.test-view.contrast-white-black .part-header,
.test-view.contrast-white-black .passage-panel,
.test-view.contrast-white-black .questions-panel,
.test-view.contrast-white-black .bottom-nav,
.test-view.contrast-yellow-black .ielts-header,
.test-view.contrast-yellow-black .part-header,
.test-view.contrast-yellow-black .passage-panel,
.test-view.contrast-yellow-black .questions-panel,
.test-view.contrast-yellow-black .bottom-nav {
  background: #000;
  color: var(--text);
  border-color: var(--border);
}

.test-view.contrast-white-black .question-group-instructions,
.test-view.contrast-white-black .part-instruction,
.test-view.contrast-yellow-black .question-group-instructions,
.test-view.contrast-yellow-black .part-instruction {
  color: var(--muted);
}

.test-view.contrast-white-black .writing-area,
.test-view.contrast-yellow-black .writing-area {
  background: #000;
  color: var(--text);
  border-color: var(--border);
}

.test-view.contrast-white-black .writing-preamble,
.test-view.contrast-white-black .writing-word-requirement,
.test-view.contrast-white-black .writing-extra-instruction,
.test-view.contrast-white-black .writing-topic-intro,
.test-view.contrast-yellow-black .writing-preamble,
.test-view.contrast-yellow-black .writing-word-requirement,
.test-view.contrast-yellow-black .writing-extra-instruction,
.test-view.contrast-yellow-black .writing-topic-intro {
  color: var(--muted);
}

.test-view.contrast-white-black .writing-task-image-wrap,
.test-view.contrast-yellow-black .writing-task-image-wrap {
  background: #000;
  border-color: var(--border);
}

.test-view.contrast-white-black,
.test-view.contrast-yellow-black {
  scrollbar-color: var(--border) #000;
}

.test-view.contrast-white-black *,
.test-view.contrast-yellow-black * {
  scrollbar-color: var(--border) #000;
}

.test-view.contrast-white-black .passage-content,
.test-view.contrast-white-black .questions-content,
.test-view.contrast-white-black .question-group,
.test-view.contrast-white-black .summary-text,
.test-view.contrast-white-black .matching-grid-wrap,
.test-view.contrast-white-black .matching-features-wrap,
.test-view.contrast-white-black .matching-endings,
.test-view.contrast-white-black .matching-ending-options,
.test-view.contrast-white-black .diagram-answers,
.test-view.contrast-yellow-black .passage-content,
.test-view.contrast-yellow-black .questions-content,
.test-view.contrast-yellow-black .question-group,
.test-view.contrast-yellow-black .summary-text,
.test-view.contrast-yellow-black .matching-grid-wrap,
.test-view.contrast-yellow-black .matching-features-wrap,
.test-view.contrast-yellow-black .matching-endings,
.test-view.contrast-yellow-black .matching-ending-options,
.test-view.contrast-yellow-black .diagram-answers {
  background: #000 !important;
  color: var(--text) !important;
}

.test-view.contrast-white-black .question-group-header,
.test-view.contrast-white-black .question-stem,
.test-view.contrast-white-black .question-option,
.test-view.contrast-white-black .question-option label,
.test-view.contrast-white-black .summary-text,
.test-view.contrast-white-black .heading-label,
.test-view.contrast-white-black .matching-ending-stem,
.test-view.contrast-white-black .matching-features-stem,
.test-view.contrast-white-black .matching-info-statement,
.test-view.contrast-white-black .flowchart-step,
.test-view.contrast-yellow-black .question-group-header,
.test-view.contrast-yellow-black .question-stem,
.test-view.contrast-yellow-black .question-option,
.test-view.contrast-yellow-black .question-option label,
.test-view.contrast-yellow-black .summary-text,
.test-view.contrast-yellow-black .heading-label,
.test-view.contrast-yellow-black .matching-ending-stem,
.test-view.contrast-yellow-black .matching-features-stem,
.test-view.contrast-yellow-black .matching-info-statement,
.test-view.contrast-yellow-black .flowchart-step {
  color: var(--text) !important;
}

.test-view.contrast-white-black input,
.test-view.contrast-white-black select,
.test-view.contrast-white-black textarea,
.test-view.contrast-white-black .summary-blank,
.test-view.contrast-white-black .config-select,
.test-view.contrast-white-black .heading-drop-zone,
.test-view.contrast-white-black .matching-ending-slot,
.test-view.contrast-white-black .matching-grid-cell,
.test-view.contrast-white-black .matching-grid-stem,
.test-view.contrast-white-black .matching-grid-header,
.test-view.contrast-white-black .matching-features-cell,
.test-view.contrast-white-black .matching-features-stem,
.test-view.contrast-white-black .matching-features-header,
.test-view.contrast-white-black .matching-feature-options th,
.test-view.contrast-white-black .matching-feature-options td,
.test-view.contrast-white-black .diagram-container,
.test-view.contrast-white-black .summary-option-pill,
.test-view.contrast-white-black .heading-pill,
.test-view.contrast-white-black .matching-ending-pill,
.test-view.contrast-white-black .note-card,
.test-view.contrast-yellow-black input,
.test-view.contrast-yellow-black select,
.test-view.contrast-yellow-black textarea,
.test-view.contrast-yellow-black .summary-blank,
.test-view.contrast-yellow-black .config-select,
.test-view.contrast-yellow-black .heading-drop-zone,
.test-view.contrast-yellow-black .matching-ending-slot,
.test-view.contrast-yellow-black .matching-grid-cell,
.test-view.contrast-yellow-black .matching-grid-stem,
.test-view.contrast-yellow-black .matching-grid-header,
.test-view.contrast-yellow-black .matching-features-cell,
.test-view.contrast-yellow-black .matching-features-stem,
.test-view.contrast-yellow-black .matching-features-header,
.test-view.contrast-yellow-black .matching-feature-options th,
.test-view.contrast-yellow-black .matching-feature-options td,
.test-view.contrast-yellow-black .diagram-container,
.test-view.contrast-yellow-black .summary-option-pill,
.test-view.contrast-yellow-black .heading-pill,
.test-view.contrast-yellow-black .matching-ending-pill,
.test-view.contrast-yellow-black .note-card {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black input::placeholder,
.test-view.contrast-white-black .summary-blank::placeholder,
.test-view.contrast-yellow-black input::placeholder,
.test-view.contrast-yellow-black .summary-blank::placeholder {
  color: var(--text) !important;
  opacity: 1;
}

.test-view.contrast-white-black .slot-num,
.test-view.contrast-white-black .pill-indicator,
.test-view.contrast-yellow-black .slot-num,
.test-view.contrast-yellow-black .pill-indicator {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .slot-text,
.test-view.contrast-yellow-black .slot-text {
  color: var(--muted) !important;
}

.test-view.contrast-white-black .slot-heading,
.test-view.contrast-yellow-black .slot-heading {
  color: var(--text) !important;
}

.test-view.contrast-white-black .flowchart-arrow,
.test-view.contrast-yellow-black .flowchart-arrow {
  color: var(--text) !important;
}

.test-view.contrast-white-black .nav-part-btn,
.test-view.contrast-white-black .nav-q-btn,
.test-view.contrast-white-black .nav-arrow-btn,
.test-view.contrast-white-black .header-icon-btn,
.test-view.contrast-white-black .speed-choice-btn,
.test-view.contrast-yellow-black .nav-part-btn,
.test-view.contrast-yellow-black .nav-q-btn,
.test-view.contrast-yellow-black .nav-arrow-btn,
.test-view.contrast-yellow-black .header-icon-btn,
.test-view.contrast-yellow-black .speed-choice-btn {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .nav-part-btn.active,
.test-view.contrast-white-black .nav-q-btn.active,
.test-view.contrast-white-black .nav-q-btn.answered,
.test-view.contrast-yellow-black .nav-part-btn.active,
.test-view.contrast-yellow-black .nav-q-btn.active,
.test-view.contrast-yellow-black .nav-q-btn.answered {
  background: var(--border) !important;
  color: #000 !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .header-icon-btn svg,
.test-view.contrast-yellow-black .header-icon-btn svg {
  stroke: currentColor !important;
}

.test-view.contrast-white-black .nav-arrow-btn svg,
.test-view.contrast-yellow-black .nav-arrow-btn svg {
  fill: currentColor !important;
}

.test-view.contrast-white-black .answer-notification-banner,
.test-view.contrast-white-black .modal-content,
.test-view.contrast-white-black .result-warning,
.test-view.contrast-white-black .annotation-popover,
.test-view.contrast-white-black .annotation-popover button,
.test-view.contrast-white-black~.floating-note-panel,
.test-view.contrast-white-black~.floating-note-panel .note-card,
.test-view.contrast-white-black~.floating-note-panel .note-textarea,
.test-view.contrast-white-black~.floating-note-panel .note-delete-btn,
.test-view.contrast-white-black .help-btn,
.test-view.contrast-white-black .btn-banner,
.test-view.contrast-white-black .btn-share,
.test-view.contrast-yellow-black .answer-notification-banner,
.test-view.contrast-yellow-black .modal-content,
.test-view.contrast-yellow-black .result-warning,
.test-view.contrast-yellow-black .annotation-popover,
.test-view.contrast-yellow-black .annotation-popover button,
.test-view.contrast-yellow-black~.floating-note-panel,
.test-view.contrast-yellow-black~.floating-note-panel .note-card,
.test-view.contrast-yellow-black~.floating-note-panel .note-textarea,
.test-view.contrast-yellow-black~.floating-note-panel .note-delete-btn,
.test-view.contrast-yellow-black .help-btn,
.test-view.contrast-yellow-black .btn-banner,
.test-view.contrast-yellow-black .btn-share {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .modal-header,
.test-view.contrast-yellow-black .modal-header {
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .correct-answer-badge,
.test-view.contrast-yellow-black .correct-answer-badge {
  background: #000 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .is-correct,
.test-view.contrast-white-black .is-incorrect,
.test-view.contrast-yellow-black .is-correct,
.test-view.contrast-yellow-black .is-incorrect {
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .heading-pill:hover,
.test-view.contrast-white-black .summary-option-pill:hover,
.test-view.contrast-white-black .matching-ending-pill:hover,
.test-view.contrast-white-black .matching-grid-cell:hover,
.test-view.contrast-white-black .matching-features-cell:hover,
.test-view.contrast-white-black .nav-part-btn:hover,
.test-view.contrast-white-black .nav-q-btn:hover,
.test-view.contrast-white-black .nav-arrow-btn:hover,
.test-view.contrast-white-black .header-icon-btn:hover,
.test-view.contrast-white-black .speed-choice-btn:hover,
.test-view.contrast-white-black .annotation-popover button:hover,
.test-view.contrast-yellow-black .heading-pill:hover,
.test-view.contrast-yellow-black .summary-option-pill:hover,
.test-view.contrast-yellow-black .matching-ending-pill:hover,
.test-view.contrast-yellow-black .matching-grid-cell:hover,
.test-view.contrast-yellow-black .matching-features-cell:hover,
.test-view.contrast-yellow-black .nav-part-btn:hover,
.test-view.contrast-yellow-black .nav-q-btn:hover,
.test-view.contrast-yellow-black .nav-arrow-btn:hover,
.test-view.contrast-yellow-black .header-icon-btn:hover,
.test-view.contrast-yellow-black .speed-choice-btn:hover,
.test-view.contrast-yellow-black .annotation-popover button:hover {
  background: #111 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .summary-blank:focus,
.test-view.contrast-yellow-black .summary-blank:focus {
  box-shadow: 0 0 0 3px currentColor !important;
}

.test-view.contrast-white-black .passage-highlight,
.test-view.contrast-yellow-black .passage-highlight {
  background: var(--border) !important;
  color: #000 !important;
}

.test-view.contrast-white-black .passage-note-anchor,
.test-view.contrast-yellow-black .passage-note-anchor {
  border-bottom-color: var(--border) !important;
}

.test-view.contrast-white-black~.floating-note-panel .note-excerpt,
.test-view.contrast-white-black~.floating-note-panel .note-textarea,
.test-view.contrast-white-black~.floating-note-panel .note-delete-btn {
  color: #fff !important;
}

.test-view.contrast-yellow-black~.floating-note-panel .note-excerpt,
.test-view.contrast-yellow-black~.floating-note-panel .note-textarea,
.test-view.contrast-yellow-black~.floating-note-panel .note-delete-btn {
  color: #ffd400 !important;
}

.test-view.contrast-white-black~.floating-note-panel .note-textarea::placeholder {
  color: #cfcfcf !important;
}

.test-view.contrast-yellow-black~.floating-note-panel .note-textarea::placeholder {
  color: #ffe777 !important;
}

.test-view.contrast-white-black~.floating-note-panel .note-delete-btn,
.test-view.contrast-yellow-black~.floating-note-panel .note-delete-btn {
  background: transparent !important;
  border-width: 1.5px !important;
}

.test-view.contrast-white-black~.floating-note-panel .note-delete-btn:hover {
  background: #222 !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black~.floating-note-panel .note-delete-btn:hover {
  background: #1d1a00 !important;
  border-color: #ffd400 !important;
}

.test-view.text-size-large .passage-content,
.test-view.text-size-large .questions-content,
.test-view.text-size-large .writing-area {
  font-size: 1.02rem;
}

.test-view.text-size-xlarge .passage-content,
.test-view.text-size-xlarge .questions-content,
.test-view.text-size-xlarge .writing-area {
  font-size: 1.15rem;
}

.question-marker {
  display: inline-block;
  border: 2px dashed var(--accent);
  color: var(--accent);
  padding: 2px 16px;
  font-weight: 700;
  font-size: .84rem;
  margin-bottom: 8px;
  border-radius: 3px;
}

.questions-panel {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}

.questions-content {
  padding: 16px 24px 40px;
}

.writing-test-section {
  display: none;
}

.test-view.writing-active .writing-test-section {
  display: flex;
}

.test-view.writing-active #writing-part-header {
  display: flex;
}

.test-view.writing-active #writing-split-pane {
  display: flex;
}

.test-view.writing-active #writing-bottom-nav {
  display: flex;
}

.writing-split-pane {
  background: #e8eaed;
}

.writing-prompt-panel {
  flex: 0 0 50%;
}

.writing-response-panel {
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.writing-response-content {
  flex: 1;
  min-height: 0;
  padding: 16px;
  display: block;
}

.writing-prompt-content {
  font-size: .92rem;
}

.writing-task-label {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.writing-preamble,
.writing-word-requirement,
.writing-extra-instruction,
.writing-topic-intro {
  margin-bottom: 14px;
  color: #333;
  line-height: 1.55;
}

.writing-prompt-box {
  margin: 14px 0;
  padding: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.writing-topic-box {
  font-weight: 700;
  color: var(--text);
}

.writing-task-image-wrap {
  margin: 18px 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  padding: 10px;
  text-align: center;
}

.writing-task-image {
  max-width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
}

.writing-area {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: calc((100% - 30px) / 2);
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  background: #fff;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: .94rem;
  line-height: 1.7;
  outline: none;
}

.writing-area:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .12);
}

.writing-area:disabled {
  background: #f6f8fa;
  cursor: default;
}

.writing-inline-word-count {
  margin-top: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: .9rem;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  line-height: 1.4;
}

.writing-bottom-nav {
  justify-content: space-between;
}

.writing-word-count {
  flex: 1;
}

.word-count-num.word-ok {
  color: inherit;
}

.word-count-num.word-low {
  color: inherit;
}

.question-group {
  margin-bottom: 28px;
}

.question-group-header {
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 4px;
  color: var(--text);
}

.question-group-instructions {
  font-size: .86rem;
  color: #555;
  margin-bottom: 12px;
  line-height: 1.55;
}

/* Heading Match Pills */
.heading-list {
  margin: 26px 0 14px;
}

.heading-label {
  font-weight: 700;
  font-size: .84rem;
  color: #555;
  margin-bottom: 8px;
}

.heading-pill {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 5px;
  padding: 4px 16px;
  margin-bottom: 10px;
  border: 1px solid #eef0f3;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: grab;
  transition: background .15s, box-shadow .15s, transform .15s;
  user-select: none;
}

.heading-pill:hover {
  background: #fafafa;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .16);
}

.heading-pill .pill-indicator {
  display: none;
}

.heading-slot {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  margin-bottom: 5px;
  border: 2px dashed #bbb;
  border-radius: 3px;
  background: #fafafa;
  min-height: 40px;
  font-size: .86rem;
  color: #999;
}

/* Radio / Checkbox Groups */
.question-item {
  margin-bottom: 16px;
}

.question-stem {
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.5;
}

.question-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  font-size: .86rem;
  line-height: 1.5;
  cursor: pointer;
}

.question-option input {
  margin-top: 3px;
  flex-shrink: 0;
}

.question-option label {
  cursor: pointer;
}

.questions-content input:disabled,
.questions-content select:disabled,
.questions-content textarea:disabled {
  cursor: default;
  opacity: .82;
  background: #f6f8fa;
}

.answers-locked {
  cursor: default !important;
}

.answers-locked.dragover {
  background: inherit;
  border-color: inherit;
}

/* Summary Completion */
.summary-text {
  font-size: .86rem;
  line-height: 1.9;
  margin-bottom: 12px;
  word-spacing: normal;
}

.summary-blank {
  display: inline-block;
  width: 104px;
  height: 29px;
  border: 1px solid #7f8895;
  background: #fff;
  font-family: inherit;
  font-size: .9rem;
  padding: 4px 8px;
  text-align: center;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  border-radius: 3px;
  vertical-align: baseline;
  font-weight: 600;
  margin: 0 .22em;
}

.summary-blank:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .12);
}

.summary-blank::placeholder {
  color: var(--text);
  opacity: 1;
}

.summary-blank:not(:placeholder-shown) {
  color: var(--text);
  font-weight: 500;
}

.summary-blank-label {
  display: none;
}

.summary-choice-blank {
  width: 124px;
  min-width: 124px;
  max-width: 176px;
  height: 31px;
  padding: 4px 7px;
  font-size: .84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  margin: 0 .14em;
}

.summary-choice-blank.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .12);
  background: #f3f8ff;
}

.summary-wordbank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.summary-wordbank .heading-label {
  flex: 0 0 100%;
  margin-bottom: 0;
}

.summary-option-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  transition: border-color .15s, background-color .15s, color .15s, opacity .15s;
}

.summary-option-pill:hover:not(.used) {
  border-color: var(--accent);
  color: var(--accent);
}

.summary-option-pill:active,
.summary-option-pill.dragging {
  cursor: grabbing;
}

.summary-option-pill.used {
  display: none;
}

/* Pane Resizer */
.pane-resizer {
  width: 5px;
  cursor: col-resize;
  background: #e0e0e0;
  flex-shrink: 0;
  transition: background .15s;
}

.pane-resizer:hover,
.pane-resizer.active {
  background: var(--accent);
}

/* Bottom Nav */
.bottom-nav {
  display: flex;
  align-items: center;
  height: var(--bottom-nav-height);
  min-height: var(--bottom-nav-height);
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #d0d0d0;
  flex-shrink: 0;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  z-index: 120;
}

.nav-parts {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.nav-part-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  font-family: inherit;
}

.nav-part-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.nav-part-btn:hover:not(.active) {
  background: #f0f4f8;
}

.nav-questions {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex: 1;
}

.nav-q-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  white-space: nowrap;
  padding: 0 5px;
  font-family: inherit;
}

.nav-q-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.nav-q-btn.answered {
  background: #e6f4ea;
  border-color: var(--success);
  color: var(--success);
}

.nav-q-btn:hover:not(.active) {
  background: #f0f4f8;
}

.nav-arrows {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-arrow-btn {
  width: 34px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  font-size: .88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-family: inherit;
}

.nav-arrow-btn:hover {
  background: #f0f4f8;
  border-color: var(--accent);
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
  animation: fadeUp .25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 4px;
}

.modal-body {
  padding: 20px;
}

.result-modal-content {
  max-width: 580px;
}

/* Score Hero Band */
.result-score-band {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 20px 16px;
  background: linear-gradient(135deg, #f0f5ff 0%, #eaf1fb 100%);
  border-bottom: 1px solid #dce7f5;
  margin: -20px -20px 0;
  border-radius: 0 0 0 0;
}

.result-score-ring {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(9, 105, 218, .18);
}

.result-score-ring .score-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.result-score-ring .score-denom {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  margin-top: 1px;
}

.result-score-text {
  flex: 1;
  min-width: 0;
}

.result-summary {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}

.result-meta {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.result-stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  padding: 12px 14px;
  transition: background .15s;
}

.result-stat:hover {
  background: #f3f6fa;
}

.result-stat.stat-correct {
  border-color: #a3d9b1;
  background: #f0fbf3;
}

.result-stat.stat-incorrect {
  border-color: #f5c6cb;
  background: #fff5f5;
}

.result-stat.stat-skipped {
  border-color: #f0d48a;
  background: #fefbf0;
}

.result-comment {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  padding: 14px 16px;
}

.result-stat-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.result-stat.stat-correct .result-stat-label {
  color: var(--success);
}

.result-stat.stat-incorrect .result-stat-label {
  color: var(--error);
}

.result-stat.stat-skipped .result-stat-label {
  color: var(--warning);
}

.result-stat strong {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  display: block;
}

.result-stat.stat-correct strong {
  color: var(--success);
}

.result-stat.stat-incorrect strong {
  color: var(--error);
}

.result-stat.stat-skipped strong {
  color: var(--warning);
}

.result-comment p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text);
}

.result-warning {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 8px;
  background: #fff8ec;
  border: 1px solid #f0d48a;
  color: #8a5a00;
  font-size: .86rem;
  line-height: 1.55;
  font-weight: 600;
  white-space: pre-line;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.share-feedback {
  color: var(--success);
  font-size: .82rem;
  font-weight: 700;
  margin-top: 10px;
  display: flex;
  align-items: center;
}

.share-modal-content {
  max-width: 440px;
}

.emergency-score-content {
  max-width: 440px;
}

/* PIN Modal Header Icon */
.pin-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f0f4ff;
  border: 1.5px solid #d4e3ff;
  margin: 0 auto 16px;
  color: var(--accent);
}

.pin-modal-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emergency-score-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
  text-align: center;
}

/* Large PIN input */
.pin-input-large {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .25em;
  text-align: center;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.pin-input-large:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(9, 105, 218, .12);
}

.pin-input-large::placeholder {
  color: #c5cdd8;
  font-size: .95rem;
  letter-spacing: .05em;
  font-weight: 500;
}

.emergency-score-error {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #ffb3b3;
  border-radius: 8px;
  background: #fff0f0;
  color: var(--error);
  font-size: .84rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.emergency-score-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.emergency-score-actions .btn-tertiary,
.emergency-score-actions .btn-primary {
  padding: 10px 20px;
  font-size: .88rem;
}

/* Speed Up Menu */
.speed-modal-header {
  text-align: center;
  margin-bottom: 16px;
}

.speed-modal-desc {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
  text-align: center;
}

.speed-choice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.speed-choice-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 14px 6px 12px;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, transform .15s, box-shadow .15s;
  gap: 4px;
}

.speed-choice-btn::after {
  content: 'faster';
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .18s;
}

.speed-choice-btn:hover {
  border-color: var(--accent);
  background: #f0f5ff;
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(9, 105, 218, .14);
}

.speed-choice-btn:hover::after {
  color: var(--accent);
}

.speed-choice-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.speed-choice-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.speed-choice-btn.selected::after {
  color: rgba(255, 255, 255, .7);
}

@media (max-width: 520px) {
  .speed-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.share-option {
  display: flex;
  gap: 14px;
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.share-option:last-child {
  border: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.share-option-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  border-radius: 10px;
  color: var(--accent);
}

.share-option-body {
  flex: 1;
  min-width: 0;
}

.share-option h4 {
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.share-desc {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

.btn-share:hover {
  background: #0559b8;
  border-color: #0559b8;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(9, 105, 218, .2);
}

.load-textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: Arial, Helvetica, sans-serif;
  font-size: .82rem;
  resize: vertical;
}

.load-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Drag and Drop Heading Slots in Passage ── */
.heading-drop-zone {
  display: flex;
  align-items: center;
  margin: 10px 0;
  padding: 8px 12px;
  border: 2px dashed #999;
  background: #fafafa;
  border-radius: 4px;
  min-height: 42px;
  font-size: .86rem;
  transition: background .2s, border-color .2s;
  position: relative;
}

.heading-drop-zone.dragover {
  background: #e8f0fe;
  border-color: #0969da;
}

.heading-example-zone {
  border-style: solid;
  background: #f3f4f6;
}

.heading-example-zone .slot-num {
  width: auto;
  min-width: 58px;
  padding: 0 6px;
}

.heading-drop-zone .slot-num {
  font-weight: 700;
  color: var(--text);
  margin-right: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
}

.heading-drop-zone .slot-text {
  color: #888;
  flex: 1;
}

.heading-drop-zone .slot-heading {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.heading-drop-zone .slot-clear {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.heading-drop-zone .slot-clear:hover {
  color: var(--error);
}

/* ── Diagram Completion ── */
.diagram-container {
  margin: 16px 0;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: #fafafa;
}

.diagram-img {
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: 4px;
}

.diagram-answers {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  text-align: left;
}

.diagram-answer-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matching-grid-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.matching-grid {
  display: grid;
  grid-template-columns: var(--grid-columns, minmax(260px, 1.8fr) repeat(5, minmax(56px, 72px)));
  border: 1.5px solid #666;
  border-bottom: none;
  background: #fff;
}

.matching-grid-header,
.matching-grid-cell,
.matching-grid-stem {
  min-height: 44px;
  border-bottom: 1px solid #777;
}

.matching-grid-header {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f5;
  color: #000;
  font-weight: 700;
  font-size: .92rem;
  border-left: 1px solid #777;
}

.matching-grid-header:first-child {
  border-left: none;
}

.matching-grid-stem {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-size: .88rem;
  line-height: 1.5;
  background: #fff;
  color: #000;
  margin-bottom: 0;
}

.matching-grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #777;
  background: #fff;
  cursor: pointer;
}

.matching-grid-cell:hover {
  background: #f5f7f9;
}

.matching-grid-cell input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.matching-features-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.matching-features-grid {
  display: grid;
  grid-template-columns: var(--grid-columns, minmax(260px, 1.8fr) repeat(5, minmax(56px, 72px)));
  min-width: 560px;
  border: 1.5px solid #666;
  border-bottom: none;
  background: #fff;
  margin-bottom: 18px;
}

.matching-features-header,
.matching-features-cell,
.matching-features-stem {
  min-height: 38px;
  border-bottom: 1px solid #777;
}

.matching-features-header {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f5;
  color: #000;
  border-left: 1px solid #777;
  font-size: .92rem;
  font-weight: 700;
}

.matching-features-header:first-child {
  border-left: none;
}

.matching-features-stem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  color: #000;
  font-size: .88rem;
  line-height: 1.4;
}

.matching-features-number {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
}

.matching-features-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #777;
  background: #fff;
  cursor: pointer;
}

.matching-features-cell:hover {
  background: #f5f7f9;
}

.matching-features-cell input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.matching-feature-options {
  min-width: 320px;
  max-width: 520px;
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: .88rem;
  border: 1.5px solid #666;
}

.matching-feature-options th,
.matching-feature-options td {
  border: 1px solid #777;
  padding: 8px 12px;
  background: #fff;
  color: #000;
  text-align: left;
}

.matching-feature-options th {
  font-size: .92rem;
  font-weight: 700;
  background: #eef1f5;
  border-bottom: 1.5px solid #666;
}

.matching-feature-options td:first-child {
  width: 48px;
  text-align: center;
  font-weight: 700;
}

.matching-endings {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.matching-ending-question {
  padding: 0;
  margin: 0 0 20px;
}

.matching-ending-question:last-of-type {
  margin-bottom: 30px;
}

.matching-ending-stem {
  font-size: 1rem;
  line-height: 1.45;
  margin-bottom: 5px;
  color: var(--text);
}

.matching-ending-slot {
  width: min(585px, 100%);
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 10px;
  border: 1px dashed #c7c7c7;
  border-radius: 8px;
  background: #fff;
  color: #1f2328;
}

.matching-ending-slot.dragover {
  background: #f4f9ff;
  border-color: var(--accent);
}

.matching-ending-slot.filled {
  justify-content: center;
  border-style: solid;
}

.matching-ending-slot-text {
  font-weight: 600;
  font-size: .95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matching-ending-options {
  border-top: 0;
  background: transparent;
  padding: 0;
}

.matching-ending-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 5px 13px;
  border: 1px solid #eef0f3;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
  font-size: 1rem;
  line-height: 1.25;
  cursor: grab;
}

/* ── Answer Key Checking & Notification Banner ── */
.answer-notification-banner {
  padding: 8px 20px;
  background: #eef8f0;
  border-bottom: 1px solid #d0e7d5;
  color: var(--success);
  font-size: .84rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.answer-notification-banner.generated {
  background: #fdf8eb;
  border-bottom: 1px solid #f6e6cd;
  color: #b07000;
}

.banner-actions {
  display: flex;
  gap: 8px;
}

.btn-banner {
  background: #fff;
  border: 1px solid currentColor;
  padding: 4px 10px;
  font-size: .74rem;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  color: inherit;
  transition: opacity .15s;
  font-family: inherit;
}

.btn-banner:hover {
  opacity: 0.8;
}

/* Feedback Styling */
.is-correct {
  border-color: var(--success) !important;
  background-color: #f2fbf4 !important;
}

.is-incorrect {
  border-color: var(--error) !important;
  background-color: #fff5f5 !important;
}

.correct-answer-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--success);
  background: #e8f7ed;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #d0eed8;
}

.test-view.contrast-white-black .is-correct,
.test-view.contrast-white-black .is-incorrect {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black .is-correct,
.test-view.contrast-yellow-black .is-incorrect {
  background-color: #000 !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}

.test-view.contrast-white-black .is-correct *,
.test-view.contrast-white-black .is-incorrect * {
  color: #fff !important;
}

.test-view.contrast-yellow-black .is-correct *,
.test-view.contrast-yellow-black .is-incorrect * {
  color: #ffd400 !important;
}

.test-view.contrast-white-black .is-correct input,
.test-view.contrast-white-black .is-incorrect input,
.test-view.contrast-yellow-black .is-correct input,
.test-view.contrast-yellow-black .is-incorrect input {
  accent-color: currentColor;
}

.test-view.contrast-white-black .question-option input:checked+label {
  display: inline-block;
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #fff !important;
  border-radius: 3px;
  padding: 1px 6px;
}

.test-view.contrast-white-black .question-option input:checked+label * {
  color: #000 !important;
}

.test-view.contrast-white-black .matching-grid-cell input,
.test-view.contrast-white-black .matching-features-cell input,
.test-view.contrast-yellow-black .matching-grid-cell input,
.test-view.contrast-yellow-black .matching-features-cell input {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: #000 !important;
  box-shadow: inset 0 0 0 3px #000;
}

.test-view.contrast-white-black .matching-grid-cell input:checked,
.test-view.contrast-white-black .matching-features-cell input:checked {
  background: #fff !important;
  border-color: #fff !important;
  box-shadow: inset 0 0 0 3px #000, 0 0 0 2px #fff;
}

.test-view.contrast-yellow-black .matching-grid-cell input:checked,
.test-view.contrast-yellow-black .matching-features-cell input:checked {
  background: #ffd400 !important;
  border-color: #ffd400 !important;
  box-shadow: inset 0 0 0 3px #000, 0 0 0 2px #ffd400;
}

.test-view.contrast-white-black .matching-grid-cell:has(input:checked),
.test-view.contrast-white-black .matching-features-cell:has(input:checked) {
  background: #2a2a2a !important;
}

.test-view.contrast-yellow-black .matching-grid-cell:has(input:checked),
.test-view.contrast-yellow-black .matching-features-cell:has(input:checked) {
  background: #332b00 !important;
}

.test-view.contrast-yellow-black .question-option input:checked+label {
  display: inline-block;
  background: #ffd400 !important;
  color: #000 !important;
  border: 1px solid #ffd400 !important;
  border-radius: 3px;
  padding: 1px 6px;
}

.test-view.contrast-yellow-black .question-option input:checked+label * {
  color: #000 !important;
}

.test-view.contrast-white-black .correct-answer-badge {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black .correct-answer-badge {
  background: #000 !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}

.test-view.contrast-white-black .matching-ending-question.is-correct,
.test-view.contrast-white-black .matching-ending-question.is-incorrect,
.test-view.contrast-white-black .matching-ending-stem,
.test-view.contrast-white-black .matching-ending-slot,
.test-view.contrast-white-black .matching-ending-slot.is-correct,
.test-view.contrast-white-black .matching-ending-slot.is-incorrect {
  background: #000 !important;
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black .matching-ending-question.is-correct,
.test-view.contrast-yellow-black .matching-ending-question.is-incorrect,
.test-view.contrast-yellow-black .matching-ending-stem,
.test-view.contrast-yellow-black .matching-ending-slot,
.test-view.contrast-yellow-black .matching-ending-slot.is-correct,
.test-view.contrast-yellow-black .matching-ending-slot.is-incorrect {
  background: #000 !important;
  background-color: #000 !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}

.test-view.contrast-white-black .matching-ending-slot-text,
.test-view.contrast-white-black .matching-ending-slot .slot-clear {
  color: #fff !important;
}

.test-view.contrast-yellow-black .matching-ending-slot-text,
.test-view.contrast-yellow-black .matching-ending-slot .slot-clear {
  color: #ffd400 !important;
}

.test-view.contrast-white-black .matching-ending-options,
.test-view.contrast-yellow-black .matching-ending-options {
  background: #000 !important;
  border-color: var(--border) !important;
}

.test-view.contrast-white-black .summary-text,
.test-view.contrast-white-black .summary-text[style],
.test-view.contrast-white-black .summary-text p,
.test-view.contrast-white-black .summary-text li,
.test-view.contrast-white-black .question-item.is-correct,
.test-view.contrast-white-black .question-item.is-incorrect,
.test-view.contrast-white-black .question-item.is-correct *,
.test-view.contrast-white-black .question-item.is-incorrect * {
  background: #000 !important;
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black .summary-text,
.test-view.contrast-yellow-black .summary-text[style],
.test-view.contrast-yellow-black .summary-text p,
.test-view.contrast-yellow-black .summary-text li,
.test-view.contrast-yellow-black .question-item.is-correct,
.test-view.contrast-yellow-black .question-item.is-incorrect,
.test-view.contrast-yellow-black .question-item.is-correct *,
.test-view.contrast-yellow-black .question-item.is-incorrect * {
  background: #000 !important;
  background-color: #000 !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}

.test-view.contrast-white-black .summary-blank.is-correct,
.test-view.contrast-white-black .summary-blank.is-incorrect {
  background: #2b2b2b !important;
  background-color: #2b2b2b !important;
  color: #fff !important;
  border-color: #fff !important;
}

.test-view.contrast-yellow-black .summary-blank.is-correct,
.test-view.contrast-yellow-black .summary-blank.is-incorrect {
  background: #2b2b2b !important;
  background-color: #2b2b2b !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}

.gap-answer-tooltip {
  position: fixed;
  z-index: 5000;
  display: none;
  pointer-events: none;
  max-width: 260px;
  padding: 5px 8px;
  border: 1px solid #d0eed8;
  border-radius: 3px;
  background: #e8f7ed;
  color: var(--success);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

.test-view.contrast-white-black~.gap-answer-tooltip,
.test-view.contrast-yellow-black~.gap-answer-tooltip {
  background: #000;
}

.test-view.contrast-white-black~.gap-answer-tooltip {
  color: #fff;
  border-color: #fff;
}

.test-view.contrast-yellow-black~.gap-answer-tooltip {
  color: #ffd400;
  border-color: #ffd400;
}

/* File Inputs in Editor */
.upload-btn-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.upload-btn-wrapper input[type=file] {
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}

.uploaded-images-indicator {
  font-size: .82rem;
  color: var(--success);
  font-weight: 700;
  margin-top: 6px;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
}

.toast {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
  font-size: .86rem;
  line-height: 1.5;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

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

.toast-success {
  border-color: #b8dfc3;
  background: #eef8f0;
  color: var(--success);
}

.toast-warning {
  border-color: #f0d48a;
  background: #fff4d6;
  color: #8a5a00;
}

.toast-error {
  border-color: #f2b8bd;
  background: #fff0f1;
  color: var(--error);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .split-pane {
    flex-direction: column;
  }

  .passage-panel {
    border-right: none;
    border-bottom: 1px solid #d0d0d0;
    max-height: 45vh;
  }

  .pane-resizer {
    display: none;
  }

  .config-row {
    flex-direction: column;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row button {
    width: 100%;
    justify-content: center;
  }

  .action-dropdown-wrapper {
    width: 100%;
  }

  .action-dropdown-menu {
    position: fixed;
    top: auto;
    right: 10px;
    left: 10px;
    min-width: auto;
  }

  .ielts-header {
    padding: 0 10px;
  }

  .timer-display {
    font-size: .76rem;
  }

  .matching-grid {
    grid-template-columns: var(--grid-columns-mobile, minmax(220px, 1.6fr) repeat(5, minmax(48px, 56px)));
  }

  .matching-features-grid {
    grid-template-columns: var(--grid-columns-mobile, minmax(220px, 1.6fr) repeat(5, minmax(48px, 56px)));
  }

  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
    max-width: none;
  }
}

/* Emergency Choice Modal */
.emergency-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.emergency-choice-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all .2s ease;
  font-family: inherit;
}

.emergency-choice-btn:hover {
  border-color: var(--accent);
  background: #f0f5ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(9, 105, 218, .12);
}

.emergency-choice-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.emergency-choice-btn .choice-btn-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .2s ease;
}

.emergency-choice-btn:hover .choice-btn-icon {
  stroke: var(--accent);
}

.emergency-choice-btn .choice-btn-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.emergency-choice-btn .choice-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.emergency-choice-btn .choice-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ── REDESIGN: ARIAL & PREMIUM BUILDERS ── */
.creator-redesign-root {
  font-family: Arial, Helvetica, sans-serif !important;
}

.creator-qs-card-redesign {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
  overflow: hidden;
}

.creator-qs-header-redesign {
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.creator-qs-badge-redesign {
  background: #eff6ff;
  color: #0969da;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #dbeafe;
}

.creator-qs-title-redesign {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.creator-table-toolbar-redesign {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fcfdfe;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
}

.wysiwyg-table-wrap-redesign {
  border: 1px solid #475569;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.wysiwyg-table-redesign {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.wysiwyg-table-redesign th {
  background: #fff;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  text-align: left;
  border-right: 1px solid #475569;
  border-bottom: 2px solid #475569;
}

.wysiwyg-table-redesign td {
  padding: 0;
  border-right: 1px solid #475569;
  border-bottom: 1px solid #475569;
  position: relative;
  background: #fff;
}

.creator-table-cell-editable-redesign {
  padding: 12px;
  outline: none;
  min-height: 44px;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
  transition: all 0.2s;
  cursor: text;
}

.creator-table-cell-editable-redesign:focus {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(9, 105, 218, 0.1);
}

.creator-cell-tools-redesign {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1e293b;
  padding: 6px;
  border-radius: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 100;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.wysiwyg-table-redesign td:focus-within .creator-cell-tools-redesign,
.wysiwyg-table-redesign td:hover .creator-cell-tools-redesign {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-4px);
}

.creator-cell-tool-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.creator-cell-tool-btn:hover {
  background: #334155;
  color: white;
}

.creator-cell-tool-btn.is-active {
  background: #0969da;
  color: white;
}

/* Flowchart Redesign */
.flowchart-canvas-redesign {
  background-color: #fcfdfe;
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  min-height: 400px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.flowchart-node-redesign {
  background: white;
  border: 2px solid var(--node-color, #3b82f6);
  border-radius: 16px;
  padding: 16px;
  width: var(--node-width, 240px);
  min-height: var(--node-height, 80px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.flowchart-node-redesign:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.flowchart-node-tag {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--node-color, #3b82f6);
  margin-bottom: 8px;
  display: block;
}

.flowchart-node-editable {
  outline: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: #1e293b;
  text-align: center;
}

.flowchart-arrow-redesign {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  position: relative;
}

.wysiwyg-gap-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #0969da;
  font-weight: 900;
  font-size: 12px;
  width: 28px;
  height: 24px;
  border-radius: 6px;
  border: 2px dashed #0969da;
  margin: 0 4px;
  vertical-align: middle;
}

/* Resizer Handles styling */
.creator-table-col-handle {
  position: absolute;
  right: -5px;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background-color 0.2s;
}
.creator-table-col-handle:hover {
  background: rgba(9, 105, 218, 0.3) !important;
}

.creator-table-row-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 10px;
  cursor: row-resize;
  z-index: 10;
  background: transparent;
  transition: background-color 0.2s;
}
.creator-table-row-handle:hover {
  background: rgba(9, 105, 218, 0.3) !important;
}
