@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600&family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-1: #1a1130;
    --bg-2: #2b1a4a;
    --card: rgba(255, 255, 255, 0.055);
    --card-border: rgba(255, 255, 255, 0.12);
    --text: #f4f0ff;
    --text-dim: rgba(244, 240, 255, 0.68);
    --accent: #ffb84d;
    --accent-2: #ff7eb3;
    --correct: #3ddc97;
    --wrong: #ff6b6b;
    --radius-m: 16px;
    --radius-l: 24px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    font-family: "Inter", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 184, 77, 0.10), transparent 35%),
        radial-gradient(circle at 85% 85%, rgba(255, 126, 179, 0.10), transparent 40%),
        linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.5), transparent),
        radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,.4), transparent),
        radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,.35), transparent),
        radial-gradient(1.5px 1.5px at 90% 60%, rgba(255,255,255,.4), transparent),
        radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,.3), transparent),
        radial-gradient(1.5px 1.5px at 10% 80%, rgba(255,255,255,.35), transparent);
    background-repeat: repeat;
    background-size: 500px 500px;
    opacity: .6;
    animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: .35; }
    to { opacity: .7; }
}

.wrap {
    position: relative;
    z-index: 1;
    max-width: 980px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top {
    text-align: center;
    margin-bottom: 40px;
}

.top__eyebrow {
    font-size: 13px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-2);
    font-weight: 600;
    margin-bottom: 10px;
}

.top__title {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.15;
}

.top__title .heart {
    color: var(--accent-2);
}

.top__subtitle {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 15.5px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.screen { display: none; animation: screenIn .5s var(--ease); }
.screen.active { display: block; }

@keyframes screenIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 6px;
    width: fit-content;
    margin: 0 auto 30px;
}

.mode-toggle button {
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 11px 26px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .3s var(--ease);
}

.mode-toggle button.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #241129;
}

.mode-hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 13.5px;
    margin-bottom: 30px;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.cat-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-m);
    padding: 22px 24px;
    text-align: left;
    cursor: pointer;
    transition: all .3s var(--ease);
    color: var(--text);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.cat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 184, 77, 0.4);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.cat-card__title {
    font-weight: 700;
    font-size: 17px;
    margin-bottom: 6px;
}

.cat-card__meta {
    font-size: 12.5px;
    color: var(--text-dim);
}

.cat-card__best {
    display: inline-block;
    margin-top: 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(255, 184, 77, 0.12);
    padding: 5px 11px;
    border-radius: 999px;
}

.cat-card--wide { grid-column: 1 / -1; }

/* Quiz screen */
.quiz-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
}

.quiz-progress-label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    border-radius: 999px;
    transition: width .5s var(--ease);
}

.btn-exit {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .3s;
}

.btn-exit:hover { border-color: rgba(255,255,255,.4); color: var(--text); }

.q-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-l);
    padding: 34px 36px;
    animation: qIn .45s var(--ease);
}

@keyframes qIn {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: translateX(0); }
}

.q-tag {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #241129;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 5px 13px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.q-title {
    font-size: 13.5px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.q-text {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 600;
    font-size: clamp(20px, 3vw, 25px);
    line-height: 1.4;
    margin-bottom: 26px;
}

.options { display: flex; flex-direction: column; gap: 12px; }

.option {
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid var(--card-border);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    padding: 16px 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: all .25s var(--ease);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.option:hover:not(.disabled) {
    border-color: rgba(255, 184, 77, 0.5);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.option__letter {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    margin-top: 1px;
}

.option.correct {
    border-color: var(--correct);
    background: rgba(61, 220, 151, 0.12);
}

.option.correct .option__letter {
    background: var(--correct);
    color: #0c2a1d;
}

.option.wrong {
    border-color: var(--wrong);
    background: rgba(255, 107, 107, 0.12);
}

.option.wrong .option__letter {
    background: var(--wrong);
    color: #2a0c0c;
}

.option.selected {
    border-color: var(--accent);
    background: rgba(255, 184, 77, 0.14);
}

.option.selected .option__letter {
    background: var(--accent);
    color: #241129;
}

.option.disabled { cursor: default; }
.option.dim { opacity: .45; }

.feedback-card {
    margin-top: 22px;
    padding: 18px 22px;
    border-radius: 14px;
    animation: qIn .35s var(--ease);
}

.feedback-card.is-correct {
    background: rgba(61, 220, 151, 0.1);
    border: 1px solid rgba(61, 220, 151, 0.35);
}

.feedback-card.is-wrong {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.35);
}

.feedback-card__title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.feedback-card.is-correct .feedback-card__title { color: var(--correct); }
.feedback-card.is-wrong .feedback-card__title { color: var(--wrong); }

.feedback-card__tip {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dim);
}

.feedback-card__tip b { color: var(--text); }

.q-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 26px;
}

.btn-next {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #241129;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 14px;
    padding: 14px 30px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .3s var(--ease);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
}

.btn-next.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-next:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255, 150, 60, 0.3); }

/* Results screen */
.result-hero {
    text-align: center;
    padding: 10px 0 30px;
}

.result-ring {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(255,255,255,0.08) 0);
    position: relative;
}

.result-ring::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--bg-2);
}

.result-ring__num {
    position: relative;
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 34px;
}

.result-ring__num span {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 2px;
}

.result-title {
    font-family: "Playfair Display", serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-sub {
    color: var(--text-dim);
    font-size: 15px;
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 28px 0 14px;
    flex-wrap: wrap;
}

.btn-solid {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #241129;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 13.5px;
    padding: 13px 26px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .3s var(--ease);
}

.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--card-border);
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 13.5px;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .3s var(--ease);
}

.btn-solid:hover, .btn-ghost:hover { transform: translateY(-2px); }
.btn-ghost:hover { border-color: rgba(255,255,255,.4); }

.mistakes {
    margin-top: 20px;
}

.mistakes__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 14px;
}

.mistake-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-m);
    padding: 20px 22px;
    margin-bottom: 12px;
    animation: qIn .4s var(--ease);
}

.mistake-card__ticket {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--wrong);
    background: rgba(255, 107, 107, 0.12);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.mistake-card__q {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.mistake-card__answer {
    font-size: 14px;
    color: var(--correct);
    margin-bottom: 8px;
    line-height: 1.5;
}

.mistake-card__tip {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.6;
    border-top: 1px dashed var(--card-border);
    padding-top: 10px;
    margin-top: 10px;
}

.confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.confetti span {
    position: absolute;
    top: -10px;
    font-size: 20px;
    animation: fall linear forwards;
}

@keyframes fall {
    to { transform: translateY(110vh) rotate(360deg); opacity: .2; }
}

footer.site-footer {
    text-align: center;
    margin-top: auto;
    padding-top: 40px;
    color: rgba(244, 240, 255, 0.35);
    font-size: 12.5px;
}

@media (max-width: 720px) {
    .cat-grid { grid-template-columns: 1fr; }
    .q-card { padding: 26px 22px; }
    .quiz-head { flex-wrap: wrap; }
    .result-actions { flex-direction: column; align-items: stretch; }
}
