:root {
    --bg: #0a0a1a;
    --text: #e0e0ff;
    --accent: #00e5ff;
    --danger: #ff3d71;
    --gold: #ffd740;
}

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

body {
    background: var(--bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.game-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    padding: 0 10px;
}

.score-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.15);
}

.score-box span {
    color: var(--accent);
    font-size: 1.6rem;
    margin-left: 4px;
}

.high-score-box {
    background: rgba(255, 215, 64, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 64, 0.3);
    border-radius: 16px;
    padding: 12px 20px;
    color: var(--gold);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(255, 215, 64, 0.15);
}

.high-score-box span {
    font-size: 1.6rem;
    margin-left: 4px;
}

canvas {
    display: block;
    border: 2px solid rgba(0, 229, 255, 0.25);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.2),
                0 0 80px rgba(0, 229, 255, 0.08),
                inset 0 0 40px rgba(0, 0, 0, 0.3);
    background: radial-gradient(ellipse at center, #0d0d2b 0%, #050510 100%);
    cursor: none;
    transition: box-shadow 0.3s ease;
    max-width: 100%;
    height: auto;
}

.credit {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(224, 224, 255, 0.35);
    letter-spacing: 0.5px;
}

.credit a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.credit a:hover {
    text-decoration: underline;
}

.game-over-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    border: 2px solid var(--danger);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--text);
    box-shadow: 0 0 60px rgba(255, 61, 113, 0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    pointer-events: none;
}

.game-over-overlay.active {
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.game-over-overlay h2 {
    font-size: 2.5rem;
    color: var(--danger);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(255, 61, 113, 0.6);
}

.game-over-overlay .final-score {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--gold);
}

.btn {
    background: var(--accent);
    color: #0a0a1a;
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4);
    text-transform: uppercase;
}

.btn:hover {
    background: #4df0ff;
    box-shadow: 0 6px 30px rgba(0, 229, 255, 0.6);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    canvas {
        border-radius: 12px;
        border-width: 1px;
    }
    .header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .score-box,
    .high-score-box {
        padding: 8px 16px;
        font-size: 1rem;
    }
    .game-over-overlay {
        padding: 1.5rem 1.2rem;
    }
    .game-over-overlay h2 {
        font-size: 2rem;
    }
}