@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-secondary: #f2f2f7;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --subtle: #8e8e93;
    --line: rgba(60, 60, 67, .14);
    --blue: #d33c38;
    --blue-hover: #b72f2b;
    --red: #d33c38;
    --green: #248a3d;
    --radius: 18px;
    --shadow: 0 2px 8px rgba(0,0,0,.035), 0 14px 38px rgba(0,0,0,.055);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: var(--bg);
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }
button, label, summary { -webkit-tap-highlight-color: transparent; }
.snow { display: none; }

.site-watermark {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    overflow: hidden;
    color: rgba(29, 29, 31, .018);
    font-family: "Manrope", Arial, sans-serif;
    font-size: clamp(52px, 13vw, 205px);
    font-weight: 750;
    line-height: .82;
    letter-spacing: .1em;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

.site-watermark span {
    display: block;
    width: 100%;
    transform: scaleX(1.06);
}

.site-watermark span:nth-child(n + 6) { display: none; }

main { position: relative; z-index: 1; flex: 1; }
footer { position: relative; z-index: 1; padding: 26px; color: var(--subtle); text-align: center; font-size: 11px; }

.hero {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
}

.landing-page:not(.wizard-mode) footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 24px;
    background: linear-gradient(to bottom, rgba(245,245,247,0), var(--bg) 22%);
}

.landing-page.wizard-mode footer { display: none; }

.landing-page:not(.wizard-mode) .hero {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: 100%;
    min-height: 0;
    padding-bottom: 170px;
    padding-top: 170px;
}

.landing-page:not(.wizard-mode) .hero h1 {
    font-size: clamp(52px, 10vw, 112px);
    letter-spacing: .035em;
}

.landing-page:not(.wizard-mode) .hero .lead {
    max-width: 690px;
    margin: 30px auto 34px;
    font-size: 16px;
}

.landing-description {
    max-width: 760px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.landing-description b { color: var(--text); font-weight: 650; }

.landing-page:not(.wizard-mode) .magic-button {
    min-height: 66px;
    padding: 20px 34px;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(211,60,56,.22);
    animation: landingPulse 2.2s ease-in-out infinite;
}

@keyframes landingPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(211,60,56,.2), 0 0 0 0 rgba(211,60,56,.13); }
    50% { transform: scale(1.035); box-shadow: 0 11px 30px rgba(211,60,56,.3), 0 0 0 12px rgba(211,60,56,0); }
}

.eyebrow {
    margin: 0 0 17px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .1em;
}

.hero h1, .center-card h1, .form-card h1, .dashboard h1 {
    margin: 0;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: -.045em;
}

.hero h1 { max-width: 860px; font-size: clamp(50px, 8vw, 88px); line-height: .98; }
.hero h1 em { color: var(--blue); font-style: normal; }
.lead { max-width: 560px; margin: 24px auto 30px; color: var(--muted); font-size: 17px; line-height: 1.55; }

.magic-button, .next, .settings button {
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 13px 23px;
    color: #fff;
    background: var(--blue);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.magic-button:hover, .next:hover, .settings button:hover { background: var(--blue-hover); box-shadow: 0 5px 16px rgba(211,60,56,.2); }
.magic-button:active, .next:active, .settings button:active { transform: scale(.98); }
.magic-button span, .next span { margin-left: 12px; }
.magic-button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.hidden { display: none !important; }

.wizard { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 36px 20px; }
.wizard form { width: min(680px, 100%); border-radius: 26px; padding: clamp(25px, 5vw, 46px); background: var(--surface); box-shadow: var(--shadow); }
.progress { height: 4px; overflow: hidden; border-radius: 4px; background: var(--surface-secondary); }
.progress i { display: block; width: 33.33%; height: 100%; border-radius: inherit; background: var(--blue); transition: width .35s ease; }
.step-count { margin: 12px 0 0; color: var(--subtle); text-align: right; font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.step { display: none; padding-top: 25px; text-align: center; }
.step.active { display: block; animation: stepIn .3s cubic-bezier(.22,.8,.4,1); }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.step > label { display: block; margin-bottom: 28px; font-size: clamp(28px, 5vw, 42px); font-weight: 700; letter-spacing: -.035em; }

.step > input {
    display: block;
    width: 100%;
    height: 58px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0 17px;
    outline: none;
    color: var(--text);
    background: var(--surface-secondary);
    text-align: center;
    font-size: clamp(18px, 3.5vw, 25px);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.step > input:focus, .settings input:focus, .settings select:focus,
.participant-form input:focus, .participant-form textarea:focus, .participant-form select:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(211,60,56,.12);
}

.step > input::placeholder, .participant-form input::placeholder, .participant-form textarea::placeholder {
    color: #aeaeb2;
    opacity: 1;
    transition: opacity .22s ease;
}

.step > input.placeholder-changing::placeholder { opacity: 0; }
.hint, .micro { color: var(--subtle); font-size: 11px; line-height: 1.45; }
.next { margin-top: 23px; }
.actions { display: flex; justify-content: center; gap: 9px; }
.back { width: 48px; height: 48px; margin-top: 23px; border: 0; border-radius: 50%; color: var(--blue); background: var(--surface-secondary); cursor: pointer; transition: background .15s; }
.back:hover { background: #e5e5ea; }

.money-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-row > div { display: flex; align-items: center; height: 68px; border: 1px solid transparent; border-radius: 14px; padding: 0 15px; background: var(--surface-secondary); transition: .15s; }
.money-row > div:focus-within { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(211,60,56,.12); }
.money-row small { color: var(--subtle); font-size: 10px; font-weight: 650; }
.money-row input { min-width: 0; width: 100%; border: 0; padding: 14px 6px; outline: none; background: transparent; text-align: center; font-size: 28px; font-weight: 600; }
.money-row b { color: var(--muted); font-weight: 500; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: flex; flex-direction: column; gap: 8px; min-height: 178px; border: 2px solid transparent; border-radius: var(--radius); padding: 22px; background: var(--surface-secondary); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.choice:hover { transform: translateY(-2px); background: #ececf1; }
.choice:has(input:checked) { border-color: var(--blue); background: rgba(211,60,56,.06); }
.choice input { align-self: flex-start; width: 17px; height: 17px; accent-color: var(--blue); }
.choice-icon { color: var(--blue); font-size: 27px; }
.choice b { font-size: 15px; }
.choice small { color: var(--muted); font-size: 12px; line-height: 1.45; }

.center-card, .form-card, .dashboard { width: min(1020px, calc(100% - 32px)); margin: 44px auto; }
.center-card, .panel, .participant-form { border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.center-card { max-width: 660px; padding: 48px clamp(22px, 6vw, 54px); text-align: center; }
.center-card h1 { font-size: clamp(38px, 7vw, 62px); }
.ornament { margin: 9px; color: var(--red); font-size: 22px; }
.muted { color: var(--muted); }

.notice, .toast { margin: 18px 0; border-radius: 13px; padding: 13px 15px; color: #22623b; background: #edf8f0; font-size: 12px; line-height: 1.5; }
.error { color: #9c2c28 !important; background: #fff0ef !important; }
.join-card form { margin: 29px; }

.dashboard-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.dashboard h1 { font-size: clamp(37px, 6vw, 52px); }
.status { border-radius: 999px; padding: 8px 12px; color: var(--blue); background: rgba(211,60,56,.09); font-size: 10px; font-weight: 600; }
.status.done { color: var(--green); background: rgba(36,138,61,.1); }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.panel { min-width: 0; padding: 27px; }
.panel-label { margin: 0; color: var(--blue); font-size: 10px; font-weight: 650; letter-spacing: .07em; }
.panel h2 { margin: 6px 0 17px; font-size: 25px; letter-spacing: -.025em; }
.copybox { display: flex; border-radius: 12px; padding: 4px 4px 4px 13px; background: var(--surface-secondary); }
.copybox input { min-width: 0; width: 100%; border: 0; padding: 9px 0; outline: none; background: transparent; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.copybox button { border: 0; border-radius: 9px; padding: 0 11px; color: var(--blue); background: var(--surface); font-size: 10px; font-weight: 600; cursor: pointer; }
.copybox button:hover { background: #fafafa; }
.panel hr { margin: 25px 0; border: 0; border-top: 1px solid var(--line); }
.warning { color: var(--red); }
.panel-title { display: flex; justify-content: space-between; }
.people { color: var(--blue); }
.participant-list > div { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); font-size: 13px; }
.participant-list > div:last-child { border-bottom: 0; }
.participant-list > div span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 10px; font-weight: 650; }
.participant-list small, .privacy, .empty { color: var(--subtle); }
.participant-list small { font-size: 10px; }
.empty { padding: 30px 0; text-align: center; font-size: 13px; line-height: 1.55; }
.privacy { margin-top: 17px; text-align: center; font-size: 10px; }

.settings { margin: 16px 0; border-radius: var(--radius); padding: 16px 18px; background: var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,.035); }
.settings summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.settings form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; margin-top: 15px; }
.settings input, .settings select, .participant-form input, .participant-form textarea, .participant-form select { border: 1px solid transparent; border-radius: 12px; padding: 12px 13px; outline: none; color: var(--text); background: var(--surface-secondary); font-size: 13px; transition: .15s; }
.settings button { min-height: 42px; margin: 0; border-radius: 12px; padding: 10px 16px; }
.draw-form { margin: 35px; text-align: center; }

.form-card {
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.form-card > .eyebrow, .form-card > h1 { margin-left: 4px; }
.form-card h1 { font-size: clamp(38px, 7vw, 54px); line-height: 1.02; }
.participant-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 0;
    padding: clamp(24px, 5vw, 36px);
}
.saved-state {
    max-width: 620px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin: 0 auto;
    border-radius: 24px;
    padding: clamp(34px, 7vw, 58px);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}
.saved-state .eyebrow { margin: 0; color: var(--green); }
.saved-state h1 { font-size: clamp(36px, 7vw, 54px); }
.saved-check {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(36,138,61,.2);
}
.saved-name { margin: 0; font-size: 16px; line-height: 1.55; }
.saved-state .muted { max-width: 470px; margin: 0 auto; font-size: 13px; line-height: 1.55; }
.secondary-button {
    min-height: 44px;
    margin-top: 6px;
    border: 0;
    border-radius: 999px;
    padding: 11px 20px;
    color: var(--blue);
    background: rgba(211,60,56,.09);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.secondary-button:hover { background: rgba(211,60,56,.15); }
.participant-form label { display: block; margin: 0; font-size: 15px; font-weight: 600; }
.participant-form input, .participant-form textarea, .participant-form select { display: block; width: 100%; margin-top: 8px; resize: vertical; font-weight: 400; }
.participant-form textarea { min-height: 90px; line-height: 1.5; }
.participant-form label small { display: block; margin-top: 7px; color: var(--subtle); font-size: 10px; font-weight: 400; line-height: 1.4; }
.letter { width: 100%; margin: 0; border-radius: 16px; padding: 19px; background: var(--surface-secondary); text-align: left; }
.letter small, .countdown small { color: var(--blue); font-size: 9px; font-weight: 650; letter-spacing: .08em; }
.letter p { margin-bottom: 0; line-height: 1.6; }
.countdown { margin: 0; }
.countdown strong { display: block; margin: 9px; font-size: 29px; letter-spacing: -.025em; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; margin: 0; background: rgba(237,248,240,.96); box-shadow: var(--shadow); animation: toast 4s forwards; }

#participantEditor {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#participantEditor > .eyebrow,
#participantEditor > h1,
#participantEditor > .notice {
    margin: 0;
}

.participant-form > .magic-button {
    align-self: flex-start;
    margin-top: 2px;
}

.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.result-card > * { margin-top: 0; margin-bottom: 0; }
.result-card .ornament { margin: -4px 0; }
.result-card .letter p { margin-top: 10px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(16px); } 10%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }

@media (max-width: 700px) {
    .site-watermark {
        justify-content: center;
        gap: 0;
        font-size: 13vw;
        line-height: .86;
    }
    .site-watermark span:nth-child(n) {
        display: block;
        flex: 0 0 auto;
    }
    .hero { min-height: calc(100vh - 105px); padding: 48px 20px; }
    .dashboard-grid, .choice-grid, .settings form { grid-template-columns: 1fr; }
    .dashboard-head { display: block; }
    .status { display: inline-block; margin-top: 13px; }
    .money-row { gap: 7px; }
    .money-row > div { padding: 0 9px; }
    .money-row input { font-size: 23px; }
    .center-card { padding: 38px 20px; }
    .dashboard-grid { gap: 14px; }
    .panel, .wizard form, .participant-form { border-radius: 20px; padding: 21px; }
    .copybox { display: block; padding: 7px; }
    .copybox input { display: block; font-size: 10px; }
    .copybox button { width: 100%; padding: 10px; }
    .choice { min-height: auto; }
    .draw-form { margin: 30px 0; }
    .draw-form .magic-button { width: 100%; }
    .participant-form > .magic-button,
    .saved-state .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
