/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'Nunito', sans-serif;
    color: #fff;
    cursor: default;
    -webkit-font-smoothing: antialiased;
}

canvas {
    display: block;
}

.hidden {
    display: none !important;
}

/* ===== LANDING SCREEN ===== */
#landing {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#landing.exiting {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

#logo-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#landing-ui {
    position: relative;
    z-index: 2;
    text-align: center;
    pointer-events: none;
}

#landing-ui > * {
    pointer-events: auto;
}

#logo-text {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.2em;
    text-shadow:
        0 0 40px rgba(76, 175, 80, 0.4),
        0 0 80px rgba(76, 175, 80, 0.2);
}

.logo-cat {
    color: #FFB74D;
    text-shadow:
        0 0 30px rgba(255, 183, 77, 0.5),
        0 2px 0 #E65100;
}

.logo-cucumber {
    color: #66BB6A;
    text-shadow:
        0 0 30px rgba(102, 187, 106, 0.5),
        0 2px 0 #2E7D32;
}

#tagline {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: lowercase;
}

#enter-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 600;
    padding: 1em 2.5em;
    border: none;
    border-radius: 60px;
    background: linear-gradient(135deg, #43A047, #66BB6A);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 15px rgba(76, 175, 80, 0.4),
        0 0 40px rgba(76, 175, 80, 0.15);
    position: relative;
    overflow: hidden;
}

#enter-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 8px 30px rgba(76, 175, 80, 0.6),
        0 0 60px rgba(76, 175, 80, 0.3);
}

#enter-btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-icon {
    display: inline-block;
    margin: 0 0.3em;
    transition: transform 0.3s ease;
}

#enter-btn:hover .btn-icon {
    transform: rotate(15deg) scale(1.2);
}

#sub-tagline {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.25);
    font-style: italic;
}

/* ===== GAME SCREEN ===== */
#game-section {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
}

#game-canvas {
    width: 100%;
    height: 100%;
    cursor: none;
}

#game-ui {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* HUD */
#hud-top {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 2rem;
}

#hud-top > div {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#hud-top span:first-child {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

#hud-top span:last-child {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

#score-value {
    color: #FFD54F;
}

#items-value {
    color: #FF8A65;
}

#scares-value {
    color: #81C784;
}

/* Chaos meter */
#chaos-meter-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: min(400px, 80vw);
    text-align: center;
}

#chaos-meter-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: #FF5252;
    margin-bottom: 0.5rem;
    animation: chaosPulse 0.3s ease infinite alternate;
}

@keyframes chaosPulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

#chaos-meter-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

#chaos-meter-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #FF5252, #FF9800, #FFEB3B);
    border-radius: 4px;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

/* Instructions */
#instruction-text {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    white-space: nowrap;
    animation: instructionFade 3s ease infinite;
}

@keyframes instructionFade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* Reaction text */
#reaction-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: #FF5252;
    text-shadow:
        0 0 20px rgba(255, 82, 82, 0.8),
        0 0 40px rgba(255, 82, 82, 0.4),
        3px 3px 0 rgba(0, 0, 0, 0.3);
    animation: reactionPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 10;
}

@keyframes reactionPop {
    from {
        transform: translate(-50%, -50%) scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Back button */
#back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 20;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

#back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    #hud-top {
        gap: 0.8rem;
        padding: 0.5rem 1rem;
    }

    #hud-top > div {
        padding: 0.3rem 0.8rem;
        min-width: 70px;
    }

    #hud-top span:last-child {
        font-size: 1.1rem;
    }

    #instruction-text {
        font-size: 0.8rem;
        white-space: normal;
        max-width: 80%;
    }
}

/* ===== CUSTOM SCROLLBAR (just in case) ===== */
::-webkit-scrollbar { width: 0; }
