/* ═══════════════════════════════════════════════════════════════
   NetForge Cloud — Members Portal Styles
   Extends the main site design language
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #eef3f5;
  --ink: #0a2230;
  --muted: #4e6774;
  --surface: #ffffff;
  --line: #c8d5dc;
  --brand: #005f78;
  --brand-strong: #003e51;
  --brand-soft: #dceff5;
  --accent: #f49a1a;
  --accent-soft: #ffefd4;
  --success: #0a7a5e;
  --success-soft: #d4f0e8;
  --danger: #c0392b;
  --danger-soft: #fde8e6;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-soft: 0 10px 30px rgba(8, 40, 56, 0.08);
  --shadow-strong: 0 20px 45px rgba(0, 70, 90, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overflow-x: hidden; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Sora", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Grid backdrop ────────────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; pointer-events: none; z-index: -1; }
.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(10, 34, 48, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 34, 48, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 83%);
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0;
  backdrop-filter: blur(8px);
  background: rgba(238, 243, 245, 0.88);
  border-bottom: 1px solid rgba(10, 34, 48, 0.1);
  z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  width: min(1160px, 92vw); margin: 0 auto;
  min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; gap: 0.65rem;
  font-weight: 700;
}
.brand-logo { width: 38px; height: 38px; border-radius: 10px; }
.brand span { font-size: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user { font-size: 0.85rem; color: var(--muted); }
.btn-logout {
  font-size: 0.82rem; font-weight: 600;
  color: var(--brand); border: 1.5px solid var(--line);
  background: var(--surface); padding: 0.3rem 0.8rem;
  border-radius: 8px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-logout:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn-profile {
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  padding: 0.38rem 0.85rem; border-radius: 8px;
  border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-profile:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

/* Profile modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,34,48,0.45);
  z-index: 100; display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 2rem; width: min(440px, 92vw);
  box-shadow: var(--shadow-strong);
  border: 1.5px solid var(--line);
  max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin: 0 0 0.35rem; font-size: 1.25rem; }
.modal-box .modal-subtitle { color: var(--muted); font-size: 0.88rem; margin: 0 0 1.25rem; }
.profile-section {
  padding: 1rem 0; border-top: 1px solid var(--line);
}
.profile-section:first-of-type { border-top: none; padding-top: 0; }
.profile-section h4 {
  margin: 0 0 0.75rem; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.profile-info-row {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.88rem; margin-bottom: 0.35rem;
}
.profile-info-row span:first-child { color: var(--muted); }
.profile-info-row span:last-child { font-weight: 600; text-align: right; word-break: break-all; }
.btn-support {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.72rem 1rem; margin-top: 0.25rem;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  background: var(--bg); color: var(--brand);
  border: 1.5px solid var(--brand); border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer; transition: background 0.15s;
}
.btn-support:hover { background: var(--brand-soft); }
.modal-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.25rem;
}
.btn-modal-cancel, .btn-modal-save {
  font-family: inherit; font-size: 0.88rem; font-weight: 600;
  padding: 0.55rem 1.1rem; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface);
}
.btn-modal-save { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-modal-save:hover { background: var(--brand-strong); }
.btn-modal-cancel:hover { background: var(--bg); }
.profile-admin-note {
  font-size: 0.84rem; color: var(--muted); line-height: 1.5;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.75rem 0.9rem; margin-bottom: 0.5rem;
}

/* ── Page wrapper ─────────────────────────────────────────────── */
.page { width: min(1160px, 92vw); margin: 0 auto; padding: 3rem 0 5rem; }
.page-sm { width: min(480px, 92vw); margin: 0 auto; padding: 3.5rem 0 5rem; }

/* ── Auth card ────────────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 2.5rem;
}
.auth-card h1 { margin: 0 0 0.35rem; font-size: 1.55rem; }
.auth-card .subtitle { color: var(--muted); margin: 0 0 2rem; font-size: 0.92rem; }

/* Tabs */
.tab-row {
  display: flex; gap: 0; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1.8rem;
}
.tab-btn {
  flex: 1; padding: 0.65rem 1rem;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); transition: background 0.15s, color 0.15s;
}
.tab-btn.active { background: var(--brand); color: #fff; }
.tab-btn:not(.active):hover { background: var(--brand-soft); color: var(--brand); }

/* Form */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--muted); margin-bottom: 0.3rem; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input {
  width: 100%; padding: 0.7rem 0.9rem;
  font-family: inherit; font-size: 0.95rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 95, 120, 0.12);
}
.btn-primary {
  width: 100%; padding: 0.8rem 1rem;
  font-family: inherit; font-size: 0.95rem; font-weight: 700;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.form-error {
  margin-top: 0.8rem; padding: 0.7rem 0.9rem;
  background: var(--danger-soft); border: 1.5px solid #f5c6c1;
  border-radius: var(--radius-sm); color: var(--danger);
  font-size: 0.87rem;
}
.form-success {
  margin-top: 0.8rem; padding: 0.7rem 0.9rem;
  background: var(--success-soft); border: 1.5px solid #a8e0d0;
  border-radius: var(--radius-sm); color: var(--success);
  font-size: 0.87rem;
}

/* ── Portal dashboard ─────────────────────────────────────────── */
.portal-header { margin-bottom: 2.5rem; }
.portal-header h1 { margin: 0 0 0.4rem; font-size: 2rem; }
.portal-header p { color: var(--muted); margin: 0; }
.eyebrow {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brand); margin: 0 0 0.5rem;
}

.section-head { margin-bottom: 1.5rem; }
.section-head h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.section-head p { color: var(--muted); margin: 0; font-size: 0.92rem; }

.cards { display: grid; gap: 1.25rem; }
.cards-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.exam-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 0.8rem;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.exam-card:hover { box-shadow: var(--shadow-strong); transform: translateY(-3px); border-color: var(--brand); }

.exam-card .tag {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft);
  padding: 0.2rem 0.55rem; border-radius: 6px;
}
.exam-card h3 { margin: 0; font-size: 1.15rem; }
.exam-card p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }

.exam-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.8rem; color: var(--muted);
}
.exam-meta span {
  background: var(--bg); border: 1px solid var(--line);
  padding: 0.15rem 0.5rem; border-radius: 6px;
}

.domain-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.domain-pill {
  font-size: 0.72rem; font-weight: 600;
  padding: 0.15rem 0.5rem; border-radius: 6px;
  color: #fff;
}
a.domain-pill { text-decoration: none; transition: opacity 0.15s; }
a.domain-pill:hover { opacity: 0.88; }

.exam-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: auto; }
.btn-start {
  display: block; text-align: center;
  padding: 0.72rem 1.25rem;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s;
}
.btn-start:hover { background: var(--brand-strong); }
.btn-start.ghost {
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-start.ghost:hover { background: var(--brand-soft); }

.best-score {
  font-size: 0.82rem; text-align: center; color: var(--muted);
  padding: 0.4rem 0.5rem; background: var(--bg);
  border-radius: var(--radius-sm); border: 1px solid var(--line);
}
.best-score strong { color: var(--success); }

/* Progress panel */
.progress-section { margin-top: 2.5rem; }
.progress-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.87rem;
}
.progress-table th {
  text-align: left; padding: 0.55rem 0.8rem;
  color: var(--muted); font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--line);
}
.progress-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.progress-table tr:last-child td { border-bottom: none; }
.pct-pass { color: var(--success); font-weight: 700; }
.pct-fail { color: var(--danger); font-weight: 700; }
.progress-actions-head {
  width: 4.5rem;
  text-align: right;
}
.progress-actions-cell {
  text-align: right;
  white-space: nowrap;
}
.btn-delete-attempt {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: 1.5px solid rgba(192, 57, 43, 0.35);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-delete-attempt:hover {
  background: rgba(192, 57, 43, 0.08);
  border-color: var(--danger);
}
.progress-section-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn-clear-progress {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: 1.5px solid rgba(192, 57, 43, 0.35);
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-clear-progress:hover {
  background: rgba(192, 57, 43, 0.08);
  border-color: var(--danger);
}
.btn-clear-progress:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.empty-state { color: var(--muted); font-size: 0.9rem; padding: 1.5rem 0; text-align: center; }

/* ── Case studies viewer ─────────────────────────────────────── */
.cs-viewer-topbar {
  position: sticky; top: 68px; z-index: 20;
  background: rgba(238,243,245,0.97);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
  backdrop-filter: blur(6px);
  max-width: 100%;
  overflow: visible;
}
.cs-viewer-topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
  padding: 0.65rem 1rem;
}
.cs-viewer-counter {
  font-size: 0.88rem; font-weight: 700; color: var(--ink);
  flex: 1 1 auto; min-width: 0;
}
.cs-viewer-nav {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  justify-content: center;
  flex: 1 1 100%;
  max-width: 100%;
}
.cs-viewer-nav .btn-read,
.cs-viewer-nav .btn-nav {
  flex-shrink: 0;
}
.cs-viewer-tts-row {
  display: flex; justify-content: center;
  padding: 0 1rem 0.55rem;
  border-top: 1px solid var(--line);
  margin-top: -0.15rem;
  padding-top: 0.5rem;
}
.cs-viewer-dots {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  justify-content: center;
  padding: 0 1rem 0.65rem;
}
.cs-viewer-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.cs-viewer-dot.current {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}
.cs-viewer-card[hidden] { display: none !important; }

/* ── Exam interface ───────────────────────────────────────────── */
.exam-topbar {
  background: var(--surface); border-bottom: 1.5px solid var(--line);
  position: sticky; top: 68px; z-index: 20;
}
.exam-topbar-inner {
  width: min(900px, 92vw); margin: 0 auto;
  padding: 0.75rem 0 0.35rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  flex-wrap: wrap;
}
.exam-portal-back {
  font-size: 0.8rem; font-weight: 700; color: var(--brand);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.exam-portal-back:hover { text-decoration: underline; }
.exam-tts-bar {
  border-top: 1px solid var(--line);
  background: rgba(238, 243, 245, 0.97);
}
.exam-tts-inner {
  width: min(900px, 92vw); margin: 0 auto;
  padding: 0.45rem 0 0.65rem;
  display: flex; align-items: center; justify-content: flex-start;
  gap: 0.65rem; flex-wrap: wrap;
}
.tts-speed-control {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.tts-speed-label-text {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin-right: 0.15rem;
}
.tts-speed-value {
  min-width: 2.5rem; text-align: center;
  font-family: "JetBrains Mono", monospace; font-size: 0.8rem; font-weight: 700;
  color: var(--brand);
}
.btn-tts-step {
  width: 1.65rem; height: 1.65rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1;
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--line); border-radius: 6px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-tts-step:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.btn-tts-step:disabled { opacity: 0.35; cursor: not-allowed; }
.exam-title { font-weight: 700; font-size: 0.92rem; flex: 1 1 12rem; min-width: 0; }
.exam-title-bar { font-weight: 700; font-size: 0.92rem; flex: 1 1 12rem; min-width: 0; }
.exam-info { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: var(--muted); }
.exam-timer { font-family: "JetBrains Mono", monospace; font-size: 1rem; font-weight: 600; color: var(--ink); }
.exam-timer.warning { color: var(--danger); }

.progress-bar-wrap {
  background: var(--line); border-radius: 4px; height: 4px;
  width: min(900px, 92vw); margin: 0 auto;
}
.progress-bar-fill {
  height: 100%; background: var(--brand); border-radius: 4px;
  transition: width 0.3s ease;
}

.exam-body {
  width: min(760px, 92vw); margin: 2.5rem auto 5rem;
}
.exam-body-back {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.question-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-soft);
}
.question-num {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--brand); margin-bottom: 0.5rem;
}
.question-domain-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
  padding: 0.15rem 0.5rem; border-radius: 6px; margin-bottom: 1rem;
}
.question-text {
  font-size: 1.05rem; font-weight: 600; line-height: 1.55;
  margin: 0 0 1.5rem;
}
.question-multi-hint {
  font-size: 0.84rem;
  font-weight: 700;
  color: #b46f00;
  margin: -1rem 0 1.25rem;
  letter-spacing: 0.02em;
}

.question-feedback .feedback-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.btn-feedback {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 2rem;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-feedback:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn-feedback.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.hotarea-panel {
  margin: 0 0 1.5rem;
  padding: 1.25rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.hotarea-diagram-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.hotarea-grid {
  display: grid;
  gap: 0.65rem;
}

.hotarea-zone {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.hotarea-zone:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.hotarea-zone.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px rgba(0, 95, 120, 0.15);
}

.hotarea-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.85rem 0 0;
}

.case-study-panel {
  background: rgba(0, 100, 164, 0.06);
  border: 1.5px solid rgba(0, 100, 164, 0.22);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.case-study-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand);
  margin: 0 0 0.35rem;
}

.case-study-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.case-study-text {
  font-size: 0.9rem;
  line-height: 1.65;
  margin: 0;
  color: var(--text);
}

.options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.option-btn {
  width: 100%; text-align: left;
  padding: 0.85rem 1.1rem;
  font-family: inherit; font-size: 0.92rem;
  background: var(--bg); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.option-btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.option-btn .opt-letter {
  width: 24px; height: 24px; min-width: 24px;
  border-radius: 50%; border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
  margin-top: 0.05rem;
}
.option-btn.selected { border-color: var(--brand); background: var(--brand-soft); }
.option-btn.correct  { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.option-btn.wrong    { border-color: var(--danger);  background: var(--danger-soft);  color: var(--danger); }
.option-btn:disabled { cursor: default; }

.explanation-box {
  margin-top: 1.25rem; padding: 1rem 1.15rem;
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem; line-height: 1.6; color: var(--ink);
  animation: fadeIn 0.25s ease;
}
.explanation-box strong { color: var(--brand); }

/* ── Per-question result reveal (Python-app UX) ───────────────── */
.result-banner {
  border-radius: var(--radius-sm); padding: 0.9rem 1.15rem;
  font-size: 1rem; font-weight: 700; line-height: 1.3;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.6rem;
  animation: fadeIn 0.2s ease;
}
.result-banner.correct { background: var(--success-soft); color: var(--success); border: 1.5px solid var(--success); }
.result-banner.wrong   { background: var(--danger-soft);  color: var(--danger);  border: 1.5px solid var(--danger); }

.answer-reveal {
  margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.65rem;
  animation: fadeIn 0.2s ease;
}
.reveal-section {
  padding: 0.7rem 1rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.reveal-section-explanation {
  background: var(--brand-soft); border-color: var(--brand);
}
.reveal-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin: 0 0 0.25rem;
  user-select: none;
}
.reveal-value {
  font-size: 0.9rem; line-height: 1.6; color: var(--ink); margin: 0;
  user-select: text; /* Speechify / screen-reader selectable */
}
.reveal-value.reveal-correct  { color: var(--success); font-weight: 600; }
.reveal-value.reveal-wrong-ans { color: var(--danger);  font-weight: 600; }

/* Submit Answer + Redo buttons */
.btn-submit-answer {
  padding: 0.65rem 1.6rem;
  font-family: inherit; font-size: 0.92rem; font-weight: 700;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.btn-submit-answer:hover:not(:disabled) { background: #004a5e; }
.btn-submit-answer:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-redo {
  padding: 0.65rem 1.4rem;
  font-family: inherit; font-size: 0.88rem; font-weight: 700;
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-redo:hover { background: var(--bg); border-color: var(--muted); }

.btn-finish {
  padding: 0.65rem 1.6rem;
  font-family: inherit; font-size: 0.92rem; font-weight: 700;
  background: var(--success); color: #fff;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.btn-finish:hover { background: #085f49; }

.nav-right { display: flex; align-items: center; gap: 0.65rem; }

/* Speechify: ensure all readable content is selectable */
.question-text, .option-btn, .reveal-value, .result-banner { user-select: text; }

.exam-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.5rem; gap: 1rem;
}
.btn-nav {
  padding: 0.65rem 1.4rem;
  font-family: inherit; font-size: 0.88rem; font-weight: 700;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-nav:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn-nav:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-submit {
  padding: 0.65rem 1.6rem;
  font-family: inherit; font-size: 0.88rem; font-weight: 700;
  background: var(--accent); color: var(--ink);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
}
.btn-submit:hover { background: #e08a0a; }

.question-nav-dots {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 1.5rem;
}
.q-dot {
  width: 28px; height: 28px;
  border-radius: 6px; border: 1.5px solid var(--line);
  background: var(--bg); font-size: 0.72rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background 0.12s, border-color 0.12s;
}
.q-dot:hover { border-color: var(--brand); }
.q-dot.current { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.q-dot.answered { background: var(--brand); border-color: var(--brand); color: #fff; }
.q-dot.correct  { background: var(--success); border-color: var(--success); color: #fff; }
.q-dot.wrong    { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.q-dot.flagged:not(.correct):not(.wrong) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ── Question card meta row (num + flag button) ────────────────── */
.question-card-meta {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.15rem;
}
.question-card-meta > div { flex: 1; min-width: 0; }

/* ── Flag for Review button ──────────────────────────────────────── */
.btn-flag {
  padding: 0.3rem 0.75rem;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; line-height: 1.5;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-flag:hover:not(:disabled) {
  background: var(--accent-soft); border-color: var(--accent); color: #9a5500;
}
.btn-flag.active {
  background: var(--accent-soft); border-color: var(--accent);
  color: #8a4a00; font-weight: 700;
}
.btn-flag:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Read aloud (Web Speech API) ───────────────────────────────── */
.btn-read {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
  background: var(--surface); color: var(--brand);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn-read:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.btn-read:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-read.reading { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }

/* ── Results screen ───────────────────────────────────────────── */
.results-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 2.5rem 2.5rem;
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.score-ring {
  width: 130px; height: 130px; margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 800;
  border: 6px solid var(--brand);
}
.score-ring.pass { border-color: var(--success); color: var(--success); }
.score-ring.fail { border-color: var(--danger);  color: var(--danger);  }
.score-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; }
.results-card h2 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.results-card .subtitle { color: var(--muted); margin: 0 0 1.75rem; }
.result-stats {
  display: flex; justify-content: center; gap: 2rem;
  margin-bottom: 1.75rem; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.stat span { font-size: 0.8rem; color: var(--muted); }
.results-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.btn-review {
  padding: 0.7rem 1.5rem;
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s; text-decoration: none; display: inline-block;
}
.btn-review:hover { background: var(--brand-strong); }
.btn-back {
  padding: 0.7rem 1.5rem;
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--brand); border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s; text-decoration: none; display: inline-block;
}
.btn-back:hover { background: var(--brand-soft); }

/* Domain breakdown */
.domain-breakdown {
  margin-top: 1.75rem; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.domain-breakdown table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.domain-breakdown th {
  background: var(--bg); padding: 0.6rem 0.9rem;
  text-align: left; font-size: 0.77rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  border-bottom: 2px solid var(--line);
}
.domain-breakdown td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.domain-breakdown tr:last-child td { border-bottom: none; }

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (min-width: 720px) {
  .cs-viewer-nav {
    flex: 1 1 auto;
    justify-content: flex-end;
  }
}

@media (max-width: 600px) {
  .auth-card { padding: 1.75rem 1.25rem; }
  .question-card { padding: 1.5rem 1.15rem; }
  .results-card { padding: 1.75rem 1.25rem; }
  .result-stats { gap: 1rem; }
  .exam-topbar-inner { flex-wrap: wrap; gap: 0.4rem; }
  .exam-tts-inner { gap: 0.45rem; }
  .btn-read { font-size: 0.74rem; padding: 0.3rem 0.65rem; }
  .cs-viewer-topbar-inner { flex-direction: column; align-items: stretch; }
  .cs-viewer-counter { text-align: center; }
  .cs-viewer-nav { justify-content: center; }
  .question-card-meta { flex-wrap: wrap; gap: 0.5rem; }
  .btn-flag { padding: 0.25rem 0.55rem; font-size: 0.72rem; }
  .access-banner-inner { flex-direction: column; }
  .commerce-bar-inner { flex-direction: column; align-items: flex-start; }
}

/* ── Commerce & access control ─────────────────────────────────── */
.commerce-bar {
  margin: 0 0 2rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-soft);
}
.commerce-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  font-weight: 600;
}
.commerce-bar-unlocked { color: var(--success); }
.commerce-bar-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.commerce-bar-link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.88rem;
}
.commerce-bar-link:hover { text-decoration: underline; }
.btn-all-access {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  border: none;
  cursor: pointer;
}

.access-banner {
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface) 100%);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.access-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.access-banner-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 0.35rem;
}
.access-banner h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}
.access-banner-copy p:last-child {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 42rem;
}
.access-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}
.cert-locked .exam-card:not(.access-banner *) {
  opacity: 0.72;
}
.link-locked { cursor: not-allowed; }

.checkout-modal-box { max-width: 420px; }
.checkout-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-strong);
  margin: 0.5rem 0 1rem;
}
.checkout-features {
  text-align: left;
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}
.checkout-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
  text-align: center;
}
.checkout-alt {
  text-align: center;
  margin: 0.5rem 0 0;
}
.btn-preorder-email,
.btn-support-inline {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-preorder-email:hover,
.btn-support-inline:hover {
  color: var(--brand-strong);
}
.commerce-bar-link.btn-support-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  text-decoration: none;
}
.commerce-bar-link.btn-support-link:hover {
  text-decoration: underline;
}
.checkout-loading { text-align: center; color: var(--muted); font-size: 0.88rem; }
.paypal-button-container { min-height: 45px; }

.cert-request-panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-soft);
}
.cert-request-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) {
  .cert-request-form .form-row { grid-template-columns: 1fr; }
}
.cert-request-form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.pricing-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}
.pricing-card.featured {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}
.pricing-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.pricing-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand-strong);
  margin: 0.5rem 0 1rem;
}
.pricing-card ul {
  flex: 1;
  margin: 0 0 1.25rem;
  padding-left: 1.1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
}
.pricing-card .btn-start { width: 100%; text-align: center; }
.pricing-card .btn-start + .btn-start { margin-top: 0.5rem; }

.legal-page { max-width: 720px; margin: 0 auto; }
.legal-page h2 { margin-top: 2rem; }
.legal-page p, .legal-page li { color: var(--muted); line-height: 1.65; }

/* ── Chat (member + admin) ─────────────────────────────────── */
.chat-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1200;
  width: 3.25rem; height: 3.25rem; border-radius: 999px; border: none;
  background: var(--brand); color: #fff; font-size: 1.25rem; cursor: pointer;
  box-shadow: var(--shadow-strong);
}
.chat-panel {
  position: fixed; right: 1.25rem; bottom: 5rem; z-index: 1200;
  width: min(380px, calc(100vw - 2rem)); max-height: min(520px, 70vh);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-strong);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel.hidden { display: none; }
.chat-panel-head {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg);
}
.chat-panel-head p { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }
.chat-panel-close {
  border: none; background: transparent; font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--muted);
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.65rem;
  background: var(--bg);
}
.chat-compose {
  display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--line); background: var(--surface);
}
.chat-compose textarea {
  flex: 1; resize: vertical; min-height: 2.5rem; max-height: 6rem;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 0.55rem 0.7rem;
  font-family: inherit; font-size: 0.88rem;
}
.chat-compose .btn-start { flex-shrink: 0; align-self: flex-end; }
.chat-bubble {
  max-width: 92%; padding: 0.65rem 0.8rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.chat-bubble.chat-mine { margin-left: auto; background: var(--brand-soft); border-color: rgba(0,95,120,0.2); }
.chat-bubble.chat-broadcast { border-color: var(--accent); background: var(--accent-soft); }
.chat-meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: center;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 0.35rem;
}
.chat-meta strong { color: var(--ink); font-size: 0.78rem; }
.chat-tag {
  font-family: "JetBrains Mono", monospace; font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.chat-time { margin-left: auto; }
.chat-body { font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.chat-empty { color: var(--muted); font-size: 0.86rem; text-align: center; padding: 1.5rem 0.5rem; }
