/*
 * Quiz Maker: the tool's own components, styled in the site's design language (12 Nov 2026, automatic mode, on the
 * UltraCompress Pro template). The first part copies the Decision Maker's shared block, as the Love Calculator's file does
 * (tokens, page, hero, buttons, toolbar, fields, windows, toasts, information sections). Base: /libs/site-pages.css (tokens,
 * Inter and Space Grotesk, theme toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). The second
 * part is the original's components (the four steps, the text box and settings, the question list, the player with its
 * clock ring and coloured answer keys, the results ring and breakdown) on the site's tokens, with the original's colours
 * for the three question types (purple, amber, teal) darkened or lightened to reach 4.5:1 in both themes. The original's
 * top bar, footer, background blobs, theme and fixed answer sheet are gone. Light is the default; dark applies when <html>
 * has no data-theme. Written once from the Love Calculator's file and the original's style.css, then edited by hand: this
 * file is the source.
 */


/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }


/* ===== Quiz Maker components ===== */

/* ----- The site's text rules (p, ul, li, headings) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.dialog) p { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.app-shell) h4 { margin: 0; line-height: 1.25; }
:root { --head: 81px; }
@media (max-width: 639.98px) { :root { --head: 65px; } }

/* ----- The three question types and the answer keys (the original's colours, at 4.5:1 in both themes) ----- */
:root {
    --mc: #6d28d9;
    --mc-soft: #f3efff;
    --tf: #92400e;
    --tf-soft: #fff4e0;
    --tf-bar: #d97706;
    --fib: #0f766e;
    --fib-soft: #e3f8f3;
    --key-a: #6d28d9;
    --key-b: #c2410c;
    --key-c: #0f766e;
    --key-d: #a16207;
    --track: #e7e9f3;
    --streak: #c2410c;
    --streak-soft: #ffeee9;
}
:root:not([data-theme="light"]) {
    --mc: #c4b5fd;
    --mc-soft: rgba(139, 92, 246, 0.16);
    --tf: #fbbf24;
    --tf-soft: rgba(251, 191, 36, 0.12);
    --tf-bar: #fbbf24;
    --fib: #5eead4;
    --fib-soft: rgba(45, 212, 191, 0.12);
    --track: rgba(255, 255, 255, 0.1);
    --streak: #fdba74;
    --streak-soft: rgba(251, 146, 60, 0.14);
}

/* ----- Shared pieces ----- */
.app-shell { scroll-margin-top: calc(var(--head) + 16px); }
.app-shell :is(p, h2, h3, li, strong, span) { overflow-wrap: anywhere; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { font-size: 1.15rem; font-weight: 700; color: var(--text-strong); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 32px 0 14px; }
.section-head h2 { font-size: 1.3rem; color: var(--text-strong); }
.empty { color: var(--text-2); padding: 12px 0; }
.screen[hidden] { display: none; }

/* ----- Toolbar: the four steps and the sound button ----- */
.app-toolbar { flex-wrap: nowrap; align-items: center; }
.steps { display: flex; gap: 8px; flex: 1; min-width: 0; }
.steps li { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-radius: 9999px; background: var(--surface); border: 1px solid var(--surface-border); color: var(--text-2); font-size: 0.85rem; font-weight: 600; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; min-width: 0; }
.steps .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.steps li.is-done { color: var(--text-strong); }
.steps li.is-done .num { background: var(--ok-soft); color: var(--ok); }
.steps li.is-active { color: var(--link); border-color: var(--brand); background: var(--tint-brand); }
.steps li.is-active .num { background: var(--gradient-brand); color: #fff; }
.sound-btn { width: 44px; height: 44px; border: 1px solid var(--surface-border); background: var(--surface); border-radius: 50%; }
.sound-btn .ico-off { display: none; }
.sound-btn[aria-pressed="false"] .ico-on { display: none; }
.sound-btn[aria-pressed="false"] .ico-off { display: block; }

/* ----- Create: samples, the text box and the settings ----- */
.sample-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.sample-row .chips-label { color: var(--text-2); font-size: 0.9rem; font-weight: 600; margin-right: 4px; }
.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; } }
.editor { position: relative; border: 2px dashed transparent; border-radius: 14px; transition: border-color 0.2s ease, background 0.2s ease; }
.editor.is-over { border-color: var(--brand); background: var(--tint-brand); }
.editor.is-over textarea { opacity: 0.4; }
.editor textarea.input { min-height: 320px; padding: 16px; line-height: 1.6; resize: vertical; display: block; }
.editor-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; color: var(--text-2); pointer-events: none; padding: 20px; }
.editor-empty svg { color: var(--link); margin-bottom: 6px; }
.editor-empty strong { color: var(--text-strong); }
.editor.has-text .editor-empty, .editor.is-focused .editor-empty { display: none; }
.editor-foot { display: flex; gap: 12px; align-items: center; margin-top: 10px; color: var(--text-2); font-size: 0.875rem; flex-wrap: wrap; }
.settings { display: flex; flex-direction: column; gap: 16px; }
.settings .card-title { margin-bottom: 0; }
.field-label { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.field-label output { color: var(--link); font-variant-numeric: tabular-nums; font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input[type="range"] { flex: 1; accent-color: var(--brand); margin: 0; min-width: 0; }
.step-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); font-family: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0; flex-shrink: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.step-btn:hover { border-color: var(--brand); color: var(--link); }
.toggle-group { display: grid; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--surface-2); font-family: inherit; font-weight: 600; font-size: 0.925rem; cursor: pointer; text-align: left; color: var(--text-2); transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease; }
.toggle i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; transition: background 0.2s ease, box-shadow 0.2s ease; }
.toggle:hover { border-color: var(--brand); }
.toggle.is-on { color: var(--text-strong); background: var(--surface); }
.toggle.mc.is-on i { background: var(--mc); box-shadow: 0 0 0 4px var(--mc-soft); }
.toggle.tf.is-on i { background: var(--tf-bar); box-shadow: 0 0 0 4px var(--tf-soft); }
.toggle.fib.is-on i { background: var(--fib); box-shadow: 0 0 0 4px var(--fib-soft); }
.toggle::after { content: "Off"; margin-left: auto; font-size: 0.75rem; font-weight: 700; color: var(--text-2); }
.toggle.is-on::after { content: "On"; color: var(--ok); }
.toggle:focus-visible, .segmented button:focus-visible, .step-btn:focus-visible, .answer:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.segmented { display: flex; padding: 4px; border-radius: 9999px; background: var(--surface-2); gap: 4px; }
.segmented button { flex: 1; padding: 8px 10px; border: 0; border-radius: 9999px; background: transparent; color: var(--text-2); font-family: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.segmented button:hover { color: var(--link); }
.segmented button.is-on { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.segmented.small { display: inline-flex; }
.segmented.small button { flex: 0 0 auto; padding: 6px 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.925rem; color: var(--text); position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch .track { position: relative; width: 42px; height: 24px; border-radius: 9999px; background: var(--line-strong); flex: none; transition: background 0.2s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-big { width: 100%; padding: 14px 18px; font-size: 1.05rem; }
.settings .hint { font-size: 0.875rem; color: var(--text-2); }

/* ----- Saved quizzes ----- */
.saved-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.saved-item { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface); box-shadow: var(--surface-shadow); min-width: 0; }
.saved-name { font-weight: 700; color: var(--text-strong); }
.saved-meta { color: var(--text-2); font-size: 0.85rem; }
.saved-item .actions { margin-top: 6px; }

/* ----- Review ----- */
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.review-title { flex: 1; min-width: 240px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.title-input.input { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.4rem; font-weight: 700; padding: 6px 10px; margin-left: -10px; width: calc(100% + 10px); border-color: transparent; background: transparent; color: var(--text-strong); }
.title-input.input:hover { border-color: var(--field-border); }
.meta-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.meta-chip { font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 9999px; background: var(--surface-2); color: var(--text-2); }
.meta-chip.mc, .tag { background: var(--mc-soft); color: var(--mc); }
.meta-chip.tf, .tag.tf { background: var(--tf-soft); color: var(--tf); }
.meta-chip.fib, .tag.fib { background: var(--fib-soft); color: var(--fib); }
.notice { padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(217, 119, 6, 0.3); font-size: 0.925rem; margin-bottom: 14px; }
.qlist { display: grid; gap: 12px; }
.qitem { position: relative; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 18px 20px 18px 24px; box-shadow: var(--surface-shadow); overflow: hidden; }
.qitem::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.qitem.mc::before { background: var(--mc); }
.qitem.tf::before { background: var(--tf-bar); }
.qitem.fib::before { background: var(--fib); }
.qitem.is-right::before { background: var(--ok); }
.qitem.is-wrong::before { background: var(--bad); }
.qitem[hidden] { display: none; }
.qitem-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.qitem-head .spacer { flex: 1; }
.qnum { font-weight: 800; color: var(--text-2); font-size: 0.85rem; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 9999px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.qtext { font-weight: 600; margin-bottom: 10px; font-size: 1.02rem; color: var(--text-strong); }
.qopts { display: grid; gap: 6px; font-size: 0.925rem; }
.qopts li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.qopts .key { font-size: 0.75rem; font-weight: 800; color: var(--text-2); min-width: 16px; }
.qopts li.is-correct { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.qopts li.is-correct .key { color: var(--ok); }
.qopts li.is-chosen-wrong { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.qexplain { margin-top: 10px; color: var(--text-2); font-size: 0.875rem; }
.verdict { font-weight: 800; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.verdict.right { color: var(--ok); }
.verdict.wrong { color: var(--bad); }
.sticky-cta { display: none; }

/* ----- Play ----- */
.play-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.play-title { flex: 1; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.quit-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--surface-border); background: var(--surface); font-size: 1.4rem; line-height: 1; }
.score-pill { padding: 6px 14px; border-radius: 9999px; background: var(--gradient-brand); color: #fff; font-size: 0.85rem; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); white-space: nowrap; }
.score-pill.bump { animation: bump 0.4s ease; }
@keyframes bump { 30% { transform: scale(1.15); } }
.streak-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 9999px; background: var(--streak-soft); color: var(--streak); font-weight: 800; font-size: 0.85rem; animation: bump 0.4s ease; }
.play-pills { display: flex; align-items: center; gap: 8px; }
.segments { display: flex; gap: 4px; margin-bottom: 20px; }
.segments i { flex: 1; height: 6px; border-radius: 9999px; background: var(--track); transition: background 0.3s ease; }
.segments i.is-current { background: var(--brand); animation: seg-pulse 1.2s ease-in-out infinite; }
.segments i.is-right { background: var(--ok); }
.segments i.is-wrong { background: var(--bad); }
@keyframes seg-pulse { 50% { opacity: 0.5; } }
.play-stage { max-width: 860px; margin: 0 auto; }
.question-card { padding: 28px; border-radius: 22px; animation: card-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.question-card.shake { animation: shake 0.4s ease; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.q-top { display: flex; align-items: center; gap: 12px; }
.counter { color: var(--text-2); font-weight: 700; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.q-top .timer { margin-left: auto; }
.question-text { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.6rem); margin: 16px 0 22px; font-weight: 700; color: var(--text-strong); }
.timer { position: relative; width: 46px; height: 46px; display: grid; place-items: center; font-size: 0.875rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: var(--track); stroke-width: 3.5; }
.timer-ring { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s linear, stroke 0.3s ease; }
.timer.is-low .timer-ring { stroke: var(--bad); }
.timer.is-low { color: var(--bad); animation: tick-pulse 1s ease-in-out infinite; }
@keyframes tick-pulse { 50% { transform: scale(1.1); } }
.answers { display: grid; gap: 10px; }
@media (min-width: 640px) { .answers.two-col { grid-template-columns: 1fr 1fr; } }
.answer { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--surface-border); background: var(--surface); color: var(--text-strong); cursor: pointer; font-family: inherit; font-size: 1rem; font-weight: 600; transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease; min-width: 0; }
.answer:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-shadow); }
.answer .key { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 0.85rem; font-weight: 800; color: #fff; background: var(--key-a); }
.answer[data-index="1"] .key { background: var(--key-b); }
.answer[data-index="2"] .key { background: var(--key-c); }
.answer[data-index="3"] .key { background: var(--key-d); }
.answer.tf-true .key { background: var(--key-c); }
.answer.tf-false .key { background: var(--key-b); }
.answer.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.answer.is-correct .key { background: #166534; }
.answer.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer.is-wrong .key { background: #b91c1c; }
.answer:disabled { cursor: default; transform: none; }
.answer:disabled:not(.is-correct):not(.is-wrong) { opacity: 0.55; }
.fib-row { display: flex; gap: 10px; }
.fib-row .input { flex: 1; font-size: 1.1rem; padding: 14px 16px; }
.fib-row .input.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.fib-row .input.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.play-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.keys { text-align: center; margin-top: 12px; color: var(--text-2); font-size: 0.875rem; }
.feedback { margin-top: 14px; display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--surface-border); box-shadow: var(--surface-shadow); border-left: 6px solid var(--ok); animation: sheet-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); scroll-margin-bottom: 16px; }
.feedback.bad { border-left-color: var(--bad); }
@keyframes sheet-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.feedback-text { flex: 1; min-width: 0; }
.feedback strong { font-size: 1.05rem; color: var(--ok); margin-right: 8px; }
.feedback.bad strong { color: var(--bad); }
.fb-points { font-weight: 800; color: var(--link); font-size: 0.925rem; }
.feedback-text p { font-size: 0.95rem; color: var(--text); }
.feedback-text .fb-explain { color: var(--text-2); font-size: 0.875rem; margin-top: 2px; }
.feedback-text p:empty { display: none; }

/* ----- Results ----- */
.results-hero { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; padding: 32px; border-radius: 24px; }
.results-body { flex: 1; min-width: 260px; }
.results-body h2 { font-size: 1.7rem; margin: 6px 0 4px; color: var(--text-strong); }
.results-body .actions { margin-top: 18px; }
.grade { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--gradient-brand); color: #fff; font-weight: 900; font-size: 1.2rem; }
.grade.good { background: #166534; }
.grade.bad { background: #b91c1c; }
.ring { --pct: 0; position: relative; width: 160px; height: 160px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--track) 0); flex: none; animation: ring-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring::before { content: ""; position: absolute; width: 124px; height: 124px; border-radius: 50%; background: var(--surface); }
.ring-value { position: relative; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.ring.good { background: conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--track) 0); }
.ring.bad { background: conic-gradient(var(--bad) calc(var(--pct) * 1%), var(--track) 0); }
@keyframes ring-in { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: 12px 10px; text-align: center; }
.stats strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.stats span { font-size: 0.8rem; color: var(--text-2); font-weight: 600; }
.breakdown { display: grid; gap: 8px; margin-top: 16px; }
.bd-row { display: grid; grid-template-columns: 140px 1fr 52px; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text); }
.bd-row .bd-bar { height: 8px; border-radius: 9999px; background: var(--track); overflow: hidden; }
.bd-row .bd-bar i { display: block; height: 100%; border-radius: 9999px; background: var(--mc); width: 0; transition: width 0.8s ease; }
.bd-row.tf .bd-bar i { background: var(--tf-bar); }
.bd-row.fib .bd-bar i { background: var(--fib); }
.bd-row .bd-val { text-align: right; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ----- Windows ----- */
.edit-opts { display: grid; gap: 8px; }
.edit-opt-row { display: flex; align-items: center; gap: 10px; }
.opt-pick { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; cursor: pointer; }
.opt-pick input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
.radio-row { display: flex; gap: 20px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.radio-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
.share-row { display: flex; gap: 8px; }
.share-row .input { flex: 1; }

/* ----- Confetti ----- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2500; }
.confetti-piece { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.2; } }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { padding-right: 52px; } /* the site's round theme button sits at the top right on phones (45 px, 15 px from the edge) */
    .steps { gap: 6px; }
    .steps li { padding: 8px 6px; }
    .steps .label { display: none; }
    .card { padding: 16px; }
    .question-card { padding: 18px; }
    .results-hero { padding: 20px; gap: 20px; justify-content: center; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .bd-row { grid-template-columns: 110px 1fr 48px; }
    .review-actions .btn-primary { display: none; }
    .sticky-cta { display: block; position: sticky; bottom: 12px; margin-top: 16px; z-index: 4; }
    .sticky-cta .btn { width: 100%; box-shadow: 0 10px 30px rgba(139, 92, 246, 0.45); }
    .feedback { flex-direction: column; align-items: stretch; }
    .feedback .btn { width: 100%; }
    .fib-row { flex-direction: column; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}
@media (min-width: 640px) and (max-width: 959px) {
    .info-section .info-grid, .info-three { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .toast, .question-card, .feedback, .ring, .confetti-piece, .timer.is-low, .score-pill.bump,
    .streak-pill, .segments i.is-current, .answer, .toggle, .segmented button, .steps li { animation: none !important; transition: none; }
    .timer-ring, .bd-row .bd-bar i { transition: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The confetti and the rings are drawings. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .step-btn { width: 44px; height: 44px; }
    main .icon-btn, main .sound-btn, main .quit-btn { width: 44px; height: 44px; min-width: 44px; }
    main input[type="range"] { min-height: 44px; }
    main .switch { min-height: 44px; }
    main :is(p, li, .hint, .label, .field-label, .input, .segmented button, .toggle, .chip, .muted, .meta-chip, .saved-meta, .editor-foot,
        .qopts, .qexplain, .counter, .keys, .bd-row, .stats span, .chips-label, .switch, .link, .empty, .notice):not(.question-text, .ring-value) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog input:not([type="checkbox"]):not([type="radio"]), .dialog select { min-height: 44px; }
    .dialog .dialog-close { width: 44px; height: 44px; }
    .dialog :is(p, .hint, .label, .field-label, .input, .select, label) { font-size: 1rem; }
    .dialog .opt-pick { width: 44px; height: 44px; }
    .dialog .opt-pick input, .dialog .radio-row input { width: 24px; height: 24px; }
    .dialog .radio-row label { min-height: 44px; }
}
