:root {
    color-scheme: dark;
    --bg: #08050a;
    --panel: rgba(13, 10, 15, 0.82);
    --panel-strong: rgba(12, 9, 14, 0.96);
    --obsidian: #151016;
    --obsidian-bright: #2b2027;
    --line: rgba(255, 171, 69, 0.24);
    --line-cold: rgba(107, 255, 153, 0.22);
    --ember: #ff9d35;
    --lava: #ff4a1d;
    --emerald: #62ff8b;
    --cream: #fff4df;
    --red: #8b0f22;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--cream);
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    position: relative;
    isolation: isolate;
}

.world-bg,
#curtains,
#sparks,
.countdown-shell {
    position: fixed;
    inset: 0;
}

.world-bg {
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 50% 38%,
            rgba(89, 255, 133, 0.075),
            transparent 28rem
        ),
        radial-gradient(
            circle at 50% 112%,
            rgba(255, 62, 28, 0.34),
            transparent 37rem
        ),
        linear-gradient(180deg, #0e0710 0%, #08050a 48%, #090405 100%);
}

.nether-depth {
    position: absolute;
    inset: -8vh -8vw;
    opacity: 0.55;
    background:
        linear-gradient(135deg, rgba(255, 93, 32, 0.05), transparent 35%),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.018) 0 2px,
            transparent 2px 58px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.017) 0 2px,
            transparent 2px 58px
        );
    transform: perspective(920px) rotateX(58deg) translateY(18vh) scale(1.35);
    transform-origin: 50% 100%;
    mask-image: linear-gradient(transparent 3%, black 34%, transparent 100%);
}

.block-grid {
    position: absolute;
    inset: -2px;
    opacity: 0.34;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px),
        linear-gradient(
            135deg,
            rgba(98, 255, 139, 0.06),
            rgba(255, 74, 29, 0.045)
        );
    background-size:
        56px 56px,
        56px 56px,
        100% 100%;
    mask-image: radial-gradient(circle at 50% 48%, black, transparent 72%);
}

.horizon-glow {
    position: absolute;
    left: 50%;
    bottom: -25vh;
    width: min(1040px, 96vw);
    height: 48vh;
    transform: translateX(-50%);
    background:
        radial-gradient(
            ellipse at center,
            rgba(255, 102, 30, 0.24),
            transparent 50%
        ),
        radial-gradient(
            ellipse at center,
            rgba(93, 255, 131, 0.1),
            transparent 68%
        );
    filter: blur(10px);
}

#ambient-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.92;
}

.countdown-shell {
    z-index: 3;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 4vw, 4rem);
    pointer-events: none;
}

.countdown-card {
    position: relative;
    width: min(1120px, 94vw);
    padding: clamp(1.25rem, 4vw, 3.35rem);
    border: 2px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 37%),
        linear-gradient(135deg, rgba(255, 99, 28, 0.09), transparent 30%),
        linear-gradient(225deg, rgba(98, 255, 139, 0.06), transparent 28%),
        var(--panel);
    box-shadow:
        0 0 0 6px rgba(0, 0, 0, 0.28),
        0 34px 100px rgba(0, 0, 0, 0.62),
        0 0 90px rgba(255, 78, 28, 0.13),
        inset 0 0 0 1px rgba(255, 255, 255, 0.045),
        inset 0 -34px 76px rgba(0, 0, 0, 0.44);
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(10px);
}

.countdown-card::before,
.countdown-card::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.countdown-card::before {
    inset: -2px;
    border-radius: inherit;
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 157, 53, 0.44),
            transparent
        ),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 32%);
    opacity: 0.22;
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 2px;
}

.countdown-card::after {
    inset: 0;
    border-radius: inherit;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.021) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.25;
    mix-blend-mode: screen;
}

body.revealed .countdown-card {
    animation: cardIn 860ms cubic-bezier(0.16, 1, 0.3, 1) 150ms forwards;
}

.server-title {
    position: relative;
    z-index: 1;
    margin: 0 0 clamp(0.95rem, 2.5vw, 1.85rem);
    text-align: center;
    color: #fff6df;
    font-size: clamp(2.35rem, 8vw, 6.75rem);
    font-weight: 950;
    letter-spacing: clamp(0.1em, 1.55vw, 0.26em);
    text-indent: clamp(0.1em, 1.55vw, 0.26em);
    line-height: 0.92;
    text-transform: uppercase;
    text-shadow:
        0 4px 0 #26120e,
        0 8px 0 rgba(0, 0, 0, 0.72),
        0 0 28px rgba(255, 133, 44, 0.24),
        0 0 54px rgba(98, 255, 139, 0.12);
    opacity: 0;
    transform: translateY(12px);
}

body.revealed .server-title {
    animation: titleIn 560ms cubic-bezier(0.16, 1, 0.3, 1) 380ms forwards;
}

.timer {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    gap: clamp(0.35rem, 1vw, 0.82rem);
    align-items: stretch;
    max-width: 1000px;
    margin: 0 auto;
}

.time-box {
    position: relative;
    min-width: 0;
    padding: clamp(0.78rem, 2.3vw, 1.52rem) clamp(0.42rem, 1.5vw, 1.15rem);
    border: 2px solid rgba(255, 255, 255, 0.075);
    border-top-color: rgba(255, 184, 82, 0.2);
    border-left-color: rgba(255, 184, 82, 0.15);
    border-bottom-color: rgba(0, 0, 0, 0.64);
    border-right-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.078), transparent 42%),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.025) 0 8px,
            transparent 8px 16px
        ),
        radial-gradient(
            circle at 50% 0%,
            rgba(255, 128, 40, 0.09),
            transparent 58%
        ),
        var(--panel-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -18px 42px rgba(0, 0, 0, 0.45),
        0 16px 38px rgba(0, 0, 0, 0.45),
        0 0 30px rgba(255, 88, 28, 0.08);
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    filter: blur(7px);
    overflow: hidden;
}

.time-box::before {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 3px solid rgba(255, 157, 53, 0.18);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 157, 53, 0.11),
        transparent
    );
    transform: translateX(-120%);
}

.time-box::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
    background-size: 18px 18px;
    pointer-events: none;
}

body.revealed .time-box {
    animation: digitIn 620ms cubic-bezier(0.16, 1, 0.3, 1)
        calc(560ms + var(--delay)) forwards;
}

body.revealed .time-box::before {
    animation: scan 880ms cubic-bezier(0.16, 1, 0.3, 1)
        calc(850ms + var(--delay)) both;
}

.number {
    position: relative;
    z-index: 1;
    display: block;
    font-variant-numeric: tabular-nums;
    font-size: clamp(2.58rem, 9.2vw, 7.75rem);
    font-weight: 1000;
    line-height: 0.88;
    letter-spacing: -0.08em;
    text-align: center;
    color: #fff8e9;
    text-shadow:
        0 4px 0 rgba(0, 0, 0, 0.9),
        0 0 22px rgba(255, 127, 38, 0.22),
        0 0 34px rgba(98, 255, 139, 0.12);
    transform: translateZ(0);
}

.number.tick {
    animation: numberTick 360ms cubic-bezier(0.18, 1.2, 0.28, 1) both;
}

.label {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: clamp(0.35rem, 0.9vw, 0.72rem);
    color: rgba(255, 244, 223, 0.72);
    font-size: clamp(0.58rem, 1.25vw, 0.9rem);
    font-weight: 900;
    letter-spacing: 0.18em;
    text-align: center;
    text-transform: uppercase;
}

.divider {
    display: grid;
    place-items: center;
    color: rgba(255, 157, 53, 0.67);
    font-size: clamp(1.8rem, 5vw, 4.4rem);
    font-weight: 950;
    opacity: 0;
    text-shadow:
        0 0 18px rgba(255, 118, 31, 0.32),
        0 0 34px rgba(98, 255, 139, 0.09);
}

body.revealed .divider {
    animation: titleIn 420ms ease 780ms forwards;
}

#sparks {
    z-index: 4;
    display: block;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    mix-blend-mode: screen;
}

#curtains {
    z-index: 6;
    display: block;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    opacity: 1;
    transition: opacity 780ms ease;
}

#curtains.is-hidden {
    opacity: 0;
}

.noscript {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.82);
    color: white;
}

.digit {
    display: inline-block;
}

.number.tick,
.digit.tick {
    animation: numberTick 360ms cubic-bezier(0.18, 1.2, 0.28, 1) both;
}

#loading-overlay {
    transition: opacity 0.45s ease-out;
    pointer-events: auto;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes titleIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes digitIn {
    70%,
    100% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes scan {
    to {
        transform: translateX(120%);
    }
}

@keyframes numberTick {
    0% {
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
    35% {
        transform: translateY(-3px) scale(1.035);
        filter: brightness(1.45);
    }
    100% {
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
}

@media (max-width: 720px) {
    .timer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .divider {
        display: none;
    }

    .countdown-card {
        padding-block: 1.45rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }

    #curtains,
    #ambient-particles,
    #sparks {
        display: none;
    }

    .countdown-card,
    .server-title,
    .time-box,
    .divider {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
}
