:root {
    --teal: #22A1A9;
    --teal-deep: #17777D;
    --pool: #0D4A55;
    --pool-deep: #07323A;
    --sun: #FFC63D;
    --sun-deep: #D99A12;
    --coral: #FF6A55;
    --coral-deep: #D2442F;
    --sky: #E6F6F5;
    --ink: #0F2D35;
    --muted: #4C6970;
    --line: #C9E3E3;
    --white: #FFFFFF;
    --error: #C7321D;

    --font-display: "Bagel Fat One", "Arial Rounded MT Bold", system-ui, sans-serif;
    --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius-field: 14px;
    --radius-panel: 28px;
    --radius-block: 20px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--sky);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

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

.hidden {
    display: none !important;
}

/* ---------- Page frame ---------- */

.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px clamp(20px, 4vw, 48px);
}

.site-header {
    padding-bottom: clamp(24px, 5vw, 48px);
}

.brand img {
    width: 120px;
    height: auto;
}

.layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(32px, 6vw, 80px);
    align-items: center;
}

/* ---------- Hero ---------- */

.hero-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.75rem, 7.2vw, 5.75rem);
    line-height: 0.98;
    letter-spacing: -0.01em;
    color: var(--pool);
}

.hero-title .word {
    display: inline-block;
    white-space: nowrap;
}

.hero-title .char {
    display: inline-block;
    transform-origin: 50% 100%;
}

.hero-title.is-ready .char {
    animation: drop 900ms cubic-bezier(0.3, 0, 0.4, 1) both;
    animation-delay: calc(var(--i) * 32ms);
}

@keyframes drop {
    0% {
        transform: translateY(-1.1em);
        opacity: 0;
    }
    40% {
        transform: translateY(0) scale(1.08, 0.86);
        opacity: 1;
    }
    58% {
        transform: translateY(-0.22em) scale(0.97, 1.04);
    }
    76% {
        transform: translateY(0) scale(1.03, 0.96);
    }
    88% {
        transform: translateY(-0.05em);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.mat {
    width: min(100%, 560px);
    height: 44px;
    margin: 10px 0 0 -6px;
    overflow: visible;
}

.mat path {
    fill: none;
    stroke-linecap: round;
}

.mat-legs {
    stroke: var(--pool);
    stroke-width: 6;
}

.mat-frame {
    stroke: var(--sun);
    stroke-width: 9;
}

.mat-surface {
    stroke: var(--teal);
    stroke-width: 7;
    transform-origin: 50% 0;
}

.hero-title.is-ready ~ .mat .mat-surface {
    animation: dip 1100ms ease-out 380ms both;
}

@keyframes dip {
    0% { transform: scaleY(0.4); }
    30% { transform: scaleY(1.9); }
    55% { transform: scaleY(0.75); }
    75% { transform: scaleY(1.2); }
    100% { transform: scaleY(1); }
}

.hero-intro {
    max-width: 34rem;
    margin: 20px 0 32px;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--muted);
}

/* ---------- Countdown: foam blocks ---------- */

.countdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(10px, 2vw, 18px);
    max-width: 520px;
}

.block {
    --face: var(--teal);
    --edge: var(--teal-deep);
    --text: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1.05;
    border-radius: var(--radius-block);
    background: var(--face);
    color: var(--text);
    box-shadow:
        inset 0 -6px 0 rgba(0, 0, 0, 0.08),
        inset 0 4px 0 rgba(255, 255, 255, 0.25),
        0 8px 0 var(--edge);
}

.block:nth-child(1) { transform: rotate(-3deg); }
.block:nth-child(2) { transform: rotate(2deg) translateY(4px); }
.block:nth-child(3) { transform: rotate(-1.5deg); }
.block:nth-child(4) { transform: rotate(3deg) translateY(3px); }

.block-sun {
    --face: var(--sun);
    --edge: var(--sun-deep);
    --text: var(--pool);
}

.block-coral {
    --face: var(--coral);
    --edge: var(--coral-deep);
}

.block-pool {
    --face: var(--pool);
    --edge: var(--pool-deep);
}

.num {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5vw, 3.1rem);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.num.tick {
    animation: tick 160ms ease-out;
}

@keyframes tick {
    from { transform: translateY(-3px); }
    to { transform: translateY(0); }
}

.unit {
    margin-top: 6px;
    font-size: clamp(0.75rem, 1.4vw, 0.9rem);
    font-weight: 600;
}

.countdown.is-open {
    display: block;
}

.open-banner {
    display: inline-block;
    padding: 18px 28px;
    border-radius: var(--radius-block);
    background: var(--teal);
    color: var(--white);
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    box-shadow: 0 8px 0 var(--teal-deep);
}

.dateline {
    margin: 30px 0 0;
    font-weight: 600;
    color: var(--pool);
}

/* ---------- Signup panel ---------- */

.signup {
    background: var(--white);
    border-radius: var(--radius-panel);
    padding: clamp(24px, 4vw, 40px);
    border: 2px solid var(--line);
}

.signup h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    line-height: 1.1;
    color: var(--pool);
}

.note {
    margin: 10px 0 24px;
    color: var(--muted);
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.field input,
.field select {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-field);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field input::placeholder {
    color: #8AA3A8;
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 48px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230D4A55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
}

.field select:invalid {
    color: #8AA3A8;
}

.field select option {
    color: var(--ink);
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(34, 161, 169, 0.2);
}

.hint {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.error-msg {
    margin: 6px 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--error);
}

.error-msg:empty {
    display: none;
}

.field.error input,
.field.error select {
    border-color: var(--error);
}

.field.error .hint {
    display: none;
}

.form-error {
    margin: 0 0 14px;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cta {
    width: 100%;
    min-height: 56px;
    margin-top: 6px;
    border: 0;
    border-radius: 16px;
    background: var(--coral);
    color: var(--white);
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--coral-deep);
    transition: transform 90ms ease, box-shadow 90ms ease, background-color 120ms ease;
}

.cta:hover {
    background: #FF7A66;
}

.cta:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 var(--coral-deep);
}

.cta:disabled {
    cursor: progress;
    opacity: 0.75;
}

/* ---------- Success ---------- */

.success {
    text-align: center;
    padding: 12px 0;
}

.success-mark {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
}

.success-mark circle {
    fill: var(--teal);
}

.success-mark path {
    fill: none;
    stroke: var(--white);
    stroke-width: 9;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 70;
    stroke-dashoffset: 70;
}

.success:not(.hidden) .success-mark {
    animation: pop 500ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

.success:not(.hidden) .success-mark path {
    animation: draw 400ms ease-out 250ms forwards;
}

@keyframes pop {
    from { transform: scale(0.4); }
    to { transform: scale(1); }
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

.success p {
    max-width: 26rem;
    margin: 10px auto 0;
    color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px 24px;
    margin-top: clamp(40px, 6vw, 72px);
    padding-top: 20px;
    border-top: 2px solid var(--line);
    font-size: 0.9rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0;
}

.site-footer nav {
    display: flex;
    gap: 20px;
}

.site-footer a {
    text-decoration-color: var(--line);
    text-underline-offset: 3px;
}

.site-footer a:hover {
    color: var(--pool);
}

/* ---------- Bouncing balls (background) ---------- */

.balls {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ball {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    transform: translate(-50%, -100%);
}

.ball-body {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75) 0 12%, rgba(255, 255, 255, 0) 13%),
        radial-gradient(circle at 40% 35%, var(--ball-light) 0%, var(--ball) 55%, var(--ball-dark) 100%);
    transform-origin: 50% 100%;
    animation: ball-bounce var(--dur) infinite;
    animation-delay: var(--delay);
}

.ball-shadow {
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: calc(var(--size) * -0.12);
    height: calc(var(--size) * 0.18);
    border-radius: 50%;
    background: rgba(13, 74, 85, 0.22);
    animation: ball-shadow var(--dur) infinite;
    animation-delay: var(--delay);
}

.ball-teal  { --ball: var(--teal);  --ball-light: #5FD0D6; --ball-dark: var(--teal-deep); }
.ball-sun   { --ball: var(--sun);   --ball-light: #FFE08A; --ball-dark: var(--sun-deep); }
.ball-coral { --ball: var(--coral); --ball-light: #FFA393; --ball-dark: var(--coral-deep); }
.ball-pool  { --ball: #1C6C79;      --ball-light: #4FA3AF; --ball-dark: var(--pool); }

@keyframes ball-bounce {
    0% {
        transform: translateY(0) scale(1.18, 0.82);
        animation-timing-function: ease-out;
    }
    8% {
        transform: translateY(-8%) scale(0.94, 1.06);
        animation-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);
    }
    50% {
        transform: translateY(calc(var(--h) * -1)) scale(1);
        animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4);
    }
    92% {
        transform: translateY(-4%) scale(0.95, 1.05);
        animation-timing-function: ease-in;
    }
    100% {
        transform: translateY(0) scale(1.18, 0.82);
    }
}

@keyframes ball-shadow {
    0%, 100% {
        transform: scaleX(1.1);
        opacity: 1;
    }
    50% {
        transform: scaleX(0.45);
        opacity: 0.35;
    }
}

@media (max-width: 900px) {
    .ball:nth-child(1),
    .ball:nth-child(2),
    .ball:nth-child(5),
    .ball:nth-child(7) {
        display: none;
    }

    .ball {
        width: calc(var(--size) * 0.75);
        height: calc(var(--size) * 0.75);
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
        align-items: start;
        align-content: start;
    }
}

@media (max-width: 420px) {
    .countdown {
        gap: 8px;
    }

    .block {
        border-radius: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .success-mark path {
        stroke-dashoffset: 0;
    }
}