@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;700&family=Source+Sans+3:wght@400;600;700&display=swap");

@font-face {
    font-family: "BuffyTitle";
    src:
        url("./Buffied.ttf") format("truetype"),
        url("../Buffied.ttf") format("truetype"),
        local("Buffied"),
        local("ITC Benguiat Std Bold"),
        local("ITC Benguiat"),
        local("Benguiat");
    font-display: swap;
}

:root {
    --night: #0a0b0f;
    --violet: #15171d;
    --wine: #26222c;
    --stone: #545662;
    --stone-deep: #383b45;
    --stone-frost: #8f93a1;
    --ember: #c96b43;
    --ember-bright: #e8a06c;
    --gold: #d8c398;
    --gold-pale: #efe4c9;
    --mist: rgba(216, 223, 237, 0.08);
    --panel: rgba(24, 25, 31, 0.88);
    --panel-strong: rgba(40, 42, 50, 0.97);
    --line: rgba(192, 198, 212, 0.16);
    --line-strong: rgba(218, 224, 236, 0.36);
    --text: #f2f1ee;
    --text-soft: #c9ccd4;
    --danger: #ffb8aa;
    --shadow: 0 28px 68px rgba(0, 0, 0, 0.4);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Source Sans 3", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at top center, rgba(208, 213, 224, 0.18), transparent 24%),
        radial-gradient(circle at left 14%, rgba(115, 121, 138, 0.14), transparent 20%),
        radial-gradient(circle at right 18%, rgba(90, 97, 110, 0.18), transparent 22%),
        linear-gradient(180deg, #050608 0%, #0b0d11 24%, var(--violet) 56%, var(--wine) 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01)),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 14px,
            rgba(255, 255, 255, 0.015) 14px,
            rgba(255, 255, 255, 0.015) 15px
        );
}

body::after {
    background:
        radial-gradient(circle at 82% 14%, rgba(209, 216, 229, 0.06), transparent 10%),
        radial-gradient(circle at 18% 24%, rgba(209, 216, 229, 0.05), transparent 9%),
        radial-gradient(ellipse at 12% 104%, rgba(231, 236, 245, 0.14) 0, rgba(231, 236, 245, 0.08) 18%, transparent 44%),
        radial-gradient(ellipse at 50% 108%, rgba(231, 236, 245, 0.18) 0, rgba(231, 236, 245, 0.1) 22%, transparent 48%),
        radial-gradient(ellipse at 86% 105%, rgba(231, 236, 245, 0.13) 0, rgba(231, 236, 245, 0.07) 18%, transparent 42%),
        linear-gradient(180deg, transparent 62%, rgba(231, 236, 245, 0.05) 80%, transparent 100%);
}

.page-shell {
    width: min(1040px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3.4rem 0 4.6rem;
}

.hero,
.picker-panel,
.result-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    background:
        linear-gradient(128deg, transparent 0 23%, rgba(232, 236, 244, 0.05) 23.4%, rgba(26, 27, 33, 0.08) 24.2%, transparent 25%) 8% 18% / 220px 120px no-repeat,
        linear-gradient(164deg, transparent 0 54%, rgba(18, 19, 24, 0.22) 54.4%, rgba(226, 230, 238, 0.05) 55%, transparent 56%) 86% 70% / 250px 124px no-repeat,
        linear-gradient(112deg, transparent 0 48%, rgba(226, 230, 238, 0.04) 48.4%, transparent 49.2%) 46% 88% / 170px 86px no-repeat,
        linear-gradient(180deg, rgba(92, 95, 108, 0.1), rgba(18, 19, 24, 0.2)),
        linear-gradient(180deg, rgba(58, 60, 71, 0.95), var(--panel));
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero {
    padding: 2.7rem clamp(1.4rem, 4vw, 3.6rem);
    border-radius: 42px 42px 26px 26px / 76px 76px 26px 26px;
}

.hero::after,
.result-panel::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    top: -84px;
    right: -70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(228, 232, 239, 0.14), transparent 68%);
}

.picker-panel,
.result-panel {
    margin-top: 1.35rem;
    padding: 1.5rem clamp(1.2rem, 3vw, 2.25rem);
    border-radius: 34px 34px 22px 22px / 54px 54px 22px 22px;
}

.result-panel.is-empty {
    background:
        linear-gradient(180deg, rgba(92, 95, 108, 0.08), rgba(18, 19, 24, 0.2)),
        linear-gradient(180deg, rgba(44, 47, 58, 0.92), rgba(21, 23, 29, 0.97));
}

.hero::before,
.picker-panel::before,
.result-panel::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background:
        linear-gradient(134deg, transparent 0 44%, rgba(240, 243, 247, 0.035) 44.3%, transparent 44.9%) 22% 42% / 180px 90px no-repeat,
        linear-gradient(151deg, transparent 0 38%, rgba(26, 28, 34, 0.18) 38.4%, transparent 39.2%) 74% 24% / 210px 100px no-repeat;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -18px 40px rgba(0, 0, 0, 0.14);
    pointer-events: none;
}

.hero::before {
    inset: 12px;
}

.picker-panel::after,
.result-panel .section-heading::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(233, 237, 243, 0.38), transparent);
}

.picker-panel::after {
    top: 22px;
    right: 28px;
}

.result-panel .section-heading {
    position: relative;
}

.result-panel .section-heading::after {
    top: 10px;
    right: 0;
}

.eyebrow,
.result-kicker {
    margin: 0 0 0.9rem;
    color: var(--gold);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
    gap: 1.4rem;
    align-items: center;
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    margin: 0.2rem 0 0;
    color: #d7d8dd;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hero-seal {
    position: relative;
    min-height: 290px;
    filter: saturate(0.8);
}

.hero-crypt,
.hero-crypt-roof,
.hero-crypt-wing,
.hero-crypt-body,
.hero-crypt-pillar,
.hero-crypt-arch,
.hero-crypt-emblem,
.hero-crypt-emblem-b,
.hero-crypt-door,
.hero-crypt-step,
.hero-crypt-fog {
    position: absolute;
}

.hero-crypt {
    inset: 6px 0 0;
}

.hero-crypt::before {
    content: "";
    position: absolute;
    inset: 8px 20px 14px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(215, 220, 230, 0.12), transparent 62%);
    filter: blur(8px);
}

.hero-crypt-roof {
    top: 30px;
    left: 50%;
    width: 186px;
    height: 86px;
    transform: translateX(-50%);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    background:
        linear-gradient(152deg, transparent 0 48%, rgba(240, 243, 247, 0.08) 48.4%, transparent 49.1%) 24% 36% / 110px 54px no-repeat,
        linear-gradient(180deg, #9fa5b2, #5f6470 72%, #444853);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 30px rgba(0, 0, 0, 0.24);
}

.hero-crypt-wing {
    bottom: 58px;
    width: 72px;
    height: 78px;
    border-radius: 18px 18px 12px 12px;
    background:
        linear-gradient(135deg, transparent 0 44%, rgba(236, 239, 245, 0.06) 44.4%, transparent 45.1%) 28% 38% / 80px 40px no-repeat,
        linear-gradient(180deg, #7c818d, #4b4f5b);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.hero-crypt-wing-left {
    left: 34px;
}

.hero-crypt-wing-right {
    right: 34px;
}

.hero-crypt-body {
    left: 50%;
    bottom: 54px;
    width: 176px;
    height: 148px;
    transform: translateX(-50%);
    border-radius: 18px 18px 10px 10px;
    background:
        linear-gradient(146deg, transparent 0 42%, rgba(240, 243, 247, 0.06) 42.4%, transparent 43.2%) 22% 54% / 130px 62px no-repeat,
        linear-gradient(180deg, #7a7f8b, #4e535f 54%, #3d414b);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 18px 34px rgba(0, 0, 0, 0.26);
}

.hero-crypt-pillar {
    bottom: 54px;
    width: 22px;
    height: 128px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(242, 245, 249, 0.12), transparent 30%),
        linear-gradient(180deg, #8a909b, #545964);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.hero-crypt-pillar-left {
    left: calc(50% - 82px);
}

.hero-crypt-pillar-right {
    right: calc(50% - 82px);
}

.hero-crypt-arch {
    left: 50%;
    bottom: 136px;
    width: 54px;
    height: 30px;
    transform: translateX(-50%);
    border-radius: 54px 54px 12px 12px;
    background: linear-gradient(180deg, #333741, #21242c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-crypt-emblem {
    left: 50%;
    bottom: 114px;
    width: 96px;
    height: 96px;
    transform: translateX(-50%);
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(241, 243, 248, 0.98) 0 21%, rgba(183, 187, 199, 0.98) 22%, rgba(107, 112, 126, 0.98) 62%, rgba(51, 53, 62, 0.96) 100%);
    box-shadow:
        0 0 22px rgba(225, 230, 240, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 -12px 24px rgba(32, 34, 42, 0.28);
    z-index: 4;
}

.hero-crypt-emblem::before,
.hero-crypt-emblem::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #737784, #4a4e59);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.hero-crypt-emblem::before {
    width: 34px;
    height: 114px;
    border-radius: 16px;
}

.hero-crypt-emblem::after {
    width: 114px;
    height: 34px;
    border-radius: 16px;
}

.hero-crypt-emblem-b {
    inset: 0;
    display: grid;
    place-items: center;
    font-family: "BuffyTitle", "Cormorant Garamond", serif;
    font-size: 2.95rem;
    line-height: 1;
    color: #f7f4ef;
    text-shadow:
        0 0 8px rgba(243, 244, 247, 0.34),
        0 0 16px rgba(206, 213, 225, 0.18);
    z-index: 2;
}

.hero-crypt-door {
    left: 50%;
    bottom: 54px;
    width: 66px;
    height: 98px;
    transform: translateX(-50%);
    border-radius: 34px 34px 10px 10px;
    background:
        radial-gradient(circle at 70% 52%, rgba(218, 223, 233, 0.4) 0 3px, transparent 4px),
        linear-gradient(180deg, #1e2128, #2a2d36);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -12px 20px rgba(0, 0, 0, 0.28);
}

.hero-crypt-step {
    left: 50%;
    transform: translateX(-50%);
    border-radius: 18px;
    background: linear-gradient(180deg, #747984, #515662);
}

.hero-crypt-step-one {
    bottom: 36px;
    width: 132px;
    height: 16px;
}

.hero-crypt-step-two {
    bottom: 20px;
    width: 178px;
    height: 16px;
}

.hero-crypt-fog {
    left: -2px;
    right: -2px;
    bottom: -12px;
    height: 118px;
    background:
        radial-gradient(ellipse at 12% 70%, rgba(228, 233, 242, 0.26), transparent 42%),
        radial-gradient(ellipse at 34% 80%, rgba(228, 233, 242, 0.18), transparent 44%),
        radial-gradient(ellipse at 50% 78%, rgba(228, 233, 242, 0.34), transparent 46%),
        radial-gradient(ellipse at 68% 82%, rgba(228, 233, 242, 0.2), transparent 44%),
        radial-gradient(ellipse at 88% 70%, rgba(228, 233, 242, 0.24), transparent 42%);
    filter: blur(12px);
}

h1,
h2 {
    margin: 0;
    font-family: "BuffyTitle", "Cormorant Garamond", serif;
    font-weight: 700;
    line-height: 0.98;
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

h1 {
    max-width: 10ch;
    font-size: clamp(4rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    color: #f1e8d9;
    text-shadow: 0 0 14px rgba(232, 160, 108, 0.24), 0 8px 34px rgba(0, 0, 0, 0.48);
}

h2 {
    max-width: 14ch;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    letter-spacing: 0.03em;
}

.section-heading {
    display: grid;
    gap: 0.2rem;
    margin-bottom: 1rem;
}

.section-kicker {
    margin: 0;
    color: var(--gold);
    font-size: 0.76rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.section-title {
    margin: 0;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(1.5rem, 3vw, 2.3rem);
    line-height: 1.1;
    letter-spacing: 0.02em;
    color: #e3e5ea;
}

.result-heading {
    margin-bottom: 0.6rem;
}

.intro,
.pool-note,
.message,
#episode-detail {
    color: var(--text-soft);
}

.intro {
    max-width: 54ch;
    margin: 1.1rem 0 0;
    line-height: 1.7;
    font-size: 1.08rem;
}

.episode-form {
    display: grid;
    gap: 1rem;
}

.season-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.season-fieldset legend {
    margin: 0 0 0.95rem;
    padding: 0;
    font-size: 0.98rem;
    color: var(--text-soft);
}

.season-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.season-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
}

.season-option {
    position: relative;
    display: block;
    cursor: pointer;
}

.season-checkbox {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.season-card {
    display: grid;
    justify-items: start;
    gap: 0.2rem;
    min-height: 94px;
    padding: 1rem 1rem 1.1rem;
    border: 1px solid rgba(218, 223, 233, 0.12);
    border-radius: 26px 26px 16px 16px / 38px 38px 16px 16px;
    background:
        linear-gradient(141deg, transparent 0 40%, rgba(233, 237, 244, 0.05) 40.5%, transparent 41.3%) 26% 38% / 96px 48px no-repeat,
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18)),
        repeating-linear-gradient(
            105deg,
            rgba(255, 255, 255, 0.03) 0,
            rgba(255, 255, 255, 0.03) 2px,
            transparent 2px,
            transparent 13px
        ),
        var(--panel-strong);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.season-card::after {
    content: "";
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #2b180e;
    background: linear-gradient(135deg, #dfe3eb, #b9bfcc);
    box-shadow: 0 8px 20px rgba(82, 88, 102, 0.2);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 180ms ease, transform 180ms ease;
}

.season-card::before {
    content: "";
    position: absolute;
    top: 0.33rem;
    right: 1.2rem;
    width: 0.6rem;
    height: 1rem;
    border-right: 2px solid #282b33;
    border-bottom: 2px solid #282b33;
    transform: rotate(42deg);
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 1;
}

.season-option:hover .season-card {
    transform: translateY(-1px);
    border-color: rgba(222, 227, 237, 0.28);
}

.season-checkbox:checked + .season-card {
    border-color: var(--line-strong);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.26), inset 0 0 0 1px rgba(230, 235, 244, 0.14);
    background:
        linear-gradient(180deg, rgba(231, 236, 244, 0.12), rgba(128, 137, 153, 0.05)),
        repeating-linear-gradient(
            105deg,
            rgba(255, 255, 255, 0.03) 0,
            rgba(255, 255, 255, 0.03) 2px,
            transparent 2px,
            transparent 13px
        ),
        var(--panel-strong);
}

.season-checkbox:checked + .season-card::after {
    opacity: 1;
    transform: scale(1);
}

.season-checkbox:checked + .season-card::before {
    opacity: 1;
}

.season-checkbox:focus + .season-card,
.mini-button:focus,
button:focus {
    outline: 2px solid rgba(241, 204, 127, 0.6);
    outline-offset: 3px;
}

.season-card-label {
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.season-card-number {
    font-family: "BuffyTitle", "Cormorant Garamond", serif;
    font-size: 2rem;
    line-height: 1;
    color: #eceef3;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.primary-button,
.ghost-button,
.mini-button {
    border-radius: 999px;
    font: inherit;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-button,
.ghost-button {
    padding: 0.95rem 1.35rem;
}

.primary-button {
    border: 0;
    color: #1f1f22;
    background: linear-gradient(135deg, #d8dbe3, #8f95a1);
    box-shadow: 0 18px 30px rgba(56, 59, 69, 0.34);
}

.ghost-button,
.mini-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(219, 224, 234, 0.12);
}

.mini-button {
    padding: 0.58rem 0.92rem;
    color: var(--text-soft);
}

.primary-button:hover,
.ghost-button:hover,
.mini-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.mini-button:disabled {
    opacity: 0.72;
    cursor: wait;
}

.pool-note,
.message {
    margin: 0;
    line-height: 1.6;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1rem;
    align-items: center;
    margin-top: 1rem;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    color: #1f2128;
    background: linear-gradient(135deg, #e2e5ec, #aab0bd);
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 10px 18px rgba(0, 0, 0, 0.18);
}

#episode-title {
    color: #f3eee3;
}

.error {
    color: var(--danger);
}

.is-loading .result-badge {
    animation: ember-glow 900ms ease-in-out infinite alternate;
}

@keyframes ember-glow {
    from {
        box-shadow: 0 0 0 rgba(220, 225, 236, 0.08);
    }

    to {
        box-shadow: 0 0 28px rgba(220, 225, 236, 0.24);
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 1rem, 1040px);
        padding: 2.3rem 0 3rem;
    }

    .hero,
    .picker-panel,
    .result-panel {
        border-radius: 28px 28px 18px 18px / 42px 42px 18px 18px;
    }

    h1,
    h2 {
        max-width: none;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-seal {
        min-height: 220px;
        order: -1;
    }

    .hero-crypt-roof {
        width: 148px;
        height: 68px;
    }

    .hero-crypt-body {
        width: 142px;
        height: 118px;
    }

    .hero-crypt-pillar-left {
        left: calc(50% - 66px);
    }

    .hero-crypt-pillar-right {
        right: calc(50% - 66px);
    }

    .hero-crypt-wing {
        width: 54px;
        height: 58px;
        bottom: 56px;
    }

    .hero-crypt-emblem {
        width: 82px;
        height: 82px;
        bottom: 104px;
    }

    .hero-crypt-emblem::before {
        width: 28px;
        height: 96px;
    }

    .hero-crypt-emblem::after {
        width: 96px;
        height: 28px;
    }

    .hero-crypt-emblem-b {
        font-size: 2.4rem;
    }

    .actions {
        flex-direction: column;
    }

    .primary-button,
    .ghost-button {
        width: 100%;
    }
}
