.game-wrapper {
    width: 100%;
    max-width: 1000px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 10;
    height: 100vh;
    box-sizing: border-box;
}

.game-header {
    width: 100%;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.score-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    margin-top: 0.5rem;
}

#game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 20px var(--primary);
    background: rgba(0,0,0,0.8);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 2px solid var(--primary);
    z-index: 100;
    white-space: nowrap;
}

.hidden { display: none !important; }

.canvas-container {
    width: 100%;
    flex-grow: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Mobile Controls */
.controls-overlay {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none; /* Let clicks pass through empty space */
}

.d-pad, .action-pad {
    display: flex;
    gap: 1rem;
    pointer-events: auto; /* Catch clicks on buttons */
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.control-btn:active, .control-btn.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}

.control-btn.action {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
}
.control-btn.action:active, .control-btn.action.active {
    background: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}

@media (min-width: 800px) {
    .controls-overlay {
        display: none; /* Hide on larger screens, assuming keyboard is present */
    }
}
@media (max-width: 600px) {
    .game-wrapper { padding: 0.5rem; }
    .game-header { padding-top: 2.5rem; }
    .back-btn { top: 0; transform: none; padding: 0.5rem; }
}
