/* ================================================================
   GMAT Simulator — Vanset-style theme
   Header: #1a3a5c (deep navy)
   Primary btn: #0066cc  Secondary: #ff9900  Dark: #2c3e50
   Background: #f0f2f5
   ================================================================ */

:root {
  --header-bg: #1a3a5c;
  --header-text: #e8eaed;
  --primary: #0066cc;
  --primary-hover: #0055aa;
  --secondary: #ff9900;
  --secondary-hover: #e68a00;
  --dark: #2c3e50;
  --dark-hover: #1a252f;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1f2328;
  --text-muted: #6b7280;
  --border: #d1d5db;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
       "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 8px 20px; border: none; border-radius: 4px;
  cursor: pointer; font-size: 14px; font-weight: 600; transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-blue { background: var(--primary); color: #fff; }
.btn-blue:hover { background: var(--primary-hover); }
.btn-orange { background: var(--secondary); color: #fff; }
.btn-orange:hover { background: var(--secondary-hover); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--dark-hover); }
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ==================== LOGIN ==================== */
#screen-login {
  justify-content: center; align-items: center;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%);
}
.login-card {
  background: var(--card-bg); border-radius: 12px; padding: 40px 36px;
  width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-logo {
  font-size: 28px; font-weight: 800; text-align: center;
  margin-bottom: 8px; color: var(--header-bg);
}
.login-card h2 { text-align: center; margin-bottom: 24px; color: var(--text-muted); }
.login-card input {
  width: 100%; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px; outline: none;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,.15); }
.login-card button { width: 100%; margin-top: 6px; }
.login-switch { text-align: center; margin-top: 18px; color: var(--text-muted); font-size: 13px; }
.login-switch a { color: var(--primary); text-decoration: none; }
.login-switch a:hover { text-decoration: underline; }

/* ==================== HOME ==================== */
.app-header {
  background: var(--header-bg); color: var(--header-text);
  padding: 10px 24px; display: flex; justify-content: space-between;
  align-items: center;
}
.app-brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.app-user { font-size: 13px; opacity: .85; }
.app-user a { color: inherit; text-decoration: none; margin-left: 10px; opacity: .7; }
.app-user a:hover { opacity: 1; text-decoration: underline; }

.home-body { max-width: 900px; margin: 24px auto; padding: 0 16px; width: 100%; }

.mode-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.mode-card h3 { margin-bottom: 16px; font-size: 17px; }
.hint { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; line-height: 1.5; }

.mode-btns { display: flex; gap: 10px; }
.mode-btn {
  flex: 1; padding: 12px; border: 2px solid var(--border); border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 15px; font-weight: 600;
  transition: .15s;
}
.mode-btn.active { border-color: var(--primary); background: rgba(0,102,204,.06); color: var(--primary); }
.mode-btn:hover:not(.active) { border-color: var(--primary); }

.settings-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.settings-table td { padding: 8px 6px; border-bottom: 1px solid #eee; font-size: 14px; }
.settings-table td:first-child { font-weight: 600; width: 30%; }
.settings-table select, .settings-table input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; width: 100%;
}

.practice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.practice-grid label { font-size: 14px; font-weight: 600; }
.practice-grid label select, .practice-grid label input {
  display: block; width: 100%; margin-top: 4px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px;
}

/* history */
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid #eee; font-size: 14px;
}
.history-item:last-child { border-bottom: none; }
.hist-score { font-weight: 700; color: var(--primary); font-size: 16px; }
.hist-date { color: var(--text-muted); font-size: 12px; }

/* ==================== EXAM (Vanset) ==================== */
#screen-exam {
  flex-direction: column; height: 100vh; overflow: hidden;
}
.exam-header {
  background: var(--header-bg); color: var(--header-text);
  padding: 8px 20px; display: flex; align-items: center; gap: 20px;
  font-size: 13px; flex-shrink: 0;
}
.exam-brand { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.exam-title { flex: 1; text-align: center; opacity: .85; }
.exam-timer { font-family: "Courier New", monospace; font-size: 16px;
             font-weight: 700; min-width: 60px; text-align: right; }

.exam-subbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 6px 20px; display: flex; align-items: center; gap: 16px;
  font-size: 13px; flex-shrink: 0;
}
.mark-label { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.q-counter { display: flex; align-items: center; gap: 4px; }
.q-counter input {
  width: 48px; padding: 2px 6px; border: 1px solid var(--border);
  border-radius: 3px; text-align: center; font-size: 14px; font-weight: 700;
}
.instructions-link { color: var(--primary); text-decoration: none; margin-left: auto; }
.instructions-link:hover { text-decoration: underline; }

.exam-body {
  flex: 1; overflow-y: auto; padding: 24px 32px;
  position: relative; background: #fafbfc;
}
.question-area { max-width: 860px; margin: 0 auto; }
.stem {
  font-size: 15.5px; line-height: 1.75; margin-bottom: 20px;
  word-wrap: break-word;
}
/* MathJax container sizing */
.stem .MathJax, .stem .math { white-space: nowrap; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option-label {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px;
  border: 2px solid transparent; border-radius: 6px; cursor: pointer;
  transition: .12s; font-size: 15px; line-height: 1.55;
}
.option-label:hover { background: rgba(0,102,204,.04); }
.option-label.selected { background: rgba(0,102,204,.08); border-color: var(--primary); }
.option-label.correct { background: rgba(22,163,74,.08); border-color: #16a34a; }
.option-label.wrong { background: rgba(220,38,38,.06); border-color: #dc2626; }
.option-label input[type=radio] { margin-top: 4px; flex-shrink: 0; }
.option-text { flex: 1; }

.font-controls {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px; z-index: 5;
}
.font-controls button {
  width: 32px; height: 32px; border: 1px solid var(--border);
  border-radius: 4px; background: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.font-controls button:hover { background: #f0f0f0; }

/* toolbar */
.exam-toolbar {
  background: #fff; border-top: 1px solid var(--border);
  padding: 8px 20px; display: flex; align-items: center; gap: 12px;
  flex-shrink: 0; flex-wrap: wrap;
}
.toolbar-left, .toolbar-center, .toolbar-right { display: flex; gap: 8px; align-items: center; }
.toolbar-center { flex: 1; justify-content: center; }
.toolbar-right { margin-left: auto; }
.chk-wrap {
  display: flex; align-items: center; gap: 4px; font-size: 13px;
  cursor: pointer; user-select: none; white-space: nowrap;
}

/* overlays */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 100; display: flex; align-items: center; justify-content: center;
}
.overlay-box {
  background: var(--card-bg); border-radius: 12px; padding: 28px 32px;
  max-width: 580px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,.3);
}
.overlay-wide { max-width: 800px; }
.overlay-box h3 { margin-bottom: 16px; font-size: 18px; }
.overlay-box ul { padding-left: 20px; line-height: 1.8; }
.overlay-box ul li { margin-bottom: 6px; }

.list-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px; margin-bottom: 16px;
}
.list-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: .1s;
}
.list-cell:hover { border-color: var(--primary); background: rgba(0,102,204,.05); }
.list-cell.answered { background: rgba(0,102,204,.1); border-color: var(--primary); }
.list-cell.marked { background: rgba(255,153,0,.1); border-color: var(--secondary); }
.list-cell.current { border: 2px solid var(--primary); font-weight: 700; }
.list-cell.correct { background: rgba(22,163,74,.15); border-color: #16a34a; }
.list-cell.wrong { background: rgba(220,38,38,.1); border-color: #dc2626; }

/* result */
.result-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: center; }
.result-score-big { font-size: 42px; font-weight: 800; color: var(--primary); text-align: center; margin: 12px 0; }
.result-section-scores { display: flex; gap: 20px; justify-content: center; margin: 16px 0; }
.result-sec { text-align: center; padding: 12px 20px; border-radius: 8px; background: #f8f9fa; }
.result-sec-val { font-size: 26px; font-weight: 700; }
.result-sec-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* DS special layout */
.ds-options .option-label::before { content: attr(data-prefix); font-weight: 700; margin-right: 4px; }

/* ==================== NEW question types ==================== */

.muted { color: var(--text-muted); font-size: 14px; }

/* RC: passage + question share one stem — keep it scrollable */
.stem-rc {
  max-height: 42vh; overflow-y: auto; padding-right: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px;
}
.stem p { margin: 0 0 10px; }

.opt-prefix { font-weight: 700; margin-right: 6px; min-width: 26px; }

/* How a multi-part item is scored — shown above its parts, because "3 of 4
   sub-questions" and "all or nothing" are both surprising without notice. */
.q-scoring-hint {
  grid-column: 1 / -1;
  font-size: 12.5px; line-height: 1.5; color: var(--text-muted);
  background: #f6f8fa; border-left: 3px solid var(--secondary, #3b6ea5);
  border-radius: 4px; padding: 7px 11px;
}
.q-scoring-hint b { color: var(--text); }

/* TPA: two columns over one shared option list */
.options.tpa-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start;
}
.tpa-col { display: flex; flex-direction: column; gap: 8px; }
.tpa-col-head {
  font-weight: 700; font-size: 14px; color: #fff; background: var(--header-bg);
  padding: 8px 12px; border-radius: 4px; text-align: center;
}
.tpa-option { font-size: 14px; }

/* GT: one row per drop-down / Yes-No statement */
.options.gt-rows { display: flex; flex-direction: column; gap: 16px; }
.gt-row {
  border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px;
  background: #fff;
}
.gt-row.correct { border-color: #16a34a; background: rgba(22,163,74,.05); }
.gt-row.wrong { border-color: #dc2626; background: rgba(220,38,38,.04); }
.gt-row-stem { font-size: 14px; line-height: 1.55; margin-bottom: 10px; }
.gt-select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px; min-width: 180px; background: #fff;
}
.gt-choices { display: flex; gap: 12px; flex-wrap: wrap; }

/* Graphics Interpretation: the drop-down sits on the blank, inside the
   sentence it belongs to — the way the real exam presents it. */
.gt-select.gt-inline {
  display: inline-block; min-width: 90px; max-width: 100%;
  margin: 0 6px; padding: 4px 8px; font-size: 14px;
  vertical-align: baseline;
}
.gt-select.gt-inline.selected { border-color: var(--accent, #2563eb); }
.gt-select.gt-inline.correct { border-color: #16a34a; background: rgba(22,163,74,.08); }
.gt-select.gt-inline.wrong { border-color: #dc2626; background: rgba(220,38,38,.06); }
.stem .gt-blank { display: inline-block; min-width: 70px; }

.option-label.inline {
  flex-direction: row; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 16px; font-size: 14px;
}
.option-label.inline input[type=radio] { margin-top: 0; }

/* RC: one block per numbered sub-question */
.options.rc-rows { display: flex; flex-direction: column; gap: 18px; }
.rc-q {
  border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px;
  background: #fff;
}
.rc-q-stem { font-size: 14.5px; line-height: 1.6; margin-bottom: 10px; }
.rc-option { font-size: 14px; }

/* RC is served one question at a time, the way the real exam does it:
   the passage stays on screen, only the question below it changes. */
.options.rc-single { display: flex; flex-direction: column; gap: 14px; }

.rc-passage { line-height: 1.75; }
.rc-passage.collapsed {
  max-height: 5.2em; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
          mask-image: linear-gradient(#000 55%, transparent);
}
.rc-passage-toggle {
  margin-top: 10px; padding: 5px 14px; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--accent, #1a56db);
  border: 1px solid var(--border); border-radius: 16px;
}
.rc-passage-toggle:hover { background: rgba(26, 86, 219, .06); }

.rc-nav {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-bottom: 2px;
}
.rc-nav-label { font-size: 13px; color: var(--text-muted, #6b7280); margin-right: 4px; }
.rc-nav-dot {
  min-width: 30px; height: 30px; padding: 0 8px; cursor: pointer;
  font-size: 13px; border-radius: 15px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text, #1f2937);
}
.rc-nav-dot:hover { border-color: var(--accent, #1a56db); }
.rc-nav-dot.done { background: #eef2ff; border-color: #c7d2fe; }
.rc-nav-dot.cur {
  background: var(--accent, #1a56db); border-color: var(--accent, #1a56db);
  color: #fff; font-weight: 600;
}

/* Boldfaced / highlighted portions — the bank marks them `**…**`, the client
   converts them to <strong>. Give them a soft highlight so they stand out. */
.stem strong, .option-text strong, .rc-q-stem strong,
.rev-stem strong, .rev-text strong, .rev-rc-stem strong {
  font-weight: 700;
  background: #fdf0b8;
  padding: 0 3px;
  border-radius: 3px;
}

/* History rows */
.hist-mode { font-weight: 600; min-width: 84px; }
.hist-acc { color: var(--text-muted); font-size: 12px; min-width: 96px; text-align: right; }

/* Submit button state on the last question */
.btn-submit { background: var(--secondary) !important; }

/* Question-list cells for CAT questions not yet generated */
.list-cell.locked { opacity: .35; cursor: not-allowed; }

/* ==================== merged history cards ==================== */

.hist-card {
  display: flex; align-items: center; gap: 16px; cursor: pointer;
  transition: background .15s ease;
  border-bottom: 1px solid #eee;
}
.hist-card:hover { background: rgba(0,102,204,.04); }
.hist-main { flex: 1; min-width: 0; }
.hist-line1 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hist-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.hist-badge.exam { background: rgba(0,102,204,.12); color: var(--primary); }
.hist-badge.practice { background: rgba(255,153,0,.14); color: #b26a00; }

.hist-score-row { display: flex; align-items: baseline; gap: 8px; }
.hist-total { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.hist-total.sm { font-size: 20px; }
.hist-pct { font-size: 12px; color: var(--text-muted); }
.hist-chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.hist-chip {
  font-size: 12px; padding: 2px 8px; border-radius: 4px;
  background: #f1f3f5; color: var(--text-muted);
}
.hist-chip b { color: var(--dark); margin-right: 3px; }
.hist-line3 { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.btn-detail {
  flex-shrink: 0; padding: 7px 14px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--primary); border-radius: 4px;
  background: #fff; color: var(--primary);
}
.btn-detail:hover { background: var(--primary); color: #fff; }
.btn-detail.ghost { border-color: var(--border); color: var(--text-muted); }
.btn-detail.ghost:hover { background: var(--border); color: var(--dark); }

.hist-actions { flex-shrink: 0; display: flex; gap: 8px; }

/* ==================== session detail overlay ==================== */

.overlay-detail { max-width: 920px; max-height: 86vh; width: 92vw; }
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: -28px; background: var(--card-bg); z-index: 2;
  padding-bottom: 10px; margin-bottom: 4px;
}
.detail-head h3 { margin: 0; }
.btn-close-x {
  border: none; background: transparent; font-size: 26px; line-height: 1;
  cursor: pointer; color: var(--text-muted); padding: 0 4px;
}
.btn-close-x:hover { color: var(--dark); }

.detail-summary {
  border-bottom: 1px solid #eee; padding-bottom: 16px; margin-bottom: 14px;
}
.ds-hero { text-align: center; margin-bottom: 14px; }
.ds-hero-score { font-size: 46px; font-weight: 800; color: var(--primary); line-height: 1; }
.ds-hero-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.ds-secs { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ds-sec {
  flex: 1 1 140px; max-width: 200px; text-align: center;
  background: #f8f9fa; border-radius: 8px; padding: 10px 8px;
}
.ds-sec-val { font-size: 24px; font-weight: 700; }
.ds-sec-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ds-sec-sub { font-size: 12px; color: var(--primary); margin-top: 4px; }
.ds-stats {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin-top: 14px; font-size: 13px; color: var(--text-muted);
}

.detail-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 16px;
  background: #fff; color: var(--text-muted);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}

.detail-content { display: flex; flex-direction: column; gap: 14px; }

/* ---- per-question review cards ---- */
.rev-card {
  border: 1px solid #e6e8eb; border-left: 4px solid #c7ccd1;
  border-radius: 8px; padding: 14px 16px; background: #fff;
}
.rev-card.correct { border-left-color: #16a34a; }
.rev-card.wrong { border-left-color: #dc2626; }
.rev-card.unanswered { border-left-color: #c7ccd1; }

.rev-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.rev-no { font-weight: 700; font-size: 14px; }
.rev-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #f1f3f5; color: var(--text-muted);
}
.rev-badge {
  margin-left: auto; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 10px; color: #fff;
}
.rev-badge.correct { background: #16a34a; }
.rev-badge.wrong { background: #dc2626; }
.rev-badge.unanswered { background: #9aa0a6; }
/* "3/4 sub-questions" — partial credit, neither right nor wrong. */
.rev-badge.partial { background: #b45309; }

.rev-stem {
  font-size: 14px; line-height: 1.65; margin-bottom: 12px;
  background: #fafbfc; border-radius: 6px; padding: 10px 12px;
  white-space: pre-wrap; word-break: break-word;
}
.rev-stem p { margin: 0 0 8px; }
.rev-stem p:last-child { margin-bottom: 0; }

.rev-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rev-opt {
  display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.5;
  padding: 7px 10px; border: 1px solid transparent; border-radius: 5px; background: #fff;
}
.rev-opt.is-answer { background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.35); }
.rev-opt.is-picked { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.35); }
.rev-opt.is-picked.is-answer { background: rgba(22,163,74,.12); border-color: #16a34a; }
.rev-letter { font-weight: 700; min-width: 20px; color: var(--text-muted); }
.rev-text { flex: 1; word-break: break-word; }

.tag {
  flex-shrink: 0; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.tag.pick { background: rgba(220,38,38,.12); color: #b91c1c; }
.tag.ans { background: rgba(22,163,74,.14); color: #15803d; }
.tag.ok { background: rgba(22,163,74,.14); color: #15803d; }
.tag.bad { background: rgba(220,38,38,.12); color: #b91c1c; }
.tag.muted { background: #f1f3f5; color: var(--text-muted); }

.rev-tpa {
  border: 1px solid #e6e8eb; border-radius: 6px; padding: 10px 12px;
  margin-bottom: 10px; background: #fafbfc;
}
.rev-tpa-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; padding: 3px 0; }
.rev-tpa-col { font-weight: 700; min-width: 130px; }
.rev-tpa-val.ok { color: #15803d; }
.rev-tpa-val.no { color: #b91c1c; }
.rev-tpa-val.ans { color: var(--text-muted); }

.rev-gt { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rev-gt-row {
  border: 1px solid #e6e8eb; border-radius: 6px; padding: 9px 12px; background: #fafbfc;
  font-size: 13px;
}
.rev-gt-row.ok { border-color: rgba(22,163,74,.4); }
.rev-gt-row.no { border-color: rgba(220,38,38,.4); }
.rev-gt-stem { line-height: 1.55; margin-bottom: 5px; }
.rev-gt-ans { color: var(--text-muted); }

.rev-rc { display: flex; flex-direction: column; gap: 10px; }
.rev-rc-q {
  border: 1px solid #e6e8eb; border-radius: 6px; padding: 10px 12px; background: #fafbfc;
}
.rev-rc-stem { line-height: 1.55; margin-bottom: 8px; font-size: 14px; }
.rev-rc-q .rev-opts { margin-top: 4px; }
.rev-gt-opts { margin-top: 5px; font-size: 12px; color: var(--text-muted); }

.rev-plain { font-size: 14px; padding: 8px 0; }
.rev-src {
  display: inline-block; margin-top: 10px; font-size: 12px;
  color: var(--primary); text-decoration: none;
}
.rev-src:hover { text-decoration: underline; }

/* responsive */
@media (max-width: 640px) {
  .exam-toolbar { flex-direction: column; }
  .toolbar-right { margin-left: 0; }
  .practice-grid { grid-template-columns: 1fr; }
  .hist-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .ds-secs { flex-direction: column; }
}


/* ---------- Question Review & Edit (GMAT Focus Edition) ---------- */

.edits-left {
  font-size: 12px; color: var(--text-muted);
  padding: 2px 9px; border: 1px solid var(--border);
  border-radius: 11px; white-space: nowrap;
}
.edits-left.exhausted {
  color: #b91c1c; border-color: #fca5a5; background: #fef2f2;
}

.rev-hint {
  font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0 0 12px;
}
.rev-summary { font-size: 13px; margin-bottom: 12px; }
.rev-warn { color: #b91c1c; font-weight: 600; }

.rev-grid .rev-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; background: var(--card-bg); color: var(--text);
  transition: .1s;
}
.rev-grid .rev-cell:hover { border-color: var(--primary); background: rgba(0,102,204,.05); }
.rev-grid .rev-cell.answered { background: rgba(0,102,204,.1); border-color: var(--primary); }
.rev-grid .rev-cell.blank {
  border-style: dashed; border-color: #dc2626; color: #b91c1c; background: #fef2f2;
}
.rev-grid .rev-cell.flagged { box-shadow: inset 0 0 0 2px var(--secondary); }
.rev-grid .rev-cell.edited { position: relative; }
.rev-grid .rev-cell.edited::after {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 50%; background: #16a34a;
}
.rev-grid .rev-cell.current { outline: 2px solid var(--primary); outline-offset: 1px; }

.rev-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted); margin-bottom: 14px;
}
.rev-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rev-legend i.rev-cell {
  display: inline-block; width: 15px; height: 15px;
  border-radius: 4px; border: 1px solid var(--border); background: var(--card-bg);
}
.rev-legend i.rev-cell.answered { background: rgba(0,102,204,.1); border-color: var(--primary); }
.rev-legend i.rev-cell.blank { border-style: dashed; border-color: #dc2626; }
.rev-legend i.rev-cell.flagged { box-shadow: inset 0 0 0 2px var(--secondary); }

.rev-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- section order picker ---------- */
.order-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.order-row label { font-size: 13px; color: var(--text-muted); }
.order-row select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card-bg); color: var(--text); font-size: 13px;
}

/* ---------- on-screen calculator (Data Insights only) ---------- */
.calc {
  position: fixed; right: 16px; bottom: 78px; z-index: 20;
  width: 232px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; font-size: 13px;
}
.calc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--header-bg); color: var(--header-text);
  font-size: 12px; font-weight: 600;
}
.calc-head button {
  width: 20px; height: 20px; line-height: 1; border: none; cursor: pointer;
  background: rgba(255,255,255,.18); color: var(--header-text);
  border-radius: 3px; font-size: 14px;
}
.calc-display {
  padding: 8px 10px; text-align: right;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 17px; background: #f7f9fc; border-bottom: 1px solid var(--border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calc-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 8px; }
.calc-pad button {
  height: 30px; border: 1px solid var(--border); border-radius: 4px;
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer;
}
.calc-pad button:hover { background: #eef2f7; }
.calc-pad button:active { background: #dbe4ef; }
.calc-pad .calc-eq {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.calc-pad .calc-eq:hover { background: var(--primary-hover); }

@media (max-width: 900px) {
  .calc { width: 200px; right: 8px; bottom: 8px; }
  .calc-pad button { height: 26px; font-size: 12px; }
}

/* ================================================================
   Account & device panel
   ================================================================ */

.login-note {
  margin-top: 10px; font-size: 12px; line-height: 1.6;
  color: var(--text-muted); text-align: center;
}

.app-user { display: flex; align-items: center; gap: 12px; }
.app-user a { color: var(--header-text); text-decoration: none; opacity: .85; }
.app-user a:hover { opacity: 1; text-decoration: underline; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.acct-block { margin-bottom: 18px; }
.acct-block h4 {
  font-size: 14px; margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border); color: var(--dark);
}
.acct-n {
  display: inline-block; min-width: 18px; padding: 0 6px;
  background: var(--bg); border-radius: 9px;
  font-size: 11px; color: var(--text-muted); text-align: center;
}
.acct-kv {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 13px;
  border-bottom: 1px dashed #eceff3;
}
.acct-kv span { color: var(--text-muted); }

.acct-list { display: flex; flex-direction: column; gap: 6px; }
.acct-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 8px 10px;
  background: #f8fafc; border: 1px solid #eceff3; border-radius: 6px;
}
.acct-row.is-current { border-color: var(--primary); background: #eff6ff; }
.acct-row.is-failed { border-color: #fecaca; background: #fef2f2; }
.acct-main { min-width: 0; flex: 1; }
.acct-label { font-size: 13px; font-weight: 600; word-break: break-word; }
.acct-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.acct-fp {
  margin-top: 3px; font-size: 11px; color: #9aa3af;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  word-break: break-all;
}
.acct-bad { color: #dc2626; }

@media (max-width: 900px) {
  .app-user { gap: 8px; font-size: 12px; }
}

/* ================================================================
   Question figures (served per-question from /img/<sha1>.<ext>)
   ================================================================ */

.q-figures {
  display: flex; flex-direction: column; gap: 10px;
  margin: 12px 0 4px;
}
.q-figures img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}
.rev-card .q-figures { margin: 8px 0; }
.rev-card .q-figures img { max-width: 420px; }

/* ================================================================
   Data tables (rec.table = {header, rows})
   Replaces the previously-flattened table blob with a real <table>.
   ================================================================ */

.q-table-wrap {
  margin: 14px 0 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.q-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  line-height: 1.45;
}
.q-table th, .q-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}
.q-table thead th {
  background: var(--header-bg);
  color: var(--header-text);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.q-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, .025); }
.q-table tbody tr:hover { background: rgba(0, 102, 204, .05); }
/* boldfaced/highlighted cell fragments share the stem-highlight look */
.q-table strong {
  background: #fdf0b8;
  padding: 0 3px;
  border-radius: 3px;
}
.rev-card .q-table-wrap { margin: 10px 0; }

/* dark theme (only if the app ever adds [data-theme="dark"]) */
[data-theme="dark"] .q-table-wrap { background: #1e2430; border-color: #333a47; }
[data-theme="dark"] .q-table { color: #e6e9ef; }
[data-theme="dark"] .q-table th,
[data-theme="dark"] .q-table td { border-color: #333a47; }
[data-theme="dark"] .q-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .04); }
[data-theme="dark"] .q-table tbody tr:hover { background: rgba(0, 102, 204, .12); }
[data-theme="dark"] .q-table strong { background: #5a4a12; }
[data-theme="dark"] .q-scoring-hint { background: #1e2430; color: #9aa4b2; }
[data-theme="dark"] .q-scoring-hint b { color: #e6e9ef; }
[data-theme="dark"] .tag.muted { background: #2a3140; color: #9aa4b2; }
