:root {
    --brand: #1e3a8a;
    --brand-dark: #172e6e;
    --brand-soft: #eef2fb;
    --ink: #1f2937;
    --muted: #5b6474;
    --line: #e3e7ef;
    --bg: #f4f6fa;
    --card: #ffffff;
    --ok: #15803d;
    --ok-soft: #e9f7ee;
    --bad: #b42318;
    --bad-soft: #fdecea;
    --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--brand); }

/* Header */
.q-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.q-header__inner {
    max-width: 920px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.q-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}
.q-brand__logo { height: 40px; width: auto; flex: none; }
.q-brand__tag {
    padding-left: 12px;
    border-left: 1px solid var(--line);
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}
.q-brand__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.q-brand__text strong {
    font-size: 14px;
    color: var(--brand);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.q-brand__text span { font-size: 12px; color: var(--muted); }
.q-header__step {
    flex: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}
.q-progress { height: 3px; background: var(--line); }
.q-progress__bar {
    height: 100%;
    width: 0;
    background: var(--brand);
    transition: width .35s ease;
}

/* Layout */
.q-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}
.q-step { display: none; }
.q-step.is-active { display: block; animation: q-in .3s ease; }
@keyframes q-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.q-card {
    max-width: 680px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.q-card--wide { max-width: 860px; }

.q-eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--brand);
}
.q-title {
    margin: 0 0 16px;
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 1.25;
    color: #111827;
}
h2.q-title { font-size: 28px; }
.q-lead { font-size: 18px; color: var(--ink); }
.q-muted { color: var(--muted); }
.q-card p { margin: 0 0 16px; }

/* Lessons */
.q-lesson h3 {
    margin: 28px 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}
.q-lesson ul, .q-lesson ol { margin: 0 0 16px; padding-left: 22px; }
.q-lesson li { margin-bottom: 6px; }
.q-lesson li::marker { color: var(--brand); }
.q-notice {
    margin: 24px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 15px;
}

/* Buttons */
.q-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.q-actions > :only-child { margin-left: auto; }
.q-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 24px;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.q-btn--primary { background: var(--brand); color: #fff; }
.q-btn--primary:hover { background: var(--brand-dark); }
.q-btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.q-btn--ghost:hover { border-color: #c9cfdb; background: #f9fafc; }
.q-btn--block { width: 100%; padding: 14px 24px; font-size: 16px; }
.q-btn:disabled { opacity: .45; cursor: not-allowed; }
.q-btn:focus-visible, .q-option:focus-within, .q-field input:focus {
    outline: 3px solid rgba(30, 58, 138, .25);
    outline-offset: 2px;
}

/* Intro */
.q-slider {
    position: relative;
    margin: 24px 0;
    border-radius: 10px;
    overflow: hidden;
    background: #e9edf4;
}
.q-slider__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}
.q-slider__track::-webkit-scrollbar { display: none; }
.q-slider__track img {
    flex: 0 0 100%;
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    scroll-snap-align: start;
    display: block;
}
.q-slider__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: var(--ink);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.q-slider__nav--prev { left: 12px; }
.q-slider__nav--next { right: 12px; }
.q-slider__dots {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.q-slider__dots button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, .6);
    cursor: pointer;
    transition: width .2s, background-color .2s;
}
.q-slider__dots button.is-active { width: 22px; background: #fff; }

.q-facts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.q-facts li {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}
.q-facts strong { font-size: 15px; color: var(--brand); }
.q-facts span { font-size: 13px; color: var(--muted); }

/* Form */
.q-form { margin-top: 8px; }
.q-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.q-field { display: block; margin-bottom: 16px; }
.q-field > span {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}
.q-field input {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfd5e0;
    border-radius: 8px;
    transition: border-color .15s;
}
.q-field input:focus { border-color: var(--brand); outline-offset: 0; }
.q-field.has-error input { border-color: var(--bad); }
.q-error { display: block; min-height: 0; margin-top: 4px; font-size: 13px; color: var(--bad); }
.q-error:empty { display: none; }
.q-field.is-checking .q-error { color: var(--muted); }

/* Questions */
.q-qhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--muted);
}
.q-qhead strong { color: var(--brand); }
.q-qbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 28px; }
.q-qbar > div { height: 100%; background: var(--brand); transition: width .3s ease; }
.q-question {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.45;
    color: #111827;
}
.q-options { display: grid; gap: 10px; }
.q-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #d5dae4;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.q-option:hover { border-color: #aab4c8; background: #fafbfd; }
.q-option input { position: absolute; opacity: 0; pointer-events: none; }
.q-option__key {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #c4cbd8;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    transition: all .15s;
}
.q-option__text { padding-top: 2px; }
.q-option.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.q-option.is-selected .q-option__key { background: var(--brand); border-color: var(--brand); color: #fff; }
.q-option.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.q-option.is-correct .q-option__key { background: var(--ok); border-color: var(--ok); color: #fff; }
.q-option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.q-option.is-wrong .q-option__key { background: var(--bad); border-color: var(--bad); color: #fff; }
.q-options.is-locked .q-option { cursor: default; }
.q-feedback {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
}
.q-feedback.is-ok { background: var(--ok-soft); color: var(--ok); }
.q-feedback.is-bad { background: var(--bad-soft); color: var(--bad); }

/* Result */
.q-result { text-align: center; }
.q-result__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 700;
}
.q-result__icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.q-result__icon.is-bad { background: var(--bad-soft); color: var(--bad); }
.q-result__icon.is-wait { background: var(--brand-soft); color: var(--brand); }
.q-result__score { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.q-result .q-actions { justify-content: center; flex-wrap: wrap; }
.q-result .q-actions > :only-child { margin-left: 0; }
.q-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(30, 58, 138, .2);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: q-spin .8s linear infinite;
}
@keyframes q-spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 640px) {
    .q-main { padding: 16px 12px 40px; }
    .q-card { padding: 24px 18px; border-radius: 10px; }
    .q-title { font-size: 26px; }
    h2.q-title { font-size: 23px; }
    .q-lead { font-size: 17px; }
    .q-question { font-size: 18px; }
    .q-row { grid-template-columns: 1fr; gap: 0; }
    .q-facts { gap: 8px; }
    .q-facts li { padding: 10px; }
    .q-facts strong { font-size: 13px; }
    .q-facts span { font-size: 12px; line-height: 1.35; }
    .q-brand__tag { font-size: 13px; }
    .q-brand__logo { height: 34px; }
    .q-brand__text strong { font-size: 13px; }
    .q-actions { flex-direction: column-reverse; align-items: stretch; }
    .q-actions > :only-child { margin-left: 0; }
    .q-btn { width: 100%; }
    .q-slider__nav { width: 34px; height: 34px; font-size: 22px; }
}
