body {
    background: #1a1a1a;
    color: white;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: none;
}

.game-container {
    text-align: center;
    width: min(488px, calc(100% - 16px));
    width: min(
        488px,
        calc(100% - 16px),
        calc(75dvh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom))
    );
    max-height: 100%;
    margin: auto;
}

.dashboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d3748;
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    font-weight: bold;
    border: 4px solid #333;
    border-bottom: none;
    width: 100%;
    box-sizing: border-box;
}

.stat-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

button {
    background: #4a5568;
    color: white;
    border: none;
    min-height: 32px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.controls-col {
    align-items: flex-end;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 5px;
}

button:hover {
    background: #718096;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
}

canvas {
    background: #111;
    border: 4px solid #333;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Overlay Component UI styling rules */
.game-over-screen {
    position: absolute;
    inset: 4px;
    background: rgba(17, 24, 39, 0.85);
    /* Smooth dark background transparency tint */
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.game-over-screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.game-over-screen[data-state="start"] h2 {
    color: #f7fafc;
}

.game-over-screen[data-state="start"] #game-overlay-message {
    max-width: 320px;
    color: #cbd5e0;
    font-size: 16px;
    line-height: 1.5;
}

.game-over-screen[data-state="start"] #final-score-row {
    display: none !important;
}

.game-over-screen[data-state="start"] .restart-btn {
    background: #38a169;
}

.game-over-screen[data-state="start"] .restart-btn:hover {
    background: #2f855a;
}

.game-over-screen h2 {
    color: #f56565;
    font-size: 42px;
    margin: 0 0 10px 0;
    letter-spacing: 2px;
}

.game-over-screen p {
    font-size: 20px;
    margin: 5px 0;
}

.api-status {
    font-size: 14px;
    color: #a0aec0;
    margin-bottom: 20px !important;
}

.restart-btn {
    background: #e53e3e;
    font-size: 18px;
    padding: 10px 24px;
}

.restart-btn:hover {
    background: #c53030;
}

@media (max-width: 420px), (max-height: 740px) {
    .dashboard {
        padding: 7px 9px;
        font-size: 14px;
    }

    button {
        min-height: 30px;
        padding: 4px 7px;
        font-size: 11px;
    }

    .game-container {
        width: min(488px, calc(100% - 12px));
        width: min(
            488px,
            calc(100% - 12px),
            calc(75dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom))
        );
    }
}
