/* Test series question page. Loaded after testseries.css; every rule is scoped
   to #quizPage and uses its own class names (tq-), so the series list, the
   start page and the result page are not affected.

   Desktop: one card with a title bar, the question panel and a single row of
   buttons. Phones: the same markup as a plain flow with the picture (when a
   question has one) on top and the buttons in two rows. */

#quizPage {
  --tq-ink: #0d1b3e;
  --tq-muted: #5c6b8a;
  --tq-line: #dfe8f6;
  --tq-blue: #1765f2;
  --tq-navy: #0a2569;
  width: min(100%, 1080px);
  margin: clamp(8px, 2vw, 28px) auto 32px;
  border: 1px solid var(--tq-line);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: 0 26px 60px rgba(31, 72, 150, 0.14);
  color: var(--tq-ink);
  overflow: hidden;
}

#quizPage[hidden] { display: none; }

#quizPage,
#quizPage :where(p, span, strong, small, b, div, label) {
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#quizPage h2,
#quizPage :where(.tq-opt__key, .tq-qno, .tq-count, .tq-clock) {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#quizPage button {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  -webkit-tap-highlight-color: transparent;
}

#quizPage lucide-icon {
  display: inline-flex;
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

/* ---------- title bar ---------- */
#quizPage .tq-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 32px;
}

#quizPage .tq-back { display: none; }

#quizPage .tq-top__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 60px;
  height: 60px;
  border: 1px solid #d6e4fb;
  border-radius: 16px;
  background: #eaf2ff;
  color: var(--tq-blue);
  font-size: 1.6rem;
}

#quizPage .tq-top h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--tq-navy);
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#quizPage .tq-clock,
#quizPage .tq-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #d6e4fb;
  border-radius: 999px;
  background: #eef4ff;
  color: #40527a;
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#quizPage .tq-clock { background: #ffffff; color: var(--tq-navy); }
#quizPage .tq-clock lucide-icon { color: var(--tq-blue); }
#quizPage .tq-count b { color: var(--tq-blue); font-weight: 800; }

/* ---------- question panel ---------- */
#quizPage .tq-body {
  display: grid;
  gap: 18px;
  margin: 0 32px;
  padding: 28px;
  border: 1px solid var(--tq-line);
  border-radius: 22px;
  background: linear-gradient(160deg, #f5f9ff 0%, #fbfdff 100%);
}

/* A question that comes with a picture or diagram. */
#quizPage .tq-figure {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--tq-line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 72, 150, 0.08);
}

#quizPage .tq-figure[hidden] { display: none; }

#quizPage .tq-figure :where(img, svg) {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(46vh, 360px);
  object-fit: contain;
}

#quizPage .tq-ask {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

#quizPage .tq-qno {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 62px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  background: #e4edfd;
  color: var(--tq-blue);
  font-size: 1.05rem;
  font-weight: 800;
}

#quizPage .tq-qtext {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-top: 8px;
  color: var(--tq-ink);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ---------- options ---------- */
#quizPage .tq-opts {
  display: grid;
  gap: 14px;
}

#quizPage .tq-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 10px 24px;
  border: 2px solid #e3eaf6;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(31, 72, 150, 0.05);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

/* The real radio stays in the page for keyboards and screen readers. */
#quizPage .tq-opt input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

#quizPage .tq-opt__key {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #e7ecf6;
  color: var(--tq-navy);
  font-size: 1.02rem;
  font-weight: 800;
}

#quizPage .tq-opt__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--tq-ink);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
  cursor: inherit;
}

#quizPage .tq-opt__dot {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border: 2px solid #b9c4d9;
  border-radius: 50%;
  background: #ffffff;
}

@media (hover: hover) {
  #quizPage .tq-opt:not(.is-locked):hover {
    border-color: #a9c5fb;
    box-shadow: 0 10px 22px rgba(31, 72, 150, 0.1);
  }
}

#quizPage .tq-opt:has(input:focus-visible) {
  outline: 3px solid #8fb6ff;
  outline-offset: 2px;
}

#quizPage .tq-opt.is-picked {
  border-color: var(--tq-blue);
  background: #eef4ff;
}

#quizPage .tq-opt.is-picked .tq-opt__key {
  background: linear-gradient(180deg, #2a78ff 0%, #0b4fe0 100%);
  color: #ffffff;
}

#quizPage .tq-opt.is-picked .tq-opt__dot { border-color: var(--tq-blue); }

#quizPage .tq-opt.is-picked .tq-opt__dot::after,
#quizPage .tq-opt.is-answer .tq-opt__dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--tq-blue);
}

#quizPage .tq-opt.is-locked { cursor: default; }
#quizPage .tq-opt.is-locked:not(.is-answer) { opacity: 0.7; }

#quizPage .tq-opt.is-answer {
  border-color: #16a34a;
  background: #eafaf0;
}

#quizPage .tq-opt.is-answer .tq-opt__key { background: #16a34a; color: #ffffff; }
#quizPage .tq-opt.is-answer .tq-opt__dot { border-color: #16a34a; }
#quizPage .tq-opt.is-answer .tq-opt__dot::after { background: #16a34a; }

/* ---------- know answer ---------- */
#quizPage .tq-help {
  display: flex;
  align-items: center;
  gap: 24px;
}

#quizPage .tq-know {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: none;
  min-height: 54px;
  padding: 0 28px;
  border: 2px solid #cfdcf5;
  border-radius: 999px;
  background: #ffffff;
  color: var(--tq-blue);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

#quizPage .tq-know:disabled {
  border-color: #e3e8f2;
  color: #8b97b3;
  cursor: not-allowed;
}

#quizPage .tq-help__note {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid #d3dcec;
  color: var(--tq-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

#quizPage .tq-reveal {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid #bfe8cf;
  border-radius: 16px;
  background: #eafaf0;
}

#quizPage .tq-reveal[hidden] { display: none; }
#quizPage .tq-reveal > span { color: #0f8a3c; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
#quizPage .tq-reveal strong { color: #0b3d22; font-size: 1.15rem; overflow-wrap: anywhere; }
#quizPage .tq-reveal p { margin: 0; color: #3c5a48; font-size: 0.92rem; }

/* ---------- buttons ---------- */
#quizPage .tq-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding: 22px 32px 28px;
  border-top: 1px solid var(--tq-line);
}

#quizPage .tq-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 30px;
  border: 2px solid #d5deee;
  border-radius: 999px;
  background: #ffffff;
  color: #33415f;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

#quizPage .tq-go:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#quizPage .tq-go--submit {
  margin-left: auto;
  min-width: min(100%, 280px);
  border-color: transparent;
  background: linear-gradient(180deg, #ffd45c 0%, #f8b21c 100%);
  box-shadow: 0 12px 24px rgba(240, 168, 20, 0.3);
  color: #2b2100;
}

#quizPage .tq-go--next {
  min-width: 180px;
  border-color: transparent;
  background: linear-gradient(180deg, #2a78ff 0%, #0b4fe0 100%);
  box-shadow: 0 12px 24px rgba(18, 87, 230, 0.3);
  color: #ffffff;
}

@media (hover: hover) {
  #quizPage .tq-go--prev:not(:disabled):hover,
  #quizPage .tq-go--quit:hover,
  #quizPage .tq-know:not(:disabled):hover { border-color: var(--tq-blue); background: #f4f8ff; }
  #quizPage .tq-go--submit:hover { box-shadow: 0 16px 30px rgba(240, 168, 20, 0.4); }
  #quizPage .tq-go--next:not(:disabled):hover { box-shadow: 0 16px 30px rgba(18, 87, 230, 0.4); }
}

#quizPage :where(.tq-go, .tq-know, .tq-back):focus-visible {
  outline: 3px solid #8fb6ff;
  outline-offset: 3px;
}

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  #quizPage .tq-top { padding: 18px 20px; gap: 12px; }
  #quizPage .tq-top__ico { width: 50px; height: 50px; font-size: 1.3rem; }
  #quizPage .tq-body { margin: 0 20px; padding: 20px; }
  #quizPage .tq-nav { gap: 10px; padding: 18px 20px 22px; }
  #quizPage .tq-go { min-height: 54px; padding: 0 20px; font-size: 0.98rem; }
  #quizPage .tq-go--submit { min-width: 0; }
  #quizPage .tq-go--next { min-width: 130px; }
}

/* ---------- phone ---------- */
@media (max-width: 700px) {
  #quizPage {
    margin: 0 auto 20px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
  }

  /* Back, title and question count share a row; the clock sits under the title. */
  #quizPage .tq-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "back title count" "back clock count";
    align-items: center;
    gap: 2px 12px;
    padding: 6px 0 14px;
  }

  #quizPage .tq-top h2 { grid-area: title; align-self: end; }
  #quizPage .tq-count { grid-area: count; }

  #quizPage .tq-top .tq-clock {
    grid-area: clock;
    align-self: start;
    justify-self: start;
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tq-muted);
    font-size: 0.86rem;
  }

  #quizPage .tq-back {
    grid-area: back;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--tq-line);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(31, 72, 150, 0.12);
    color: var(--tq-navy);
    font-size: 1.15rem;
    cursor: pointer;
  }

  #quizPage .tq-top__ico,
  #quizPage .tq-count__word,
  #quizPage .tq-qno {
    display: none;
  }

  #quizPage .tq-top h2 { font-size: 1.12rem; }
  #quizPage .tq-count { min-height: 40px; padding: 0 14px; font-size: 0.92rem; }

  #quizPage .tq-body {
    gap: 14px;
    margin: 0;
    padding: 14px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 14px 32px rgba(31, 72, 150, 0.1);
  }

  #quizPage .tq-figure { padding: 12px; box-shadow: 0 8px 18px rgba(31, 72, 150, 0.08); }
  #quizPage .tq-figure :where(img, svg) { max-height: min(40vh, 300px); }
  #quizPage .tq-qtext { padding-top: 0; font-size: 1.1rem; }

  #quizPage .tq-opts { gap: 10px; }

  #quizPage .tq-opt {
    min-height: 60px;
    gap: 12px;
    padding: 8px 16px;
  }

  /* On phones the round mark leads and the letter reads "A)". */
  #quizPage .tq-opt__dot { order: -1; width: 24px; height: 24px; }

  #quizPage .tq-opt__key,
  #quizPage .tq-opt.is-picked .tq-opt__key,
  #quizPage .tq-opt.is-answer .tq-opt__key {
    display: block;
    width: auto;
    height: auto;
    background: none;
    color: var(--tq-navy);
    font-size: 1.02rem;
  }

  #quizPage .tq-opt__key::after { content: ")"; }
  #quizPage .tq-opt__text { font-size: 1rem; }

  #quizPage .tq-help {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  #quizPage .tq-know { min-height: 48px; padding: 0 22px; }
  #quizPage .tq-help__note { padding-left: 0; border-left: 0; font-size: 0.9rem; }

  #quizPage .tq-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "prev next" "submit quit";
    gap: 12px;
    margin-top: 16px;
    padding: 0 0 8px;
    border-top: 0;
  }

  #quizPage .tq-go { min-height: 54px; padding: 0 12px; gap: 8px; }
  #quizPage .tq-go--prev { grid-area: prev; }
  #quizPage .tq-go--next { grid-area: next; min-width: 0; }
  #quizPage .tq-go--submit { grid-area: submit; margin-left: 0; }
  #quizPage .tq-go--quit { grid-area: quit; background: #f1f4fa; border-color: transparent; }
}

@media (max-width: 360px) {
  #quizPage .tq-go { font-size: 0.9rem; gap: 6px; }
  #quizPage .tq-go--submit lucide-icon { display: none; }
}

/* =====================================================================
   Test series result page. Same look as the quiz result screen (blue
   banner with the mascot, figure tiles, account note, actions), with the
   figures a test series has: accuracy, GE, time, attempted, correct,
   wrong and answer reveals, followed by the answer review.
   Scoped to #resultPage with its own class names (tr-).
   ===================================================================== */
#resultPage {
  --tr-ink: #0f1b3d;
  --tr-muted: #5b6b8c;
  --tr-line: #dbe6f7;
  --tr-blue: #1557f5;
  width: min(100%, 1080px);
  margin: clamp(8px, 2vw, 28px) auto 32px;
  border: 1px solid var(--tr-line);
  border-radius: 28px;
  background: linear-gradient(180deg, #f3f7ff 0%, #ffffff 40%);
  box-shadow: 0 28px 70px rgba(31, 72, 150, 0.18);
  color: var(--tr-ink);
  overflow: hidden;
}

#resultPage[hidden] { display: none; }

#resultPage,
#resultPage :where(p, span, strong, small, a, div) {
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#resultPage :where(h2, h3),
#resultPage :where(.tr-fig strong, .tr-score strong, .tr-kicker, .tr-row__no, .tr-account__title) {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#resultPage :where(button, a.tr-act) {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  -webkit-tap-highlight-color: transparent;
}

#resultPage lucide-icon {
  display: inline-flex;
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

/* ---------- banner ---------- */
#resultPage .tr-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(14px, 3vw, 36px);
  min-height: 220px;
  padding: clamp(22px, 3vw, 34px) clamp(18px, 4vw, 44px);
  background:
    radial-gradient(circle at 12% 30%, rgba(88, 140, 255, 0.55), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(120, 170, 255, 0.5), transparent 38%),
    linear-gradient(135deg, #0a1f73 0%, #123bb8 55%, #1b56e6 100%);
  color: #ffffff;
  overflow: hidden;
}

#resultPage .tr-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffe08a;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#resultPage .tr-top h2 {
  margin: 14px 0 0;
  /* the shared heading colour is set with !important */
  color: #ffffff !important;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

#resultPage .tr-top__copy > p {
  max-width: 34em;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1rem;
  line-height: 1.5;
}

#resultPage .tr-score {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 150px;
  padding: 16px 22px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  text-align: center;
}

#resultPage .tr-score small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#resultPage .tr-score strong {
  color: #ffffff;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#resultPage .tr-mascot {
  align-self: end;
  width: clamp(130px, 17vw, 210px);
  height: auto;
  margin-bottom: calc(-1 * clamp(22px, 3vw, 34px));
  filter: drop-shadow(0 14px 22px rgba(4, 22, 80, 0.4));
  pointer-events: none;
  user-select: none;
}

/* ---------- figures ---------- */
#resultPage .tr-figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 22px clamp(14px, 3vw, 32px) 6px;
}

#resultPage .tr-fig {
  --fig: #1557f5;
  --fig-soft: #eaf1ff;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--tr-line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 72, 150, 0.07);
}

#resultPage .tr-fig--ge { --fig: #d98a00; --fig-soft: #fff4dc; }
#resultPage .tr-fig--time, #resultPage .tr-fig--avg { --fig: #6d3fe0; --fig-soft: #f0ebfd; }
#resultPage .tr-fig--attempted { --fig: #0e8fa8; --fig-soft: #e3f6fa; }
#resultPage .tr-fig--correct { --fig: #16a34a; --fig-soft: #e6f8ed; }
#resultPage .tr-fig--wrong { --fig: #e5304d; --fig-soft: #ffe9ed; }
#resultPage .tr-fig--reveals { --fig: #f2690d; --fig-soft: #fff0e2; }

#resultPage .tr-fig__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--fig-soft);
  color: var(--fig);
  font-size: 1.2rem;
}

#resultPage .tr-fig__text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#resultPage .tr-fig__text span {
  color: var(--tr-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

#resultPage .tr-fig__text strong {
  color: var(--tr-ink);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#resultPage .tr-fig__art {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

/* Accuracy ring: --tr-pct is the percentage, set by the page script. */
#resultPage .tr-ring {
  --tr-pct: 0;
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: conic-gradient(var(--fig) calc(var(--tr-pct) * 1%), #e2eaf8 0);
}

#resultPage .tr-ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #ffffff;
}

/* ---------- account note ---------- */
#resultPage .tr-account {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px clamp(14px, 3vw, 32px) 0;
  padding: 16px 20px;
  border: 1px solid #cfe0fb;
  border-radius: 18px;
  background: linear-gradient(120deg, #eef4ff 0%, #f8fbff 100%);
}

#resultPage .tr-account:empty { display: none; }

#resultPage .tr-account__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #dbe8ff;
  color: var(--tr-blue);
  font-size: 1.3rem;
}

#resultPage .tr-account__text { flex: 1; min-width: 0; }
#resultPage .tr-account__title { margin: 0; color: var(--tr-ink); font-size: 1.02rem; font-weight: 800; }
#resultPage .tr-account__note { margin: 4px 0 0; color: var(--tr-muted); font-size: 0.93rem; line-height: 1.5; }

/* ---------- answer review ---------- */
#resultPage .tr-review {
  margin: 22px clamp(14px, 3vw, 32px) 0;
}

#resultPage .tr-review h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--tr-ink);
  font-size: 1.2rem;
  font-weight: 800;
}

#resultPage .tr-review h3 lucide-icon { color: var(--tr-blue); }

#resultPage .tr-review__list {
  display: grid;
  gap: 10px;
}

#resultPage .tr-review__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 22px;
  border: 1px dashed #c9d7ef;
  border-radius: 16px;
  color: var(--tr-muted);
  font-size: 0.98rem;
}

#resultPage .tr-row {
  --row: #e5304d;
  --row-soft: #ffe9ed;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--tr-line);
  border-left: 4px solid var(--row);
  border-radius: 16px;
  background: #ffffff;
}

#resultPage .tr-row--correct { --row: #16a34a; --row-soft: #e6f8ed; }
#resultPage .tr-row--revealed { --row: #f2690d; --row-soft: #fff0e2; }

#resultPage .tr-row__no {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 46px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e4edfd;
  color: var(--tr-blue);
  font-size: 0.9rem;
  font-weight: 800;
}

#resultPage .tr-row__body { display: grid; gap: 6px; flex: 1; min-width: 0; }
#resultPage .tr-row__q { margin: 0; color: var(--tr-ink); font-size: 1rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }

#resultPage .tr-row__a {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: #33415f;
  font-size: 0.93rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#resultPage .tr-row__a lucide-icon { margin-top: 0.15em; }
#resultPage .tr-row__a span { min-width: 0; }
#resultPage .tr-row__a--yours.is-incorrect { color: #c81e3c; }
#resultPage .tr-row__a--yours.is-correct { color: #0f8a3c; }
#resultPage .tr-row__a--yours.is-revealed { color: #c2570c; }
#resultPage .tr-row__a--right { color: #0f8a3c; font-weight: 600; }

#resultPage .tr-row__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--row-soft);
  color: var(--row);
}

/* ---------- actions ---------- */
#resultPage .tr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding: 20px clamp(14px, 3vw, 32px) 26px;
  border-top: 1px solid var(--tr-line);
}

#resultPage .tr-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border: 2px solid #c9dafb;
  border-radius: 999px;
  background: #ffffff;
  color: var(--tr-blue);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

#resultPage .tr-act--main,
#resultPage .tr-act--login {
  border-color: transparent;
  background: linear-gradient(180deg, #2a78ff 0%, #0b4fe0 100%);
  box-shadow: 0 12px 24px rgba(18, 87, 230, 0.3);
  color: #ffffff;
}

#resultPage .tr-act--login { flex: none; min-height: 48px; padding: 0 22px; }

@media (hover: hover) {
  #resultPage .tr-act:not(.tr-act--main, .tr-act--login):hover { border-color: var(--tr-blue); background: #f4f8ff; }
  #resultPage .tr-act--main:hover, #resultPage .tr-act--login:hover { box-shadow: 0 16px 30px rgba(18, 87, 230, 0.4); }
}

#resultPage .tr-act:focus-visible {
  outline: 3px solid #8fb6ff;
  outline-offset: 3px;
}

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  #resultPage .tr-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---------- phone ---------- */
@media (max-width: 700px) {
  #resultPage {
    margin: 0 auto 20px;
    border-radius: 22px;
  }

  #resultPage .tr-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "copy copy" "score mascot";
    gap: 14px;
    min-height: 0;
    padding: 20px 18px 0;
  }

  #resultPage .tr-top__copy { grid-area: copy; }
  #resultPage .tr-top__copy > p { font-size: 0.94rem; }

  #resultPage .tr-score {
    grid-area: score;
    align-self: center;
    justify-self: start;
    min-width: 128px;
    margin-bottom: 18px;
    padding: 12px 18px;
  }

  #resultPage .tr-mascot {
    grid-area: mascot;
    width: 128px;
    margin-bottom: 0;
  }

  #resultPage .tr-figures { gap: 10px; padding: 16px 12px 4px; }
  #resultPage .tr-fig { gap: 10px; min-height: 78px; padding: 10px 12px; border-radius: 16px; }
  #resultPage .tr-fig__ico { width: 36px; height: 36px; border-radius: 12px; font-size: 1rem; }
  #resultPage .tr-fig__text span { font-size: 0.76rem; }
  #resultPage .tr-fig__text strong { font-size: 1.15rem; }
  #resultPage .tr-fig__art, #resultPage .tr-ring { display: none; }

  #resultPage .tr-account {
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 12px 0;
    padding: 14px;
  }

  #resultPage .tr-account__text { flex-basis: calc(100% - 60px); }
  #resultPage .tr-account .tr-act--login { width: 100%; }

  #resultPage .tr-review { margin: 18px 12px 0; }
  #resultPage .tr-row { gap: 10px; padding: 12px; }
  #resultPage .tr-row__no { min-width: 40px; min-height: 30px; padding: 0 8px; font-size: 0.82rem; }
  #resultPage .tr-row__mark { width: 28px; height: 28px; }

  #resultPage .tr-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 18px;
    padding: 16px 12px 18px;
  }

  #resultPage .tr-act { min-height: 52px; padding: 0 16px; }
  #resultPage .tr-act--main { order: -1; }
}

@media (max-width: 360px) {
  #resultPage .tr-figures { gap: 8px; padding-inline: 10px; }
  #resultPage .tr-fig { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ---------- guest warning ---------- */
/* Shown to guests only (the script hides it for signed-in learners). It is a
   warning, so it is red: the GE on this page is not being kept. */
#resultPage .tr-account[hidden] { display: none; }

#resultPage .tr-account {
  border: 1px solid #f3a9b4;
  border-left: 6px solid #e11d48;
  background: linear-gradient(120deg, #fff0f2 0%, #fff7f8 100%);
  box-shadow: 0 10px 26px rgba(225, 29, 72, 0.14);
}

#resultPage .tr-account__ico { background: #ffdfe4; color: #e11d48; }
#resultPage .tr-account__title { color: #be123c; }
#resultPage .tr-account__note { color: #7f1d2d; }

#resultPage .tr-account .tr-act--login {
  background: linear-gradient(180deg, #f43f5e 0%, #be123c 100%);
  box-shadow: 0 12px 24px rgba(225, 29, 72, 0.32);
}

/* =====================================================================
   Finish pass: the test series start page and the quit question take the
   same finish as the question and result pages (card shape, type, buttons).
   ===================================================================== */
#startPage {
  width: min(100%, 860px);
  margin: clamp(8px, 2vw, 28px) auto 32px;
  padding: 0;
  border: 1px solid #dbe6f7;
  border-radius: 28px;
  background: linear-gradient(180deg, #f3f7ff 0%, #ffffff 46%);
  box-shadow: 0 28px 70px rgba(31, 72, 150, 0.18);
  color: #0f1b3d;
  text-align: left;
  overflow: hidden;
}

#startPage[hidden] { display: none; }

#startPage,
#startPage :where(p, span, div) {
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#startPage h2,
#startPage .ts-start__kicker {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif;
}

#startPage button {
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  -webkit-tap-highlight-color: transparent;
}

#startPage lucide-icon {
  display: inline-flex;
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

#startPage .ts-start__top {
  padding: clamp(22px, 3vw, 34px) clamp(18px, 4vw, 40px);
  background:
    radial-gradient(circle at 12% 30%, rgba(88, 140, 255, 0.55), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(120, 170, 255, 0.5), transparent 38%),
    linear-gradient(135deg, #0a1f73 0%, #123bb8 55%, #1b56e6 100%);
  color: #ffffff;
}

#startPage .ts-start__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffe08a;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.testseries-body #startPage .ts-start__top h2 {
  margin: 14px 0 0;
  /* the shared heading colour is set with !important */
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
  background: none;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  overflow-wrap: anywhere;
}

#startPage .start-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

#startPage .start-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: none;
}

#startPage .start-meta-item span { color: inherit; font: inherit; }
#startPage .start-meta-item lucide-icon { color: #bcd6ff; }

#startPage .start-description {
  margin: clamp(18px, 3vw, 28px) clamp(18px, 4vw, 40px) 0;
  padding: 18px 20px;
  border: 1px solid #dbe6f7;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 72, 150, 0.07);
  color: #44516d;
  font-size: 1.02rem;
  line-height: 1.6;
  text-align: left;
}

#startPage .action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin: clamp(18px, 3vw, 26px) 0 0;
  padding: 20px clamp(18px, 4vw, 40px) 26px;
  border-top: 1px solid #dbe6f7;
}

#startPage .action-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  margin: 0;
  padding: 0 28px;
  border: 2px solid #c9dafb;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: none;
  color: #1557f5;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

/* An older rule paints this button gold with !important. */
body.testseries-body #startPage #beginTestBtn {
  order: 2;
  min-width: min(100%, 240px);
  border-color: transparent !important;
  background: linear-gradient(180deg, #2a78ff 0%, #0b4fe0 100%) !important;
  box-shadow: 0 14px 28px rgba(18, 87, 230, 0.34) !important;
  color: #ffffff !important;
}

@media (hover: hover) {
  #startPage #backToSeriesBtn:hover { border-color: #1557f5; background: #f4f8ff; }
  #startPage #beginTestBtn:hover { box-shadow: 0 18px 34px rgba(18, 87, 230, 0.42); }
}

#startPage .action-buttons button:focus-visible,
#modalOverlay .modal-btn:focus-visible {
  outline: 3px solid #8fb6ff;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  #startPage { margin: 0 auto 20px; border-radius: 22px; }
  #startPage .start-meta-item { min-height: 36px; padding: 0 12px; font-size: 0.88rem; }
  #startPage .start-description { padding: 14px 16px; font-size: 0.96rem; }
  #startPage .action-buttons { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-bottom: 20px; }
  #startPage .action-buttons button { min-height: 54px; }
  body.testseries-body #startPage #beginTestBtn { order: -1; }
}

/* ---------- quit question ---------- */
body.testseries-body #modalOverlay {
  padding: 16px;
  background: rgba(15, 27, 56, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

body.testseries-body #modalOverlay .modal-content {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(520px, 100%);
  max-width: 100%;
  padding: 30px 30px 28px;
  border: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 96% 100%, #d3e3ff, transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #edf4ff 100%) !important;
  box-shadow: 0 34px 80px rgba(8, 20, 54, 0.4);
  text-align: center;
  animation: tq-pop-in 240ms cubic-bezier(.2, .7, .25, 1) both;
}

@keyframes tq-pop-in {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: none; }
}

#modalOverlay .tq-ask-mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffffff66, transparent 42%), #1765f2;
  box-shadow: 0 0 0 10px rgba(23, 101, 242, 0.14), 0 16px 30px rgba(23, 101, 242, 0.36);
  color: #ffffff;
}

#modalOverlay .tq-ask-mark lucide-icon { width: 42px; height: 42px; }

body.testseries-body #modalOverlay .modal-content h3 {
  margin: 8px 0 0;
  color: #0d1b3e !important;
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: clamp(1.5rem, 4vw, 2rem) !important;
  font-weight: 800;
  line-height: 1.15;
}

body.testseries-body #modalOverlay .modal-content p {
  max-width: 30em;
  margin: 0;
  color: #44516d;
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 1.02rem;
  line-height: 1.5;
}

#modalOverlay .modal-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 8px 0 0;
}

#modalOverlay .modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid #c9dafb;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: none;
  color: #0b4fe0;
  font-family: "Manrope", "Inter", "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
}

#modalOverlay .modal-btn lucide-icon { width: 1.15em; height: 1.15em; }

/* Staying is the main action, as on the quiz page. */
#modalOverlay .modal-btn.cancel {
  border-color: transparent;
  background: linear-gradient(180deg, #2a78ff 0%, #0b4fe0 100%);
  box-shadow: 0 14px 28px rgba(18, 87, 230, 0.34);
  color: #ffffff;
}

@media (max-width: 420px) {
  body.testseries-body #modalOverlay .modal-content { padding: 22px 16px 20px; border-radius: 26px; }
  #modalOverlay .modal-btn { min-height: 52px; font-size: 0.96rem; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  body.testseries-body #modalOverlay .modal-content { animation: none; }
}
