:root {
    --bg: #050507;
    --accent-warm: #e9c9a6;
    --accent-hot: #c98a4b;
    --accent-cool: #8f7bd6;
    --text: #f3f1f6;
    --text-dim: #9b98a8;
    --glass-bg: rgba(255, 255, 255, 0.055);
    --glass-border: rgba(255, 255, 255, 0.14);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.space {
    position: relative;
    width: 100vw;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    animation: space-appear 2.2s ease-out forwards;
}

@keyframes space-appear {
    from { opacity: 0; }
    to { opacity: 1; }
}

#stars {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.nebula {
    position: absolute;
    inset: -10%;
    z-index: 1;
    background:
        radial-gradient(ellipse 42% 28% at 28% 30%, rgba(140, 110, 200, 0.14), transparent 62%),
        radial-gradient(ellipse 38% 26% at 74% 68%, rgba(160, 110, 90, 0.12), transparent 62%);
    filter: blur(34px);
    opacity: 0;
    animation: nebula-appear 3s ease-out 0.4s forwards;
    pointer-events: none;
}

@keyframes nebula-appear {
    to { opacity: 1; }
}

/* ---------- Scene (card + orbiting shapes) ---------- */

.scene {
    position: relative;
    z-index: 2;
    width: min(400px, 88vw);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Black hole (peeks from behind the glass card) ---------- */

.blackhole {
    position: absolute;
    top: 0;
    left: 50%;
    width: clamp(190px, 38vmin, 320px);
    aspect-ratio: 1;
    z-index: 1;
    transform: translate(-50%, -58%) scale(0.6);
    opacity: 0;
    animation: blackhole-appear 1.8s cubic-bezier(.2, .8, .2, 1) 0.5s forwards;
    transition: transform 0.9s cubic-bezier(.6, 0, .9, 1), filter 0.9s ease-in, opacity 0.6s ease-in;
}

@keyframes blackhole-appear {
    from { opacity: 0; transform: translate(-50%, -58%) scale(0.6); }
    to { opacity: 1; transform: translate(-50%, -58%) scale(1); }
}

.blackhole__glow {
    position: absolute;
    inset: -55%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 226, 183, 0.22), rgba(159, 110, 218, 0.14) 40%, rgba(80, 40, 90, 0.08) 60%, transparent 72%);
    filter: blur(26px);
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.75; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Wide accretion disk, seen edge-on: bright streaks either side of the horizon */
.blackhole__disk {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%) scaleY(0.22) rotate(-3deg);
    border-radius: 50%;
    background:
        linear-gradient(90deg,
            rgba(255, 255, 255, 0.75) 0%,
            rgba(255, 236, 209, 0.55) 22%,
            transparent 38%,
            transparent 62%,
            rgba(154, 74, 42, 0.55) 82%,
            rgba(90, 40, 30, 0.35) 100%
        ),
        radial-gradient(ellipse at center,
            #fffaf0 0%,
            #ffe2b0 16%,
            #f6b56c 34%,
            #d9793f 52%,
            rgba(154, 74, 42, 0.4) 70%,
            transparent 82%
        );
    animation: disk-shimmer 7s ease-in-out infinite;
}

@keyframes disk-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.12); }
}

.blackhole__horizon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56%;
    height: 56%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 44% 40%, #050308 0%, #000 62%);
    box-shadow: 0 0 50px 10px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(0, 0, 0, 0.9);
    z-index: 2;
}

/* Photon ring: lensed light wrapping fully around the horizon (visible above/below it too) */
.blackhole__ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 82%;
    height: 82%;
    border-radius: 50%;
    transform: translate(-50%, -50%) scaleY(0.88);
    z-index: 3;
    background: radial-gradient(circle,
        transparent 0%,
        transparent 60%,
        #fff6e4 66%,
        #ffd18c 73%,
        #ff9d4d 80%,
        #d9622c 87%,
        rgba(140, 55, 30, 0.6) 93%,
        transparent 98%
    );
}

.blackhole__ring::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(100deg,
        rgba(255, 255, 255, 0.45) 0%,
        transparent 30%,
        transparent 66%,
        rgba(40, 12, 10, 0.55) 100%
    );
}

/* ---------- Custom logo (replaces the black hole) ---------- */

.blackhole--logo {
    width: clamp(120px, 24vmin, 190px);
}

.blackhole__badge {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.blackhole__logo-img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

/* ---------- Glass card ---------- */

.glass-card {
    position: relative;
    z-index: 3;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.6rem 2rem;
    border-radius: 26px;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 55%);
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(16px);
    animation: content-appear 1.1s ease-out 1.2s forwards;
}

@keyframes content-appear {
    to { opacity: 1; transform: translateY(0); }
}

.title {
    margin: 0 0 1.7rem;
    font-size: clamp(1.3rem, 4.2vw, 1.65rem);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.go-btn {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;
    padding: 0.85em 1.9em;
    font-size: clamp(0.88rem, 2.6vw, 0.96rem);
    font-weight: 500;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(233, 201, 166, 0.35);
    animation: btn-pulse 2.6s ease-out infinite;
    transition: transform 0.15s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.go-btn:hover {
    background: rgba(255, 255, 255, 0.11);
}

.go-btn:active {
    transform: scale(0.96);
}

@keyframes btn-pulse {
    0% { box-shadow: 0 0 0 0 rgba(233, 201, 166, 0.4); }
    70% { box-shadow: 0 0 0 16px rgba(233, 201, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(233, 201, 166, 0); }
}

.go-btn__aura {
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    background: radial-gradient(circle, rgba(233, 201, 166, 0.22), transparent 70%);
    filter: blur(6px);
    z-index: -1;
    animation: aura-pulse 2.6s ease-in-out infinite;
}

@keyframes aura-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 0.85; transform: scale(1.12); }
}

.go-btn__label {
    position: relative;
}

.countdown__track {
    margin-top: 1.5rem;
    width: min(150px, 50%);
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.countdown__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-cool), var(--accent-hot));
    transform-origin: left;
    transition: width linear;
}

.noscript-link {
    margin-top: 1rem;
}

.noscript-link a {
    color: var(--accent-warm);
}

/* ---------- Leaving / transition state ---------- */

.space.leaving .blackhole {
    transform: translate(-50%, -58%) scale(7);
    filter: blur(4px) brightness(1.4);
    opacity: 1;
}

.space.leaving .glass-card {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.space.leaving .nebula {
    transition: opacity 0.6s ease;
    opacity: 0;
}

.flash {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.65s ease;
}

.flash--active {
    opacity: 1;
}

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

@media (max-width: 480px) {
    .glass-card {
        padding: 2.1rem 1.6rem;
        border-radius: 22px;
    }
}

@media (min-width: 900px) {
    .scene {
        width: min(430px, 40vw);
    }
}

/* Safe area for iOS home indicator */
.glass-card {
    padding-bottom: max(2.1rem, env(safe-area-inset-bottom, 0));
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .space,
    .nebula,
    .blackhole,
    .glass-card,
    .blackhole__glow,
    .blackhole__disk,
    .go-btn,
    .go-btn__aura {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
