:root {
    --bg-dark: #0a0514;
    --neon-blue: #00e5ff;
    --neon-purple: #b400ff;
    --neon-green: #00ff88;
    --neon-yellow: #ffea00;
    --neon-red: #ff2a55;
    --glass-bg: rgba(10, 5, 20, 0.75);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: #000;
    color: #fff;
    font-family: var(--font-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 1024px;
    height: 100%;
    max-height: 768px;
    background-color: var(--bg-dark);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(180, 0, 255, 0.15);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 30px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-group {
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.center-stat {
    align-items: center;
    transform: scale(1.2);
    border-color: rgba(180, 0, 255, 0.5);
    box-shadow: 0 0 20px rgba(180, 0, 255, 0.2);
}

.right-stat {
    align-items: flex-end;
}

.stat-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: #aaa;
    margin-bottom: 5px;
    font-weight: 700;
}

.stat-value {
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.combo-text {
    color: var(--neon-purple);
    text-shadow: 0 0 15px var(--neon-purple);
}

.combo-pulse {
    animation: combopulse 0.1s ease-out;
}

@keyframes combopulse {
    0% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

#hit-feedback {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 4px;
    opacity: 0;
    text-transform: uppercase;
    transition: opacity 0.5s;
}

/* Pop animation for feedback text injected via JS */
.anim-pop {
    animation: popOut 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popOut {
    0% { transform: translate(-50%, -30%) scale(0.5); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -60%) scale(0.9); opacity: 0; }
}

/* Utility Colors */
.text-glow-blue { color: var(--neon-blue); text-shadow: 0 0 15px var(--neon-blue); }
.text-glow-purple { color: var(--neon-purple); text-shadow: 0 0 15px var(--neon-purple); }
.text-glow-green { color: var(--neon-green); text-shadow: 0 0 15px var(--neon-green); }
.text-glow-yellow { color: var(--neon-yellow); text-shadow: 0 0 15px var(--neon-yellow); }
.text-glow-red { color: var(--neon-red); text-shadow: 0 0 15px var(--neon-red); }

/* Screens */
.screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
}

.logo-container {
    position: relative;
    margin-bottom: 50px;
}

.logo-pulse {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(180,0,255,0.4) 0%, rgba(180,0,255,0) 70%);
    animation: logopulse 2s infinite alternate;
    z-index: -1;
}

@keyframes logopulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

h1 {
    font-size: 72px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 5px;
    background: linear-gradient(180deg, #fff 0%, var(--neon-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(0,229,255,0.4));
}

h2 {
    font-size: 48px;
    margin-bottom: 30px;
    letter-spacing: 3px;
}

@media (max-width: 600px) { h1 { font-size: 48px; } h2 { font-size: 32px; } }

.track-select {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0,0,0,0.4);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.track-select p {
    font-size: 12px;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 10px;
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: rgba(180, 0, 255, 0.1);
    border: 2px solid var(--neon-purple);
    color: #fff;
    box-shadow: 0 0 15px rgba(180, 0, 255, 0.2) inset, 0 0 15px rgba(180, 0, 255, 0.3);
}

.btn-primary:hover {
    background: var(--neon-purple);
    color: #000;
    box-shadow: 0 0 30px rgba(180, 0, 255, 0.6) inset, 0 0 30px rgba(180, 0, 255, 0.6);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #555;
    color: #ccc;
}
.btn-secondary:hover {
    border-color: #fff;
    color: #fff;
}

.btn:active {
    transform: scale(0.95);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--neon-purple);
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 0 40px rgba(180, 0, 255, 0.2);
}

@media (max-width: 600px) {
    .results-grid { grid-template-columns: 1fr; padding: 20px; }
}

.res-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.res-item:first-child {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.res-label {
    font-size: 12px;
    letter-spacing: 2px;
    color: #888;
}

.res-value {
    font-size: 24px;
    font-weight: 900;
}
.res-item:first-child .res-value {
    font-size: 48px;
}

.mt-20 { margin-top: 20px; }

.tips {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
}

/* Shake Effect */
.shake {
    animation: screenshake 0.15s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenshake {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10px, 8px); }
    50% { transform: translate(10px, -8px); }
    75% { transform: translate(-10px, -8px); }
    100% { transform: translate(0, 0); }
}
