/* Exam prep runner (/real-estate-exam-prep/practice/) only. Loaded after site.css and xp.css; uses the site's tokens,
   so light and dark themes follow the rest of the site. Prefix xp- (ep- is the episode prefix in site.css). */

/* ---------- Page chrome: a compact bar instead of the site header, no marketing footer ---------- */
.xp-runner-page { background: var(--paper); }
.xp-topbar { position: sticky; top: 0; z-index: 30; background: var(--header-bg); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rule); }
.xp-topbar__inner { display: flex; align-items: center; gap: 14px; min-height: 60px; padding-top: env(safe-area-inset-top); }
.xp-topbar__brand { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 10px; min-width: 44px; min-height: 44px; color: var(--ink); text-decoration: none; }
.xp-topbar .theme-toggle { flex: none; }
.xp-runner .btn--sm, .xp-dialog .btn--sm { min-height: 44px; } /* 44px targets next to the question */
.xp-topbar__brand img { width: 32px; height: 32px; border-radius: 7px; flex: none; }
.xp-topbar__title { display: grid; min-width: 0; line-height: 1.2; }
.xp-topbar__title h1 { margin: 0; font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.01em; }
.xp-topbar__title span { font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-topbar__status { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.xp-topbar__progress { margin: 0; font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; }
.xp-timer { margin: 0; display: inline-flex; flex: none; white-space: nowrap; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: 999px; font-variant-numeric: tabular-nums; font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.xp-timer.is-low { border-color: var(--accent); color: var(--accent); }
.xp-timer[hidden] { display: none; }
.xp-topbar__exit { display: inline-flex; flex: none; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--ink-2); font-size: 0.9375rem; font-weight: 600; text-decoration: none; }
.xp-topbar__exit:hover { color: var(--ink); background: var(--paper-2); }
@media (max-width: 699px) {
  .xp-topbar__inner { gap: 8px; min-height: 56px; }
  .xp-topbar__brand img { width: 28px; height: 28px; }
  .xp-topbar__title span, .xp-topbar__progress { display: none; }
  .xp-topbar .theme-toggle { display: none; }
}
.xp-minifooter { border-top: 1px solid var(--rule); padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); font-size: 0.875rem; color: var(--ink-3); }
.xp-minifooter ul { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 8px 0 0; padding: 0; }
.xp-minifooter a { color: var(--ink-2); }

/* ---------- Stage ---------- */
.xp-shell { padding-block: clamp(20px, 4vw, 44px) 40px; }
.xp-stage:focus { outline: none; }
.xp-view { max-width: 1080px; }
.xp-view--question { max-width: none; }
.xp-head { max-width: 740px; margin-bottom: 22px; }
.xp-head__title { font-family: var(--font-serif); font-size: clamp(1.75rem, 1.4rem + 1.3vw, 2.375rem); line-height: 1.12; letter-spacing: -0.015em; margin: 6px 0 0; }
.xp-head__title:focus, .xp-head__title:focus-visible { outline: none; } /* focused by script for screen readers; not a control */
.xp-head__lede { margin: 10px 0 0; font-size: 1.0625rem; line-height: 1.55; color: var(--ink-2); }
.xp-sub { font-family: var(--font-sans); font-size: 1.0625rem; font-weight: 650; margin: 0 0 10px; }
.xp-small { font-size: 0.9375rem; line-height: 1.55; color: var(--ink-3); max-width: 740px; }
.xp-savestate { min-height: 1.4em; margin: 20px 0 0; font-size: 0.875rem; color: var(--ink-3); }
.xp-boot h2 { font-family: var(--font-serif); font-size: 1.75rem; }
.xp-loading { color: var(--ink-3); }

/* Notices */
.xp-notices:empty { display: none; }
.xp-notices { display: grid; gap: 10px; margin-bottom: 18px; max-width: 900px; }
.xp-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--rule-strong); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); font-size: 0.9375rem; line-height: 1.5; color: var(--ink); }
.xp-notice p { margin: 0; }
.xp-notice .xp-icon { flex: none; margin-top: 2px; color: var(--accent); }
.xp-notice--warn { border-left-color: var(--ink); background: var(--paper-2); }
.xp-notice--ok .xp-icon { color: var(--ok); }
.xp-view > .xp-notice { margin-bottom: 18px; max-width: 900px; }

/* ---------- Setup ---------- */
.xp-modes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 8px; max-width: 980px; }
@media (min-width: 760px) { .xp-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.xp-card { display: flex; flex-direction: column; gap: 10px; padding: 22px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.xp-card p { margin: 0; line-height: 1.55; color: var(--ink-2); }
.xp-card .btn, .xp-card .btn-row { margin-top: auto; }
.xp-card .btn-row { padding-top: 6px; }
.xp-card--wide { grid-column: 1 / -1; }
.xp-card--resume { margin-bottom: 18px; border-color: var(--accent); background: var(--accent-soft); max-width: 740px; }
.xp-card__title { font-family: var(--font-sans); font-size: 1.1875rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.xp-card__meta { font-size: 0.875rem; color: var(--ink-3) !important; }
.xp-form { display: grid; gap: 16px; margin-top: 4px; }
.xp-field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.xp-field > legend, .xp-field > label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.xp-field select { max-width: 520px; width: 100%; }
.xp-field__help { font-size: 0.875rem !important; color: var(--ink-3) !important; }
.xp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.xp-chips--stack { flex-direction: column; align-items: stretch; }
.xp-chip { position: relative; display: inline-flex; }
.xp-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.xp-chip span, .xp-chip--btn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); color: var(--ink-2); font: inherit; font-size: 0.9375rem; line-height: 1.35; cursor: pointer; transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease); }
.xp-chips--stack .xp-chip span { border-radius: var(--radius); width: 100%; }
.xp-chip input:checked + span, .xp-chip--btn.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.xp-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.xp-chip input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.xp-history, .xp-data { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); max-width: 900px; }
.xp-history__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.xp-history__list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 6px 18px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; }
.xp-history__label { font-weight: 600; }
.xp-history__score { color: var(--ink-2); }
.xp-history__date { color: var(--ink-3); white-space: nowrap; }
@media (max-width: 699px) { .xp-history__list li { grid-template-columns: 1fr auto; } .xp-history__score { grid-column: 1 / -1; grid-row: 2; } }
.xp-data p { margin: 0 0 10px; color: var(--ink-2); max-width: 740px; line-height: 1.55; }
.xp-data .muted { color: var(--ink-3); font-size: 0.9375rem; }

/* ---------- Question ---------- */
.xp-q-layout { display: grid; gap: 28px; }
@media (min-width: 1080px) { .xp-q-layout { grid-template-columns: minmax(0, 740px) 280px; justify-content: space-between; align-items: start; } }
.xp-q { min-width: 0; }
.xp-q__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.xp-q__topic { margin: 0; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.xp-q__tools { display: inline-flex; align-items: center; gap: 6px; }
.xp-q__num { font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 600; color: var(--accent); margin: 14px 0 0; }
.xp-q__num:focus, .xp-q__num:focus-visible { outline: none; }
.xp-q__seen { margin: 6px 0 0; font-size: 0.875rem; color: var(--ink-3); }
.xp-q__stem { margin-top: 10px; font-family: var(--font-serif); font-size: clamp(1.1875rem, 1.13rem + 0.25vw, 1.3125rem); line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.xp-q__stem p { margin: 0; }
.xp-q__stem p + p { margin-top: 0.75em; }
.xp-flag { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: 999px; background: transparent; color: var(--ink-2); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease); }
.xp-flag:hover { border-color: var(--ink); color: var(--ink); }
.xp-flag.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.xp-linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--link); font: inherit; font-size: 0.9375rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.xp-linkbtn--quiet { color: var(--ink-3); font-size: 0.875rem; }

.xp-choices { border: 0; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; min-width: 0; }
.xp-choice { position: relative; }
.xp-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.xp-choice label { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 4px 12px; min-height: 56px; padding: 13px 16px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); font-size: 1.0625rem; line-height: 1.5; cursor: pointer; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.xp-choice__key { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1.5px solid var(--rule-strong); border-radius: 50%; font-family: var(--font-sans); font-size: 0.875rem; font-weight: 650; color: var(--ink-2); transition: inherit; }
.xp-choice__text { padding-top: 3px; overflow-wrap: anywhere; }
.xp-choice__state { grid-column: 2; display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 650; }
.xp-choice label:hover { border-color: var(--ink-3); }
.xp-choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.xp-choice.is-selected label { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.xp-choice.is-selected .xp-choice__key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.xp-choice input:disabled + label { cursor: default; }
.xp-choice input:disabled + label:hover { border-color: var(--rule-strong); }
/* After Check: the key and a wrong pick are marked by border style, an icon and words, not colour alone. */
.xp-choice.is-key label { border-color: var(--ok); border-style: solid; background: color-mix(in srgb, var(--ok) 9%, var(--paper)); box-shadow: inset 0 0 0 1px var(--ok); }
.xp-choice.is-key .xp-choice__key { background: var(--ok); border-color: var(--ok); color: var(--paper); }
.xp-choice.is-key .xp-choice__state { color: var(--ok); }
.xp-choice.is-wrong label { border-color: var(--err); border-style: dashed; background: color-mix(in srgb, var(--err) 7%, var(--paper)); box-shadow: none; }
.xp-choice.is-wrong .xp-choice__key { background: transparent; border-color: var(--err); color: var(--err); }
.xp-choice.is-wrong .xp-choice__state { color: var(--err); }
.xp-hint { margin: 12px 0 0; font-weight: 600; color: var(--ink); }

.xp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.xp-actions .btn { min-width: 150px; }
@media (max-width: 699px) {
  /* Not sticky on purpose: a bar pinned to the bottom of a phone screen would sit on top of the last answer or the
     explanation until you scroll. In the normal flow the buttons always come right after what they act on. */
  .xp-actions .btn { flex: 1 1 0; min-width: 0; padding-inline: 12px; }
  .xp-view--question .xp-actions:last-child { padding-bottom: env(safe-area-inset-bottom); }
}

/* Feedback */
.xp-feedback { margin-top: 26px; padding: 22px 22px 18px; border: 1px solid var(--rule); border-left: 4px solid var(--ok); border-radius: var(--radius-lg); background: var(--paper-2); }
.xp-feedback.is-wrong { border-left-color: var(--err); }
.xp-feedback--plain { border-left-color: var(--rule-strong); margin-top: 18px; }
.xp-feedback__title { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-sans); font-size: 1.1875rem; font-weight: 700; }
.xp-feedback__title:focus, .xp-feedback__title:focus-visible { outline: none; }
.xp-feedback.is-right .xp-feedback__title .xp-icon { color: var(--ok); }
.xp-feedback.is-wrong .xp-feedback__title .xp-icon { color: var(--err); }
.xp-feedback__block { margin-top: 16px; }
.xp-feedback__block h4 { margin: 0 0 4px; font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.xp-feedback__block p { margin: 0; font-size: 1.0625rem; line-height: 1.6; color: var(--ink); }
.xp-feedback__block p + p { margin-top: 0.6em; }
.xp-why { margin: 4px 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; font-size: 1rem; line-height: 1.55; color: var(--ink-2); }
.xp-feedback__note { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; font-size: 0.9375rem; color: var(--ink-2); }
.xp-feedback__note .xp-icon { flex: none; margin-top: 3px; }
.xp-sources { margin: 16px 0 0; font-size: 0.9375rem; line-height: 1.5; color: var(--ink-3); overflow-wrap: anywhere; }
.xp-sources__label { font-weight: 600; color: var(--ink-2); }
.xp-report-line { margin: 8px 0 0; }

/* Question list */
.xp-nav { min-width: 0; }
@media (min-width: 1080px) { .xp-nav { position: sticky; top: 84px; } }
.xp-nav__box { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.xp-nav__box > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 10px 16px; cursor: pointer; font-weight: 650; list-style: none; }
.xp-nav__box > summary::-webkit-details-marker { display: none; }
.xp-nav__sum { margin-left: auto; font-weight: 400; font-size: 0.875rem; color: var(--ink-3); }
.xp-nav__grid { list-style: none; margin: 0; padding: 4px 14px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.xp-navq { position: relative; display: grid; place-items: center; width: 100%; min-height: 44px; border: 1.5px solid var(--rule-strong); border-radius: 8px; background: var(--paper); color: var(--ink-2); font: inherit; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.xp-navq .xp-icon { position: absolute; top: 3px; right: 3px; }
.xp-navq.is-done { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.xp-navq.is-right { background: color-mix(in srgb, var(--ok) 10%, var(--paper)); border-color: var(--ok); }
.xp-navq.is-wrong { background: color-mix(in srgb, var(--err) 8%, var(--paper)); border-color: var(--err); }
.xp-navq.is-skipped { border-style: dashed; }
.xp-navq.is-flagged .xp-icon:first-of-type { color: var(--accent); }
.xp-navq.is-current { outline: 2px solid var(--ink); outline-offset: 1px; }
.xp-nav__legend { margin: 0; padding: 0 16px 12px; font-size: 0.8125rem; color: var(--ink-3); }
.xp-nav__box > .btn { margin: 0 16px 16px; }

/* ---------- Mock intro ---------- */
.xp-list { max-width: 740px; margin: 0 0 18px; padding-left: 1.2em; line-height: 1.6; color: var(--ink-2); }
.xp-list li + li { margin-top: 6px; }
.xp-limits { max-width: 740px; margin: 0 0 22px; border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.xp-limits summary { min-height: 48px; display: flex; align-items: center; padding: 0 16px; font-weight: 650; cursor: pointer; }
.xp-limits ul { margin: 0; padding: 0 20px 16px 36px; line-height: 1.6; color: var(--ink-2); }
.xp-limits li + li { margin-top: 6px; }

/* ---------- Results ---------- */
.xp-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; max-width: 900px; }
.xp-score { padding: 22px; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.xp-score__label { margin: 0 0 6px; font-family: var(--font-sans); font-size: 1rem; font-weight: 650; }
.xp-score__big { margin: 0; font-family: var(--font-serif); font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem); line-height: 1.05; letter-spacing: -0.02em; }
.xp-score__sub { margin: 6px 0 0; color: var(--ink-2); }
.xp-score__rows { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.xp-score__rows dt { color: var(--ink-2); }
.xp-score__rows dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.xp-split { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 14px; color: var(--ink-2); }
.xp-split p { margin: 0; }
.xp-topics { margin-top: 32px; max-width: 900px; }
.xp-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.xp-table th, .xp-table td { padding: 10px 8px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.xp-table thead th { font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); }
.xp-table tbody th { font-weight: 500; }
.xp-table td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.xp-table td:last-child { width: 32%; }
.xp-bar { display: block; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--w), var(--paper-3) var(--w)); }
@media (max-width: 599px) { .xp-table td:last-child { display: none; } }
.xp-next { margin-top: 32px; max-width: 740px; padding: 24px; border: 1px solid var(--accent); border-radius: var(--radius-lg); background: var(--accent-soft); }
.xp-next__title { font-family: var(--font-serif); font-size: 1.625rem; line-height: 1.2; margin: 6px 0 8px; }
.xp-next p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.55; }
.xp-view--results > .btn-row { margin-top: 26px; }
.xp-partners { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--rule); max-width: 740px; }
.xp-partners ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.xp-partners__disclosure { display: block; font-size: 0.875rem; color: var(--ink-3); }
.xp-disclaimer { margin-top: 28px; }

/* ---------- Review ---------- */
.xp-view--review .xp-chips { margin-bottom: 20px; }
.xp-q--review { max-width: 740px; }
.xp-rv-choices { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.xp-rv-choices li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: var(--radius-lg); line-height: 1.5; }
.xp-rv-choices li.is-key { border-color: var(--ok); }
.xp-rv-choices li.is-wrong { border-color: var(--err); border-style: dashed; }
.xp-rv-choices .xp-choice__state { grid-column: 2; }
.xp-rv-choices li.is-key .xp-choice__state { color: var(--ok); }
.xp-rv-choices li.is-wrong .xp-choice__state { color: var(--err); }
.xp-rv-result { margin: 14px 0 0; font-weight: 650; }
.xp-empty { color: var(--ink-2); }

/* ---------- Dialogs ---------- */
.xp-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg); }
.xp-dialog::backdrop { background: rgba(8, 15, 26, 0.55); }
.xp-dialog__body { padding: 24px; }
.xp-dialog h2 { margin: 0 0 10px; font-family: var(--font-sans); font-size: 1.25rem; font-weight: 700; }
.xp-dialog p { margin: 0 0 12px; line-height: 1.55; color: var(--ink-2); }
.xp-dialog .btn-row { margin-top: 18px; }
.xp-dialog .field textarea { width: 100%; min-height: 130px; }
.xp-dialog .xp-ref { display: flex; gap: 8px; margin: 6px 0 4px; }
.xp-dialog .xp-ref input { flex: 1; min-width: 0; min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .xp-runner-page *, .xp-runner-page *::before, .xp-runner-page *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .xp-topbar, .xp-nav, .xp-actions, .xp-minifooter, .xp-notices { display: none !important; }
}
