body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #050510;
    color: white;
    font-family: monospace;
    overflow: hidden;
    touch-action: none;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
}

#score-board {
    padding: 20px;
    font-size: 1.2rem;
    text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 30, 0.9);
    padding: 30px;
    border: 1px solid #444;
    text-align: center;
    border-radius: 10px;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    transform: translate(-50%, 20px);
    padding: 10px 16px;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    background: rgba(10, 10, 30, 0.95);
    font-family: monospace;
    font-size: 0.8rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms, transform 180ms;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

button {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 20px;
    margin: 10px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
}

button:hover {
    background: #ccc;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #67e8f9;
    outline-offset: 3px;
}

#score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

#back-arcade-btn, #help-toggle-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid #555;
    padding: 6px 12px;
    font-size: 0.85rem;
    margin: 0;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-shadow: none;
    -webkit-user-select: none;
    user-select: none;
}

#back-arcade-btn:hover, #help-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #00bfff;
    color: white;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.2);
}

@media (max-width: 600px) {
    #score-board {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    #score-metrics {
        order: -1;
        width: 100%;
        text-align: center;
        font-size: 0.95rem;
    }
}

#help-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 30, 0.95);
    padding: 25px;
    border: 2px solid #00bfff;
    border-radius: 10px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.35);
}

#help-panel h2 {
    color: #00bfff;
    margin-top: 0;
    margin-bottom: 20px;
}

.help-grid {
    display: grid;
    grid-template-columns: 85px 1fr;
    text-align: left;
    gap: 15px;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 20px;
}

.help-label {
    font-weight: bold;
    color: #00bfff;
}

.help-desc {
    color: #cccccc;
}

#close-help-btn {
    background: #00bfff;
    color: #000;
    margin: 0;
}

#close-help-btn:hover {
    background: #008bbf;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
