/* Copyright (c) 2024-2026 Jericho Crosby (Chalwk). All Rights Reserved. */

.panel {
    background: var(--light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

.panel-head h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

#game-settings {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

#game-settings label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

#game-settings select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    background: white;
    color: var(--dark);
    font-family: var(--font-primary);
    min-width: 120px;
}

#game-container {
    position: relative;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    background: var(--darker);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
}

/* score / status bar */
.game-stats {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "p1 status p2";
    align-items: center;
    width: 100%;
    gap: 0.5rem 0.75rem;
    padding: 0.25rem 0.5rem;
}

.stat-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.1;
}

.stat-block.player1 {
    grid-area: p1;
    align-items: flex-start;
}

.stat-block.player2 {
    grid-area: p2;
    align-items: flex-end;
}

.stat-block strong {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-block .score {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1;
}

.score-player-1 {
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.score-player-2 {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.5);
}

.status-block {
    grid-area: status;
    justify-self: center;
    min-width: 0;
}

#status {
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    color: #fff;
    white-space: nowrap;
}

/* board / canvas */
.board-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}

#gameCanvas {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    background: #050810;
    border-radius: var(--radius-sm);
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 0 40px rgba(126, 249, 255, 0.06) inset;
    outline: none;
    cursor: default;
}

#gameCanvas:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* floating powerup notification */
.powerup-message {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--accent);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border: 1px solid var(--accent);
    backdrop-filter: blur(5px);
    white-space: nowrap;
}

.powerup-message.show {
    opacity: 1;
}

/* button row (pause / sound) */
.game-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* overlays (menu, info, game over) */
.game-over-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    border-radius: var(--radius-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    text-align: center;
    padding: 1rem;
    z-index: 2;
}

.game-over-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.game-over-content {
    animation: celebrate 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    max-width: 400px;
}

.game-over-message {
    color: #fff;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.game-over-score {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

.game-over-content .menu-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.smallprint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    max-width: 320px;
    line-height: 1.4;
}

.info-content .info-list {
    text-align: left;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    line-height: 1.55;
    padding-left: 1.25rem;
    margin: 0.25rem 0 0.5rem;
}

.info-content .info-list li {
    margin-bottom: 0.2rem;
}

@keyframes celebrate {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* touch controls (mobile dpad) */
.touch-controls {
    display: flex;
    justify-content: center;
    margin-top: 0.25rem;
}

.touch-controls.hidden {
    display: none !important;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.tc-row {
    display: flex;
    gap: 0.25rem;
}

.btn-round {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-round:hover,
.btn-round:active {
    background: var(--accent);
    color: #06121a;
    transform: scale(1.08);
}

@media (max-width: 768px) {
    #game-settings {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem 1.25rem;
    }
}

@media (max-width: 480px) {
    #game-container {
        padding: 0.75rem 0.5rem;
    }

    #game-settings {
        gap: 0.5rem 0.75rem;
    }

    #game-settings select {
        min-width: 0;
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .stat-block .score {
        font-size: 1.2rem;
    }

    .game-over-message {
        font-size: 1.3rem;
    }

    .game-buttons .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.9rem;
    }

    .btn-round {
        width: 42px;
        height: 42px;
        font-size: 0.95rem;
    }
}

@media (max-width: 420px) {
    .game-stats {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "p1 p2"
            "status status";
    }

    .status-block {
        margin-top: 0.15rem;
    }
}