/* ==========================================================================
   ROOT VARIABLES
   ========================================================================== */
:root {
    --dried-blood: #5a0000;
    --arterial-spray: #ff0000;
    --bone-white: #f5f5dc;
    --muted-bone: #c8c8b4;
    --font-ui: 'Cinzel', serif;
    --smooth-curve: cubic-bezier(0.4, 0, 0.2, 1);
    --bg-dark: #050000;
}

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

body {
    background: radial-gradient(circle at center, #1a0000 0%, #000000 80%);
    color: var(--bone-white);
    font-family: var(--font-ui);
    overflow: hidden; /* Hide scrollbars for the 3D void */
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for flawless mobile address bars */
    
    /* Flexbox enables the void container to dynamically fill space beneath the sticky navbar */
    display: flex; 
    flex-direction: column;
}

/* ==========================================================================
   FLUID NAVBAR - STICKY FIX
   ========================================================================== */
@keyframes organicHeartbeatBorder {
    0% { border-bottom-color: var(--dried-blood); box-shadow: 0 4px 20px rgba(90, 0, 0, 0.6); }
    15% { border-bottom-color: var(--arterial-spray); box-shadow: 0 4px 30px rgba(255, 0, 0, 0.8); }
    30% { border-bottom-color: var(--dried-blood); box-shadow: 0 4px 20px rgba(90, 0, 0, 0.6); }
    100% { border-bottom-color: var(--dried-blood); box-shadow: 0 4px 20px rgba(90, 0, 0, 0.6); }
}

.navbar {
    /* THE FIX: Sticky keeps it at the top but inside the document flow so it pushes the void down */
    position: sticky; 
    top: 0;
    left: 0;
    width: 100%;
    min-height: 70px;
    height: auto;
    padding: clamp(5px, 1.5vw, 10px) 15px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.98) 0%, rgba(15, 0, 0, 0.90) 100%);
    border-bottom: 2px solid var(--dried-blood);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: organicHeartbeatBorder 4s infinite var(--smooth-curve);
}

.nav-links {
    display: flex;
    gap: clamp(15px, 3vw, 40px);
    flex-wrap: wrap; /* Allows wrapping on tiny screens */
    list-style: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.navbar li a {
    font-family: var(--font-ui);
    font-size: clamp(0.9rem, 2.5vw, 1.5rem); /* Fluid typography */
    font-weight: 700;
    letter-spacing: clamp(1px, 1vw, 3px);
    color: var(--muted-bone);
    text-decoration: none;
    text-transform: uppercase;
    position: relative;
    padding: clamp(5px, 1.5vw, 8px) clamp(10px, 2vw, 15px);
    transition: all 0.3s var(--smooth-curve);
    white-space: nowrap;
}

.navbar li a::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--arterial-spray);
    transform: translate(-50%, -50%) rotate(-3deg);
    transition: width 0.4s var(--smooth-curve);
    box-shadow: 0 0 10px var(--arterial-spray);
    z-index: 2;
    opacity: 0;
}

.navbar li a:hover {
    color: var(--bone-white);
    text-shadow: 0 0 15px rgba(255, 5, 5, 0.7);
}

.navbar li a:hover::before {
    width: 100%;
    opacity: 1;
}

/* Active State (Just in case you implement it here like the other pages) */
.navbar li a.active {
    color: var(--bone-white);
    text-shadow: 0 0 15px rgba(255, 5, 5, 0.7);
}
.navbar li a.active::before { width: 100%; opacity: 1; }

/* ==========================================================================
   3D SPACE & KILLERS - FULLY RESPONSIVE
   ========================================================================== */
#void-container {
    /* 
       Because of flex: 1, this container automatically fills all space remaining 
       under the sticky navbar. No need for fixed tops or calc() heights anymore! 
    */
    position: relative; 
    flex: 1; 
    width: 100%;
    perspective: clamp(800px, 50vw, 1200px); /* Fluid 3D depth based on screen size */
    overflow: hidden;
}

.killer-wrapper {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    transition: transform 0.6s var(--smooth-curve), opacity 1s ease, filter 0.6s ease;
    will-change: transform;
}

.killer-img {
    /* Shrinks dynamically on mobile, stays 200px on desktop */
    width: clamp(120px, 30vw, 200px); 
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    animation: float 6s ease-in-out infinite alternate;
    transition: all 0.5s ease;
    user-select: none;
    -webkit-user-drag: none;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(-2deg); }
    100% { transform: translateY(-20px) rotate(2deg); }
}

/* --- SHUFFLING STATE --- */
.is-shuffling .killer-wrapper {
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.4s;
    filter: blur(3px) brightness(1.2);
}

.is-shuffling .killer-img {
    animation: none;
    box-shadow: 0 0 40px var(--arterial-spray);
}

/* --- RESULT STATES --- */
.loser {
    opacity: 0.15;
    filter: blur(5px) grayscale(50%);
    z-index: 1 !important;
}

.winner {
    z-index: 1000 !important;
    transform: translate3d(-50%, -50%, clamp(200px, 20vw, 400px)) !important;
    transition: transform 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 1s !important;
}

.winner .killer-img {
    /* Ensures the winner image NEVER overflows a small mobile screen */
    width: clamp(220px, 80vw, 380px); 
    box-shadow: 0 0 80px 20px rgba(255, 0, 0, 0.6), 0 0 150px rgba(255, 0, 0, 0.4);
    border: 2px solid var(--arterial-spray);
    animation: float-winner 4s ease-in-out infinite alternate;
}

@keyframes float-winner {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(-15px) scale(1.02); }
}

/* ==========================================================================
   CONTROLS - FLUID
   ========================================================================== */
#controls {
    position: absolute;
    bottom: clamp(20px, 5vh, 40px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    width: 90%;
    display: flex;
    justify-content: center;
}

#randomize-btn {
    background: linear-gradient(135deg, #2a0000 0%, #0a0000 100%);
    border: 2px solid var(--dried-blood);
    color: var(--bone-white);
    font-family: var(--font-ui);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    padding: clamp(10px, 3vw, 15px) clamp(25px, 6vw, 50px);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: clamp(2px, 1.5vw, 4px);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

#randomize-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 0, 0, 0.4), transparent);
    transform: skewX(-20deg);
    transition: 0s;
}

#randomize-btn:hover {
    border-color: var(--arterial-spray);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.7);
    color: #fff;
    text-shadow: 0 0 10px red;
}

#randomize-btn:hover::after {
    left: 200%;
    transition: 0.8s ease-in-out;
}

#randomize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    border-color: #333;
}