/* Exam simulation app styles — builds on the site's base stylesheet. */

#exam-app { margin: 1.5rem 0; }

.exam-error { color: #b3261e; font-weight: 600; }

/* gate */
.exam-gate { border: 1px solid var(--line, #dfe7f0); border-radius: 12px; padding: 1.5rem; background: var(--card, #fff); }
.exam-gate h2 { margin-top: 0; }

/* intro */
.exam-intro h2 { margin-bottom: 0.25rem; }
.exam-meta { color: var(--muted, #5b6b7f); font-weight: 600; }
.exam-access-note { background: #eef6ee; border: 1px solid #bfe0bf; border-radius: 8px; padding: 0.6rem 0.9rem; }
.exam-access-note.preview { background: #fff8e6; border-color: #f0d98c; }
.exam-spec-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.exam-spec-table th, .exam-spec-table td { border-bottom: 1px solid var(--line, #dfe7f0); padding: 0.45rem 0.6rem; text-align: left; }
.exam-spec-table td.num, .exam-spec-table th:last-child { text-align: right; }
.exam-spec-table tr.total td { font-weight: 700; }
.exam-fineprint { font-size: 0.85rem; color: var(--muted, #5b6b7f); }

/* topbar */
.exam-topbar { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0.9rem; border: 1px solid var(--line, #dfe7f0); border-radius: 10px; margin-bottom: 1rem; position: sticky; top: 0; background: var(--card, #fff); z-index: 60; }
.exam-timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; }
.exam-timer.warn { color: #b3541e; }
.exam-timer.urgent { color: #b3261e; }
.exam-progress { flex: 1; color: var(--muted, #5b6b7f); }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.9rem; }

/* main layout */
.exam-main { display: grid; grid-template-columns: 1fr 220px; gap: 1.25rem; align-items: start; }
@media (max-width: 760px) { .exam-main { grid-template-columns: 1fr; } }

.exam-qwrap { border: 1px solid var(--line, #dfe7f0); border-radius: 12px; padding: 1.25rem; background: var(--card, #fff); scroll-margin-top: 90px; }
.exam-qnum { font-size: 0.85rem; color: var(--muted, #5b6b7f); margin-top: 0; }
.exam-stem { font-size: 1.05rem; line-height: 1.55; }
.exam-diagram { background: #fff; border: 1px solid #dfe7f0; border-radius: 10px; padding: 0.75rem; margin: 1rem 0; text-align: center; }
.exam-diagram img { max-width: 100%; height: auto; }
.exam-diagram.small img { max-width: 420px; }

.exam-opts { display: grid; gap: 0.6rem; margin: 1rem 0; }
.exam-opt { display: flex; gap: 0.75rem; align-items: flex-start; text-align: left; padding: 0.7rem 0.9rem; border: 1px solid var(--line, #dfe7f0); border-radius: 10px; background: var(--card, #fff); cursor: pointer; font-size: 1rem; }
.exam-opt:hover { border-color: var(--water-dark, #0B5FA5); }
.exam-opt.selected { border-color: var(--water-dark, #0B5FA5); background: #eef5fc; box-shadow: 0 0 0 1px var(--water-dark, #0B5FA5); }
.opt-key { font-weight: 800; min-width: 1.4rem; }
.opt-val { flex: 1; }

.exam-nav { display: flex; gap: 0.6rem; justify-content: space-between; margin-top: 1rem; flex-wrap: wrap; }
.exam-opt.flagged, .btn.flagged { border-color: #b3541e; color: #b3541e; }

/* palette */
.exam-side { border: 1px solid var(--line, #dfe7f0); border-radius: 12px; padding: 1rem; background: var(--card, #fff); }
.exam-side h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.exam-palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.35rem; max-height: 420px; overflow-y: auto; }
.pal { aspect-ratio: 1; border: 1px solid var(--line, #dfe7f0); border-radius: 6px; background: var(--card, #fff); cursor: pointer; font-size: 0.8rem; padding: 0; }
.pal.answered { background: #e3f0fa; border-color: #9cc6e2; }
.pal.flagged { border-color: #b3541e; color: #b3541e; font-weight: 700; }
.pal.current { outline: 2px solid var(--water-dark, #0B5FA5); font-weight: 800; }
.exam-legend { font-size: 0.8rem; color: var(--muted, #5b6b7f); }

/* results */
.exam-results h2 { margin-bottom: 0.25rem; }
.exam-timeout { background: #fff8e6; border: 1px solid #f0d98c; border-radius: 8px; padding: 0.6rem 0.9rem; }
.exam-score { font-size: 2.2rem; font-weight: 800; margin: 0.5rem 0 0; }
.exam-pct { font-size: 1.2rem; color: var(--muted, #5b6b7f); margin-top: 0; }
.exam-catbars { margin: 1rem 0 1.5rem; display: grid; gap: 0.5rem; }
.exam-emailcta { margin: 0 0 1.5rem; font-size: 0.95rem; }
.exam-solutions-note { border: 1px solid var(--line, #dfe7f0); border-left: 4px solid var(--water-dark, #0B5FA5); border-radius: 8px; padding: 0.8rem 1rem; margin: 0 0 1.5rem; background: var(--card, #fff); font-size: 0.95rem; }
.exam-discount { border: 1px solid #b7d8b0; border-left: 4px solid #2e7d32; border-radius: 8px; padding: 0.9rem 1rem; margin: 0 0 1.5rem; background: #f2f9f0; }
.exam-discount h3 { margin: 0 0 0.4rem; }
.exam-discount .discount-code { font-family: ui-monospace, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: 1px; background: #fff; border: 1px dashed #2e7d32; border-radius: 8px; padding: 0.5rem 0.8rem; display: inline-block; margin: 0.3rem 0; }
.exam-referral { border: 1px solid #b9cdea; border-left: 4px solid #20548f; border-radius: 8px; padding: 0.9rem 1rem; margin: 0 0 1.5rem; background: #eef4fb; }
.exam-referral h3 { margin: 0 0 0.4rem; }
.exam-referral .discount-code { font-family: ui-monospace, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: 1px; background: #fff; border: 1px dashed #20548f; border-radius: 8px; padding: 0.5rem 0.8rem; display: inline-block; margin: 0.3rem 0; }
.exam-feedbackcta { border: 1px solid var(--line, #dfe7f0); border-radius: 8px; padding: 0.9rem 1rem; margin: 0 0 1.5rem; background: var(--card, #fff); }
.exam-feedbackcta h3 { margin: 0 0 0.4rem; }
.discount-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 0.5rem; }
.discount-row label { font-weight: 600; font-size: 0.95rem; }
.discount-row input { padding: 0.55rem 0.7rem; font-size: 1rem; border: 1px solid var(--line, #dfe7f0); border-radius: 8px; text-transform: uppercase; }
.discount-row .discount-msg { font-size: 0.9rem; color: var(--muted, #5b6b7f); }
.catbar-row { display: grid; grid-template-columns: minmax(160px, 240px) 1fr 96px; gap: 0.6rem; align-items: center; font-size: 0.9rem; }
.catbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catbar-track { position: relative; height: 10px; background: #edf1f6; border-radius: 6px; overflow: hidden; }
.catbar-fill { height: 100%; background: var(--water-dark, #0B5FA5); border-radius: 6px; }
/* benchmark marker (2026-11-06): spans the full track height so it stays
   clearly visible over both the fill and the empty track; left is set
   inline at the ~70% ballpark */
.catbar-marker { position: absolute; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); background: #e8930c; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9); }
.catbar-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-benchline { font-size: 0.95rem; color: var(--muted, #5b6b7f); margin: 0.4rem 0 0; }
.exam-catlegend { font-size: 0.85rem; color: var(--muted, #5b6b7f); margin: 0 0 0.25rem; }
.exam-weakbox { border: 1px solid #f0d9ae; border-left: 4px solid #e8930c; border-radius: 8px; padding: 0.9rem 1rem; margin: 1rem 0 1.5rem; background: #fffaf0; }
.exam-weakbox h3 { margin: 0 0 0.4rem; }
.exam-weakbox p { margin: 0.35rem 0; }
.exam-weakbox .weak-list { margin: 0.5rem 0; padding-left: 1.1rem; }
.exam-weakbox .weak-list li { margin: 0.25rem 0; font-weight: 600; }

.exam-review { display: grid; gap: 1rem; margin-top: 1rem; }
.rev-item { border: 1px solid var(--line, #dfe7f0); border-radius: 10px; padding: 1rem 1.1rem; background: var(--card, #fff); }
.rev-item.ok { border-left: 4px solid #2e7d32; }
.rev-item.miss { border-left: 4px solid #b3261e; }
.rev-head { font-size: 0.85rem; font-weight: 700; margin: 0 0 0.4rem; }
.rev-item.ok .rev-head { color: #2e7d32; }
.rev-item.miss .rev-head { color: #b3261e; }
.rev-stem { margin: 0.3rem 0; }
.rev-sol, .rev-dd, .rev-tk { font-size: 0.92rem; margin: 0.35rem 0; }
.rev-dd { color: #b3541e; }
.rev-tk { color: var(--muted, #5b6b7f); font-style: italic; }

/* pricing */
.pass-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.pass-card { border: 1px solid var(--line, #dfe7f0); border-radius: 12px; padding: 1.25rem; background: var(--card, #fff); }
.pass-card.featured { border-color: var(--water-dark, #0B5FA5); box-shadow: 0 2px 12px rgba(11, 95, 165, 0.12); }
.pass-card h3 { margin-top: 0; }
.pass-price { font-size: 1.8rem; font-weight: 800; margin: 0.25rem 0; }
.pass-card ul { padding-left: 1.1rem; margin: 0.6rem 0 1rem; }
.pass-card li { margin: 0.3rem 0; }
.paypal-button-wrap { min-height: 50px; margin-top: 0.75rem; }
.paypal-note { font-size: 0.85rem; color: var(--muted, #5b6b7f); }

.exam-ait-note { font-size: 0.9rem; color: var(--muted, #5b6b7f); font-style: italic; margin: 0.4rem 0; }
.exam-fillwrap { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.exam-fill { font-size: 1.05rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line, #dfe7f0); border-radius: 10px; max-width: 220px; }

/* finish-confirmation modal */
.exam-modal-overlay { position: fixed; inset: 0; background: rgba(20, 30, 45, 0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.exam-modal { background: var(--card, #fff); border-radius: 12px; padding: 1.5rem; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.25); }
.exam-modal h3 { margin-top: 0; }
.exam-modal-row { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

@media print {
  .exam-topbar, .exam-side, .exam-nav { display: none; }
  /* Copy protection (2026-11-06): exam questions, results and the
     question review (incl. Premium worked solutions) are view-only —
     printing the simulation pages yields just this notice. */
  #exam-app > * { display: none !important; }
  #exam-app::after {
    content: "Solutions are view-only in your browser.";
    display: block; padding: 2rem 0; font-size: 1rem;
  }
  .exam-results, .exam-review, .rev-item, .rev-sol, .rev-dd, .rev-tk { display: none !important; }
}

/* sample question preview */
#sample { margin: 2.5rem 0; }
#sample-app { margin-top: 1rem; }
.sample-start { text-align: center; padding: 1.5rem; border: 1px dashed var(--line, #dfe7f0); border-radius: 12px; }
.sample-count { font-weight: 700; margin-top: 0; }
.sample-error { color: #b3541e; }
.exam-opt.correct { border-color: #1e7e34; background: #e9f7ef; box-shadow: 0 0 0 1px #1e7e34; }
.exam-opt.wrong { border-color: #c0392b; background: #fdedec; box-shadow: 0 0 0 1px #c0392b; }
.exam-opt:disabled { cursor: default; }
.sample-feedback { border-top: 1px solid var(--line, #dfe7f0); margin-top: 1rem; padding-top: 1rem; }
.sample-verdict { font-weight: 700; }
.sample-verdict.good { color: #1e7e34; }
.sample-verdict.miss { color: #b3541e; }
.sample-feedback h4 { margin: 0.8rem 0 0.3rem; }
.sample-solution { white-space: pre-line; }
.sample-takeaway { font-style: italic; color: var(--muted, #5b6b7f); }
.sample-nav { margin-top: 1rem; }
.sample-gate { text-align: center; padding: 1.5rem; border: 1px solid var(--line, #dfe7f0); border-radius: 12px; background: var(--card, #fff); }
.sample-gate h3 { margin-top: 0; }
@keyframes sampleFlash { 0% { box-shadow: 0 0 0 0 rgba(11,95,165,0.55); } 100% { box-shadow: 0 0 0 18px rgba(11,95,165,0); } }
#pricing.sample-flash { animation: sampleFlash 1.2s ease-out 2; border-radius: 12px; }

/* pass code (cross-device access) */
.pass-confirm { text-align: center; padding: 2rem 1.5rem; border: 1px solid var(--line, #dfe7f0); border-radius: 12px; background: var(--card, #fff); }
.pass-confirm h2 { margin-top: 0; }
.pass-code-row { display: flex; gap: 0.6rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.pass-code { font-family: ui-monospace, monospace; font-size: 0.82rem; background: #f2f5f9; border: 1px dashed #9fb3c8; border-radius: 8px; padding: 0.6rem 0.8rem; word-break: break-all; max-width: 100%; }
.pass-note { color: var(--muted, #5b6b7f); font-size: 0.9rem; }
.exam-have-code { margin-top: 1.1rem; margin-bottom: 0; }
.linklike { background: none; border: none; color: var(--water-dark, #0B5FA5); text-decoration: underline; cursor: pointer; font-size: 0.95rem; padding: 0; }
.exam-code-form { margin-top: 0.6rem; }
.exam-code-input { font-family: ui-monospace, monospace; font-size: 0.88rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line, #dfe7f0); border-radius: 8px; width: min(420px, 100%); margin: 0 0.5rem 0.5rem 0; }
.exam-code-msg { font-size: 0.9rem; color: #b3541e; min-height: 1.2em; }

/* narrow screens: keep the sticky exam toolbar compact so it never covers answers */
@media (max-width: 640px) {
  .exam-topbar { padding: 0.45rem 0.6rem; gap: 0.6rem; }
  .exam-timer { font-size: 1.05rem; }
  .exam-qwrap { scroll-margin-top: 84px; }
  /* diagnostic rows: keep name, bar and % on one line without clipping */
  .catbar-row { grid-template-columns: minmax(96px, 36%) 1fr 88px; gap: 0.45rem; font-size: 0.84rem; }
}

/* copy protection: exam content is not selectable */
.exam-locked, .exam-locked * { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.exam-locked input, .exam-locked textarea { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }

/* Belt and braces: stems, options and every review/solution line stay
   unselectable inside the app even before lockDown arms. */
#exam-app .exam-stem, #exam-app .exam-opt, #exam-app .rev-stem,
#exam-app .rev-sol, #exam-app .rev-dd, #exam-app .rev-tk,
#exam-app .exam-review {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}

/* resume banner (v5.5) */
.exam-resume-banner { border: 2px solid var(--water-dark, #0B5FA5); border-radius: 12px;
  padding: 1rem 1.2rem; margin: 0 0 1.2rem; background: #f0f7fd; }
.exam-resume-banner p { margin: 0 0 0.7rem; font-weight: 600; }

/* numbered simulations list (v5.5) */
.exam-sims-title { margin: 1.2rem 0 0.5rem; font-size: 1.05rem; }
.exam-sims { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: 0.5rem; }
.exam-sim { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  border: 1px solid var(--line, #dfe7f0); border-radius: 10px; padding: 0.6rem 0.9rem;
  background: var(--card, #fff); }
.exam-sim-name { font-weight: 700; }
.exam-sim-status { font-size: 0.88rem; font-weight: 600; border-radius: 999px; padding: 0.2rem 0.7rem; }
.exam-sim-status.done { background: #e6f4ea; color: #1a6b2e; }
.exam-sim-status.progress { background: #fff4d6; color: #8a6100; }
.exam-sim-status.todo { background: #eef1f5; color: #5a6b7d; }

/* pass-code swap + exhausted-pass states (v5.4 QC fixes) */
.exam-swap-code { margin: -0.4rem 0 1rem; font-size: 0.88rem; }
.linklike { background: none; border: none; padding: 0; color: var(--water-dark, #0B5FA5);
  text-decoration: underline; cursor: pointer; font-size: inherit; font-family: inherit; }
.linklike:hover { filter: brightness(1.2); }
.exam-access-note.exhausted { color: #a33; font-weight: 700; }

/* exam switcher: prominent FE/PE picker visible on samples, paywall and paid intro */
.exam-switch { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  border: 1px solid var(--line, #dfe7f0); border-radius: 12px; padding: 0.7rem 1rem;
  background: var(--card, #fff); margin: 0 0 1.25rem; }
.exam-switch-label { font-weight: 700; font-size: 0.95rem; }
.exam-switch-on { font-weight: 800; color: var(--water-dark, #0B5FA5);
  border: 2px solid var(--water-dark, #0B5FA5); border-radius: 999px; padding: 0.3rem 0.9rem; }
.exam-switch-btn { font-weight: 700; text-decoration: none; color: #fff;
  background: var(--water-dark, #0B5FA5); border-radius: 999px; padding: 0.4rem 1rem; }
.exam-switch-btn:hover { filter: brightness(1.1); }

/* dark mode: the app uses hardcoded light surfaces, so they need dark variants
   or light text from the theme variables becomes unreadable on them */
@media (prefers-color-scheme: dark) {
  .exam-access-note { background: #13261c; border-color: #2f6544; }
  .exam-access-note.preview, .exam-timeout { background: #2a2115; border-color: #624a26; }
  .exam-diagram { background: #17232c; border-color: #344652; }
  .exam-opt.selected { background: #1a3445; }
  .pal.answered { background: #1a3445; border-color: #52afe7; }
  .exam-opt.correct { background: #13261c; }
  .exam-opt.wrong { background: #2b1a1e; }
  .catbar-track { background: #344652; }
  .catbar-marker { box-shadow: 0 0 0 1px rgba(23, 35, 44, 0.9); }
  .exam-weakbox { background: #2a2115; border-color: #624a26; border-left-color: #e8930c; }
  .pass-code { background: #1a3445; border-color: #52afe7; }
  .exam-opt.flagged, .btn.flagged, .pal.flagged { color: #f3b65f; border-color: #f3b65f; }
  .sample-error, .exam-code-msg, .rev-dd, .sample-verdict.miss { color: #f3b65f; }
  .exam-switch-on { color: #83c8f2; border-color: #83c8f2; }
  .linklike { color: #83c8f2; }
  .exam-access-note.exhausted { color: #f3b65f; }
  .exam-sim-status.done { background: #123d22; color: #7fe0a0; }
  .exam-sim-status.progress { background: #4a3a10; color: #ffd97a; }
  .exam-sim-status.todo { background: #2a3542; color: #a9bcd0; }
  .exam-resume-banner { background: #12283a; }
}

/* discount-code dark mode (v5.19) */
@media (prefers-color-scheme: dark) {
  .exam-discount { background: #14280f; border-color: #2e7d32; }
  .exam-discount .discount-code { background: #17232c; }
  .exam-referral { background: #12283a; border-color: #2a4a63; }
  .exam-referral .discount-code { background: #17232c; }
}
