﻿:root {
    --primary-color: #f7b733;
    --secondary-color: #c90a19;
    --accent-color: #ffde59;
    --bg-dark: #0f0505;
    --bg-light: #42080e;
    --font-serif: 'Noto Serif SC', serif;
    --font-display: 'Ma Shan Zheng', cursive;
    --page-padding: clamp(16px, 4vw, 40px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: radial-gradient(circle at center, var(--bg-light), var(--bg-dark));
    font-family: var(--font-serif);
    color: var(--primary-color);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
}

#fireworksCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
    touch-action: manipulation;
}

.audio-gate {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(6px);
}

.audio-gate.active {
    display: flex;
}

.audio-gate-card {
    width: min(460px, 100%);
    padding: 30px 24px;
    border: 1px solid rgba(247, 183, 51, 0.3);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(66, 8, 14, 0.96), rgba(15, 5, 5, 0.96));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.audio-gate-card h3 {
    margin-bottom: 12px;
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 6vw, 2.8rem);
    letter-spacing: 0.08em;
}

.audio-gate-card p {
    margin-bottom: 20px;
    font-size: 0.98rem;
    letter-spacing: 0.08em;
    opacity: 0.9;
}

.audio-gate-card button {
    border: 1px solid rgba(247, 183, 51, 0.42);
    border-radius: 999px;
    padding: 10px 24px;
    background: linear-gradient(180deg, rgba(247, 183, 51, 0.92), rgba(201, 10, 25, 0.92));
    color: #fff;
    font-size: 0.96rem;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.audio-gate-card button:hover {
    filter: brightness(1.08);
}

.celebration-modal {
    position: fixed;
    inset: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.56);
    backdrop-filter: blur(4px);
}

.celebration-modal.active {
    display: flex;
}

.celebration-modal-card {
    width: min(440px, 100%);
    padding: 28px 24px;
    border: 1px solid rgba(247, 183, 51, 0.28);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(66, 8, 14, 0.95), rgba(15, 5, 5, 0.95));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.celebration-modal-card h3 {
    margin-bottom: 10px;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    letter-spacing: 0.08em;
}

.celebration-modal-card p {
    margin-bottom: 18px;
    font-size: 0.98rem;
    letter-spacing: 0.08em;
    opacity: 0.88;
}

.celebration-modal-card button {
    border: 1px solid rgba(247, 183, 51, 0.4);
    border-radius: 999px;
    padding: 10px 24px;
    background: linear-gradient(180deg, rgba(247, 183, 51, 0.92), rgba(201, 10, 25, 0.92));
    color: #fff;
    font-size: 0.96rem;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.celebration-modal-card button:hover {
    filter: brightness(1.08);
}

.container {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding-top: calc(var(--page-padding) + env(safe-area-inset-top));
    padding-right: calc(var(--page-padding) + env(safe-area-inset-right));
    padding-bottom: calc(var(--page-padding) + env(safe-area-inset-bottom));
    padding-left: calc(var(--page-padding) + env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(18px, 3vw, 34px);
    text-align: center;
    backdrop-filter: blur(2px);
}

header {
    max-width: 100%;
}

.title-secondary {
    display: none;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1.1;
    letter-spacing: 0.2em;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.5),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to bottom, #fff8dc, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 3s infinite alternate;
}

.subtitle {
    font-family: 'Times New Roman', serif;
    font-size: clamp(0.9rem, 1.6vw, 1.2rem);
    letter-spacing: 0.45em;
    text-transform: uppercase;
    opacity: 0.82;
    margin-top: -0.35em;
    color: var(--accent-color);
}

.countdown-box {
    width: min(860px, 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: clamp(0.9rem, 2.5vw, 2rem);
    border: 1px solid rgba(247, 183, 51, 0.2);
    border-radius: 20px;
    background: rgba(15, 5, 5, 0.3);
    box-shadow: 0 0 30px rgba(199, 10, 25, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.number {
    font-family: 'Helvetica Neue', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1;
    color: #fff;
    text-shadow:
        0 0 15px var(--secondary-color),
        2px 2px 0 rgba(0, 0, 0, 0.5);
}

.separator {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    margin-top: -0.35em;
}

.label {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: var(--primary-color);
    letter-spacing: 0.1em;
    opacity: 0.85;
}

.controls {
    font-size: 0.9rem;
    letter-spacing: 0.18em;
    opacity: 0.65;
    animation: pulse 2s infinite;
}

@media (hover: hover) and (pointer: fine) {
    .countdown-box:hover {
        transform: scale(1.02);
        box-shadow: 0 0 50px rgba(199, 10, 25, 0.4);
    }
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
    }
    to {
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
}

@media (max-width: 768px) {
    .container {
        justify-content: space-evenly;
        gap: 16px;
    }

    .title {
        font-size: clamp(2.2rem, 12vw, 4rem);
        letter-spacing: 0.1em;
    }

    .subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.22em;
        margin-top: 0;
    }

    .countdown-box {
        width: min(520px, 100%);
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        padding: 1rem;
        border-radius: 16px;
    }

    .separator {
        display: none;
    }

    .time-unit {
        min-width: 0;
        padding: 0.7rem 0.4rem;
        border: 1px solid rgba(247, 183, 51, 0.15);
        border-radius: 12px;
        background: rgba(247, 183, 51, 0.06);
    }

    .number {
        font-size: clamp(2rem, 14vw, 3.2rem);
    }

    .label {
        margin-top: 0.35rem;
        font-size: 0.78rem;
    }

    .controls {
        max-width: 24ch;
        font-size: 0.82rem;
        line-height: 1.45;
        letter-spacing: 0.12em;
    }

    .container.celebrating .title {
        font-size: clamp(2.1rem, 11vw, 4rem);
    }
}

@media (max-width: 420px) {
    .container {
        gap: 14px;
    }

    .countdown-box {
        gap: 0.6rem;
        padding: 0.8rem;
    }

    .number {
        font-size: clamp(1.8rem, 15vw, 2.8rem);
    }

    .label {
        font-size: 0.72rem;
    }
}

@media (max-height: 700px) {
    .container {
        justify-content: center;
        gap: 12px;
    }

    .controls {
        font-size: 0.75rem;
    }
}

.container.celebrating .countdown-box,
.container.celebrating .subtitle,
.container.celebrating .controls {
    position: absolute;
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    transition: opacity 1s ease, transform 1s ease;
}

.container.celebrating header {
    position: absolute;
    inset: 0;
    width: 100%;
    padding-inline: clamp(16px, 5vw, 56px);
    box-sizing: border-box;
}

.container.celebrating .title {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    font-size: clamp(2.9rem, 14vw, 5.8rem);
    white-space: normal;
    text-wrap: balance;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-align: center;
    text-shadow: 0 0 30px rgba(255, 215, 0, 1);
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    will-change: transform, clip-path, opacity, filter;
    animation: titleRevealUp 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.container.celebrating .title-secondary {
    display: block;
    top: 60%;
    left: calc(50% + clamp(22px, 3vw, 44px));
    font-size: clamp(3.5rem, 18vw, 7.2rem);
    animation-delay: 3s;
}

@media (max-width: 768px) {
    .container.celebrating .title {
        font-size: clamp(2.4rem, 12vw, 4.4rem);
    }

    .container.celebrating .title-secondary {
        left: calc(50% + clamp(14px, 2.4vw, 32px));
        font-size: clamp(3rem, 16vw, 5.8rem);
    }
}

@keyframes titleRevealUp {
    0% {
        opacity: 0;
        clip-path: inset(100% 0 0 0);
        filter: blur(6px);
        transform: translate(-50%, calc(-50% + 26px));
    }
    100% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        filter: blur(0);
        transform: translate(-50%, -50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .container.celebrating .title {
        animation: none;
        opacity: 1;
        clip-path: inset(0 0 0 0);
        filter: none;
    }
}
