/* ============================================
   MOBILE FIXES & GAME TEAMS SIDEBAR
   إصلاحات الجوال وقائمة الفرق الجانبية
   ============================================ */

/* ============= HARD REFRESH BUTTON ============= */
.hard-refresh-btn {
    background: rgba(124, 58, 237, 0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hard-refresh-btn:hover {
    background: rgba(124, 58, 237, 0.4);
    transform: rotate(180deg);
}

.hard-refresh-btn:active {
    transform: rotate(360deg) scale(0.95);
}

/* زيادة حجم الزر على الجوال ليكون أوضح */
@media (max-width: 768px) {
    .header-controls {
        gap: 10px !important;
    }
    
    .hard-refresh-btn {
        font-size: 1.3rem !important;
        padding: 8px 10px !important;
        background: rgba(124, 58, 237, 0.4) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        min-width: 40px;
        min-height: 40px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
    }
    
    .hard-refresh-btn:hover,
    .hard-refresh-btn:active {
        background: rgba(124, 58, 237, 0.6) !important;
    }
}

@media (max-width: 480px) {
    .hard-refresh-btn {
        font-size: 1.1rem !important;
        padding: 6px 8px !important;
        min-width: 36px;
        min-height: 36px;
    }
}

/* ============= GUEST MODE BUTTON ============= */
.guest-divider {
    display: flex;
    align-items: center;
    margin: 15px 0;
    color: var(--text-secondary);
}

.guest-divider::before,
.guest-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.3), transparent);
}

.guest-divider span {
    padding: 0 15px;
    font-size: 0.9rem;
}

.btn-guest {
    width: 100%;
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.3), rgba(80, 80, 80, 0.5));
    border: 2px dashed rgba(124, 58, 237, 0.4);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-guest:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.3));
    border-color: rgba(124, 58, 237, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.2);
}

.btn-guest .btn-icon {
    font-size: 1.2rem;
}

/* ============= ACTIVE ROOMS SIDEBAR (RIGHT) ============= */
.active-rooms-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    max-height: 70vh;
    background: rgba(26, 26, 26, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 15px 0 0 15px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-right: none;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    overflow: hidden;
}

.active-rooms-sidebar.collapsed {
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.rooms-sidebar-header {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rooms-sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 1rem;
    font-weight: bold;
}

.rooms-refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1rem;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.rooms-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.rooms-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.active-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rooms-loading {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.rooms-loading .loading-spinner {
    display: inline-block;
    width: 25px;
    height: 25px;
    border: 3px solid rgba(124, 58, 237, 0.3);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.rooms-empty {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-secondary);
}

.rooms-empty .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
    opacity: 0.6;
}

.rooms-empty p {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
}

.rooms-empty small {
    opacity: 0.7;
    font-size: 0.8rem;
}

/* Room Card */
.room-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.room-card:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateX(-5px);
}

.room-card:hover::before {
    opacity: 1;
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.room-code {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
}

.room-status {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.room-status.waiting {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.room-status.playing {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.room-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.room-players-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.room-players-info .team-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-players-info .vs {
    color: #f59e0b;
    font-weight: bold;
    font-size: 0.75rem;
}

.room-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.room-category-tag {
    background: rgba(124, 58, 237, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.room-join-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.room-join-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

.room-join-btn:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rooms-sidebar-footer {
    padding: 8px 15px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.rooms-sidebar-footer small {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Rooms Toggle Button */
.rooms-toggle-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 15px 0 0 15px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 1.2rem;
}

.rooms-toggle-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.5);
}

.rooms-toggle-btn.sidebar-open {
    right: 280px;
    border-radius: 15px 0 0 15px;
}

.rooms-count-badge {
    background: #ec4899;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Scrollbar for rooms list */
.rooms-sidebar-content::-webkit-scrollbar {
    width: 5px;
}

.rooms-sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.rooms-sidebar-content::-webkit-scrollbar-thumb {
    background: #7c3aed;
    border-radius: 3px;
}

/* Mobile adjustments for rooms sidebar */
@media (max-width: 768px) {
    .active-rooms-sidebar {
        width: 260px;
        max-height: 60vh;
        top: auto;
        bottom: 80px;
        right: 10px;
        transform: none;
        border-radius: 15px;
        border: 2px solid rgba(124, 58, 237, 0.4);
    }
    
    .active-rooms-sidebar.collapsed {
        transform: translateX(120%);
    }
    
    .rooms-toggle-btn {
        right: 10px;
        bottom: 20px;
        top: auto;
        transform: none;
        border-radius: 15px;
        padding: 10px 12px;
    }
    
    .rooms-toggle-btn:hover {
        transform: scale(1.05);
    }
    
    .rooms-toggle-btn.sidebar-open {
        right: 10px;
    }
    
    .room-card {
        padding: 10px;
    }
    
    .room-code {
        font-size: 1rem;
    }
}

/* ============= TEAMS SIDEBAR (GAME SCREEN) ============= */
.game-teams-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 15px 0 0 15px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-right: none;
    padding: 15px;
    z-index: 100;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.game-teams-sidebar.collapsed {
    transform: translateY(-50%) translateX(160px);
}

.game-teams-sidebar .sidebar-toggle {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: white;
    width: 30px;
    height: 60px;
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.game-teams-sidebar .sidebar-toggle:hover {
    width: 35px;
}

.game-teams-sidebar.collapsed .sidebar-toggle {
    transform: translateY(-50%) rotate(180deg);
}

.sidebar-team {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-team:last-child {
    margin-bottom: 0;
}

.sidebar-team.team-1 {
    border-left: 3px solid #3b82f6;
}

.sidebar-team.team-2 {
    border-left: 3px solid #ef4444;
}

.sidebar-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-team-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sidebar-team-score {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: bold;
}

.sidebar-players {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-player {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 3px 5px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sidebar-player.current-turn {
    background: rgba(124, 58, 237, 0.2);
    color: var(--primary-color);
    font-weight: bold;
}

.sidebar-player .host-badge {
    font-size: 0.7rem;
}

/* ============= HIDE OLD SIDEBAR - USE INLINE DISPLAY ============= */
.game-teams-sidebar {
    display: none !important;
}

/* ============= INLINE TEAMS DISPLAY ============= */
.inline-teams-display {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    flex-wrap: wrap;
}

.inline-team {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    text-align: center;
}

.inline-team.team-1 {
    border: 2px solid #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.inline-team.team-2 {
    border: 2px solid #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.inline-team.current-turn {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
    border-color: var(--primary-color);
}

.inline-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.inline-team-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.inline-team-score {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
}

.inline-players {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inline-player {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.inline-player.is-me {
    background: rgba(124, 58, 237, 0.2);
    color: var(--primary-color);
    font-weight: bold;
}

.inline-player .host-badge {
    font-size: 0.75rem;
}

.inline-vs {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    padding: 10px;
    align-self: center;
}

/* Mobile adjustments for inline teams */
@media (max-width: 600px) {
    .inline-teams-display {
        gap: 10px;
        padding: 10px;
    }
    
    .inline-team {
        min-width: 120px;
        padding: 10px;
    }
    
    .inline-team-name {
        font-size: 0.8rem;
    }
    
    .inline-player {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    
    .inline-vs {
        font-size: 1rem;
        padding: 5px;
    }
}

/* ============= PLAYER ITEM FIXES ============= */
.player-item {
    background: var(--bg-secondary);
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
    min-height: 50px;
}

.player-item:hover {
    background: rgba(124, 58, 237, 0.1);
    transform: translateX(-3px);
}

.player-item .player-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.player-item .player-name,
.player-item span:not(.host-badge):not(.player-icon):not(.disconnected-badge) {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-item .host-badge {
    flex-shrink: 0;
    font-size: 1rem;
    margin-right: 0;
    animation: glow 2s ease-in-out infinite;
}

.player-item .disconnected-badge {
    flex-shrink: 0;
    opacity: 0.7;
}

.player-item.is-host {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Fix duplicate host badge */
.player-item.is-host::after {
    display: none !important;
}

/* ============= MOBILE GAME SCREEN FIXES ============= */
@media (max-width: 768px) {
    /* Hide sidebar on mobile */
    .game-teams-sidebar {
        display: none;
    }
    
    /* Fixed score header for mobile */
    .game-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: rgba(15, 15, 15, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 10px 15px;
        margin-bottom: 0;
        border-bottom: 2px solid var(--border-color);
    }
    
    .game-scores {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        grid-template-columns: unset !important;
    }
    
    .score-box {
        flex: 1;
        padding: 8px 10px;
        border-radius: 10px;
        max-width: 120px;
    }
    
    .score-box .team-name {
        font-size: 0.75rem;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .score-box .score {
        font-size: 1.5rem;
    }
    
    .timer-box {
        width: 60px;
        height: 60px;
        padding: 8px;
        flex-shrink: 0;
    }
    
    .timer-box #timer,
    .timer-box #singleTimer {
        font-size: 1.4rem;
    }
    
    .timer-label {
        font-size: 0.65rem;
    }
    
    /* Add padding to game container for fixed header */
    #gameScreen .game-container,
    #singleGameScreen .game-container {
        padding-top: 100px !important;
        padding-bottom: 20px;
    }
    
    /* Question container mobile fixes */
    .question-container {
        padding: 1.2rem;
        margin: 0 10px;
        border-radius: 15px;
    }
    
    .question-info {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .anime-tag, .difficulty-tag {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    .question {
        font-size: 1.15rem !important;
        line-height: 1.6;
        margin-bottom: 15px;
    }
    
    .current-turn {
        font-size: 0.95rem;
        padding: 8px 12px;
        margin-bottom: 15px;
    }
    
    /* Options mobile fixes */
    .options {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    .option-btn {
        padding: 15px;
        font-size: 1rem;
        min-height: 55px;
        text-align: center;
    }
    
    /* Game actions mobile */
    .game-actions {
        flex-direction: column;
        gap: 8px !important;
        margin-top: 15px !important;
    }
    
    .game-actions .btn {
        width: 100%;
        font-size: 0.9rem !important;
        padding: 10px !important;
    }
    
    /* Single player header fixes */
    .single-game-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: rgba(15, 15, 15, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 10px 15px;
        margin-bottom: 0;
        border-bottom: 2px solid var(--border-color);
    }
    
    .single-stats {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        grid-template-columns: unset !important;
        margin-bottom: 8px;
    }
    
    .stat-box {
        flex: 1;
        padding: 6px 8px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    /* Single player actions */
    .single-player-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
    }
    
    .single-player-actions .btn {
        width: 100%;
    }
    
    /* Text answer container mobile */
    .text-answer-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .text-answer-input {
        font-size: 1.1rem;
        padding: 15px;
        min-height: 50px;
    }
    
    .submit-text-btn {
        width: 100%;
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    /* Answer result modal mobile */
    .answer-result {
        min-width: unset !important;
        width: 90% !important;
        max-width: 350px;
        padding: 1.5rem;
    }
    
    .result-icon {
        font-size: 3rem;
    }
    
    .result-text {
        font-size: 1.2rem;
    }
    
    /* Header adjustments */
    .header {
        padding: 1rem 0.5rem;
        padding-top: 50px; /* Space for controls */
    }
    
    .main-title {
        font-size: 1.4rem;
        gap: 0.5rem;
    }
    
    .title-emoji {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
        padding: 0 10px;
    }
}

/* ============= EXTRA SMALL MOBILE (< 400px) ============= */
@media (max-width: 400px) {
    .game-scores {
        gap: 5px;
    }
    
    .score-box {
        padding: 6px 8px;
        max-width: 100px;
    }
    
    .score-box .team-name {
        font-size: 0.65rem;
    }
    
    .score-box .score {
        font-size: 1.3rem;
    }
    
    .timer-box {
        width: 50px;
        height: 50px;
    }
    
    .timer-box #timer,
    .timer-box #singleTimer {
        font-size: 1.2rem;
    }
    
    .question {
        font-size: 1rem !important;
    }
    
    .option-btn {
        font-size: 0.9rem;
        padding: 12px;
        min-height: 50px;
    }
    
    .main-title {
        font-size: 1.2rem;
    }
    
    .title-emoji {
        font-size: 1.5rem;
    }
}

/* ============= ROOM SCREEN MOBILE FIXES ============= */
@media (max-width: 768px) {
    .room-container {
        padding: 10px;
    }
    
    .room-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .room-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .room-info h2 {
        font-size: 1.1rem;
    }
    
    #roomCodeDisplay {
        font-size: 1.1rem;
    }
    
    .teams-container {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .vs-separator {
        order: 0;
        margin: 5px 0;
        font-size: 1.8rem;
    }
    
    .team {
        max-width: 100%;
        padding: 1rem;
    }
    
    .team-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .team-name-input {
        width: 100%;
        font-size: 1.1rem;
    }
    
    .team-score {
        font-size: 0.95rem;
    }
    
    .team-players {
        min-height: 100px;
    }
    
    .btn-join-team {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .game-settings {
        padding: 12px;
    }
    
    .game-settings h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .setting-item label {
        font-size: 0.85rem;
    }
    
    .select-field {
        padding: 10px;
        font-size: 0.95rem;
    }
    
    .room-actions {
        padding: 10px;
        gap: 10px;
    }
    
    .room-actions .btn-large {
        padding: 12px 20px;
        font-size: 1.1rem;
    }
}

/* ============= NOTIFICATIONS MOBILE ============= */
@media (max-width: 768px) {
    .notifications {
        top: 60px;
        left: 10px;
        right: 10px;
        transform: none;
        width: auto;
    }
    
    .notification {
        min-width: unset;
        font-size: 0.9rem;
        padding: 10px 12px;
    }
}

/* ============= FOOTER MOBILE ============= */
@media (max-width: 768px) {
    .footer {
        padding: 1rem;
    }
    
    .copyright {
        font-size: 0.8rem;
    }
}

/* ============= LANDSCAPE MODE FIXES ============= */
@media (orientation: landscape) and (max-height: 500px) {
    .game-header,
    .single-game-header {
        padding: 5px 10px;
    }
    
    .score-box {
        padding: 5px 8px;
    }
    
    .timer-box {
        width: 45px;
        height: 45px;
    }
    
    #gameScreen .game-container,
    #singleGameScreen .game-container {
        padding-top: 70px !important;
    }
    
    .question {
        font-size: 1rem !important;
    }
    
    .option-btn {
        padding: 10px;
        min-height: 45px;
    }
}

/* ============= SAFE AREA INSETS (Notch devices) ============= */
@supports (padding: max(0px)) {
    .game-header,
    .single-game-header {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .game-teams-sidebar {
        right: max(0px, env(safe-area-inset-right));
    }
}

/* ============= PREVENT LAYOUT SHIFT ============= */
.team-players {
    min-height: 120px;
}

.player-item {
    height: auto;
    min-height: 50px;
}

/* Stable animation for player items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============= DISABLE ANIMATIONS ON PREFER REDUCED MOTION ============= */
@media (prefers-reduced-motion: reduce) {
    .player-item,
    .game-teams-sidebar,
    .notification {
        animation: none;
        transition: none;
    }
}
