/* ========================================
   Game Player
   ======================================== */

.game-player {
    position: fixed;
    top: 77px; /* Height of navbar to avoid overlap */
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.player-header {
    background: var(--background-light);
    padding: var(--spacing-md);
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    gap: var(--spacing-md);
    position: relative;
    z-index: 3000;
    min-height: 60px;
}

.exit-btn {
    flex-shrink: 0;
    position: relative;
    z-index: 3001;
}

.player-controls {
    flex-shrink: 0;
    position: relative;
    z-index: 3001;
}

.exit-btn,
.control-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: #1a1a2e;
    color: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    opacity: 1 !important;
    visibility: visible !important;
}

.exit-btn:hover,
.control-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--background);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(0);
}

.player-controls {
    display: flex !important;
    gap: var(--spacing-sm);
    align-items: center;
    flex-shrink: 0; /* Prevent controls from being hidden */
}

.player-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

#game-iframe {
    border: none;
    background: #000;
    max-width: 100%;
    max-height: 100%;
    width: 56.25vh;
    height: 100vh;
    aspect-ratio: 9 / 16;
}

.player-footer {
    background: var(--background-light);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.score-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

#current-score {
    color: var(--primary-color);
    font-weight: 700;
}

.game-status {
    color: var(--text-secondary);
}

/* iOS Fullscreen Fallback */
.ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--background) !important;
}

.ios-fullscreen .player-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--background-light);
}

/* Ensure controls are always visible in iOS fullscreen */
.ios-fullscreen .player-controls,
.ios-fullscreen .exit-btn {
    position: relative;
    z-index: 10001;
    pointer-events: auto;
}

.ios-fullscreen .player-container {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100vh - 60px) !important;
}

.ios-fullscreen iframe {
    width: 100% !important;
    height: 100% !important;
}

.ios-fullscreen .player-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
}

/* XP notification should appear above fullscreen */
.xp-notification {
    z-index: 99999 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .player-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .player-footer {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .player-controls {
        flex-wrap: wrap;
    }
    
    .control-btn {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}
