:root {
    --ink: #07021a;
    --bg: #0e0626;
    --surface: #170936;
    --surface-alt: #221047;
    --border: #33215f;
    --hairline: rgba(255, 255, 255, 0.08);
    --primary: #8b3dff;
    --primary-end: #4f46e5;
    --text: #f7f4ff;
    --muted: #a99dd0;
    --faint: #6e6396;
    --success: #3ddc97;
    --danger: #ff6b7a;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --heading: "Sora", system-ui, sans-serif;
    --body: "Plus Jakarta Sans", system-ui, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.55 var(--body);
    -webkit-font-smoothing: antialiased;
}

main { width: min(100%, 560px); margin: 0 auto; padding: 0 20px 40px; }

h1, h2 { font-family: var(--heading); font-weight: 700; letter-spacing: -0.02em; margin: 0; }

button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(var(--bg) 40%, rgba(14, 6, 38, 0));
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 18px var(--heading); }
.brand img { border-radius: 9px; }

.link-button { background: none; border: 0; padding: 6px 2px; color: var(--muted); font-weight: 600; cursor: pointer; }
.link-button:hover { color: var(--text); }
.link-button:disabled { color: var(--faint); cursor: default; }
.link-button.centered { display: block; margin: 14px auto 0; }

/* Hero with a tilted poster wall behind the title */
.hero { position: relative; margin: 0 -20px; padding: 120px 20px 28px; overflow: hidden; }
.poster-wall {
    position: absolute; inset: -40px -60px 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    transform: rotate(-8deg);
    opacity: 0.45;
}
.poster-wall img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; }
.hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(14, 6, 38, 0.2) 0%, rgba(14, 6, 38, 0.75) 55%, var(--bg) 100%);
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(34px, 9vw, 44px); line-height: 1.08; max-width: 9em; }
.hero p { color: var(--muted); margin: 14px 0 0; max-width: 34em; }

/* Signed-in member strip */
.member-status {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; margin-bottom: 18px;
    border: 1px solid rgba(61, 220, 151, 0.35); border-radius: var(--radius-md);
    background: rgba(61, 220, 151, 0.08);
}
.member-status strong { display: block; font-family: var(--heading); font-weight: 600; }
.member-status span { color: var(--muted); font-size: 14px; }
.pill { padding: 4px 10px; border-radius: 999px; background: rgba(61, 220, 151, 0.18); color: var(--success) !important; font-weight: 600; font-size: 13px !important; }

/* Plans */
.plans { display: grid; gap: 12px; }
.plan {
    position: relative;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
    padding: 18px;
    border: 1.5px solid var(--border); border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; }
.plan:has(input:checked) { border-color: var(--primary); background: linear-gradient(135deg, rgba(139, 61, 255, 0.22), rgba(79, 70, 229, 0.12)); }
.plan:has(input:checked) .plan-check { border-color: var(--primary); background: var(--primary); }
.plan:has(input:checked) .plan-check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.plan:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 3px; }
.plan-body { display: grid; }
.plan-name { font: 600 18px var(--heading); }
.plan-note { color: var(--muted); font-size: 14px; }
.plan-price { text-align: right; display: grid; }
.plan-price strong { font: 700 20px var(--heading); }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan-saving {
    grid-column: 2 / -1;
    justify-self: start;
    margin-top: -4px;
    padding: 3px 10px; border-radius: 999px;
    background: rgba(139, 61, 255, 0.18); color: #cdb4ff;
    font-size: 12.5px; font-weight: 600;
}

/* Sticky call to action */
.cta-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
    padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(14, 6, 38, 0), var(--bg) 35%);
}
.cta-bar > * { width: min(100%, 520px); margin-left: auto; margin-right: auto; }
.cta-note { color: var(--faint); font-size: 13px; text-align: center; margin: 10px auto 0; }

.button-primary, .button-secondary {
    display: block; width: 100%;
    padding: 16px 20px;
    border: 0; border-radius: 999px;
    font: 600 16px var(--body); text-align: center; text-decoration: none;
    cursor: pointer;
}
.button-primary { color: #fff; background: linear-gradient(100deg, var(--primary), var(--primary-end)); box-shadow: 0 10px 30px rgba(139, 61, 255, 0.35); }
.button-primary:disabled { opacity: 0.5; cursor: default; }
.button-primary[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.button-secondary { color: var(--text); background: var(--surface-alt); border: 1px solid var(--border); }

/* Checkout sheet: bottom sheet on phones, centred card on wider screens */
.sheet { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
.sheet::backdrop { background: rgba(7, 2, 26, 0.72); }
.sheet[open] { display: flex; align-items: flex-end; justify-content: center; }
.sheet-card {
    width: min(100%, 520px); max-height: 92vh; overflow-y: auto;
    padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
    background: var(--bg);
    border: 1px solid var(--hairline); border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: sheet-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@media (min-width: 720px) {
    .sheet[open] { align-items: center; }
    .sheet-card { border-radius: var(--radius-lg); border-bottom: 1px solid var(--hairline); padding-bottom: 26px; }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none; } }

.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.sheet-header h2 { font-size: 22px; }
.sheet-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.icon-button { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: var(--surface-alt); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }

.step { display: grid; gap: 16px; }
.step[hidden] { display: none; }
.step-lead { margin: 0; color: var(--muted); font-size: 15px; }
.step-lead strong { color: var(--text); }

.field { display: grid; gap: 8px; }
.field-label { color: var(--muted); font-size: 13px; font-weight: 600; padding: 0; }
.field input, .phone-input {
    width: 100%; height: 56px;
    padding: 0 16px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 17px;
}
.field input:focus, .phone-input:focus-within { border-color: var(--primary); outline: none; }
.phone-input { display: flex; align-items: center; gap: 10px; }
.phone-input input { border: 0; background: none; height: auto; padding: 0; outline: none; letter-spacing: 0.04em; }
.prefix { font-weight: 600; white-space: nowrap; }
.code-input { text-align: center; letter-spacing: 0.6em; font: 600 24px var(--heading) !important; }

.error { margin: 0; min-height: 0; color: var(--danger); font-size: 14px; }
.error:empty { display: none; }

.methods, .banks { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.methods { grid-template-columns: repeat(3, 1fr); }
.methods legend, .banks legend { margin-bottom: 8px; }
.method, .bank { position: relative; cursor: pointer; }
.method input, .bank input { position: absolute; opacity: 0; }
.method span, .bank span {
    display: grid; place-items: center; text-align: center; gap: 2px;
    height: 100%; padding: 12px 8px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface);
    font-weight: 600; font-size: 14px; line-height: 1.25;
}
.method small, .bank small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.method input:checked + span, .bank input:checked + span { border-color: var(--primary); background: rgba(139, 61, 255, 0.16); }
.method input:focus-visible + span, .bank input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.bank-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 248px; overflow-y: auto; padding-right: 2px; }
.bank span { justify-items: start; text-align: left; padding: 12px 14px; min-height: 52px; }
.bank.is-offline { cursor: not-allowed; }
.bank.is-offline span { opacity: 0.45; }
.banks[hidden] { display: none; }
.method-hint { margin: 0; color: var(--muted); font-size: 14px; }
.secure-note { margin: 0; text-align: center; color: var(--faint); font-size: 12.5px; }

/* Payment result */
.result { text-align: center; padding: 72px 0 0; display: grid; gap: 16px; justify-items: center; }
.result h1 { font-size: 30px; }
.result p { color: var(--muted); margin: 0; max-width: 30em; }
.result p strong { color: var(--text); }
.result-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font: 700 34px var(--heading); }
.result-paid .result-icon { background: rgba(61, 220, 151, 0.16); color: var(--success); }
.result-failed .result-icon { background: rgba(255, 107, 122, 0.16); color: var(--danger); }
.result .button-primary, .result .button-secondary { max-width: 320px; margin-top: 8px; }
.result-spinner { width: 56px; height: 56px; border-radius: 50%; border: 4px solid var(--surface-alt); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.receipt { display: grid; gap: 6px; margin: 4px 0 0; padding: 14px 18px; width: min(100%, 320px); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.receipt div { display: flex; justify-content: space-between; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 600; }

.footer { padding: 0 20px 28px; text-align: center; color: var(--faint); font-size: 12.5px; }
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 8px !important; }
.footer-links a { color: var(--muted); }
body:has(.cta-bar) .footer { padding-bottom: 150px; }
