/* 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 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

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

.panel-head-text {
    min-width: 0;
}

.icon-btn {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--gray-light);
    background: #fff;
    color: var(--dark);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.icon-btn:hover {
    transform: scale(1.08);
}

.icon-btn:active {
    transform: scale(0.96);
}

.icon-btn.muted {
    background: #e5e7eb;
    opacity: 0.7;
}

#game-settings {
    margin-bottom: 1rem;
    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;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: var(--darker);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
}

.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.2rem;
}

.score-player-1 {
    color: #60a5fa;
}

.score-player-2 {
    color: #fbbf24;
}

.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;
}

.win-message {
    color: var(--warning);
    font-size: 1.1rem;
    animation: celebrate 0.5s ease;
}

.tie-message {
    color: var(--gray);
}

#board {
    display: grid;
    gap: 0.5rem;
    width: 100%;
    max-width: 820px;
}

.gw-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--primary);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.gw-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.gw-face {
    position: absolute;
    inset: 0;
    background-size: 600% 400%;
    background-repeat: no-repeat;
    background-color: var(--primary);
    transition: opacity 0.3s ease, filter 0.3s ease;
    pointer-events: none;
    image-rendering: -webkit-optimize-contrast;
}

.gw-flip {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #14181f, #232a35);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.1);
    font-size: 2rem;
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.gw-card.eliminated .gw-face {
    opacity: 0.15;
    filter: grayscale(1);
}

.gw-card.eliminated .gw-flip {
    opacity: 1;
}

.gw-card.correct {
    animation: correctPulse 0.7s ease;
    box-shadow: 0 0 0 3px #4ade80, 0 0 18px rgba(74, 222, 128, 0.7);
    z-index: 2;
}

.gw-card.wrong-guess {
    animation: cardShake 0.45s ease;
    box-shadow: 0 0 0 3px #ef4444, 0 0 18px rgba(239, 68, 68, 0.7);
    z-index: 2;
}

@keyframes correctPulse {

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

    50% {
        transform: scale(1.08);
    }
}

@keyframes cardShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.gw-guess {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--dark);
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
    z-index: 3;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.gw-card:hover .gw-guess {
    opacity: 1;
}

.gw-guess:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.15);
}

#question-panel {
    width: 100%;
    max-width: 820px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 0.75rem;
}

#question-panel::before {
    content: 'Ask a question';
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    margin-bottom: 0.6rem;
}

#question-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.gw-question {
    font-family: var(--font-primary);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.2;
}

.gw-question:hover:not(.used) {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.gw-question.used {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
    text-decoration: line-through;
}

.controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.record {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    letter-spacing: 0.02em;
}

.key-hint {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.32);
    text-align: center;
    margin: 0;
    letter-spacing: 0.03em;
}

.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);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    text-align: center;
    padding: 1rem;
    z-index: 10;
}

.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.5rem;
}

.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);
    margin-bottom: 0.5rem;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

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

    50% {
        transform: scale(1.1);
    }

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

#confetti {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
}

@media (max-width: 768px) {
    #board {
        gap: 0.35rem;
    }

    .gw-flip {
        font-size: 1.4rem;
    }

    .gw-guess {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }
}

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

    #board {
        gap: 0.25rem;
    }

    .gw-question {
        font-size: 0.68rem;
        padding: 0.35rem 0.6rem;
    }

    .gw-flip {
        font-size: 1rem;
    }

    .gw-guess {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
        top: 3px;
        right: 3px;
    }

    .key-hint {
        display: none;
    }
}

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

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

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