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

html, body {
    overflow: hidden;
    height: 100%;
    background: #1a1a1a;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#connection-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(255, 80, 80, 0.8);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 30;
}

#latency-display {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    z-index: 25;
}

#ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Settings gear — top left */
#settings-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    pointer-events: all;
    transition: color 0.2s;
}

#settings-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Score display */
#score-display {
    position: absolute;
    top: 12%;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 80px;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: -2px;
    pointer-events: none;
    z-index: 11;
}

/* Overlays (start menu & game over) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    z-index: 20;
}

.hidden {
    display: none !important;
}

/* Start menu */
.logo {
    font-size: 64px;
    font-weight: 200;
    color: #fff;
    letter-spacing: 12px;
    margin-bottom: 24px;
}

.prompt {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Game over menu */
#crown-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

#final-score {
    font-size: 72px;
    font-weight: 200;
    color: #fff;
    letter-spacing: -2px;
    margin-bottom: 4px;
}

#high-score-label {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 32px;
    letter-spacing: 2px;
}

#gameover-menu .prompt {
    margin-top: 8px;
}

/* Bottom bar */
#bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 14px 0 24px;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: all;
    z-index: 20;
}

.bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px 16px;
    font-family: inherit;
}

.bar-btn:disabled {
    cursor: default;
    opacity: 0.5;
}

.bar-icon {
    font-size: 22px;
}

.bar-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}
