/* Quiz play state (see quiz.js). Everything is namespaced .qz and themed through the tokens below,
   so a redesign only has to remap them. */
:root {
  --qz-ink: var(--ink, #121222);
  --qz-muted: var(--muted, #4b4b63);
  --qz-bg: var(--surface, #fff);
  --qz-surface: var(--bg, #f3f7f6);
  --qz-line: var(--line, #d5dfdc);
  --qz-blue: var(--blue, #0b7f6d);
  --qz-on-blue: #fff;
  --qz-tint: var(--blue-tint, #dff5ef);
  --qz-yellow: var(--yellow, #e5ae00);
  --qz-ok: oklch(0.5 0.14 150);
  --qz-ok-bg: oklch(0.95 0.05 150);
  --qz-no: oklch(0.52 0.19 27);
  --qz-no-bg: oklch(0.95 0.035 27);
}

/* The start panel is a navy card on the masthead; the play state stays light like the rest of the site. */
.qz-bar {
  --qz-ink: #fff;
  --qz-muted: #b9bacf;
  --qz-bg: #0d0d19;
  --qz-surface: #1c1c32;
  --qz-line: #ffffff26;
  --qz-blue: #feca1c;
  --qz-on-blue: #0d0d19;
  --qz-tint: #feca1c1f;
  --qz-yellow: #feca1c;
  --qz-ok: #feca1c;
  --qz-ok-bg: #0c3f39;
  --qz-no: #ff8f85;
  --qz-no-bg: #47202a;
  color: var(--qz-ink);
}
.qz, .qz-dim {
  --qz-ink: var(--ink, #121222);
  --qz-muted: var(--muted, #4b4b63);
  --qz-bg: var(--bg, #f3f7f6);
  --qz-surface: var(--surface, #fff);
  --qz-line: #12122214;
  --qz-blue: var(--night, #131321);
  --qz-on-blue: #fff;
  --qz-tint: #fff;
  --qz-yellow: var(--mint, #feca1c);
  --qz-ok: var(--ok, #16884a);
  --qz-ok-bg: var(--ok-tint, #dff3e7);
  --qz-no: #c8372d;
  --qz-no-bg: #fde7e4;
  color: var(--qz-ink);
}
html.qz-on body { background: var(--bg, #f3f7f6); }
html.qz-on body::before { display: none; }

/* Reserves the start control's height only when JS will fill it; without JS the slot is an empty div. */
@media (scripting: enabled) {
  .qz-slot[data-qz^="test"] { min-height: 11.5rem; padding-bottom: 0.7rem; }
  .qz-slot[data-qz^="topic"] { min-height: 14.7rem; padding-bottom: 0.7rem; }
  .qz-slot[data-qz^="hub"] { min-height: 3.2rem; }
}
@media (scripting: enabled) and (min-width: 520px) {
  .qz-slot[data-qz^="test"], .qz-slot[data-qz^="topic"] { min-height: 10.2rem; }
}

.qz-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0.5rem 1rem; border: 1px solid var(--qz-line); border-radius: 99px; background: var(--qz-bg); color: var(--qz-ink); font: inherit; font-weight: 700; text-decoration: none; text-align: center; cursor: pointer; touch-action: manipulation; }
.qz-btn-go { border-color: var(--qz-blue); background: var(--qz-blue); color: var(--qz-on-blue); }
.qz-btn:disabled { opacity: 0.4; cursor: default; }
.qz-btn:focus-visible, .qz-opt:focus-visible, .qz-mode:focus-visible, .qz-x:focus-visible, .test-grid a:focus-visible { outline: 3px solid var(--qz-yellow); outline-offset: 2px; }
.qz .qz-btn, .qz-dlg .qz-btn { border: 0; background: var(--qz-surface); box-shadow: var(--card-shadow, 0 1px 0 #1212220f); }
.qz .qz-btn-go, .qz-dlg .qz-btn-go { background: var(--mint, #feca1c); color: var(--night, #131321); box-shadow: 0 14px 26px -16px #b38600; }
.qz .qz-btn:not(:disabled):hover { transform: translateY(-2px); }
.qz .qz-btn-go:not(:disabled):hover { background: #ffd84d; }
.qz .qz-btn:not(:disabled):active { transform: scale(0.97); }

.qz-slot { display: flow-root; }
.qz-bar { margin: 0.9rem 0 1.2rem; padding: 1rem; border: 0; border-radius: 26px; background: #131321; box-shadow: 0 24px 50px -30px #131321; }
.qz-bar .qz-btn { width: 100%; margin-bottom: 0.5rem; }
.qz-bar-t { margin: 0 0 0.6rem; font-weight: 800; }
.qz-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.qz-mode { display: flex; flex-direction: column; gap: 0.15rem; min-height: 96px; padding: 0.7rem; border: 1.5px solid var(--qz-line); border-radius: 14px; background: var(--qz-surface); color: var(--qz-ink); font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.qz-mode b { color: var(--qz-blue); font-size: 1.1rem; font-stretch: 78%; line-height: 1.25; }
.qz-mode:hover { border-color: var(--qz-blue); background: var(--qz-tint); }
.qz-mode small { color: var(--qz-muted); font-size: 0.8rem; line-height: 1.3; }
.qz-status { margin: 0.6rem 0 0; color: var(--qz-muted); font-size: 0.88rem; font-weight: 600; }

.qz-hub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.4rem 0 0.7rem; }
.qz-done { font-weight: 700; color: var(--qz-ok); }
.qz-key { color: var(--qz-muted); font-size: 0.82rem; }
.qz-grid a { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 3rem; line-height: 1.15; }
.test-grid a small.qz-t { display: block; font-size: 0.68rem; font-weight: 700; }
.test-grid a.qz-t-pass { border-color: transparent; background: var(--qz-ok-bg); color: var(--qz-ok); }
.test-grid a.qz-t-try { border-color: transparent; background: var(--qz-no-bg); color: var(--qz-no); }

html.qz-on .nav, html.qz-on footer, html.qz-on main > :not(.qz) { display: none; }
html.qz-on main { width: min(100%, 46rem); padding: 0; }

.qz { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--qz-bg); overflow-wrap: anywhere; }
.qz-top { position: sticky; top: 0; z-index: 5; padding: 0.5rem var(--gutter, 1rem) 0.4rem; background: var(--qz-bg); }
.qz-row { display: flex; align-items: center; gap: 0.8rem; min-height: 44px; }
.qz-count { font-weight: 800; font-variant-numeric: tabular-nums; }
.qz-count { padding: 0.2rem 0.75rem; border-radius: 99px; background: var(--night, #131321); color: #fff; font-size: 0.9rem; }
.qz-time { padding: 0.15rem 0.7rem; border-radius: 99px; background: var(--qz-surface); box-shadow: var(--card-shadow); font-weight: 800; font-variant-numeric: tabular-nums; }
.qz-low { background: var(--qz-no-bg); color: var(--qz-no); }
.qz-x { width: 44px; height: 44px; margin-left: auto; border: 0; border-radius: 50%; background: var(--qz-surface); box-shadow: var(--card-shadow); color: var(--qz-muted); font-size: 1.7rem; line-height: 1; cursor: pointer; }
.qz-track { height: 8px; margin-top: 0.3rem; border-radius: 99px; background: #1212221a; overflow: hidden; }
.qz-track i { display: block; height: 100%; border-radius: inherit; background: var(--mint, #feca1c); box-shadow: inset 0 0 0 1px #c99a0040; transition: width 0.35s var(--ease, ease-out); }

.qz-q { display: flex; flex-direction: column; flex: 1; gap: 0.8rem; padding: 0.5rem var(--gutter, 1rem) 0; }
.qz-title { margin: 0; font-stretch: 100%; font-size: 1.15rem; line-height: 1.45; font-weight: 700; }
.qz-title:focus { outline: none; }
.qz-img { display: block; width: 100%; height: auto; max-height: 38vh; object-fit: contain; border-radius: 20px; background: #fff; box-shadow: var(--card-shadow); }
.qz-opts { display: flex; flex-direction: column; gap: 0.5rem; }
.qz-opt { display: flex; align-items: flex-start; gap: 0.75rem; width: 100%; min-height: 56px; padding: 0.8rem 0.9rem; border: 0; border-radius: 18px; background: var(--qz-surface); box-shadow: inset 0 0 0 2px transparent, var(--card-shadow); color: var(--qz-ink); font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: background-color 0.15s, box-shadow 0.15s, transform 0.25s var(--spring, ease-out); }
.qz-opt:not([aria-disabled="true"]):hover { box-shadow: inset 0 0 0 2px var(--mint, #feca1c), var(--card-shadow); }
.qz-opt:not([aria-disabled="true"]):active { transform: scale(0.985); }
.qz-opt[aria-disabled="true"] { cursor: default; }
.qz-n { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 9px; background: var(--surface-2, #e8eeec); color: var(--qz-muted); font-weight: 800; font-size: 0.9rem; line-height: 1.7rem; text-align: center; }
.qz-opt .qz-t { flex: 1; min-width: 0; line-height: 1.4; }
.qz-opt.is-sel, .qz-opt.is-sel:hover { box-shadow: inset 0 0 0 2px var(--qz-blue), var(--card-shadow); }
.qz-opt.is-right, .qz-opt.is-right:hover { background: var(--qz-ok-bg); box-shadow: inset 0 0 0 2px var(--qz-ok); font-weight: 650; }
.qz-opt.is-wrong, .qz-opt.is-wrong:hover { background: var(--qz-no-bg); box-shadow: inset 0 0 0 2px var(--qz-no); }
.qz-opt.is-sel .qz-n { background: var(--qz-blue); color: var(--mint, #feca1c); }
.qz-opt.is-right .qz-n { background: var(--qz-ok); color: #fff; }
.qz-opt.is-wrong .qz-n { background: var(--qz-no); color: #fff; }

.qz-fb { display: flex; flex-direction: column; gap: 0.3rem; }
.qz-v { align-self: flex-start; margin: 0.2rem 0 0; padding: 0.25rem 0.85rem; border-radius: 99px; font-weight: 800; }
.qz-v.is-ok { background: var(--qz-ok-bg); }
.qz-v.is-no { background: var(--qz-no-bg); }
.qz-v.is-ok, .qz-a.is-ok, .qz-title.is-ok { color: var(--qz-ok); }
.qz-v.is-no, .qz-a.is-no, .qz-title.is-no { color: var(--qz-no); }
.qz-a { margin: 0; font-weight: 600; }
.qz .q-why { margin: 0.3rem 0 0; padding: 0.9rem 1.1rem; border: 0; border-radius: 18px; background: var(--y-soft, #fff3c4); color: var(--band-ink, #4a3b08); line-height: 1.6; }
.qz .q-why a { color: var(--night, #131321); font-weight: 700; text-decoration-color: var(--mint, #feca1c); text-decoration-thickness: 3px; text-underline-offset: 3px; }

.qz-nav { position: sticky; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 0.5rem; margin-top: auto; padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom)); background: linear-gradient(#f3f7f600, var(--qz-bg) 30%); }
.qz .qz-btn { transition: transform 0.3s var(--spring, ease-out), background-color 0.2s; }
.qz-nav .qz-btn { padding-inline: 0.5rem; overflow-wrap: normal; }
.qz-fb { scroll-margin-bottom: 5.5rem; }

.qz-result { padding-bottom: 2rem; }
.qz-score { margin: 0.8rem 0 0; font-size: clamp(4rem, 3rem + 6vw, 6.5rem); line-height: 0.95; font-weight: 900; font-stretch: 66%; font-variant-numeric: tabular-nums; }
.qz-score:has(+ .is-ok) { color: var(--qz-ok); }
.qz-score:has(+ .is-no) { color: var(--qz-no); }
.qz-result .qz-title { font-size: 1.7rem; font-stretch: 74%; font-weight: 800; }
.qz-note { margin: 0; color: var(--qz-muted); }
.qz-sub { margin: 0.6rem 0 0; font-size: 1.1rem; }
.qz-score { color: var(--qz-blue); }
.qz-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.1rem; border-radius: 22px; background: var(--qz-surface); box-shadow: var(--card-shadow); }
.qz-q-t { margin: 0; font-weight: 700; }
.qz-acts { display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.qz-app { margin-top: 0.6rem; padding: 1.1rem; border-radius: 22px; background: var(--y-soft, #fff3c4); color: var(--band-ink, #4a3b08); }
.qz-app-t, .qz-hint { margin: 0 0 0.6rem; }
.qz-hint { margin: 0.6rem 0 0; color: var(--qz-muted); font-size: 0.88rem; }
.qz-stores { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.qz-dim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 1rem; background: rgb(19 19 33 / 0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.qz-dlg { display: flex; flex-direction: column; gap: 0.6rem; width: min(100%, 26rem); padding: 1.2rem; border: 0; border-radius: 26px; background: var(--qz-surface); box-shadow: 0 30px 60px -30px #131321; }
.qz-dlg .qz-sub { margin: 0; }
.qz-row-b { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.4rem; }

.qz-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 520px) {
  .qz-acts { grid-template-columns: 1fr 1fr; }
  .qz-dim { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .qz-track i, .qz-opt, .qz .qz-btn { transition: none; }
}
