/* public/css/games.css - Game Runtime & Modular Templates */

.game-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    color: var(--text-main);
}

/* Game HUD (Head-Up Display) */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.game-title-group h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.game-metrics {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.hud-metric-pill {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-main);
}

.hud-metric-pill.timer {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.4);
}

.hud-metric-pill.score {
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.4);
}

.hud-metric-pill.combo {
    color: var(--accent-purple);
    border-color: rgba(168, 85, 247, 0.4);
}

/* Timer Bar */
.game-timer-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.game-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    width: 100%;
    transition: width 1s linear;
}

/* TEMPLATE 1: Quiz Challenge / Time Attack (IP Hunter) */
.quiz-challenge-board {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.challenge-question-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-main);
}

.challenge-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.challenge-opt-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.5rem;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.challenge-opt-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.challenge-opt-btn.correct {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--accent-emerald) !important;
    color: #059669 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.challenge-opt-btn.wrong {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--accent-rose) !important;
    color: #dc2626 !important;
    animation: shake 0.3s ease-in-out;
}

/* TEMPLATE 2: Matching Matrix */
.matching-matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.matching-card {
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    user-select: none;
}

.matching-card span {
    color: var(--text-main);
    transition: color var(--transition-fast);
}

.matching-card:hover {
    border-color: var(--primary-light);
    background: var(--bg-surface);
    transform: translateX(4px);
}

/* Selected state: High contrast, clearly readable on all themes */
.matching-card.selected {
    background: #4f46e5 !important;
    border-color: #3730a3 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
    transform: scale(1.02);
}

.matching-card.selected span {
    color: #ffffff !important;
    font-weight: 700;
}

/* Matched state */
.matching-card.matched {
    background: rgba(16, 185, 129, 0.18) !important;
    border-color: var(--accent-emerald) !important;
    color: #059669 !important;
    pointer-events: none;
    opacity: 0.9;
}

.matching-card.matched span {
    color: #059669 !important;
    font-weight: 700;
}

/* Wrong / Mismatched state */
.matching-card.wrong {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--accent-rose) !important;
    color: #dc2626 !important;
    animation: shake 0.3s ease-in-out;
}

.matching-card.wrong span {
    color: #dc2626 !important;
    font-weight: 700;
}

/* TEMPLATE 3: Drag & Drop Sorter */
.drag-drop-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.drag-items-pool {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 80px;
    align-items: center;
}

.draggable-card {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.15rem;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: grab;
    user-select: none;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-fast);
}

.draggable-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.draggable-card:active {
    cursor: grabbing;
    transform: scale(1.05);
    background: var(--primary);
    color: #ffffff !important;
}

.drag-drop-zones-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.drop-zone {
    background: var(--bg-surface-elevated);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all var(--transition-fast);
}

.drop-zone.drag-over {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.drop-zone-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-cyan);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

@media (max-width: 768px) {
    .challenge-options-grid { grid-template-columns: 1fr; }
    .matching-matrix-grid { grid-template-columns: 1fr; }
    .drag-drop-zones-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   WAYGROUND LIVE ARENA LOBBY & ANIMATED AVATARS (THEME: CYBER ARENA)
   ========================================================================= */

@keyframes waygroundPopIn {
    0% {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.18) rotate(4deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes waygroundBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
}

@keyframes waygroundFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-6px) rotate(-3deg);
    }
    75% {
        transform: translateY(4px) rotate(3deg);
    }
}

@keyframes waygroundGlowRing {
    0%, 100% {
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.4), inset 0 0 15px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(6, 182, 212, 0.7), inset 0 0 25px rgba(6, 182, 212, 0.4);
    }
}

@keyframes waygroundPulseBtn {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 0 35px rgba(16, 185, 129, 0.9);
    }
}

/* Arena Lobby Stage Container */
.wayground-lobby-stage {
    background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.2) 0%, rgba(15, 23, 42, 0.95) 75%),
                linear-gradient(180deg, #0b0f19 0%, #030712 100%);
    border: 2px solid rgba(99, 102, 241, 0.35);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.wayground-player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem 0;
    min-height: 220px;
}

.wayground-player-card {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 1.25rem 1rem;
    text-align: center;
    position: relative;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: waygroundPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    cursor: default;
}

.wayground-player-card:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: rgba(6, 182, 212, 0.8);
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.35);
}

.wayground-avatar-sprite {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto 0.75rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    animation: waygroundFloat 3s ease-in-out infinite;
}

.wayground-avatar-sprite.bounce-on-join {
    animation: waygroundBounce 1.5s ease-in-out infinite;
}

.wayground-player-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.wayground-player-tag {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 600;
}

.wayground-player-card .btn-kick-player {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.5);
    opacity: 0.85;
    transform: scale(0.9);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.wayground-player-card:hover .btn-kick-player {
    opacity: 1;
    transform: scale(1.1);
}

.wayground-player-card .btn-kick-player:hover {
    background: #b91c1c;
    transform: scale(1.25);
}

/* 💎 AQUA FROST HIGH-TECH GAME HUD & CARDS */
[data-theme="aqua-frost"] .game-container {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    border: 1.5px solid rgba(6, 182, 212, 0.35);
    box-shadow: 0 12px 35px -5px rgba(6, 182, 212, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="aqua-frost"] .hud-metric-pill {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.35);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.12);
}


