:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --grid-color: rgba(255, 255, 255, 0.1);
    --triangle-border: rgba(255, 255, 255, 0.2);
}

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

.container {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    padding: 2rem;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 100%;
}

.game-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 200px;
}

h1 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--accent-color);
    text-transform: uppercase;
}

.score-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 0.25rem;
}

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

.controls {
    font-size: 0.875rem;
    line-height: 1.6;
    opacity: 0.8;
}

.controls kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-family: inherit;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

canvas {
    background: #000;
    border-radius: 0.5rem;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
    display: block;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    padding: 3rem 2rem;
    border-radius: 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: none;
    z-index: 10;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    animation: fadeInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 240px;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.game-over h2 {
    margin: 0 0 0.5rem 0;
    color: #ff3b3b;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 59, 59, 0.4);
}

.game-over p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

#finalScore {
    display: block;
    font-size: 3rem;
    color: #fff;
    font-weight: 800;
    margin-top: 0.5rem;
    font-family: 'Monaco', 'Consolas', monospace;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.btn {
    background: linear-gradient(135deg, var(--accent-color), #00b4d8);
    color: #fff;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.mobile-controls {
    display: none;
    width: 100%;
    margin-top: 1rem;
}

.action-btn {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    touch-action: manipulation;
}

.action-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        height: 100vh;
        width: 100vw;
        box-sizing: border-box;
        overflow-y: auto;
    }

    .game-info {
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    h1 {
        font-size: 1.2rem;
        margin: 0;
    }

    .score-box {
        margin: 0;
        padding: 0.5rem 1rem;
        flex: 1;
    }

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

    .controls {
        display: none; /* Hide keyboard controls on mobile by default */
    }

    .mobile-controls {
        display: flex;
    }
    
    canvas {
        max-width: 100%;
        height: auto;
    }
}
