:root {
    --bg-dark: #0D0A0A;
    --primary: #E74C3C;
    --primary-dark: #C0392B;
    --accent: #2ECC71;
    --pass: #2ECC71;
    --fail: #E74C3C;
    --text: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.6);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border-radius: 12px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
    margin: 0;
}

header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.score-board {
    display: flex;
    justify-content: space-between;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 15px 25px;
    backdrop-filter: blur(10px);
}

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

.stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 600;
}

.stat .value {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

#multiplier {
    color: var(--accent);
}

main {
    flex: 1;
    position: relative;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

canvas:active {
    cursor: pointer;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 10, 10, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    gap: 24px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

.overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.instructions p {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.btn {
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 16px 32px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

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

.reason {
    font-size: 1.2rem;
    color: #ffcc00;
    margin-bottom: 10px;
    max-width: 400px;
    line-height: 1.5;
}

.final-stats {
    background: var(--glass);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 300px;
}

.fs-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

.fs-item strong {
    font-size: 1.5rem;
    color: var(--accent);
}

.leaderboard {
    width: 100%;
    max-width: 300px;
    margin-bottom: 10px;
}

.leaderboard h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

#highScoresList {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#highScoresList li {
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

#highScoresList li .rank {
    color: var(--text-muted);
    width: 20px;
}

#highScoresList li .score {
    font-weight: bold;
    color: var(--accent);
}

@media (max-width: 600px) {
    .game-container {
        padding: 10px;
        height: 100svh;
    }
    h1 { font-size: 1.5rem; }
    .stat .value { font-size: 1.2rem; }
    .overlay h2 { font-size: 2rem; }
}
