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

:root {
    --text-white: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent-glow: rgba(255, 255, 255, 0.55);
    --bg-dark: #000000;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-white);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ==========================================================================
   Backdrop with background image (Undimmed, exactly as is)
   ========================================================================== */
.backdrop-wrapper {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

body.scene-unlocked .backdrop-wrapper {
    opacity: 1;
}

.backdrop-img {
    position: absolute;
    inset: 0;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Overlays completely disabled/removed to keep background 100% untouched */
.backdrop-overlay,
.backdrop-vignette {
    display: none;
}

/* ==========================================================================
   Start Screen (Traces "Click Anywhere" on Pitch Black Background)
   ========================================================================== */
.start-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #000000;
    transition: opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.9s;
}

.start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-stage {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 850px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.click-prompt-svg .serif-trace-text {
    font-size: 82px;
}

.click-hint-sub {
    font-size: 0.76rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    animation: fadeInSubHint 1.2s ease 1.8s forwards, pulseHint 3s ease-in-out 3s infinite;
}

@keyframes fadeInSubHint {
    0% { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulseHint {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.95; }
}

/* ==========================================================================
   Scene Container & Stages (Positioned higher up at top: 18%)
   ========================================================================== */
.scene-container {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Trace Stages - Positioned near top */
.trace-stage {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 920px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
    pointer-events: none;
}

.trace-stage.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.trace-stage.fading-out {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
    visibility: hidden;
}

.domain-svg {
    width: 100%;
    height: auto;
    min-height: 110px;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 15px rgba(255, 255, 255, 0.45));
}

.start-screen:not(.hidden) .click-prompt-svg,
.trace-stage.active .domain-svg {
    animation: loadingGlowSweep 2.2s cubic-bezier(0.4, 0, 0.2, 1) 1;
}

@keyframes loadingGlowSweep {
    0% {
        filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.9)) drop-shadow(-80px 0 15px rgba(255, 255, 255, 0.15));
    }
    50% {
        filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.95)) drop-shadow(0px 0 35px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 60px var(--accent-glow));
    }
    100% {
        filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
    }
}

.serif-trace-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 88px;
    letter-spacing: 0.03em;
    text-anchor: middle;
}

.coming-soon-svg .serif-trace-text {
    font-size: 78px;
    letter-spacing: 0.04em;
}

/* Base Trace Character Style */
.trace-char {
    display: inline;
    stroke: var(--text-white);
    stroke-width: 1.3px;
    fill: transparent;
    stroke-dasharray: 260;
    stroke-dashoffset: 260;
    opacity: 0;
}

.start-screen:not(.hidden) .trace-char,
.trace-stage.active .trace-char {
    animation: drawIndividualChar 0.42s cubic-bezier(0.2, 0.8, 0.4, 1) forwards, fillIndividualChar 0.8s ease forwards;
}

@keyframes drawIndividualChar {
    0% {
        stroke-dashoffset: 260;
        opacity: 0;
        stroke-width: 2px;
    }
    20% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
        stroke-width: 1.3px;
    }
}

@keyframes fillIndividualChar {
    0%, 65% {
        fill: transparent;
    }
    100% {
        fill: var(--text-white);
    }
}

/* ==========================================================================
   Letter Delays: "Click Anywhere" (13 letters)
   ========================================================================== */
.c-ca1  { animation-delay: 0.05s, 1.45s !important; } /* C */
.c-ca2  { animation-delay: 0.14s, 1.45s !important; } /* l */
.c-ca3  { animation-delay: 0.23s, 1.45s !important; } /* i */
.c-ca4  { animation-delay: 0.32s, 1.45s !important; } /* c */
.c-ca5  { animation-delay: 0.41s, 1.45s !important; } /* k */
.c-ca6  { animation-delay: 0.55s, 1.45s !important; } /* A */
.c-ca7  { animation-delay: 0.64s, 1.45s !important; } /* n */
.c-ca8  { animation-delay: 0.73s, 1.45s !important; } /* y */
.c-ca9  { animation-delay: 0.82s, 1.45s !important; } /* w */
.c-ca10 { animation-delay: 0.91s, 1.45s !important; } /* h */
.c-ca11 { animation-delay: 1.00s, 1.45s !important; } /* e */
.c-ca12 { animation-delay: 1.09s, 1.45s !important; } /* r */
.c-ca13 { animation-delay: 1.18s, 1.45s !important; } /* e */

/* ==========================================================================
   Letter Delays: "myt5s.app" (9 letters)
   ========================================================================== */
.c-d1 { animation-delay: 0.05s, 1.25s !important; } /* m */
.c-d2 { animation-delay: 0.16s, 1.25s !important; } /* y */
.c-d3 { animation-delay: 0.27s, 1.25s !important; } /* t */
.c-d4 { animation-delay: 0.38s, 1.25s !important; } /* 5 */
.c-d5 { animation-delay: 0.49s, 1.25s !important; } /* s */
.c-d6 { animation-delay: 0.60s, 1.25s !important; } /* . */
.c-d7 { animation-delay: 0.71s, 1.25s !important; } /* a */
.c-d8 { animation-delay: 0.82s, 1.25s !important; } /* p */
.c-d9 { animation-delay: 0.93s, 1.25s !important; } /* p */

/* ==========================================================================
   Letter Delays: "Coming Soon..." (13 letters)
   ========================================================================== */
.c-cs1  { animation-delay: 0.05s, 1.55s !important; } /* C */
.c-cs2  { animation-delay: 0.15s, 1.55s !important; } /* o */
.c-cs3  { animation-delay: 0.25s, 1.55s !important; } /* m */
.c-cs4  { animation-delay: 0.35s, 1.55s !important; } /* i */
.c-cs5  { animation-delay: 0.45s, 1.55s !important; } /* n */
.c-cs6  { animation-delay: 0.55s, 1.55s !important; } /* g */
.c-cs7  { animation-delay: 0.70s, 1.55s !important; } /* S */
.c-cs8  { animation-delay: 0.80s, 1.55s !important; } /* o */
.c-cs9  { animation-delay: 0.90s, 1.55s !important; } /* o */
.c-cs10 { animation-delay: 1.00s, 1.55s !important; } /* n */
.c-cs11 { animation-delay: 1.12s, 1.55s !important; } /* . */
.c-cs12 { animation-delay: 1.24s, 1.55s !important; } /* . */
.c-cs13 { animation-delay: 1.36s, 1.55s !important; } /* . */

/* ==========================================================================
   Status Footer & Controls
   ========================================================================== */
.status-footer {
    position: absolute;
    bottom: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    opacity: 0;
    transition: opacity 1.2s ease;
    z-index: 20;
}

.status-footer.visible {
    opacity: 1;
}

.audio-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.04em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #4ade80;
    box-shadow: 0 0 10px #4ade80;
    animation: audioPulse 1.8s ease-in-out infinite;
}

@keyframes audioPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.92);
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .start-stage, .trace-stage {
        top: 18%;
    }
    .serif-trace-text, .click-prompt-svg .serif-trace-text {
        font-size: 50px;
    }
    .coming-soon-svg .serif-trace-text {
        font-size: 44px;
    }
    .status-footer {
        bottom: 2rem;
    }
}
