/* TriagePass Engine - practice app styles.
 * Scoped under .tp-app. Skin it from the theme by overriding the --tp-* variables.
 * Logical properties throughout (RTL-safe). Mobile first. */

.tp-app {
  --tp-accent: #1e5eff;               /* exam profession colour, set per exam by app.js */
  --tp-accent-rgb: 30 94 255;
  --tp-accent-strong: #1a50d6;        /* AA-safe version of the accent for text and buttons */
  --tp-accent-strong-rgb: 26 80 214;
  --tp-ink: #0f1b2d;
  --tp-paper: #f7f5ef;
  --tp-card: #ffffff;
  --tp-line: #dedacd;
  --tp-line-strong: #b4af9f;
  --tp-muted: #4b5563;
  --tp-sunk: #ece8dc;
  --tp-good: #146c36;   --tp-good-soft: #e2f3e8;
  --tp-bad: #b3261e;    --tp-bad-soft: #fbe9e7;
  --tp-warn: #8a5300;   --tp-warn-soft: #fbefd5;
  --tp-tag-free: #e4e0d2;     --tp-tag-free-ink: #2b3139;
  --tp-tag-basic: #1b7a45;    --tp-tag-basic-ink: #ffffff;
  --tp-tag-pro: #f2c230;      --tp-tag-pro-ink: #1c1a10;
  --tp-tag-premium: #151a22;  --tp-tag-premium-ink: #ffffff;
  --tp-radius: 12px;
  --tp-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  position: relative;
  box-sizing: border-box;
  color: var(--tp-ink);
  font-family: var(--tp-font);
  font-size: 17px;
  line-height: 1.6;
  text-align: start;
  background: var(--tp-paper);
  padding: 14px;
  border-radius: var(--tp-radius);
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 900px) { .tp-app { font-size: 18px; padding: 24px; } }
.tp-app *, .tp-app *::before, .tp-app *::after { box-sizing: border-box; }
.tp-app h2, .tp-app h3, .tp-app p, .tp-app ul, .tp-app ol, .tp-app fieldset, .tp-app legend, .tp-app figure { margin: 0; padding: 0; }
.tp-app ul, .tp-app ol { list-style: none; }
.tp-app fieldset { border: 0; min-inline-size: 0; }
.tp-app h2, .tp-app h3 { color: var(--tp-ink); line-height: 1.25; font-family: inherit; text-transform: none; letter-spacing: normal; }
.tp-app h3 { font-size: 1.12em; font-weight: 700; }
.tp-app a { color: var(--tp-accent-strong); text-underline-offset: 3px; }
.tp-app button { font-family: inherit; }
.tp-app :focus-visible { outline: 3px solid var(--tp-accent-strong); outline-offset: 2px; border-radius: 4px; }
.tp-app [tabindex="-1"]:focus { outline: none; }
.tp-app [hidden] { display: none !important; }
.tp-sr { position: absolute !important; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tp-skip { position: absolute; inset-inline-start: 8px; inset-block-start: 8px; z-index: 5; background: var(--tp-ink); color: #fff !important; padding: 10px 14px; border-radius: 8px; clip: rect(0 0 0 0); clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }
.tp-skip:focus { clip: auto; clip-path: none; inline-size: auto; block-size: auto; }

/* ---- layout helpers */
.tp-app .tp-main { display: flex; flex-direction: column; gap: 16px; min-inline-size: 0; }
.tp-view { display: flex; flex-direction: column; gap: 18px; min-inline-size: 0; }
.tp-stack { display: flex; flex-direction: column; gap: 12px; }
.tp-stack-lg { display: flex; flex-direction: column; gap: 18px; }
.tp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-between { justify-content: space-between; }
.tp-self-start { align-self: start; }
.tp-gap-sm { gap: 10px !important; }
.tp-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.tp-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tp-grid-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .tp-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tp-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .tp-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tp-grid { gap: 18px; } }
.tp-builder-grid, .tp-plan-grid { align-items: start; }
.tp-muted { color: var(--tp-muted); }
.tp-small { font-size: .88em; }
.tp-strong { font-weight: 650; }
.tp-pre { white-space: pre-wrap; }
.tp-code { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.tp-dot { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; margin-inline-end: 8px; vertical-align: middle; flex: none; }
.tp-empty { text-align: center; padding: 28px 12px; color: var(--tp-muted); }
.tp-ic { flex: none; vertical-align: -0.2em; }
.tp-ic-sm { inline-size: 1em; block-size: 1em; }
.tp-ic-dir:dir(rtl) { transform: scaleX(-1); }
[dir="rtl"] .tp-ic-dir { transform: scaleX(-1); }
.tp-backlink { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }

.tp-title { font-size: clamp(26px, 4.2vw, 36px); font-weight: 800; letter-spacing: -0.015em; line-height: 1.15; }
.tp-eyebrow { font-size: .72em; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--tp-accent-strong); margin-block-end: 4px; }
.tp-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; justify-content: space-between; }
.tp-head > div:first-child { flex: 1 1 280px; min-inline-size: 0; display: flex; flex-direction: column; gap: 4px; }
.tp-head-cta { margin-block-start: 10px; }

.tp-card { background: var(--tp-card); border: 1px solid var(--tp-line); border-radius: var(--tp-radius); padding: 16px; --tp-hole: #fff; }
@media (min-width: 900px) { .tp-card { padding: 22px; } }

/* ---- buttons */
.tp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: 44px; padding: 9px 18px; border: 1.5px solid var(--tp-line-strong); background: var(--tp-card); color: var(--tp-ink) !important;
  border-radius: 9px; font-size: 16px; font-weight: 650; line-height: 1.2; cursor: pointer; text-decoration: none !important; text-align: center; font-family: inherit;
}
.tp-btn:hover { background: var(--tp-sunk); }
.tp-btn-primary { background: var(--tp-accent-strong); border-color: var(--tp-accent-strong); color: #fff !important; }
.tp-btn-primary:hover { background: var(--tp-accent-strong); filter: brightness(1.12); }
.tp-btn-dark { background: var(--tp-ink); border-color: var(--tp-ink); color: #fff !important; }
.tp-btn-dark:hover { background: var(--tp-ink); filter: brightness(1.25); }
.tp-btn-quiet { border-color: transparent; background: transparent; }
.tp-btn-quiet:hover { background: var(--tp-sunk); }
.tp-btn-sm { min-block-size: 40px; padding: 6px 12px; font-size: 15px; }
.tp-btn-lg { min-block-size: 52px; padding: 12px 24px; font-size: 17px; }
.tp-btn[disabled], .tp-btn[aria-disabled="true"] { opacity: .5; cursor: default; filter: none; }
.tp-btn[aria-pressed="true"].tp-btn-quiet { color: var(--tp-accent-strong) !important; background: rgb(var(--tp-accent-rgb) / .1); }
.tp-linkbtn { background: none; border: 0; padding: 0; color: var(--tp-accent-strong); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* ---- triage tag motif */
.tp-tag {
  --tg: var(--tp-tag-free); --tg-ink: var(--tp-tag-free-ink);
  position: relative; display: inline-flex; align-items: center; background: var(--tg); color: var(--tg-ink);
  padding: 3px 12px 3px 24px; font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; line-height: 1.5; white-space: nowrap;
  padding-inline: 24px 12px; padding-block: 3px;
  clip-path: polygon(13px 0, 100% 0, 100% 100%, 13px 100%, 0 50%);
}
.tp-tag:dir(rtl) { clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%); }
[dir="rtl"] .tp-tag { clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%); }
.tp-tag-hole { position: absolute; inset-inline-start: 11px; inset-block-start: 50%; inline-size: 6px; block-size: 6px; margin-block-start: -3px; border-radius: 50%; background: var(--tp-hole, #fff); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); }
.tp-tag-basic { --tg: var(--tp-tag-basic); --tg-ink: var(--tp-tag-basic-ink); }
.tp-tag-pro { --tg: var(--tp-tag-pro); --tg-ink: var(--tp-tag-pro-ink); }
.tp-tag-premium { --tg: var(--tp-tag-premium); --tg-ink: var(--tp-tag-premium-ink); }

/* ---- exam switcher (tag chips) */
.tp-exams ul { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.tp-examtab {
  position: relative; display: flex; align-items: center; gap: 10px; min-block-size: 52px; white-space: nowrap;
  padding: 8px 14px; padding-inline-start: 34px; background: var(--tp-card); border: 1.5px solid var(--tp-line-strong); border-inline-start: 8px solid var(--tab, var(--tp-accent));
  border-radius: 10px; color: var(--tp-ink) !important; text-decoration: none !important; font-weight: 700;
}
.tp-examtab-hole { position: absolute; inset-inline-start: 12px; inset-block-start: 50%; inline-size: 10px; block-size: 10px; margin-block-start: -5px; border-radius: 50%; border: 2px solid var(--tp-line-strong); background: var(--tp-paper); }
.tp-examtab:hover { background: var(--tp-sunk); }
.tp-examtab.is-on { border-color: var(--tp-ink); box-shadow: 0 0 0 1.5px var(--tp-ink); }
.tp-examtab.is-soon { opacity: .75; }
.tp-examtab-free { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--tp-muted); }
.tp-exams-select { max-inline-size: 360px; }

/* ---- section tabs */
.tp-tabs ul { display: flex; gap: 2px; overflow-x: auto; border-block-end: 2px solid var(--tp-line); scrollbar-width: none; }
.tp-tabs ul::-webkit-scrollbar { display: none; }
.tp-tabs a { display: inline-flex; align-items: center; gap: 6px; min-block-size: 46px; padding: 8px 14px; white-space: nowrap; font-weight: 650; font-size: 16px; color: var(--tp-muted) !important; text-decoration: none !important; border-block-end: 4px solid transparent; margin-block-end: -2px; }
.tp-tabs a:hover { color: var(--tp-ink) !important; }
.tp-tabs a.is-active { color: var(--tp-ink) !important; border-block-end-color: var(--tp-accent-strong); }
.tp-tabs a.is-locked { opacity: .8; }

/* ---- renewal banner */
.tp-banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: #fff3c9; border: 1.5px solid #e2b92a; border-inline-start-width: 8px; border-radius: 10px; padding: 12px 16px; color: #3b2f00; }
.tp-banner p { flex: 1 1 260px; }

/* ---- pass ticket */
.tp-pass { position: relative; flex: 0 1 340px; min-inline-size: min(100%, 260px); background: var(--tp-card); border: 1.5px solid var(--tp-ink); border-radius: 8px; padding: 22px 16px 14px; padding-inline-start: 46px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; overflow: hidden; --tp-hole: var(--tp-paper); }
.tp-pass::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 10px; background: var(--tp-tag-free); }
.tp-pass-basic::before { background: var(--tp-tag-basic); }
.tp-pass-pro::before { background: var(--tp-tag-pro); }
.tp-pass-premium::before { background: var(--tp-tag-premium); }
.tp-pass-hole { position: absolute; inset-inline-start: 16px; inset-block-start: 26px; inline-size: 14px; block-size: 14px; border-radius: 50%; border: 2px solid var(--tp-ink); background: var(--tp-paper); }
.tp-pass-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-pass-exam { font-weight: 800; font-size: 1.05em; }
.tp-pass-line { font-size: .94em; }

/* ---- nudge / upsell */
.tp-nudge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border-inline-start: 8px solid var(--tp-tag-pro); }
.tp-nudge > div { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; }
.tp-upsell { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; background: var(--tp-paper); border: 1.5px dashed var(--tp-line-strong); }
.tp-upsell-body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.tp-upsell.is-compact { flex-direction: column; align-items: flex-start; }
.tp-upsell.is-compact .tp-upsell-body { flex: 1 1 auto; }
.tp-upsell.is-compact .tp-btn { align-self: stretch; }

/* ---- stats, meters */
.tp-stat { display: flex; flex-direction: column; gap: 4px; }
.tp-stat-label { font-size: .84em; font-weight: 650; color: var(--tp-muted); }
.tp-value { font-size: clamp(28px, 4vw, 36px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tp-scoretag { position: relative; border-block-start: 10px solid var(--tp-accent-strong); }
.tp-scoretag::after { content: ""; position: absolute; inset-inline-end: 16px; inset-block-start: 6px; inline-size: 12px; block-size: 12px; border-radius: 50%; border: 2px solid var(--tp-line-strong); background: var(--tp-paper); }
.tp-meter { block-size: 9px; background: var(--tp-sunk); border-radius: 99px; overflow: hidden; }
.tp-meter span { display: block; block-size: 100%; background: var(--tp-accent-strong); border-radius: 99px; transition: inline-size .3s; }
.tp-meter.good span { background: var(--tp-good); }
.tp-meter.warn span { background: #b36b00; }
.tp-meter.bad span { background: var(--tp-bad); }
.tp-tone-good { color: var(--tp-good); } .tp-tone-warn { color: var(--tp-warn); } .tp-tone-bad { color: var(--tp-bad); }

.tp-gauge { padding-block: 6px 0; }
.tp-gauge-track { position: relative; block-size: 16px; background: var(--tp-sunk); border-radius: 99px; }
.tp-gauge-band { position: absolute; inset-block: 0; background: rgb(var(--tp-accent-strong-rgb) / .35); border: 2px solid var(--tp-accent-strong); border-radius: 99px; }
.tp-gauge-est { position: absolute; inset-block: -5px; inline-size: 4px; margin-inline-start: -2px; background: var(--tp-ink); border-radius: 2px; }
.tp-gauge-line { position: absolute; inset-block: -8px; border-inline-start: 2px dashed var(--tp-bad); }
.tp-gauge-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--tp-muted); margin-block-start: 6px; }

/* ---- domain list */
.tp-domlist { display: flex; flex-direction: column; }
.tp-dom { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "meta meta" "acc acc"; gap: 6px 12px; align-items: center; padding-block: 14px; border-block-start: 1px solid var(--tp-line); }
.tp-dom:first-child { border-block-start: 0; }
.tp-dom-name { grid-area: name; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-weight: 650; min-inline-size: 0; }
.tp-dom-name .tp-dot { margin-inline-end: 0; }
.tp-dom-meta { grid-area: meta; }
.tp-dom-acc { grid-area: acc; display: flex; align-items: center; gap: 10px; }
.tp-dom-acc .tp-meter { flex: 1; }
.tp-dom-pct { font-weight: 800; min-inline-size: 3.2ch; font-variant-numeric: tabular-nums; }
.tp-dom > .tp-btn { grid-area: btn; }
.tp-dom-res { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "meta" "acc"; }
@media (min-width: 900px) {
  .tp-dom { grid-template-columns: minmax(240px, 1.5fr) 150px minmax(180px, 1fr) auto; grid-template-areas: "name meta acc btn"; gap: 16px; }
  .tp-dom-res { grid-template-columns: minmax(240px, 1.5fr) 100px minmax(180px, 1fr); grid-template-areas: "name meta acc"; }
}
.tp-chip { display: inline-block; padding: 1px 9px; border-radius: 99px; background: var(--tp-sunk); color: var(--tp-muted); font-size: 12.5px; font-weight: 650; }

.tp-list { display: flex; flex-direction: column; }
.tp-li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 11px; border-block-start: 1px solid var(--tp-line); color: inherit !important; text-decoration: none !important; }
.tp-list > li:first-child > .tp-li, .tp-list > .tp-li:first-child { border-block-start: 0; }
.tp-list > li.tp-muted { padding-block: 4px; }
a.tp-li:hover { background: var(--tp-paper); }

.tp-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--tp-sunk); color: #3b4350; text-decoration: none !important; white-space: nowrap; }
.tp-badge-accent { background: rgb(var(--tp-accent-strong-rgb) / .12); color: var(--tp-accent-strong); }
.tp-badge-good { background: var(--tp-good-soft); color: var(--tp-good); }
.tp-badge-bad { background: var(--tp-bad-soft); color: var(--tp-bad); }
.tp-badge-warn { background: var(--tp-warn-soft); color: var(--tp-warn); }

.tp-alert { padding: 10px 14px; border-radius: 9px; font-size: .94em; }
.tp-alert-error { background: var(--tp-bad-soft); color: var(--tp-bad); }
.tp-alert-ok { background: var(--tp-good-soft); color: var(--tp-good); }
.tp-alert-warn { background: var(--tp-warn-soft); color: var(--tp-warn); }
.tp-app .tp-note { background: var(--tp-card); border: 1px solid var(--tp-line); border-inline-start: 6px solid var(--tp-accent-strong); border-radius: 8px; padding: 12px 16px; }

/* ---- forms */
.tp-label { display: block; font-weight: 700; font-size: .92em; margin-block-end: 6px; padding: 0; }
.tp-app select, .tp-app input[type="date"], .tp-app textarea {
  inline-size: 100%; min-block-size: 46px; padding: 9px 12px; border: 1.5px solid var(--tp-line-strong); border-radius: 9px; background: var(--tp-card); color: var(--tp-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.tp-app textarea { min-block-size: 96px; resize: vertical; }
.tp-checks { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .tp-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; } }
.tp-check { position: relative; display: flex; align-items: center; gap: 12px; min-block-size: 44px; cursor: pointer; font-size: 16px; padding-block: 2px; }
.tp-check input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.tp-check-box { flex: none; display: grid; place-items: center; inline-size: 24px; block-size: 24px; border: 2px solid var(--tp-line-strong); border-radius: 6px; background: var(--tp-card); color: #fff; }
.tp-check-box .tp-ic { inline-size: 16px; block-size: 16px; opacity: 0; stroke-width: 3; }
.tp-check input:checked + .tp-check-box { background: var(--tp-accent-strong); border-color: var(--tp-accent-strong); }
.tp-check input:checked + .tp-check-box .tp-ic { opacity: 1; }
.tp-check input:focus-visible + .tp-check-box { outline: 3px solid var(--tp-accent-strong); outline-offset: 2px; }
.tp-check-text { flex: 1; min-inline-size: 0; }
.tp-fieldset { display: flex; flex-direction: column; gap: 8px; min-inline-size: 0; }
.tp-fieldset > .tp-row { margin-block-end: 2px; }
.tp-fieldset legend { padding: 0; float: none; }

.tp-seg { display: inline-flex; flex-wrap: wrap; background: var(--tp-sunk); border-radius: 10px; padding: 3px; gap: 3px; }
.tp-seg button { min-block-size: 42px; border: 0; background: transparent; padding: 6px 16px; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; color: var(--tp-muted); display: inline-flex; align-items: center; gap: 6px; }
.tp-seg button.is-on { background: var(--tp-card); color: var(--tp-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.tp-seg button[disabled] { opacity: .55; cursor: default; }
.tp-ticks { display: grid; gap: 8px; font-size: .94em; }
.tp-ticks li { padding-inline-start: 26px; position: relative; }
.tp-ticks li::before { content: ""; position: absolute; inset-inline-start: 4px; inset-block-start: .35em; inline-size: 7px; block-size: 12px; border: solid var(--tp-accent-strong); border-width: 0 2.5px 2.5px 0; transform: rotate(40deg); }
.tp-ticks li:dir(rtl)::before { transform: rotate(40deg); }

/* ---- player */
.tp-play { display: flex; flex-direction: column; gap: 14px; min-inline-size: 0; }
.tp-playbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: var(--tp-card); border: 1px solid var(--tp-line); border-radius: var(--tp-radius); padding: 10px 14px; }
.tp-qcount { font-size: 1.05em; }
.tp-timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.05em; font-variant-numeric: tabular-nums; padding: 4px 12px; border: 1.5px solid var(--tp-line-strong); border-radius: 99px; background: var(--tp-card); }
.tp-timer.is-low { color: var(--tp-bad); border-color: var(--tp-bad); background: var(--tp-bad-soft); }
.tp-playgrid { display: flex; flex-direction: column; gap: 14px; min-inline-size: 0; }
.tp-qcard { min-inline-size: 0; }
.tp-qmeta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tp-flagbtn { display: none; }
.tp-qset { min-inline-size: 0; }
.tp-stem { display: block; font-size: 1.04em; line-height: 1.7; padding: 0; float: inline-start; inline-size: 100%; margin-block-end: 20px; font-weight: 450; color: var(--tp-ink); }
.tp-qset > .tp-instr { clear: both; }
p.tp-stem { float: none; }
.tp-instr { font-size: .9em; font-weight: 650; color: var(--tp-muted); margin-block-end: 10px; }
.tp-instr.is-multi { display: inline-block; color: var(--tp-accent-strong); background: rgb(var(--tp-accent-strong-rgb) / .1); padding: 3px 12px; border-radius: 6px; }
.tp-options { display: grid; gap: 10px; }

.tp-opt { position: relative; display: flex; align-items: stretch; background: var(--tp-card); border: 1.5px solid var(--tp-line-strong); border-radius: 11px; --tp-hole: #fff; }
.tp-opt-main { position: relative; flex: 1; min-inline-size: 0; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; margin: 0; }
.tp-opt-main input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; }
.tp-key { flex: none; display: grid; place-items: center; inline-size: 34px; block-size: 34px; border-radius: 50%; background: var(--tp-sunk); font-weight: 800; font-size: 15px; border: 2px solid transparent; }
.tp-opt-main input[type="checkbox"] ~ .tp-key { border-radius: 8px; }
.tp-key .tp-ic { inline-size: 18px; block-size: 18px; stroke-width: 2.5; }
.tp-opt-text { flex: 1; min-inline-size: 0; padding-block-start: 4px; font-size: 1em; line-height: 1.5; overflow-wrap: anywhere; }
.tp-opt:hover:not(.is-correct):not(.is-wrong) { border-color: var(--tp-ink); }
.tp-opt.is-selected { border-color: var(--tp-accent-strong); background: rgb(var(--tp-accent-strong-rgb) / .08); box-shadow: 0 0 0 1px var(--tp-accent-strong); }
.tp-opt.is-selected .tp-key { background: var(--tp-accent-strong); color: #fff; }
.tp-opt.is-correct { border-color: var(--tp-good); background: var(--tp-good-soft); box-shadow: 0 0 0 1px var(--tp-good); }
.tp-opt.is-correct .tp-key { background: var(--tp-good); color: #fff; }
.tp-opt.is-wrong { border-color: var(--tp-bad); background: var(--tp-bad-soft); box-shadow: 0 0 0 1px var(--tp-bad); }
.tp-opt.is-wrong .tp-key { background: var(--tp-bad); color: #fff; }
.tp-opt.is-struck .tp-opt-text { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .6; }
.tp-opt:has(input:focus-visible) { outline: 3px solid var(--tp-accent-strong); outline-offset: 2px; }
.tp-opt-main input:focus-visible ~ .tp-key { outline: 3px solid var(--tp-accent-strong); outline-offset: 2px; }
.tp-opt-flag { display: block; margin-block-start: 3px; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tp-opt.is-correct .tp-opt-flag { color: var(--tp-good); }
.tp-opt.is-wrong .tp-opt-flag { color: var(--tp-bad); }
.tp-why { display: block; margin-block-start: 5px; font-size: .88em; color: var(--tp-muted); font-weight: 400; }
.tp-strike { flex: none; display: grid; place-items: center; inline-size: 48px; border: 0; border-inline-start: 1px solid var(--tp-line); background: transparent; color: var(--tp-muted); cursor: pointer; border-start-end-radius: 10px; border-end-end-radius: 10px; }
.tp-strike:hover { background: var(--tp-sunk); color: var(--tp-ink); }
.tp-strike.is-on { color: var(--tp-ink); background: var(--tp-sunk); }

.tp-reveal { margin-block-start: 4px; }
.tp-verdict { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; font-weight: 750; }
.tp-verdict-good { background: var(--tp-good-soft); color: var(--tp-good); }
.tp-verdict-bad { background: var(--tp-bad-soft); color: var(--tp-bad); }
.tp-verdict-warn { background: var(--tp-warn-soft); color: var(--tp-warn); }
.tp-explain { border-inline-start: 5px solid var(--tp-accent-strong); background: rgb(var(--tp-accent-strong-rgb) / .06); border-start-end-radius: 10px; border-end-end-radius: 10px; padding: 14px 16px; }
.tp-explain p { margin-block-start: 6px; }
.tp-learning { background: var(--tp-warn-soft); color: #4a2f00; border-radius: 10px; padding: 11px 15px; font-size: .94em; }
.tp-keys summary { cursor: pointer; color: var(--tp-muted); }
.tp-keys p { margin-block-start: 6px; }
.tp-confirm { border-color: var(--tp-accent-strong); border-width: 2px; }

.tp-mapcard { display: none; flex-direction: column; gap: 12px; align-self: start; }
.tp-mapcard.is-open { display: flex; }
.tp-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-block-size: 340px; overflow: auto; padding: 2px; }
.tp-palette button { inline-size: 100%; block-size: 42px; border-radius: 8px; border: 1.5px solid var(--tp-line-strong); background: var(--tp-card); font-weight: 700; font-size: 14px; cursor: pointer; color: var(--tp-ink); padding: 0; }
.tp-palette button.is-answered { background: rgb(var(--tp-accent-strong-rgb) / .12); border-color: var(--tp-accent-strong); color: var(--tp-accent-strong); }
.tp-palette button.is-right { background: var(--tp-good-soft); border-color: var(--tp-good); color: var(--tp-good); }
.tp-palette button.is-wrongp { background: var(--tp-bad-soft); border-color: var(--tp-bad); color: var(--tp-bad); }
.tp-palette button.is-current { outline: 3px solid var(--tp-ink); outline-offset: 1px; }
.tp-palette button.is-flagged { box-shadow: inset 0 -5px 0 #d98a00; }
.tp-palette button[disabled] { cursor: default; opacity: .5; }

/* sticky answer bar: mobile first */
.tp-bar { position: sticky; inset-block-end: 0; z-index: 20; display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: stretch; padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--tp-paper); border-block-start: 2px solid var(--tp-ink); box-shadow: 0 -8px 18px rgba(15, 27, 45, .12); border-radius: 12px 12px 0 0; }
.tp-bar .tp-btn { min-block-size: 50px; }
.tp-bar-prev span { display: none; }
.tp-bar-flag span { font-size: 14px; }
.tp-bar-next { font-size: 17px; }
.tp-bar-cards { display: block; }
.tp-bar-cards .tp-bar-next { inline-size: 100%; }
@media (min-width: 960px) {
  .tp-playgrid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
  .tp-mapcard { display: flex; position: sticky; inset-block-start: 16px; }
  .tp-mapbtn { display: none; }
  .tp-flagbtn { display: inline-flex; }
  .tp-bar { position: static; display: flex; justify-content: space-between; padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
  .tp-bar-flag { display: none; }
  .tp-bar-prev span { display: inline; }
  .tp-bar-next { min-inline-size: 200px; }
  .tp-bar-cards { display: block; }
}
.tp-bar-cards { grid-template-columns: none; }

/* flashcards */
.tp-flash { gap: 16px; }
.tp-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .tp-grade { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tp-grade .tp-btn { flex-direction: column; gap: 0; min-block-size: 62px; border-block-end-width: 5px; }
.tp-grade-name { font-size: 17px; }
.tp-grade-hint { font-weight: 500; color: var(--tp-muted); }
.tp-grade-again { border-block-end-color: var(--tp-bad); }
.tp-grade-hard { border-block-end-color: #d98a00; }
.tp-grade-good { border-block-end-color: var(--tp-good); }
.tp-grade-easy { border-block-end-color: var(--tp-accent-strong); }

/* review cards */
.tp-review > summary { cursor: pointer; list-style: none; display: block; }
.tp-review > summary::-webkit-details-marker { display: none; }
.tp-review > summary:focus-visible { outline: 3px solid var(--tp-accent-strong); outline-offset: 4px; }
.tp-summary { margin-block-start: 8px; color: var(--tp-muted); }
.tp-review[open] .tp-summary { display: none; }
.tp-review-body { margin-block-start: 14px; }
.tp-review .tp-opt-main { cursor: default; }

/* history */
.tp-hist { display: flex; flex-direction: column; }
.tp-hist-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-block: 14px; border-block-start: 1px solid var(--tp-line); }
.tp-hist-row:first-child { border-block-start: 0; }
.tp-hist-main { flex: 1 1 180px; }
.tp-hist-qs { flex: 0 0 110px; }
.tp-hist-res { flex: 0 0 auto; min-inline-size: 130px; }

/* comments */
.tp-comments { display: flex; flex-direction: column; }
.tp-comment { padding-block: 12px; border-block-start: 1px solid var(--tp-line); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tp-comment .tp-row { inline-size: 100%; }
.tp-comments > li:first-child { border-block-start: 0; }

/* study plan */
.tp-order { counter-reset: tp; display: flex; flex-direction: column; gap: 8px; }
.tp-order li { counter-increment: tp; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--tp-line); border-radius: 10px; background: var(--tp-paper); font-weight: 650; }
.tp-order li::before { content: counter(tp); display: grid; place-items: center; flex: none; inline-size: 28px; block-size: 28px; border-radius: 50%; background: var(--tp-ink); color: #fff; font-size: 14px; font-weight: 800; }
.tp-order .tp-badge { margin-inline-start: auto; }

/* ---- AI tutor drawer */
.tp-scrim { position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 99998; }
.tp-drawer { position: fixed; z-index: 99999; inset-inline: 0; inset-block-end: 0; max-block-size: 86vh; max-block-size: 86dvh; display: flex; flex-direction: column; background: var(--tp-card); color: var(--tp-ink); border-radius: 18px 18px 0 0; border-block-start: 4px solid var(--tp-tag-premium); box-shadow: 0 -12px 40px rgba(15, 27, 45, .3); font-size: 16px; }
.tp-drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.tp-drawer-head h2 { font-size: 1.15em; font-weight: 800; flex: 1; }
.tp-drawer-close { flex: none; inline-size: 44px; block-size: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--tp-ink); }
.tp-drawer-close:hover { background: var(--tp-sunk); }
.tp-drawer-body { flex: 1 1 auto; overflow: auto; padding: 0 16px 12px; display: flex; flex-direction: column; gap: 12px; min-block-size: 120px; }
.tp-drawer-ctx { padding: 10px 12px; background: var(--tp-paper); border-radius: 8px; border-inline-start: 4px solid var(--tp-line-strong); }
.tp-msgs { display: flex; flex-direction: column; gap: 14px; }
.tp-msg { display: flex; flex-direction: column; gap: 2px; max-inline-size: 94%; }
.tp-msg-user { align-self: flex-end; }
.tp-msg-user .tp-msg-body { background: var(--tp-accent-strong); color: #fff; }
.tp-msg-bot .tp-msg-body { background: var(--tp-paper); border: 1px solid var(--tp-line); }
.tp-msg-body { padding: 10px 14px; border-radius: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.tp-msg-body p + p, .tp-msg-body p + ul, .tp-msg-body ul + p { margin-block-start: 8px; }
.tp-msg-body ul { list-style: disc; padding-inline-start: 1.2em; }
.tp-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-chip-btn { min-block-size: 40px; padding: 6px 14px; border: 1.5px solid var(--tp-line-strong); border-radius: 99px; background: var(--tp-card); color: var(--tp-ink); cursor: pointer; font-size: 15px; font-weight: 600; }
.tp-chip-btn:hover { background: var(--tp-sunk); }
.tp-drawer-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px; border-block-start: 1px solid var(--tp-line); }
.tp-drawer-form textarea { min-block-size: 46px; block-size: 46px; flex: 1; }
.tp-drawer-foot { padding: 0 16px 14px; }
.tp-drawer .tp-upsell { margin-block-start: 4px; }
@media (min-width: 900px) {
  .tp-scrim { display: none; }
  .tp-drawer { inset-inline: auto 0; inset-block: 0; inline-size: 420px; max-inline-size: 100vw; max-block-size: none; border-radius: 0; border-block-start: 0; border-inline-start: 5px solid var(--tp-tag-premium); box-shadow: -10px 0 40px rgba(15, 27, 45, .22); }
}

@media (prefers-reduced-motion: reduce) { .tp-app * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .tp-bar, .tp-drawer, .tp-scrim, .tp-tabs, .tp-exams { display: none !important; } }

/* Let the app use the full content width when a theme wraps pages in a narrow prose column. */
.tp-prose:has(.tp-app), .tp-plain:has(.tp-app) { max-width: none; }
.tp-wrap:has(.tp-app) { max-width: min(1200px, 100%); }
.tp-prose .tp-app { font-size: 17px; line-height: 1.6; }
@media (min-width: 900px) { .tp-prose .tp-app { font-size: 18px; } }
