:root {
    --bg-top: #0f1724;
    --bg-mid: #122033;
    --bg-bottom: #0b1624;
    --accent: #ff8aa8;
    --accent-strong: #ff6b8f;
    --accent-soft: rgba(255, 138, 168, 0.12);
    --card: rgba(10, 16, 28, 0.78);
    --card-border: rgba(255, 255, 255, 0.08);
    --field: rgba(255, 255, 255, 0.08);
    --field-hover: rgba(255, 255, 255, 0.12);
    --field-border: rgba(255, 255, 255, 0.14);
    --text: #f8f6fb;
    --muted: rgba(248, 246, 251, 0.78);
    --shadow: 0 24px 60px rgba(3, 8, 18, 0.42);
    --card-elev: 0 34px 80px rgba(5, 12, 30, 0.56);
    --bg-overlay: rgba(255,255,255,0.02);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.bg {
    min-height: 100vh;
    padding: clamp(20px, 4vw, 44px) 16px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(255, 107, 147, 0.2), transparent 32%),
        radial-gradient(circle at top right, rgba(255, 187, 204, 0.12), transparent 26%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
}

.bg::before {
    content: "";
    position: absolute;
    inset: -24%;
    background:
        radial-gradient(600px 420px at 8% 18%, rgba(136,180,255,0.06), transparent 22%),
        radial-gradient(480px 320px at 92% 78%, rgba(255,160,180,0.04), transparent 22%);
    mix-blend-mode: screen;
    pointer-events: none;
    animation: bgPan 20s linear infinite;
}

.page-shell,
.center {
    width: min(100%, 860px);
    margin: 0 auto;
    text-align: center;
}

.page-shell--form {
    align-self: flex-start;
}

.card {
    width: min(100%, 760px);
    margin: 0 auto;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px) saturate(125%);
    transition: transform 300ms cubic-bezier(.2,.9,.25,1), box-shadow 300ms ease;
    animation: cardEnter 520ms cubic-bezier(.2,.9,.25,1);
}

.quiz-card,
#result-card {
    padding: clamp(22px, 4vw, 40px);
}

.quiz-card {
    text-align: left;
}

.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.quiz-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eyebrow {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 214, 224, 0.82);
}

.page-title,
h1 {
    margin: 0;
    color: var(--text);
    line-height: 1.1;
}

.page-title {
    font-size: clamp(30px, 5.5vw, 44px);
}

.page-subtitle,
.lead,
.muted,
.center > p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(15px, 2.2vw, 18px);
}

.question-list {
    display: grid;
    gap: 16px;
}

.question {
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

.question-number {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 215, 225, 0.78);
}

.question-title,
h2 {
    display: block;
    margin: 0 0 12px;
    color: var(--text);
    font-size: clamp(18px, 2.4vw, 21px);
    font-weight: 700;
    line-height: 1.35;
}

select {
    width: 100%;
    margin: 0;
    padding: 14px 48px 14px 14px;
    appearance: none;
    border: 1px solid var(--field-border);
    border-radius: 14px;
    background-color: var(--field);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text) 50%),
        linear-gradient(135deg, var(--text) 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat, no-repeat;
    color: var(--text);
    font: inherit;
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select:hover {
    background-color: var(--field-hover);
}

select:focus {
    outline: none;
    border-color: rgba(255, 107, 147, 0.62);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

option {
    background: #10192a;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(255, 77, 127, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.quiz-form .btn {
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.03);
    box-shadow: 0 18px 34px rgba(255, 77, 127, 0.28);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.35);
    outline-offset: 3px;
}

.center > h1 {
    margin-bottom: 12px;
    font-size: clamp(34px, 7vw, 58px);
}

.center > p {
    margin-bottom: 18px;
}

.center > a {
    display: inline-block;
}

#anim-canvas {
    position: relative;
    width: 100%;
    height: min(34vh, 280px);
    min-height: 220px;
    pointer-events: none;
    overflow: hidden;
}

#result-card {
    display: block;
}

.floating-heart {
    position: absolute;
    will-change: transform, opacity;
    animation: floatUp 6s ease-in-out infinite;
}

.message {
    margin-top: 8px;
    font-size: 20px;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-elev);
}

@keyframes bgPan {
    0% { transform: translate(0,0) scale(1); }
    50% { transform: translate(6%, -4%) scale(1.03); }
    100% { transform: translate(0,0) scale(1); }
}

@keyframes floatUp {
    0% { transform: translateY(6px) rotate(-6deg); opacity: 0.9; }
    50% { transform: translateY(-8px) rotate(6deg); opacity: 1; }
    100% { transform: translateY(6px) rotate(-6deg); opacity: 0.9; }
}

@keyframes cardEnter {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@media (min-width: 760px) {
    .page-shell--form {
        align-self: center;
    }

    .question-list {
        gap: 18px;
    }

    .quiz-form .btn {
        width: auto;
        min-width: 220px;
        align-self: flex-start;
    }
}

@media (max-width: 759px) {
    .bg {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card {
        border-radius: 20px;
    }

    .question {
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    select {
        transition: none;
    }
    .bg::before,
    .card,
    .floating-heart,
    .btn {
        animation: none !important;
        transition: none !important;
    }
}
