/* Version 1.50.2 - Scientific Delta Update */
* {
    box-sizing: border-box;
}

.version-badge {
    font-size: 0.4em;
    color: #444;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 2px 6px;
    vertical-align: middle;
    margin-left: 10px;
    font-weight: 300;
    letter-spacing: 1px;
}

:root {
    --bg-color: #0f0f0f;
    /* YouTube Dark Grey */
    --text-color: #ffffff;
    --discord-color: #5865F2;
    /* Discord Blurple */
    --discord-hover: #4752c4;
    --accent-red: #ff3333;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Arial", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Vertically Center */
    min-height: 100vh;
    padding-top: 0;
    text-align: center;
}

.container {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Removed the border box "main-card" to reduce lines */
.main-card {
    width: 100%;
    max-width: 400px;
    /* Good size for mobile and desktop */
    padding: 2rem 1rem;
}

h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 400;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1rem;
    color: #888;
    margin-bottom: 3rem;
    font-weight: 400;
}

.version-tag {
    display: inline-block;
    font-size: 0.4em;
    /* Relative to H1 */
    vertical-align: middle;
    margin-left: 10px;
    padding: 2px 6px;
    border: 1px solid #333;
    /* Very subtle dark grey border */
    border-radius: 4px;
    color: #666;
    background: transparent;
    font-weight: 400;
    letter-spacing: 1px;
}

/* Buttons */
.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 400px;
    /* Limit width on desktop */
    margin: 0 auto 1rem auto;
    /* Center it */
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 400;
    text-decoration: none;
    border-radius: 8px;
    /* Slight roundness looks better than harsh square typically, but can be 0 if strictly requested. Sticking to 8px for "modern flat". */
    transition: background-color 0.2s;
    cursor: pointer;
    border: none;
    margin-bottom: 1rem;
}

.btn-discord {
    background-color: var(--discord-color);
    color: white;
}

.btn-discord:hover {
    background-color: var(--discord-hover);
}

/* User Info Section */
.user-info {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    /* Circle avatar is standard */
    margin-bottom: 1rem;
    border: 3px solid var(--bg-color);
    /* fake border to separate from bg if needed */
    box-shadow: 0 0 0 2px #333;
}

.welcome-text {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 0.2rem;
}

.status-text {
    font-size: 0.9rem;
    color: #4ade80;
    /* Green for success/authorized */
    margin-bottom: 2rem;
}

/* Start Button */
.btn-start {
    background-color: white;
    color: black;
    font-weight: 400;
    text-transform: uppercase;
}

.btn-start:hover {
    background-color: #ddd;
}

/* Logout */
.btn-logout {
    margin-top: 1rem;
    background: transparent;
    color: #666;
    font-size: 0.9rem;
    padding: 0.5rem;
    width: auto;
    display: inline-block;
}

/* Feedback Styles */
.btn-vote.correct {
    background-color: #4ade80 !important;
    /* Green */
    color: black !important;
    border-color: #4ade80 !important;
}

.btn-vote.incorrect {
    background-color: #ff3333 !important;
    /* Red */
    color: white !important;
    border-color: #ff3333 !important;
}

.btn-logout:hover {
    color: var(--accent-red);
}

.restricted {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: block;
}

/* Old animation removed */

/* --- 1. SCIENTIFIC SQUEEZE (Fixes Screen Size Bias) --- */
.experiment-stage {
    width: 100%;
    max-width: 750px;
    /* margin: 0 auto; <--- REMOVE THIS if present, Flexbox handles centering now */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    /* 16px Gap = Parafoveal Vision Range */
    /* padding: 50px 0; REMOVED to let Flexbox handle vertical centering if needed, or keep it. User prompt didn't strictly remove it but showed new block without it */
}

@media (max-width: 768px) {
    .experiment-stage {
        flex-direction: column;
        gap: 20px;
    }
}

/* --- 2. HYPNOTIC RED LOCK (Fixes Eye Drift) --- */
.spin-animation {
    animation: spin-fixed 0.5s linear infinite;
    /* 0.5s = High Alert Speed */
    color: #ff3333 !important;
    /* RED = No Retinal Bleaching */
}

@keyframes spin-fixed {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Feedback Floating Text (Typewriter Style) */
#float-feedback {
    position: absolute;
    top: 20%;
    /* Moved UP to avoid blocking center vision */
    left: 50%;
    transform: translate(-50%, -50%);
    color: #00ff41;
    /* Green to match bar */
    font-family: monospace;
    font-size: 1rem;
    /* Small */
    font-weight: bold;
    text-align: center;
    pointer-events: none;
    /* Click-through guaranteed */
    z-index: 3000;
    /* SUPER TOP LAYER */
    text-shadow: 0 0 10px #00ff41;
    /* Exact match to Streak Bar Box Shadow */
    white-space: pre;
}

/* --- DUAL AUTH GATE (Premium) --- */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.auth-gate {
    width: 100%;
    max-width: 380px;
    /* Slightly wider */
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
    padding: 30px;
    background: rgba(20, 20, 20, 0.8);
    /* Glassy Background */
    border: 1px solid #333;
    border-radius: 8px;
    /* Subtle rounding */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.btn-discord {
    background-color: #5865F2;
    /* Discord Blurple */
    color: white;
    padding: 16px 24px;
    /* Taller button */
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    /* Larger text */
    font-weight: bold;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: block;
    border-radius: 4px;
}

.btn-discord:hover {
    background-color: #4752c4;
    transform: translateY(-2px);
    /* Lift */
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.4);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #444;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #222;
}

.divider span {
    padding: 0 15px;
}

.key-input-wrapper {
    display: flex;
    border: 1px solid #333;
    background: #000;
    transition: 0.3s;
    height: 50px;
    /* Taller input */
    position: relative;
    width: 100%;
    /* Ensure full width */
    box-sizing: border-box;
    /* Include padding in width */
}

.key-input-wrapper:focus-within {
    border-color: #00ff41;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.15);
}

#access-key {
    background: transparent;
    border: none;
    color: #00ff41;
    font-family: monospace;
    font-size: 1.2rem;
    /* Larger code */
    padding: 0 15px;
    flex: 1;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    min-width: 0;
    /* CRITICAL FIX: Allows input to shrink in flex container */
    width: 100%;
}

#access-key::placeholder {
    color: #333;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

#btn-key-enter {
    background: #111;
    color: #666;
    border: none;
    border-left: 1px solid #333;
    padding: 0 20px;
    cursor: pointer;
    font-family: monospace;
    font-weight: bold;
    transition: 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
    /* Prevent button text wrapping */
}

#btn-key-enter:hover {
    color: #fff;
    background: #222;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
    border-color: #ff3333 !important;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .auth-gate {
        padding: 20px;
        /* Smaller padding */
        max-width: 100%;
    }

    #access-key {
        font-size: 1rem;
        /* Smaller font on mobile */
        letter-spacing: 1px;
        padding: 0 10px;
    }

    #btn-key-enter {
        padding: 0 15px;
    }
}

/* --- STREAK BAR HEAT SYSTEM --- */
.streak-bar-container {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    background: #111;
    overflow: hidden;
    /* Ensure the container has relative positioning for the bar */
    position: relative;
}

.streak-bar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    /* Ensure it fills height */
}

/* MODES - APPLIED TO CONTAINER but STYLES THE BAR */

/* 1. The Container (Keeps Dark Background) */
.streak-bar-container.mode-cold,
.streak-bar-container.mode-warm,
.streak-bar-container.mode-hot,
.streak-bar-container.mode-god {
    background: rgba(0, 0, 0, 0.8) !important;
    /* Force dark background */
}

/* 2. The Bar (Changes Color) */
/* 2. The Bar (Changes Color) */
/* REMOVED !important to allow JS Gradual Color to take precedence */
.mode-cold #streak-bar {
    /* Default handled by JS/HTML */
}

.mode-warm #streak-bar {
    /* animation: pulse 2s infinite; */
}

.mode-hot #streak-bar {
    /* box-shadow: 0 0 20px #ff0055; */
}

.mode-god #streak-bar {
    /* God Mode still forces White */
    background-color: #ffffff !important;
    box-shadow: 0 0 25px #ffd700, 0 0 50px #ffffff !important;
}

.mode-god #streak-bar {
    background-color: #ffffff !important;
    /* White */
    box-shadow: 0 0 25px #ffd700, 0 0 50px #ffffff !important;
    /* Gold Glow */
}

/* 3. Container Glow (Outer Shell) */
/* DISABLED PER USER REQUEST: Container should not glow, only the bar inside. */
.mode-warm {
    /* box-shadow: 0 0 10px rgba(255, 170, 0, 0.3); */
    animation: pulse 2s infinite;
}

.mode-hot {
    /* box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); */
    animation: pulse 0.8s infinite;
}

.mode-god {
    animation: shake 0.5s infinite, pulse 0.4s infinite;
    /* box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); */
}

/* ANIMATIONS */
@keyframes pulse {
    0% {
        opacity: 0.8;
        filter: brightness(1);
    }

    50% {
        opacity: 1;
        filter: brightness(1.3);
    }

    100% {
        opacity: 0.8;
        filter: brightness(1);
    }
}

@keyframes shake {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-0.5px, 0);
    }

    30% {
        transform: translate(0.5px, 0);
    }

    50% {
        transform: translate(-0.5px, 0);
    }

    70% {
        transform: translate(0.5px, 0);
    }

    90% {
        transform: translate(-0.5px, 0);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* LINK LOST OVERLAY */
@keyframes flashRed {
    0% {
        background-color: rgba(255, 0, 0, 0.5);
    }

    100% {
        background-color: transparent;
    }
}

.link-lost-anim {
    animation: flashRed 0.5s ease-out;
}