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

body {
    background: #0a1628;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    cursor: pointer;
    touch-action: none;
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    right: 0;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    pointer-events: none;
    z-index: 20;
}

#scoreDisplay {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 16px rgba(0, 212, 255, 0.8), 0 2px 4px rgba(0,0,0,0.6);
    line-height: 1;
    letter-spacing: -1px;
}

#highScoreDisplay {
    font-size: clamp(0.7rem, 1.8vw, 0.9rem);
    color: rgba(0, 212, 255, 0.7);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Home button */
#homeButton {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(10, 22, 40, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 212, 255, 0.85);
    text-decoration: none;
    z-index: 30;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#homeButton:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.7);
    color: #00d4ff;
}

#homeButton svg {
    width: 18px;
    height: 18px;
}

/* Overlays */
.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(10, 22, 40, 0.45);
}

.overlay-panel {
    background: rgba(10, 30, 60, 0.82);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 20px;
    padding: clamp(28px, 5vw, 48px) clamp(32px, 6vw, 64px);
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    max-width: 90vw;
}

.overlay-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.overlay-sub {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: rgba(0, 212, 255, 0.7);
    margin-top: -4px;
}

.overlay-result {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 700;
    color: #fff;
}

.overlay-hs {
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    color: rgba(0, 212, 255, 0.65);
    font-weight: 600;
    min-height: 1.2em;
}

/* Game button */
.btn-game {
    margin-top: 8px;
    padding: 12px 36px;
    border-radius: 50px;
    border: 1.5px solid rgba(0, 212, 255, 0.5);
    background: linear-gradient(135deg, #0a2a5e, #1a4a8a);
    color: #00d4ff;
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.2);
}

.btn-game:hover {
    background: linear-gradient(135deg, #1a4a8a, #0a2a5e);
    box-shadow: 0 0 28px rgba(0, 212, 255, 0.4);
}

.btn-game:active {
    transform: scale(0.97);
}
