:root {
    --color-primary: #7a1538;
    --color-secondary: #101820;
    --color-accent: #c9a227;
    --color-support: #0f8b8d;
    --color-page: #fffafc;
    --text: #16151a;
    --muted: #6c6470;
    --line: rgba(22, 21, 26, .12);
    --surface: rgba(255, 255, 255, .86);
    --shadow: 0 24px 70px rgba(29, 14, 23, .15);
    --radius: 8px;
    --font-public-title-size: 88px;
    --font-public-subtitle-size: 20px;
    --font-step-title-size: 40px;
    --font-step-text-size: 16px;
    --font-form-text-size: 16px;
    --font-terms-text-size: 14px;
    --font-success-title-size: 42px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    min-height: 100%;
    margin: 0;
    background:
        linear-gradient(115deg, rgba(122, 21, 56, .08), transparent 34%),
        linear-gradient(245deg, rgba(15, 139, 141, .08), transparent 36%),
        var(--color-page);
    color: var(--text);
    overflow-x: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

input,
textarea,
select {
    font-size: 16px;
}

button {
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
}

.public-shell {
    min-height: 100svh;
    display: grid;
    padding: 24px;
}

.stage-panel {
    position: relative;
    width: min(1180px, 100%);
    min-height: calc(100svh - 48px);
    margin: auto;
    padding: clamp(20px, 4vw, 44px);
    border: 1px solid rgba(255, 255, 255, .9);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .78)),
        linear-gradient(135deg, rgba(201, 162, 39, .12), transparent 40%);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stage-panel::before,
.stage-panel::after {
    content: "";
    position: absolute;
    inset: auto -10% -18% auto;
    width: 64%;
    height: 40%;
    background: repeating-linear-gradient(110deg, rgba(122, 21, 56, .1) 0 1px, transparent 1px 18px);
    transform: rotate(-4deg);
    pointer-events: none;
}

.stage-panel::after {
    inset: -12% auto auto -12%;
    background: repeating-linear-gradient(110deg, rgba(15, 139, 141, .08) 0 1px, transparent 1px 22px);
}

.ambient {
    position: absolute;
    pointer-events: none;
    opacity: .7;
}

.ambient-one {
    inset: 18% auto auto -90px;
    width: 280px;
    height: 2px;
    background: var(--color-accent);
    transform: rotate(-16deg);
    box-shadow: 0 42px 0 rgba(122, 21, 56, .16), 0 84px 0 rgba(15, 139, 141, .14);
}

.ambient-two {
    right: -140px;
    bottom: 18%;
    width: 360px;
    height: 2px;
    background: rgba(16, 24, 32, .18);
    transform: rotate(-18deg);
    box-shadow: 0 46px 0 rgba(201, 162, 39, .28), 0 92px 0 rgba(122, 21, 56, .14);
}

.public-header,
.intro-grid,
.wizard-card,
.closed-state,
.success-state,
.flash {
    position: relative;
    z-index: 1;
}

.public-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: clamp(28px, 5vw, 64px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-secondary);
    font-weight: 800;
    letter-spacing: 0;
}

.brand-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.brand-logo-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.header-meter {
    width: min(280px, 34vw);
    height: 4px;
    background: rgba(22, 21, 26, .1);
    overflow: hidden;
}

.header-meter span {
    display: block;
    width: 58%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-support));
    animation: meter 4.8s ease-in-out infinite;
}

.intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: end;
    margin-bottom: 24px;
}

.intro-copy h1,
.closed-state h1 {
    margin: 0;
    color: var(--color-secondary);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.3rem, 6vw, var(--font-public-title-size));
    line-height: .92;
    letter-spacing: 0;
    max-width: 820px;
}

.success-state h1 {
    margin: 0;
    color: var(--color-secondary);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.7rem, 4vw, var(--font-success-title-size));
    line-height: 1.08;
    letter-spacing: 0;
    max-width: 820px;
}

.intro-copy p {
    max-width: 720px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, var(--font-public-subtitle-size));
    line-height: 1.7;
    margin: 22px 0 0;
}

.referral-note,
.age-warning,
.flash {
    margin-top: 18px;
    padding: 14px 16px;
    border-left: 3px solid var(--color-support);
    background: rgba(15, 139, 141, .08);
    color: var(--color-secondary);
}

.flash-error {
    border-color: #b42318;
    background: rgba(180, 35, 24, .08);
}

.protocol-card {
    padding: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(18px);
}

.protocol-card span,
.protocol-card small {
    display: block;
    color: var(--muted);
    font-size: .85rem;
}

.protocol-card strong {
    display: block;
    margin: 12px 0;
    color: var(--color-primary);
    font-size: 2rem;
    letter-spacing: .04em;
}

.wizard-card {
    padding: clamp(18px, 4vw, 34px);
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(22px);
}

.stepper {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.step-pill {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    color: var(--muted);
    background: rgba(22, 21, 26, .05);
    transition: .25s ease;
}

.step-pill span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(22, 21, 26, .34);
    font-size: .78rem;
    font-weight: 800;
}

.step-pill.is-active {
    color: #fff;
    background: var(--color-primary);
    transform: translateY(-1px);
}

.step-pill.is-active span {
    color: var(--color-primary);
    background: #fff;
}

.wizard-progress {
    height: 3px;
    background: rgba(22, 21, 26, .08);
    margin-bottom: 28px;
    overflow: hidden;
}

.wizard-progress span {
    display: block;
    width: 20%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-support));
    transition: width .35s ease;
}

.wizard-step {
    display: none;
    animation: stepIn .42s ease both;
}

.wizard-step.is-active {
    display: block;
}

.step-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.step-head h2 {
    margin: 0;
    color: var(--color-secondary);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 3vw, var(--font-step-title-size));
    line-height: 1;
}

.step-head p {
    max-width: 460px;
    margin: 0;
    color: var(--muted);
    font-size: var(--font-step-text-size);
    line-height: 1.6;
}

.final-step {
    width: min(820px, 100%);
    margin-inline: auto;
}

.final-step .step-head {
    display: grid;
    gap: 10px;
}

.final-step .step-head p {
    max-width: 680px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field-wide {
    grid-column: 1 / -1;
}

.field span,
.upload-drop span {
    color: var(--color-secondary);
    font-size: clamp(.78rem, 1vw, var(--font-form-text-size));
    font-weight: 800;
}

.field input,
.field textarea {
    width: 100%;
    min-height: 52px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, .74);
    color: var(--text);
    font-size: var(--font-form-text-size);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field textarea {
    max-width: 100%;
    min-height: 150px;
    resize: vertical;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--color-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(122, 21, 56, .1);
}

.field input[readonly] {
    background: rgba(22, 21, 26, .05);
    color: var(--color-primary);
    font-weight: 800;
}

.uppercase {
    text-transform: uppercase;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.upload-drop {
    min-height: 210px;
    display: grid;
    place-items: center;
    gap: 10px;
    padding: 22px;
    border: 1px dashed rgba(122, 21, 56, .42);
    background:
        linear-gradient(135deg, rgba(122, 21, 56, .06), rgba(201, 162, 39, .08)),
        rgba(255, 255, 255, .74);
    color: var(--muted);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.upload-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-drop strong {
    max-width: 320px;
    color: var(--color-secondary);
    font-size: 1rem;
    line-height: 1.4;
}

.upload-drop img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    display: none;
    border: 1px solid rgba(255, 255, 255, .8);
}

.upload-drop.has-preview img {
    display: block;
}

.upload-video {
    margin-top: 16px;
}

.terms-stack {
    display: grid;
    gap: 10px;
    margin: 18px 0;
    max-width: 100%;
    min-width: 0;
}

.terms-stack details {
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .65);
    overflow: hidden;
}

.terms-stack summary {
    padding: 14px 16px;
    color: var(--color-secondary);
    font-size: var(--font-form-text-size);
    font-weight: 800;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.terms-stack p {
    max-height: 210px;
    margin: 0;
    padding: 0 16px 16px;
    color: var(--muted);
    font-size: var(--font-terms-text-size);
    line-height: 1.65;
    overflow: auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.terms-link {
    display: inline-flex;
    margin: 0 16px 16px;
    color: var(--color-primary);
    font-size: var(--font-form-text-size);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0;
    color: var(--color-secondary);
    font-size: var(--font-form-text-size);
    font-weight: 700;
}

.check-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.check-row input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.wizard-actions,
.success-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

.btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    text-decoration: none;
    font-size: var(--font-form-text-size);
    font-weight: 900;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.btn-primary {
    color: #fff;
    background: var(--color-primary);
    box-shadow: 0 14px 30px rgba(122, 21, 56, .24);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(122, 21, 56, .28);
}

.btn-ghost {
    color: var(--color-secondary);
    background: rgba(22, 21, 26, .06);
}

.btn-link {
    color: var(--color-primary);
    background: transparent;
}

.closed-state,
.success-state {
    min-height: 60svh;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 18px;
}

.closed-state p,
.success-state p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.7;
}

.closed-logo {
    width: 82px;
    height: 82px;
}

.success-mark {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--color-support);
    font-size: 2.4rem;
    font-weight: 900;
}

.reveal {
    animation: reveal .64s cubic-bezier(.2, .75, .25, 1) both;
}

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

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

@keyframes meter {
    0%, 100% {
        transform: translateX(-12%);
    }
    50% {
        transform: translateX(82%);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 860px) {
    .public-shell {
        padding: 0;
    }

    .stage-panel {
        min-height: 100svh;
        width: 100%;
        padding: 18px;
        border: 0;
    }

    .public-header {
        margin-bottom: 28px;
    }

    .header-meter {
        display: none;
    }

    .intro-grid,
    .field-grid,
    .upload-grid {
        grid-template-columns: 1fr;
    }

    .protocol-card {
        display: none;
    }

    .stepper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow-x: visible;
        padding-bottom: 0;
    }

    .step-pill {
        white-space: normal;
    }

    .step-head {
        display: grid;
    }

    .wizard-card {
        padding: 16px;
    }

    .intro-copy h1,
    .closed-state h1 {
        font-size: clamp(2.2rem, 14vw, 4rem);
    }

    .success-state h1 {
        font-size: clamp(1.55rem, 8vw, var(--font-success-title-size));
    }

    .terms-stack p {
        max-height: 180px;
    }

    .wizard-actions {
        position: sticky;
        bottom: 0;
        margin: 22px -16px -16px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 250, 252, .94);
        backdrop-filter: blur(18px);
        border-top: 1px solid var(--line);
    }

    .wizard-actions .btn {
        flex: 1 1 0;
    }
}
