/* ========== PROFESSIONAL GAME EXPERIENCE ========== */

/* Full-screen Game Overlay */
.game-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.97) 0%, rgba(10, 10, 20, 0.99) 100%);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.game-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Game Top Bar */
.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.game-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-back-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.game-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.game-back-btn svg {
    width: 22px;
    height: 22px;
}

.game-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-title svg {
    width: 26px;
    height: 26px;
    color: #0a84ff;
}

.game-live-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.2), rgba(48, 209, 88, 0.1));
    border: 1px solid rgba(48, 209, 88, 0.4);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #32d74b;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.game-live-badge .dot {
    width: 8px;
    height: 8px;
    background: #32d74b;
    border-radius: 50%;
    animation: dot-pulse 1.5s infinite;
}

@keyframes dot-pulse {

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

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

/* Game Main Area */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ===== GAME LOBBY ===== */
.game-lobby {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 32px;
}

.game-lobby.hidden {
    display: none;
}

.lobby-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #0a84ff, #5856d6);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 15px 40px rgba(10, 132, 255, 0.3);
}

.lobby-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.lobby-header {
    text-align: center;
}

.lobby-header h2 {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
}

.lobby-header p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 15px;
    max-width: 280px;
}

/* Game Selection Cards */
.game-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 380px;
}

.game-select-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 28px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-select-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-select-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #0a84ff;
    box-shadow: 0 25px 50px rgba(10, 132, 255, 0.25);
}

.game-select-card:hover::before {
    opacity: 1;
}

.game-select-card:active {
    transform: translateY(-4px) scale(0.98);
}

.game-card-emoji {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.game-select-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.game-select-card p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
}

/* Partner Invited Badge */
.invite-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #32d74b;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: invite-bounce 1s infinite;
}

@keyframes invite-bounce {

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

    50% {
        transform: translateY(-3px);
    }
}

/* ===== GAME ARENA ===== */
.game-arena {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.game-arena.active {
    display: flex;
}

/* Player Scoreboard */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
}

.player-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.player-card.reverse {
    flex-direction: row-reverse;
}

.player-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    position: relative;
}

.player-avatar.you {
    background: linear-gradient(135deg, #0a84ff, #5856d6);
    color: white;
}

.player-avatar.them {
    background: linear-gradient(135deg, #ff453a, #ff9500);
    color: white;
}

.player-avatar .turn-ring {
    position: absolute;
    inset: -4px;
    border: 3px solid #32d74b;
    border-radius: 20px;
    animation: turn-glow 1s infinite;
    display: none;
}

.player-avatar.active .turn-ring {
    display: block;
}

@keyframes turn-glow {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(48, 209, 88, 0.5);
    }

    50% {
        opacity: 0.6;
        box-shadow: 0 0 20px rgba(48, 209, 88, 0.3);
    }
}

.player-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.player-score-display {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.player-score-display strong {
    font-size: 20px;
    font-weight: 700;
    margin-left: 4px;
}

.player-card.you .player-score-display strong {
    color: #0a84ff;
}

.player-card.them .player-score-display strong {
    color: #ff453a;
}

.vs-divider {
    text-align: center;
}

.vs-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
}

/* Turn Status Bar */
.turn-status {
    padding: 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.turn-status-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.turn-status-inner.your-turn {
    background: rgba(10, 132, 255, 0.15);
    color: #0a84ff;
    border: 1px solid rgba(10, 132, 255, 0.3);
}

.turn-status-inner.their-turn {
    background: rgba(255, 159, 10, 0.12);
    color: #ff9f0a;
    border: 1px solid rgba(255, 159, 10, 0.25);
}

.turn-status-inner svg {
    width: 18px;
    height: 18px;
}

/* Game Board Area */
.game-board-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

/* ===== TIC TAC TOE ===== */
.ttt-game {
    width: 100%;
    max-width: 320px;
}

.ttt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.ttt-cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    font-weight: 900;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: white;
    position: relative;
}

.ttt-cell:hover:not(.taken) {
    transform: scale(1.08);
    border-color: #0a84ff;
    background: rgba(10, 132, 255, 0.08);
}

.ttt-cell.taken {
    cursor: default;
}

.ttt-cell.x {
    color: #0a84ff;
    text-shadow: 0 0 40px rgba(10, 132, 255, 0.6);
}

.ttt-cell.o {
    color: #ff453a;
    text-shadow: 0 0 40px rgba(255, 69, 58, 0.6);
}

.ttt-cell.winning {
    animation: cell-win 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(48, 209, 88, 0.15);
    border-color: #32d74b;
}

@keyframes cell-win {

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

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

.game-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.game-action-btn {
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-action-btn:hover {
    background: #0a84ff;
    border-color: #0a84ff;
    transform: translateY(-2px);
}

.game-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Game Result Modal */
.game-result-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 10;
    animation: modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-result-modal.visible {
    display: flex;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    font-size: 96px;
    animation: result-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes result-pop {
    0% {
        transform: scale(0) rotate(-20deg);
    }

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

.result-title {
    font-size: 36px;
    font-weight: 800;
}

.result-title.won {
    background: linear-gradient(135deg, #32d74b, #30d158);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-title.lost {
    color: #ff453a;
}

.result-title.draw {
    color: #ff9f0a;
}

.result-actions {
    display: flex;
    gap: 12px;
}

.result-btn {
    padding: 16px 36px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-btn.primary {
    background: #0a84ff;
    color: white;
}

.result-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(10, 132, 255, 0.4);
}

.result-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.result-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.result-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== WOULD YOU RATHER ===== */
.wyr-game {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    overflow-y: auto;
}

.wyr-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.wyr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a84ff, #bf5af2);
    width: 10%;
    transition: width 0.5s ease;
    border-radius: 2px;
}

.wyr-question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 0;
}

.wyr-category-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.wyr-category-badge svg {
    width: 14px;
    height: 14px;
    color: #0a84ff;
}

.wyr-question-header {
    text-align: center;
}

.wyr-question-label {
    font-size: 24px;
    font-weight: 800;
    color: white;
    display: block;
    margin-bottom: 6px;
}

.wyr-question-number {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.wyr-choices {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    gap: 14px;
    position: relative;
}

.wyr-choice-btn {
    position: relative;
    padding: 20px 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.wyr-choice-btn:hover:not(.selected):not(.revealed) {
    transform: translateY(-4px) scale(1.02);
    border-color: #0a84ff;
}

.wyr-choice-btn.selected {
    border-color: #32d74b;
    background: linear-gradient(160deg, rgba(48, 209, 88, 0.2) 0%, rgba(48, 209, 88, 0.05) 100%);
}

.wyr-choice-emoji {
    font-size: 32px;
    margin-bottom: 10px;
}

.wyr-choice-text {
    font-size: 15px;
    font-weight: 600;
    color: white;
    line-height: 1.4;
}

.wyr-choice-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    background: #32d74b;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.wyr-choice-btn.selected .wyr-choice-indicator {
    display: flex;
}

.wyr-choice-indicator svg {
    width: 14px;
    height: 14px;
    color: white;
}

.wyr-vs-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

.wyr-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wyr-action-btn {
    padding: 12px 24px;
    background: #0a84ff;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wyr-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wyr-action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.wyr-action-btn svg {
    width: 16px;
    height: 16px;
}

.wyr-session-score {
    display: flex;
    justify-content: center;
    gap: 36px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    flex-shrink: 0;
}

.wyr-score-item {
    text-align: center;
}

.wyr-score-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.wyr-score-value {
    font-size: 20px;
    font-weight: 800;
    color: white;
}

.wyr-score-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

/* Session Stats */
.session-stats {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    gap: 32px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 500px) {
    .game-selection {
        gap: 12px;
    }

    .game-select-card {
        padding: 24px 16px;
    }

    .game-card-emoji {
        font-size: 40px;
    }

    .ttt-cell {
        font-size: 40px;
        border-radius: 16px;
    }

    .ttt-grid {
        gap: 10px;
    }

    .scoreboard {
        padding: 12px 16px;
    }

    .player-avatar {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}