@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;800&family=Rajdhani:wght@500;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #020204;
    font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #e2e8f0;
}

#render-canvas {
    width: 100vw;
    height: 100vh;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Atmospheric Optical Vignette */
#vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(2, 2, 5, 0.7) 80%, rgba(1, 1, 3, 0.96) 100%);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.8);
}

/* Screen Shatter Chromatic Pulse */
#shatter-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 4;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(0, 245, 255, 0.15) 50%, transparent 80%);
    opacity: 0;
    transition: opacity 0.35s ease-out;
}

/* Minimalist HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

.brand-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 5px;
    color: #f8fafc;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

.game-subtitle {
    font-size: 11px;
    letter-spacing: 3px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.center-harmonic {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.harmonic-chord {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #00f5ff;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.8);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.harmonic-chord.active {
    opacity: 1;
    transform: translateY(0);
}

.score-counter {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.resonance-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    width: 180px;
}

.resonance-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: #94a3b8;
    font-weight: 700;
}

.resonance-bar-outer {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.resonance-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff0055, #ffaa00, #00ffaa, #00bbff, #bb00ff);
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.8);
    transition: width 0.1s ease-out;
}

/* Floating Tutorial Prompt */
#hint-overlay {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    pointer-events: none;
    text-align: center;
    transition: opacity 0.6s ease;
}

.hint-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 4px;
    color: #94a3b8;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    animation: pulseHint 2.4s infinite ease-in-out;
}

@keyframes pulseHint {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

/* Floating Musical Floating Damage/Resonance Text */
.musical-float {
    position: absolute;
    pointer-events: none;
    z-index: 30;
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 12px currentColor;
    animation: floatFloat 0.9s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatFloat {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    25% { transform: translate(-50%, -85%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -150%) scale(0.95); opacity: 0; }
}

/* Game Completion / Zen Stage Modal */
#modal-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 2, 5, 0.95);
    z-index: 100;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 30px;
    text-align: center;
}

#modal-title {
    font-family: 'Cinzel', serif;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 6px;
    color: #ffffff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

.modal-desc {
    font-size: 16px;
    letter-spacing: 2px;
    color: #94a3b8;
    max-width: 440px;
    line-height: 1.6;
}

.next-phase-btn {
    padding: 14px 44px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #020204;
    background: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.next-phase-btn:active {
    transform: scale(0.96);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.9);
}

/* Mobile responsive */
@media (max-width: 600px) {
    #hud {
        padding: 16px 20px;
    }
    .game-title {
        font-size: 15px;
    }
    .score-counter {
        font-size: 26px;
    }
    .resonance-container {
        width: 120px;
    }
}
