/* ===== RESET & TOKENS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242832;
  --border: #2e3341;
  --text: #e8eaed;
  --text2: #9aa0ad;
  --primary: #357df9;
  --primary-hover: #265ab2;
  --primary-bg: rgba(53,125,249,0.10);
  --gold: #f0d68a;
  --gold-bg: rgba(240,214,138,0.10);
  --green: #4ade80;
  --green-bg: rgba(74,222,128,0.10);
  --green-border: rgba(74,222,128,0.3);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.10);
  --red-border: rgba(248,113,113,0.3);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251,191,36,0.10);
  --r: 12px;
  --rs: 8px;
  --t: 0.2s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== START SCREEN ===== */
#start-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.start-card {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.start-icon {
  color: var(--primary);
  margin-bottom: 20px;
}

.start-card h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.start-sub {
  color: var(--text2);
  font-size: 16px;
  margin-bottom: 28px;
}

.start-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 4px 0;
  margin-bottom: 28px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 14px;
}

.info-row span { color: var(--text2); }
.info-row strong { color: var(--text); }

.info-row + .info-row { border-top: 1px solid var(--border); }

.btn-start {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--r);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: all var(--t);
}

.btn-start:hover { background: var(--primary-hover); }

.btn-resume {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--primary);
  border-radius: var(--r);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--t);
}

.btn-resume:hover { background: var(--primary-bg); }

.btn-link {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  padding: 4px 8px;
}

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

#resume-row { margin-top: 12px; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 3px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 60;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  transition: width 0.4s ease;
  width: 0%;
}

/* ===== NAV STRIP ===== */
.nav-strip {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  justify-content: center;
  position: sticky;
  top: 3px;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-dot {
  width: 36px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
  background: transparent;
}

.nav-dot:hover { border-color: var(--primary); color: var(--text); }
.nav-dot.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav-dot.correct { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.nav-dot.incorrect { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

/* ===== EXAM BODY ===== */
.exam-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

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

.q-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.q-type {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-type-mc { background: var(--primary-bg); color: var(--primary); }
.q-type-fib { background: var(--yellow-bg); color: var(--yellow); }
.q-type-pc { background: rgba(168,85,247,0.12); color: #a855f7; }
.q-type-dd { background: rgba(236,72,153,0.12); color: #ec4899; }
.q-type-multcorr { background: rgba(251,146,60,0.12); color: #fb923c; }

/* Question card */
.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px;
  margin-bottom: 20px;
}

.q-text {
  font-size: 15px;
  line-height: 1.8;
}

.q-text b, .q-text strong { color: #fff; }

.q-figure {
  margin-top: 16px;
  text-align: center;
}

.q-figure:empty { display: none; }

.q-figure img, .svg-container img {
  max-width: 100%;
  height: auto;
  max-height: 380px;
  border-radius: var(--rs);
  background: #fff;
  padding: 12px;
}

.svg-container { text-align: center; margin: 16px 0; }

/* ===== MC OPTIONS ===== */
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--t);
  user-select: none;
}

.option-item:hover:not(.correct):not(.incorrect):not(.dimmed) {
  border-color: #4a5068;
  background: var(--surface2);
}

.option-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.option-item.correct { border-color: var(--green-border) !important; background: var(--green-bg) !important; cursor: default; }
.option-item.incorrect { border-color: var(--red-border) !important; background: var(--red-bg) !important; cursor: default; }
.option-item.dimmed { opacity: 0.35; cursor: default; }

.option-label {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  color: var(--text2);
  flex-shrink: 0;
  transition: all var(--t);
}

.option-item.selected .option-label { background: var(--primary); color: #fff; }
.option-item.correct .option-label { background: var(--green); color: #0f1117; }
.option-item.incorrect .option-label { background: var(--red); color: #fff; }

.option-text { font-size: 14px; line-height: 1.5; flex: 1; }

/* ===== FIB ===== */
.fib-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fib-input {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  padding: 12px 18px;
  width: 240px;
  outline: none;
  transition: all var(--t);
}

.fib-input::placeholder { color: #555; }
.fib-input:focus { border-color: var(--primary); }
.fib-input.correct { border-color: var(--green); background: var(--green-bg); }
.fib-input.incorrect { border-color: var(--red); background: var(--red-bg); }

.fib-correct { font-size: 14px; font-weight: 600; color: var(--green); }

/* ===== D&D ===== */
.dnd-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dnd-col h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  margin-bottom: 10px;
}

.dnd-item {
  padding: 12px 16px;
  background: var(--primary-bg);
  border: 1px solid rgba(108,140,255,0.2);
  border-radius: var(--rs);
  margin-bottom: 8px;
  cursor: grab;
  font-size: 13px;
  line-height: 1.5;
  transition: all var(--t);
}

.dnd-item:active { cursor: grabbing; opacity: 0.7; }
.dnd-item.dragging { opacity: 0.3; }

.dnd-zone {
  min-height: 52px;
  border: 2px dashed var(--border);
  border-radius: var(--rs);
  margin-bottom: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  transition: all var(--t);
  color: var(--text2);
}

.dnd-zone.drag-over { border-color: var(--primary); background: var(--primary-bg); }
.dnd-zone.filled { border-style: solid; border-color: var(--green-border); background: var(--green-bg); color: var(--text); }

/* ===== BUTTONS ===== */
.action-bar {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-submit {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--r);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: all var(--t);
}

.btn-submit:hover:not(:disabled) { background: var(--primary-hover); }
.btn-submit:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-next, .btn-prev {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
}

.btn-next:hover, .btn-prev:hover { border-color: var(--text2); color: var(--text); }

.action-bar .btn-next { margin-left: auto; }

/* ===== SOLUTION ===== */
.solution-card {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.solution-header {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.3px;
}

.solution-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text2);
}

.solution-body b, .solution-body strong { color: var(--text); }

/* ===== RESULTS ===== */
#results {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.results-card {
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.results-score {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 4px;
}

.results-pct {
  font-size: 20px;
  color: var(--text2);
  margin-bottom: 32px;
}

.results-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 4px 0;
  margin-bottom: 28px;
  text-align: left;
}

.rb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 14px;
}

.rb-row + .rb-row { border-top: 1px solid var(--border); }

.rb-num { font-weight: 600; min-width: 28px; }
.rb-ka { flex: 1; color: var(--text2); }
.rb-result { font-weight: 600; font-size: 13px; }
.rb-result.pass { color: var(--green); }
.rb-result.fail { color: var(--red); }

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== AIT HINT ===== */
.ait-hint {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
  font-style: italic;
}

/* ===== P&C HOTSPOT ===== */
.hotspot-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: var(--rs);
  overflow: hidden;
}

.hotspot-img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 400px;
  background: #fff;
  padding: 12px;
  border-radius: var(--rs);
}

.hotspot-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid transparent;
  border-radius: 50%;
  background: rgba(108,140,255,0.08);
  cursor: pointer;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.hotspot-btn:hover {
  background: rgba(108,140,255,0.18);
  border-color: rgba(108,140,255,0.5);
}

.hotspot-btn.selected {
  background: rgba(108,140,255,0.25);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(108,140,255,0.3);
}

.hotspot-btn.correct {
  background: rgba(74,222,128,0.2) !important;
  border-color: var(--green) !important;
  box-shadow: 0 0 12px rgba(74,222,128,0.3);
}

.hotspot-btn.incorrect {
  background: rgba(248,113,113,0.2) !important;
  border-color: var(--red) !important;
}

.hotspot-btn.dimmed { opacity: 0.25; }

.hotspot-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(15,17,23,0.8);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.hotspot-btn.correct .hotspot-label { color: var(--green); }
.hotspot-btn.incorrect .hotspot-label { color: var(--red); }

/* ===== D&D LABEL (drop zones on image) ===== */
.dnd-label-wrap {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.dnd-label-items {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dnd-label-items h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text2);
  margin: 0 0 6px;
}
.dnd-label-image-area {
  flex: 1;
  min-width: 0;
}
.dnd-zone-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(108,140,255,0.5);
  border-radius: 6px;
  background: rgba(108,140,255,0.06);
  cursor: pointer;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}
.dnd-zone-btn:hover {
  background: rgba(108,140,255,0.18);
  border-color: var(--primary);
}
.dnd-zone-btn.filled {
  border-style: solid;
  border-color: var(--primary);
  background: rgba(108,140,255,0.15);
}
.dnd-zone-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(15,17,23,0.8);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
}
.dnd-zone-btn.filled .dnd-zone-badge {
  background: var(--primary);
  color: #fff;
}
.dnd-zone-btn.label-correct {
  border-color: var(--green) !important;
  background: rgba(74,222,128,0.15) !important;
}
.dnd-zone-btn.label-correct .dnd-zone-badge {
  background: var(--green);
  color: #fff;
}
.dnd-zone-btn.label-incorrect {
  border-color: var(--red) !important;
  background: rgba(248,113,113,0.15) !important;
}
.dnd-zone-btn.label-incorrect .dnd-zone-badge {
  background: var(--red);
  color: #fff;
}

/* ===== D&D MATCH (revised) ===== */
.dnd-zone {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.dnd-zone-label {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.dnd-zone-slot {
  padding: 8px 12px;
  border: 2px dashed var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text2);
  min-height: 36px;
  transition: all var(--t);
}

.dnd-zone-slot.filled { border-style: solid; color: var(--text); }
.dnd-zone-slot.match-correct { border-color: var(--green-border); background: var(--green-bg); }
.dnd-zone-slot.match-incorrect { border-color: var(--red-border); background: var(--red-bg); }

.dnd-item.placed { opacity: 0.35; cursor: default; }
.dnd-item.dnd-active {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
  opacity: 1;
}

.dnd-zone-slot.filled { border-style: solid; color: var(--text); }

/* ===== D&D ORDER ===== */
.dnd-order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dnd-order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--rs);
  cursor: default;
  font-size: 13px;
  line-height: 1.5;
  transition: all var(--t);
  user-select: none;
}

.order-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.order-arrow-btn {
  width: 26px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 10px;
  cursor: pointer;
  transition: all var(--t);
  padding: 0;
  line-height: 1;
}
.order-arrow-btn:hover:not(:disabled) {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}
.order-arrow-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.order-item-text {
  flex: 1;
  min-width: 0;
}

.dnd-saved-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.dnd-saved-badge.visible {
  opacity: 1;
}
.dnd-order-item.order-correct { border-color: var(--green-border); background: var(--green-bg); }
.dnd-order-item.order-incorrect { border-color: var(--red-border); background: var(--red-bg); }

.order-num {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--text2);
  flex-shrink: 0;
}

.order-correct .order-num { background: var(--green); color: #0f1117; }
.order-incorrect .order-num { background: var(--red); color: #fff; }

.order-grip {
  color: var(--text2);
  font-size: 16px;
  flex-shrink: 0;
}

.dnd-correct-order {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--rs);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text2);
}

.dnd-correct-order strong { color: var(--green); }

/* ===== MULTCORR CHECKBOX ===== */
.mc-checkbox {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all var(--t);
  position: relative;
}

.mc-checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
}

.mc-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.option-item.correct .mc-checkbox { background: var(--green); border-color: var(--green); }
.option-item.incorrect .mc-checkbox { background: var(--red); border-color: var(--red); }

.multcorr-item { gap: 12px; }
.multcorr-item .option-label::before { display: none; }

/* ===== USER HEADER (app.html) ===== */
.user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* ===== SHARED TOOLBAR (simulator + workbook) ===== */
.wb-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wb-toolbar-left img {
  width: 24px;
  height: auto;
}

.wb-toolbar-left span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wb-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wb-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text2);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t);
}

.wb-back:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.user-email {
  font-size: 13px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ===== LANDING PAGE ===== */
.landing-page {
  background: var(--bg);
}

.landing-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.landing-card {
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.landing-icon {
  color: var(--primary);
  margin-bottom: 20px;
}

.landing-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.landing-subtitle {
  font-size: 18px;
  color: var(--text2);
  margin-bottom: 24px;
}

.landing-desc {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 32px;
}

.landing-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
}

.landing-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}

.landing-feature svg {
  color: var(--primary);
  flex-shrink: 0;
}

.btn-cta {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  border: none;
  border-radius: var(--r);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: all var(--t);
}

.btn-cta:hover { background: var(--primary-hover); }

.landing-note {
  font-size: 12px;
  color: var(--text2);
  margin-top: 16px;
  opacity: 0.7;
}

/* ===== AUTH PAGE (login.html) ===== */
.auth-page {
  background: var(--bg);
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  max-width: 400px;
  width: 100%;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand svg {
  color: var(--primary);
  margin-bottom: 12px;
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-brand p {
  font-size: 14px;
  color: var(--text2);
}

/* Toggle tabs */
.auth-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-toggle-btn {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--rs);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
}

.auth-toggle-btn.active {
  background: var(--gold);
  color: var(--primary);
}

.auth-toggle-btn:not(.active):hover {
  color: var(--text);
}

/* Error / Success messages */
.auth-error {
  padding: 12px 16px;
  border-radius: var(--rs);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-success {
  padding: 12px 16px;
  border-radius: var(--rs);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.form-group input {
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  outline: none;
  transition: all var(--t);
}

.form-group input::placeholder { color: #555; }
.form-group input:focus { border-color: var(--primary); }

.btn-auth-submit {
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--r);
  background: var(--gold);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-auth-submit:hover:not(:disabled) { background: #e6c870; }
.btn-auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.8s linear infinite; }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
}

/* OAuth buttons */
.oauth-buttons {
  display: flex;
  gap: 12px;
}

.btn-oauth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--t);
}

.btn-oauth:hover {
  border-color: #4a5068;
  background: var(--surface2);
}

/* Back link */
.auth-back {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
}

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

/* Forgot password link */
.auth-forgot {
  display: block;
  text-align: right;
  margin-top: -4px;
  font-size: 0.85rem;
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
}
.auth-forgot:hover { color: var(--gold); }

/* ===== DASHBOARD ===== */
.dashboard-page { background: var(--bg); }

.dash-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.dash-header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.dash-brand svg { color: var(--primary); }

.dash-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 20px 60px;
}

.dash-welcome {
  margin-bottom: 36px;
}

.dash-welcome h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.dash-welcome p {
  font-size: 15px;
  color: var(--text2);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 32px 28px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--t);
  display: flex;
  flex-direction: column;
  position: relative;
}

a.dash-card:hover {
  border-color: var(--gold);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.dash-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.dash-card-icon--sim {
  background: var(--primary-bg);
  color: var(--primary);
}

.dash-card-icon--book {
  background: rgba(251,191,36,0.10);
  color: var(--yellow);
}

.dash-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.dash-card p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text2);
  flex: 1;
}

.dash-card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

.dash-card-action--disabled {
  color: var(--text2);
  opacity: 0.5;
}

.dash-card--soon {
  opacity: 0.6;
  cursor: default;
}

.dash-product {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dash-banner {
  width: 100%;
  text-align: center;
  padding: 14px 20px;
  background: var(--primary);
  border: 1.5px solid var(--gold);
  border-radius: var(--r);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.dash-card-white {
  width: 100%;
  background: #fff;
  border-radius: var(--r);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-card-img-wrap {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dash-card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dash-btn-gold {
  display: inline-block;
  padding: 14px 32px;
  background: var(--gold);
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  border-radius: var(--r);
  transition: all var(--t);
  text-align: center;
}

.dash-btn-gold:hover {
  background: #e6c870;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(240,214,138,0.3);
}

.dash-btn-orange {
  display: inline-block;
  padding: 14px 32px;
  background: #E87A2D;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  border-radius: var(--r);
  transition: all var(--t);
  text-align: center;
}

.dash-btn-orange:hover {
  background: #d46a20;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(232,122,45,0.3);
}

.dash-card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--yellow-bg);
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================
   EXAM MODE — White theme for NCEES-style simulator
   ============================================================= */
.exam-mode {
  --exam-bg: #f5f6f8;
  --exam-surface: #ffffff;
  --exam-border: #dee2e6;
  --exam-text: #212529;
  --exam-text2: #6c757d;
  --exam-blue: #357df9;
  --exam-orange: #e8a020;

  background: var(--exam-bg);
  color: var(--exam-text);
}

/* ── Instructions screen ── */
#instructions-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.instr-card {
  max-width: 580px;
  width: 100%;
  background: var(--exam-surface);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.instr-logo {
  text-align: center;
  margin-bottom: 16px;
}

.instr-title {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--exam-text);
  letter-spacing: -0.3px;
}

.instr-sub {
  text-align: center;
  font-size: 15px;
  color: var(--exam-text2);
  margin-bottom: 28px;
}

.instr-section {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--exam-border);
}

.instr-section:last-of-type {
  margin-bottom: 28px;
}

.instr-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(53,125,249,0.08);
  color: var(--exam-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.instr-section > div > strong:first-child {
  font-size: 14px;
  color: var(--exam-text);
  display: block;
  margin-bottom: 4px;
}

.instr-section p strong {
  color: var(--exam-text);
}

.instr-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--exam-text2);
  margin: 0;
}

.instr-section a {
  color: var(--exam-blue);
  text-decoration: underline;
}

.btn-start-exam {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  background: var(--exam-blue);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-start-exam:hover {
  background: #265ab2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(53,125,249,0.3);
}

.btn-resume-exam {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--exam-blue);
  border-radius: 12px;
  background: transparent;
  color: var(--exam-blue);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.btn-resume-exam:hover {
  background: rgba(53,125,249,0.06);
}

.instr-btn-row {
  display: flex;
  gap: 12px;
}

.instr-btn-row .btn-resume-exam {
  flex: 1;
  margin-bottom: 0;
}

.btn-fresh-exam {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--exam-border);
  border-radius: 12px;
  background: transparent;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-fresh-exam:hover {
  border-color: var(--exam-text2);
  color: var(--exam-text);
}

.exam-mode #resume-row {
  margin-top: 12px;
}

.instr-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--exam-text2);
  text-decoration: none;
  transition: color 0.2s;
}

.instr-back:hover {
  color: var(--exam-blue);
}

/* ── Exam toolbar (sticky top) ── */
.exam-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 52px;
  background: var(--exam-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  gap: 12px;
}

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

.et-logo {
  width: 24px;
  height: auto;
}

.et-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.et-center {
  display: contents;
}

/* ── Flip clock ── */
.flip-clock {
  display: flex;
  align-items: center;
  gap: 3px;
}

.flip-unit {
  display: flex;
  gap: 3px;
}

.flip-card {
  width: 30px;
  height: 42px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #111;
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.06),
    0 3px 6px rgba(0,0,0,0.5);
}

/* Top half — slightly lighter */
.flip-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, #2a2a3a 0%, #1e1e2e 100%);
  border-radius: 5px 5px 0 0;
}

/* Bottom half — darker */
.flip-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, #181828 0%, #141424 100%);
  border-radius: 0 0 5px 5px;
  border-top: 1px solid rgba(0,0,0,0.7);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.flip-card span {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #e8e8f0;
  letter-spacing: 0;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.flip-sep {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  padding: 0 1px;
  margin-top: -2px;
}

/* Warning state (< 10 min) */
.flip-clock.timer-warning .flip-card::before {
  background: linear-gradient(180deg, #3d1525 0%, #2e0e1c 100%);
}

.flip-clock.timer-warning .flip-card::after {
  background: linear-gradient(180deg, #280a18 0%, #200814 100%);
  border-top-color: rgba(0,0,0,0.8);
}

.flip-clock.timer-warning .flip-card span {
  color: #ff6b6b;
  text-shadow: 0 0 8px rgba(255,80,80,0.4);
}

.flip-clock.timer-warning .flip-sep {
  color: rgba(255,107,107,0.5);
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes flipAnim {
  0%   { transform: perspective(200px) rotateX(0deg); }
  50%  { transform: perspective(200px) rotateX(-15deg); }
  100% { transform: perspective(200px) rotateX(0deg); }
}

.flip-card.flip-anim {
  animation: flipAnim 0.35s ease-in-out;
}

/* Break timer button */
.et-break-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.et-break-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.et-break-btn.break-ready {
  border-color: var(--exam-orange);
  color: var(--exam-orange);
  background: rgba(232,160,32,0.15);
}

/* Large flip clock (break modal) */
.flip-card-lg {
  width: 52px;
  height: 72px;
  border-radius: 8px;
}

.flip-card-lg span {
  font-size: 36px;
}

.flip-unit-lg {
  gap: 4px;
}

.flip-sep-lg {
  font-size: 34px;
  padding: 0 6px;
  color: var(--exam-text2);
  margin-top: -2px;
}

.flip-clock-lg .flip-card {
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.5),
    0 4px 12px rgba(0,0,0,0.12);
}

.flip-clock-lg .flip-card::before {
  background: linear-gradient(180deg, #f0f1f3 0%, #e4e5e9 100%);
}

.flip-clock-lg .flip-card::after {
  background: linear-gradient(180deg, #d8d9dd 0%, #d0d1d5 100%);
  border-top-color: rgba(0,0,0,0.12);
}

.flip-clock-lg .flip-card span {
  color: #1a1a2e;
  text-shadow: none;
}

/* Break modal extras */
.break-box {
  max-width: 440px;
}

.break-info {
  font-size: 14px;
  line-height: 1.7;
  color: var(--exam-text2);
  margin-bottom: 24px;
}

.break-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.break-label {
  font-size: 12px;
  color: var(--exam-text2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.et-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  overflow: hidden;
}

.et-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.et-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.et-btn.flagged {
  background: var(--exam-orange);
  border-color: var(--exam-orange);
}

.et-btn-end {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  font-weight: 700;
}

.et-btn-end:hover {
  background: rgba(255,60,60,0.3);
  border-color: #ff6b6b;
}

/* ── Exam body (white) ── */
.exam-body-wrap {
  min-height: calc(100vh - 52px - 56px);
  padding-bottom: 20px;
}

.exam-mode .exam-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

.exam-mode .q-header {
  margin-bottom: 16px;
}

.exam-mode .q-number {
  color: var(--exam-text2);
  font-size: 14px;
}

.exam-mode .q-type {
  font-size: 11px;
}

.exam-mode .q-card {
  background: var(--exam-surface);
  border: 1px solid var(--exam-border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.exam-mode .q-text {
  font-family: 'STIX Two Text', 'Times New Roman', 'Latin Modern Roman', Georgia, serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--exam-text);
}

.exam-mode .q-text .MathJax {
  font-size: 1em !important;
}

.exam-mode .q-text b, .exam-mode .q-text strong {
  color: var(--exam-text);
}

/* NCEES-style options: radio circle + letter + text */
.exam-mode .answer-area {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--exam-border);
}

.exam-mode .options-list {
  gap: 4px;
}

.exam-mode .option-item {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  gap: 10px;
  color: var(--exam-text);
  font-family: 'STIX Two Text', 'Times New Roman', 'Latin Modern Roman', Georgia, serif;
  font-size: 18px;
}

.exam-mode .option-item:hover:not(.correct):not(.incorrect):not(.dimmed) {
  background: #f0f1f3;
  border: none;
}

.exam-mode .option-item.selected {
  background: rgba(53,125,249,0.06);
  border: none;
}

.exam-mode .option-label {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  color: var(--exam-text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-mode .option-label::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #adb5bd;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.exam-mode .option-item.selected .option-label {
  background: transparent;
  color: var(--exam-blue);
}

.exam-mode .option-item.selected .option-label::before {
  border-color: var(--exam-blue);
  background: var(--exam-blue);
  box-shadow: inset 0 0 0 3px #fff;
}

.exam-mode .option-text {
  color: var(--exam-text);
  font-size: 14px;
}

.exam-mode .fib-input {
  background: var(--exam-surface);
  border: 2px solid var(--exam-border);
  color: var(--exam-text);
}

.exam-mode .fib-input::placeholder {
  color: #adb5bd;
}

.exam-mode .fib-input:focus {
  border-color: var(--exam-blue);
}

.exam-mode .ait-hint {
  color: var(--exam-text2);
}

.exam-mode .dnd-item {
  background: rgba(53,125,249,0.06);
  border-color: rgba(53,125,249,0.2);
  color: var(--exam-text);
}

.exam-mode .dnd-zone {
  border-color: var(--exam-border);
  color: var(--exam-text2);
}

.exam-mode .dnd-zone-label {
  color: var(--exam-text);
}

.exam-mode .dnd-zone-slot {
  border-color: var(--exam-border);
  color: var(--exam-text2);
}

.exam-mode .dnd-order-item {
  background: var(--exam-surface);
  border-color: var(--exam-border);
  color: var(--exam-text);
}

.exam-mode .order-num {
  background: #e9ecef;
  color: var(--exam-text2);
}

.exam-mode .order-arrows {
  /* inherits fine */
}
.exam-mode .order-arrow-btn {
  border-color: var(--exam-border);
  background: #e9ecef;
  color: var(--exam-text2);
}
.exam-mode .order-arrow-btn:hover:not(:disabled) {
  background: rgba(53,125,249,0.1);
  border-color: var(--exam-blue);
  color: var(--exam-blue);
}
.exam-mode .dnd-item.dnd-active {
  border-color: var(--exam-blue);
  background: rgba(53,125,249,0.12);
  box-shadow: 0 0 0 3px rgba(53,125,249,0.2);
}
.exam-mode .dnd-zone-slot.filled {
  border: 2px solid var(--exam-blue);
  background: rgba(53,125,249,0.08);
  color: var(--exam-blue);
  font-weight: 600;
}
.exam-mode .dnd-saved-badge {
  color: #28a745;
}

.exam-mode .mc-checkbox {
  border-color: var(--exam-border);
}

.exam-mode .hotspot-label {
  background: rgba(0,0,0,0.7);
}

/* ── Bottom nav strip ── */
.exam-nav-bottom {
  position: sticky;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--exam-surface);
  border-top: 1px solid var(--exam-border);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

.en-prev, .en-next {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--exam-border);
  border-radius: 8px;
  background: var(--exam-surface);
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.en-prev:hover, .en-next:hover {
  border-color: var(--exam-blue);
  color: var(--exam-blue);
}

.en-dots {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  max-width: 70%;
  overflow: hidden;
}

.exam-mode .nav-dot {
  width: 34px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--exam-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--exam-surface);
}

.exam-mode .nav-dot:hover {
  border-color: var(--exam-blue);
  color: var(--exam-text);
}

.exam-mode .nav-dot.answered {
  background: rgba(53,125,249,0.1);
  border-color: var(--exam-blue);
  color: var(--exam-blue);
}

.exam-mode .nav-dot.flagged {
  background: rgba(232,160,32,0.12);
  border-color: #c87a00;
  color: #c87a00;
}

/* current always wins over answered/flagged */
.exam-mode .nav-dot.current,
.exam-mode .nav-dot.current.answered {
  background: var(--exam-blue);
  color: #fff;
  border-color: var(--exam-blue);
}

.exam-mode .nav-dot.current.flagged {
  background: #c87a00;
  color: #fff;
  border-color: #c87a00;
}

/* Nav page arrows */
.nav-page-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--exam-text2);
  padding: 0 6px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.nav-page-btn:hover { color: var(--exam-blue); }

/* Nav legend */
.nav-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 4px 0 0;
  font-size: 11px;
  color: var(--exam-text2);
}
.nav-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid;
}
.legend-current { background: var(--exam-blue); border-color: var(--exam-blue); }
.legend-answered { background: rgba(53,125,249,0.1); border-color: var(--exam-blue); }
.legend-flagged { background: rgba(232,160,32,0.12); border-color: #c87a00; }
.legend-unanswered { background: var(--exam-surface); border-color: var(--exam-border); }

/* Review mode nav dots (correct/incorrect) */
.exam-mode .nav-dot.correct {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

.exam-mode .nav-dot.incorrect {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

/* ── End exam modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--exam-surface);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  text-align: center;
}

.modal-box h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--exam-text);
  margin-bottom: 16px;
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.modal-stat {
  font-size: 14px;
  color: var(--exam-text2);
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.modal-stat.flagged {
  background: rgba(232,160,32,0.1);
  color: #c87a00;
}

.modal-stat.unanswered {
  background: rgba(248,113,113,0.08);
  color: #dc3545;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-btn-primary {
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  background: #dc3545;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-primary:hover {
  background: #c82333;
}

.modal-btn-review {
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--exam-blue);
  border-radius: 10px;
  background: transparent;
  color: var(--exam-blue);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-review:hover {
  background: rgba(53,125,249,0.06);
}

.modal-btn-secondary {
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--exam-border);
  border-radius: 10px;
  background: transparent;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-secondary:hover {
  border-color: var(--exam-text2);
  color: var(--exam-text);
}

.modal-btn-danger-outline {
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--exam-border);
  border-radius: 10px;
  background: transparent;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn-danger-outline:hover {
  border-color: #dc3545;
  color: #dc3545;
}

.modal-warning {
  font-size: 14px;
  line-height: 1.7;
  color: #dc3545;
  background: rgba(220,53,69,0.06);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

/* ── Review screen (pre-submit grid) ── */
#review-screen {
  min-height: 100vh;
  padding: 60px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.review-wrap {
  max-width: 600px;
  width: 100%;
}

.review-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--exam-text);
  margin-bottom: 8px;
}

.review-sub {
  font-size: 14px;
  color: var(--exam-text2);
  margin-bottom: 24px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}

.review-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--exam-border);
  border-radius: 10px;
  background: var(--exam-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.review-cell:hover {
  border-color: var(--exam-blue);
  transform: translateY(-1px);
}

.review-cell.answered {
  background: rgba(53,125,249,0.08);
  border-color: var(--exam-blue);
}

.review-cell.flagged {
  background: rgba(232,160,32,0.1);
  border-color: var(--exam-orange);
}

.review-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--exam-text2);
}

.review-cell.answered .review-num {
  color: var(--exam-blue);
}

.review-cell.flagged .review-num {
  color: #c87a00;
}

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

.review-actions .modal-btn-secondary,
.review-actions .modal-btn-primary {
  flex: 1;
}

/* ── Results screen ── */
#results-screen {
  min-height: 100vh;
  padding: 60px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.results-wrap {
  max-width: 780px;
  width: 100%;
}

.results-header {
  text-align: center;
  margin-bottom: 36px;
  padding: 32px;
  background: var(--exam-surface);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.results-score-big {
  font-size: 56px;
  font-weight: 800;
  color: var(--exam-text);
  letter-spacing: -2px;
}

.exam-mode .results-pct {
  font-size: 22px;
  color: var(--exam-text2);
  margin-bottom: 8px;
}

.results-time {
  font-size: 14px;
  color: var(--exam-text2);
}

.results-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--exam-text);
  margin-bottom: 16px;
}

.results-ka-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.ka-row {
  background: var(--exam-surface);
  border: 1px solid var(--exam-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.ka-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ka-label {
  font-size: 13px;
  color: var(--exam-text);
  font-weight: 500;
}

.ka-score {
  font-size: 13px;
  font-weight: 700;
  color: var(--exam-text2);
}

.ka-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.ka-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.ka-bar-fill.pass {
  background: #28a745;
}

.ka-bar-fill.fail {
  background: #dc3545;
}

.exam-mode .results-actions {
  display: flex;
  gap: 12px;
}

.btn-results-review {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  background: var(--exam-blue);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-results-review:hover {
  background: #265ab2;
}

.btn-results-new {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid var(--exam-border);
  border-radius: 12px;
  background: transparent;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-results-new:hover {
  border-color: var(--exam-text2);
  color: var(--exam-text);
}

.btn-results-dashboard {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--exam-border);
  border-radius: 10px;
  background: transparent;
  color: var(--exam-text2);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}
.btn-results-dashboard:hover {
  border-color: var(--exam-text2);
  color: var(--exam-text);
}

/* ===== DIAGNOSTIC REPORT ===== */
.diag-disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #856404;
  line-height: 1.55;
}
.diag-disclaimer svg { flex-shrink: 0; color: #e8a020; margin-top: 1px; }
.diag-disclaimer strong { display: block; font-size: 13px; margin-bottom: 3px; color: #664d03; }

.diag-header {
  text-align: center;
  padding: 24px;
  background: var(--exam-surface);
  border: 1px solid var(--exam-border);
  border-radius: 14px;
  margin-bottom: 20px;
}
.diag-header img { width: 44px; height: auto; margin-bottom: 10px; }
.diag-header h2 { font-size: 20px; font-weight: 700; color: var(--exam-text); margin-bottom: 2px; }
.diag-header-sub { font-size: 14px; color: var(--exam-text2); margin-bottom: 14px; }
.diag-header-meta { display: flex; justify-content: center; gap: 20px; font-size: 12px; color: var(--exam-text2); flex-wrap: wrap; }
.diag-header-meta span { display: flex; align-items: center; gap: 4px; }

.diag-overall {
  text-align: center;
  padding: 22px;
  background: var(--exam-surface);
  border-radius: 14px;
  margin-bottom: 20px;
  border: 2px solid var(--exam-border);
}
.diag-verdict { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.diag-verdict.diag-pass { color: #28a745; border-color: #28a74533; }
.diag-verdict.diag-fail { color: #dc3545; border-color: #dc354533; }
.diag-overall.pass-border { border-color: rgba(40,167,69,0.25); }
.diag-overall.fail-border { border-color: rgba(220,53,69,0.25); }
.diag-overall-score { font-size: 17px; color: var(--exam-text); font-weight: 600; margin-bottom: 6px; }
.diag-overall-note { font-size: 11px; color: var(--exam-text2); font-style: italic; }

.diag-table-wrap {
  background: var(--exam-surface);
  border-radius: 14px;
  border: 1px solid var(--exam-border);
  overflow: hidden;
  margin-bottom: 4px;
}
.diag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diag-table thead { background: #f1f3f5; }
.diag-table th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--exam-text);
  border-bottom: 2px solid var(--exam-border);
  white-space: nowrap;
  font-size: 12px;
}
.diag-table th:first-child { text-align: center; width: 36px; }
.diag-table th:nth-child(3) { text-align: center; width: 52px; }
.diag-table th:nth-child(4) { text-align: center; width: 56px; }
.diag-table th:last-child { width: 190px; }
.diag-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--exam-border);
  vertical-align: middle;
  color: var(--exam-text);
}
.diag-table td:first-child { text-align: center; font-weight: 700; }
.diag-table td:nth-child(3),
.diag-table td:nth-child(4) { text-align: center; }
.diag-table tbody tr:last-child td { border-bottom: none; }

.diag-bar-cell { position: relative; }
.diag-bar-track {
  height: 16px;
  background: #e9ecef;
  border-radius: 3px;
  position: relative;
  overflow: visible;
}
.diag-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
  min-width: 2px;
}
.diag-bar-fill.sig-below { background: #dc3545; }
.diag-bar-fill.below { background: #fd7e14; }
.diag-bar-fill.near-above { background: #28a745; }
.diag-threshold-line {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 0;
  border-left: 2px dashed #212529;
  z-index: 2;
}

.diag-legend {
  display: flex;
  gap: 14px;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--exam-text2);
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.diag-legend-item { display: flex; align-items: center; gap: 5px; }
.diag-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.diag-legend-dot.sig-below { background: #dc3545; }
.diag-legend-dot.below { background: #fd7e14; }
.diag-legend-dot.near-above { background: #28a745; }
.diag-legend-line { width: 14px; height: 0; border-top: 2px dashed #212529; }

.diag-priorities { margin-bottom: 28px; }
.diag-priorities h3 { font-size: 15px; font-weight: 700; color: var(--exam-text); margin-bottom: 10px; }
.diag-priority-list { display: flex; flex-direction: column; gap: 6px; }
.diag-priority-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--exam-surface);
  border: 1px solid var(--exam-border);
  border-radius: 8px;
}
.diag-priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.diag-priority-dot.sig-below { background: #dc3545; }
.diag-priority-dot.below { background: #fd7e14; }
.diag-priority-info { flex: 1; }
.diag-priority-ka { font-size: 13px; font-weight: 600; color: var(--exam-text); }
.diag-priority-label { font-size: 11px; color: var(--exam-text2); }
.diag-priority-score { font-size: 13px; font-weight: 700; color: var(--exam-text2); white-space: nowrap; }
.diag-congrats { text-align: center; padding: 16px; font-size: 14px; color: #28a745; font-weight: 600; }

@media (max-width: 640px) {
  .diag-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .diag-table { min-width: 580px; }
  .diag-header-meta { flex-direction: column; gap: 4px; }
  .diag-verdict { font-size: 22px; }
  .diag-overall-score { font-size: 15px; }
  .diag-disclaimer { flex-direction: column; }
}

/* LaTeX table styles */
.latex-table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.latex-table td {
  padding: 6px 12px;
  border: 1px solid var(--exam-border);
}

/* ── Review mode (post-exam) ── */
.review-toolbar {
  background: #495057;
}

.exam-mode .solution-card {
  margin-top: 24px;
  background: var(--exam-surface);
  border: 1px solid var(--exam-border);
  border-radius: 12px;
  overflow: hidden;
}

.exam-mode .solution-header {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--exam-blue);
  background: rgba(53,125,249,0.06);
  border-bottom: 1px solid var(--exam-border);
}

.exam-mode .solution-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--exam-text2);
}

.exam-mode .solution-body b, .exam-mode .solution-body strong {
  color: var(--exam-text);
}

/* Review mode feedback colors */
.exam-mode .option-item.correct {
  background: var(--green-bg) !important;
  border: none !important;
}

.exam-mode .option-item.incorrect {
  background: var(--red-bg) !important;
  border: none !important;
}

.exam-mode .option-item.dimmed {
  opacity: 0.35;
}

.exam-mode .option-item.correct .option-label {
  background: transparent;
  color: var(--green);
}

.exam-mode .option-item.correct .option-label::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px #fff;
}

.exam-mode .option-item.incorrect .option-label {
  background: transparent;
  color: var(--red);
}

.exam-mode .option-item.incorrect .option-label::before {
  border-color: var(--red);
  background: var(--red);
  box-shadow: inset 0 0 0 3px #fff;
}

.exam-mode .option-item.dimmed .option-label::before {
  border-color: #dee2e6;
  background: transparent;
}

.exam-mode .fib-input.correct {
  border-color: var(--green);
  background: var(--green-bg);
}

.exam-mode .fib-input.incorrect {
  border-color: var(--red);
  background: var(--red-bg);
}

.exam-mode .fib-correct {
  font-size: 14px;
  font-weight: 600;
  color: #28a745;
}

.exam-mode .dnd-correct-order {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--exam-text2);
}

.exam-mode .dnd-correct-order strong {
  color: #28a745;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .et-btn-label { display: none; }
  .et-btn { min-width: auto; padding: 6px 10px; }
}
@media (max-width: 900px) {
  .et-title { display: none; }
  .et-right { gap: 4px; }
  .et-btn { padding: 5px 8px; }
  .et-btn svg { width: 16px; height: 16px; }
  .flip-card { width: 24px; height: 34px; }
  .flip-card span { font-size: 17px; }
  .et-break-btn span { display: none; }
}
@media (max-width: 750px) {
  .et-logo { display: none; }
  .exam-toolbar { padding: 0 8px; gap: 4px; }
  .et-btn { padding: 4px 7px; }
  #btn-calculator { display: none; }
}
@media (max-width: 600px) {
  .flip-card { width: 20px; height: 28px; }
  .flip-card span { font-size: 14px; }
  .flip-sep { font-size: 14px; padding: 0 1px; }
  .et-break-btn { display: none; }
  .et-btn { padding: 4px 6px; }
  .et-btn svg { width: 14px; height: 14px; }
  .et-btn-end { font-size: 11px; padding: 4px 8px; }
}

@media (max-width: 640px) {
  .q-card { padding: 20px; }
  .exam-body { padding: 16px 12px 40px; }
  .dnd-wrap { grid-template-columns: 1fr; }
  .fib-input { width: 100%; }
  .nav-dot { width: 28px; height: 26px; font-size: 11px; }
  .action-bar { flex-wrap: wrap; }
  .landing-title { font-size: 28px; }
  .oauth-buttons { flex-direction: column; }
  .user-header { padding: 8px 12px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-content { padding: 32px 16px 40px; }
  .dash-welcome h1 { font-size: 24px; }

  /* Exam mode mobile — handled by 600px/750px/900px breakpoints above */
  .exam-mode .exam-body { padding: 16px 14px 32px; }
  .exam-mode .q-card { padding: 20px; }
  .en-dots { max-width: 50%; }
  .en-prev span, .en-next span { display: none; }
  .en-prev, .en-next { padding: 8px 10px; }
  .instr-card { padding: 28px 20px; }
  .instr-title { font-size: 22px; }
  .review-grid { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
  .review-actions { flex-direction: column; }
  .exam-mode .results-actions { flex-direction: column; }
  .results-score-big { font-size: 44px; }
  .modal-box { padding: 24px 20px; }
}
