:root {
    --ink: #12202a;
    --ink-soft: #2a3d4a;
    --sea: #3d6b78;
    --foam: #faf7f2;
    --brass: #b08a4f;
    --brass-deep: #8c6a38;
    --font-display: "Cormorant Garamond", Georgia, serif;
    --font-sans: "Sora", "Segoe UI", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background: #0b1420;
    overflow: hidden;
    --text: #f4efe6;
    --text-soft: #d3cabb;
    --cta-bg: #f2ebe0;
    --cta-fg: #12202a;
    --cta-border: rgba(244, 239, 230, 0.4);
}

#canvasWrap {
    position: fixed;
    inset: 0;
    z-index: 0;
}

#canvasWrap canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(10, 22, 34, 0.42) 0%, rgba(10, 22, 34, 0.16) 24%, transparent 40%),
        radial-gradient(ellipse 80% 40% at 50% 100%, rgba(8, 14, 20, 0.28) 0%, transparent 60%);
    transition: background 0.6s ease;
}

body[data-weather="sun"] .vignette {
    background:
        linear-gradient(180deg, rgba(18, 48, 78, 0.32) 0%, transparent 34%),
        radial-gradient(ellipse 42% 32% at 78% 16%, rgba(255, 214, 120, 0.28) 0%, transparent 72%);
}

body[data-weather="spring"] .vignette {
    background:
        linear-gradient(180deg, rgba(30, 58, 70, 0.3) 0%, transparent 34%);
}

body[data-weather="autumn"] .vignette {
    background:
        linear-gradient(180deg, rgba(48, 28, 12, 0.38) 0%, transparent 34%),
        radial-gradient(ellipse 50% 36% at 82% 22%, rgba(255, 150, 60, 0.2) 0%, transparent 70%);
}

body[data-weather="snow"] .vignette {
    background:
        linear-gradient(180deg, rgba(40, 56, 70, 0.28) 0%, transparent 32%);
}

body[data-weather="night"] .vignette {
    background:
        radial-gradient(ellipse 58% 40% at 50% 26%, rgba(6, 12, 18, 0.5) 0%, rgba(6, 12, 18, 0.2) 58%, transparent 80%),
        radial-gradient(ellipse 90% 70% at 50% 45%, transparent 40%, rgba(6, 12, 18, 0.55) 100%),
        linear-gradient(180deg, rgba(6, 12, 18, 0.55) 0%, transparent 30%, transparent 55%, rgba(6, 12, 18, 0.65) 100%);
}

.weather-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.weather-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.weather-layer.is-active {
    opacity: 1;
}

.sparkle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
    animation: sparkleTwinkle ease-in-out infinite;
}

.petal {
    position: absolute;
    top: -8%;
    width: 9px;
    height: 11px;
    border-radius: 60% 40% 60% 40%;
    background: #f2a8c4;
    animation: petalFall linear infinite;
    transform-origin: center;
}

.petal:nth-child(3n) { background: #f7c4d8; }
.petal:nth-child(3n + 1) { background: #e887ad; }
.petal:nth-child(4n) { background: #d9f0c7; width: 8px; height: 8px; border-radius: 50%; }
.petal:nth-child(5n) { background: #fff1f5; }

.snow-flake {
    position: absolute;
    top: -8%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.45);
    animation: snowFall linear infinite;
}

.leaf {
    position: absolute;
    top: -8%;
    width: 10px;
    height: 7px;
    border-radius: 2px 10px 2px 10px;
    background: #c46a3a;
    animation: leafFall linear infinite;
    transform-origin: center;
}

.leaf:nth-child(3n) { background: #d4893a; }
.leaf:nth-child(3n + 1) { background: #a34a2c; }
.leaf:nth-child(3n + 2) { background: #c9a14a; }

body[data-weather="snow"] {
    --text: #f6fafc;
    --text-soft: #dbe6ee;
}

body[data-weather="autumn"] {
    --text: #fdf1e0;
    --text-soft: #e8d2b4;
}

.stage {
    position: relative;
    z-index: 3;
    height: 100%;
    display: grid;
    align-content: start;
    justify-items: center;
    padding: clamp(2rem, 5vh, 3.5rem) clamp(1.5rem, 4vw, 3rem) 0;
}

.content {
    width: min(720px, 100%);
    text-align: center;
    animation: riseIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: clamp(1rem, 2.4vw, 1.6rem);
}

.brand::before {
    content: "";
    position: absolute;
    inset: -18% -28%;
    background: radial-gradient(ellipse at center, rgba(6, 12, 18, 0.58) 0%, transparent 68%);
    pointer-events: none;
    z-index: -1;
}

.brand-logo {
    display: block;
    width: min(190px, 46vw);
    height: auto;
    filter:
        brightness(0) invert(1)
        drop-shadow(0 1px 1px rgba(0, 0, 0, 0.95))
        drop-shadow(0 3px 8px rgba(0, 0, 0, 0.8))
        drop-shadow(0 0 20px rgba(0, 0, 0, 0.7));
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 4.4vw, 2.9rem);
    font-weight: 500;
    font-style: italic;
    line-height: 1.15;
    color: #fff8ee;
    margin-bottom: 0.85rem;
    text-shadow:
        0 1px 1px rgba(0, 0, 0, 0.9),
        0 2px 8px rgba(0, 0, 0, 0.75),
        0 0 22px rgba(0, 0, 0, 0.65);
}

.lead {
    font-size: clamp(0.95rem, 2.1vw, 1.1rem);
    font-weight: 400;
    line-height: 1.65;
    color: #fff8ee;
    max-width: 32rem;
    margin: 0 auto 1.6rem;
    text-shadow:
        0 1px 1px rgba(0, 0, 0, 0.9),
        0 2px 8px rgba(0, 0, 0, 0.75),
        0 0 22px rgba(0, 0, 0, 0.65);
}

.cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    justify-content: center;
    align-items: center;
}

.cta {
    appearance: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.95rem 1.6rem;
    transition: transform 0.35s ease, background 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.cta-primary {
    color: var(--cta-fg);
    background: var(--cta-bg);
    border: 1px solid var(--cta-bg);
}

.cta-primary:hover {
    background: var(--brass);
    border-color: var(--brass);
    color: #12202a;
    transform: translateY(-2px);
}

.cta-secondary {
    color: var(--text);
    background: rgba(10, 18, 26, 0.32);
    backdrop-filter: blur(8px);
    border: 1px solid var(--cta-border);
}

.cta-secondary:hover {
    border-color: var(--brass);
    color: #f0d3a0;
    transform: translateY(-2px);
}

.site-footer {
    position: fixed;
    left: 50%;
    bottom: clamp(1rem, 2.6vw, 1.6rem);
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    pointer-events: none;
}

.status {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-soft);
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.6);
}

.credit {
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    pointer-events: auto;
}

.credit a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid rgba(244, 239, 230, 0.35);
}

.credit a:hover {
    color: #f0d3a0;
    border-bottom-color: var(--brass);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e0a94f;
    animation: statusBlink 2.4s ease-in-out infinite;
}

.mute-btn {
    position: fixed;
    top: clamp(1rem, 3vw, 1.5rem);
    right: clamp(1rem, 3vw, 1.5rem);
    z-index: 8;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(10, 18, 26, 0.45);
    backdrop-filter: blur(8px);
    color: #f2ebe0;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.3s ease, transform 0.3s ease;
}

.mute-btn:hover {
    background: rgba(10, 18, 26, 0.7);
    transform: scale(1.05);
}

.mute-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.mute-btn .icon-muted {
    display: none;
}

.mute-btn.is-muted .icon-unmuted {
    display: none;
}

.mute-btn.is-muted .icon-muted {
    display: block;
}

.boot-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    max-width: min(480px, 88vw);
    padding: 1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(18, 32, 42, 0.9);
    color: #f2ebe0;
    font-size: 0.9rem;
    line-height: 1.55;
    text-align: center;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(8, 16, 24, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    width: min(420px, 100%);
    padding: 2rem 1.75rem 1.75rem;
    background: var(--foam);
    border: 1px solid rgba(176, 138, 79, 0.25);
    transform: translateY(12px);
    transition: transform 0.35s ease;
}

.modal.is-open .modal-panel {
    transform: translateY(0);
}

.modal-panel h2 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--ink);
}

.modal-panel p {
    font-size: 0.92rem;
    font-weight: 300;
    color: var(--ink-soft);
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

.modal-panel label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
    color: var(--ink-soft);
}

.modal-panel input,
.modal-panel textarea {
    width: 100%;
    border: 1px solid rgba(18, 32, 42, 0.18);
    background: #fff;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 0.85rem 0.9rem;
    margin-bottom: 1rem;
    outline: none;
    resize: vertical;
}

.modal-panel input:focus,
.modal-panel textarea:focus {
    border-color: var(--brass);
}

.modal-panel textarea {
    min-height: 110px;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.modal-actions {
    display: flex;
    gap: 0.65rem;
    justify-content: flex-end;
}

.modal-actions .cta-secondary {
    color: var(--ink);
    background: transparent;
    border-color: rgba(18, 32, 42, 0.25);
}

.modal-actions .cta-primary {
    color: var(--foam);
    background: var(--ink);
    border-color: var(--ink);
}

.modal-actions .cta:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.modal-note {
    margin-top: 0.85rem;
    font-size: 0.78rem;
    color: var(--sea);
    min-height: 1.2em;
}

.modal-note.is-error {
    color: #9b3b2e;
}

@keyframes sparkleTwinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.7); }
    50% { opacity: 1; transform: scale(1.25); }
}

@keyframes petalFall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.9; }
    50% { transform: translateY(55vh) translateX(35px) rotate(160deg); opacity: 1; }
    100% { transform: translateY(110vh) translateX(-25px) rotate(300deg); opacity: 0.7; }
}

@keyframes snowFall {
    0% { transform: translateY(0) translateX(0); opacity: 0.9; }
    50% { transform: translateY(55vh) translateX(18px); opacity: 1; }
    100% { transform: translateY(110vh) translateX(-10px); opacity: 0.7; }
}

@keyframes leafFall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.95; }
    50% { transform: translateY(55vh) translateX(40px) rotate(140deg); opacity: 1; }
    100% { transform: translateY(110vh) translateX(-30px) rotate(280deg); opacity: 0.75; }
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes statusBlink {
    0%, 100% { opacity: 0.35; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

@media (max-width: 640px) {
    .cta-group {
        flex-direction: column;
        width: 100%;
    }

    .cta {
        width: 100%;
    }

    .status {
        letter-spacing: 0.1em;
        white-space: nowrap;
    }

    .lead {
        margin-bottom: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .status-dot,
    .content,
    .petal,
    .snow-flake,
    .leaf,
    .sparkle {
        animation: none !important;
    }

    .weather-layer {
        display: none !important;
    }
}
