/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3a;
    --text: #e4e4e7;
    --text-dim: #71717a;
    --accent: #22c55e;
    --accent-glow: rgba(34, 197, 94, 0.25);
    --danger: #ef4444;
    --gold: #facc15;
    --radius: 12px;
}

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

/* ===== Layout ===== */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    width: 100%;
    max-width: 520px;
}

/* ===== Header ===== */
header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.scores {
    display: flex;
    gap: 10px;
}

.score-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    text-align: center;
    min-width: 80px;
}

.score-box.best {
    border-color: var(--gold);
    background: rgba(250, 204, 21, 0.06);
}

.score-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.score-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.score-box.best .score-value {
    color: var(--gold);
}

/* ===== Game Canvas ===== */
.game-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 480px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.3),
        0 20px 60px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.03);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--surface);
}

/* ===== Overlay ===== */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 17, 23, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    z-index: 10;
}

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

.overlay-content {
    text-align: center;
    padding: 30px;
}

.overlay-content h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 12px;
}

.overlay-content p {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.02em;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

/* ===== Mobile Controls ===== */
.controls-mobile {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.ctrl-row {
    display: flex;
    gap: 6px;
}

.ctrl-btn {
    width: 56px;
    height: 56px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.ctrl-btn:active {
    background: var(--accent);
    color: #000;
    transform: scale(0.92);
}

/* ===== Footer ===== */
footer {
    width: 100%;
    text-align: center;
}

.info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.hint {
    font-size: 0.72rem;
    color: var(--text-dim);
    opacity: 0.6;
}

kbd {
    display: inline-block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 0.7rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 12px;
        gap: 10px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .score-box {
        padding: 4px 10px;
        min-width: 64px;
    }

    .score-value {
        font-size: 1.1rem;
    }

    .controls-mobile {
        display: flex;
    }

    .hint {
        display: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    .controls-mobile {
        display: flex;
    }
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.score-pop {
    animation: pulse 0.3s ease;
}

/* ===== Game Over specific ===== */
.game-over-title {
    color: var(--danger);
}

.new-record {
    color: var(--gold);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
}
.settings-group {
    margin-bottom: 25px;
    width: 100%;
}

.settings-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#speedValue {
    color: var(--accent);
    font-weight: 700;
}

/* Slankiklio stilius */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    margin-top: -7px;
    box-shadow: 0 0 10px var(--accent-glow);
    border: 2px solid var(--surface);
}
/* Pridėti failo pabaigoje */

.action-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-top: 10px;
}

.action-btn {
    flex: 1;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.pause {
    background: var(--gold);
    color: #000;
}

.action-btn.stop {
    background: var(--danger);
    color: #fff;
}

.action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

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

/* Rodyti tik mobiliuose arba mažuose ekranuose */
@media (max-width: 768px), (pointer: coarse) {
    .controls-mobile { display: flex; }
    .hint { display: none; }
    footer { display: none; } /* Slėpiame, kad neatimtų vietos iš mygtukų */
}


}