/**
 * Responsive - Mobile First
 */

/* ===================== */
/* Mobile (default) */
/* ===================== */

/* Header mobile */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }
    
    .header-center {
        order: -1;
        width: 100%;
        text-align: center;
    }
    
    .header-logo {
        font-size: var(--font-size-lg);
    }
    
    .user-details {
        display: none;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
    }
    
    /* Menu */
    .menu-tabs {
        padding: var(--spacing-sm);
    }
    
    .tab {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
    
    /* Rooms */
    .rooms-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }
    
    .rooms-grid {
        grid-template-columns: 1fr;
    }
    
    .join-code-form {
        flex-direction: column;
    }
    
    /* Leaderboard tabs */
    .leaderboard-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--spacing-sm);
    }
    
    .lb-tab {
        white-space: nowrap;
    }
    
    /* Profile */
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-level {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .badges-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Waiting room */
    .game-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .room-info {
        order: -1;
        width: 100%;
    }
    
    .room-settings {
        width: 100%;
        justify-content: center;
    }
    
    .players-list {
        gap: var(--spacing-sm);
    }
    
    .player-card {
        min-width: 100px;
        padding: var(--spacing-sm);
    }
    
    .player-avatar {
        width: 50px;
        height: 50px;
    }
    
    /* Game */
    .album-container {
        width: 150px;
        height: 150px;
    }
    
    .answer-container {
        flex-direction: column;
    }
    
    .mini-leaderboard {
        position: static;
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 100%;
        margin-bottom: var(--spacing-lg);
    }
    
    .mini-entry {
        flex: 0 0 auto;
    }
    
    .malus-bar {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }
    
    .malus-item {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-lg);
    }
    
    .timer-container {
        width: 60px;
        height: 60px;
    }
    
    .timer-text {
        font-size: var(--font-size-lg);
    }
    
    /* End screen */
    .winner-avatar {
        width: 80px;
        height: 80px;
    }
    
    .winner-title {
        font-size: var(--font-size-xxl);
    }
    
    .end-actions {
        flex-direction: column;
    }
    
    /* Modal */
    .modal-content {
        padding: var(--spacing-lg);
        margin: var(--spacing-sm);
        max-height: 85vh;
    }
    
    /* Login */
    .logo-text {
        font-size: var(--font-size-xxl);
    }
    
    .logo-subtitle {
        font-size: var(--font-size-md);
    }
    
    /* Toast */
    #toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* ===================== */
/* Tablet */
/* ===================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .rooms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mini-leaderboard {
        right: var(--spacing-md);
    }
}

/* ===================== */
/* Desktop */
/* ===================== */

@media (min-width: 1025px) {
    .rooms-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .badges-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ===================== */
/* Large Desktop */
/* ===================== */

@media (min-width: 1440px) {
    html {
        font-size: 18px;
    }
    
    .menu-content {
        max-width: 1400px;
    }
}

/* ===================== */
/* Landscape mobile */
/* ===================== */

@media (max-height: 500px) and (orientation: landscape) {
    #game-screen .game-header {
        padding: var(--spacing-xs);
    }
    
    .timer-container {
        width: 50px;
        height: 50px;
    }
    
    .album-container {
        width: 100px;
        height: 100px;
    }
    
    .visualizer {
        height: 30px;
        margin-bottom: var(--spacing-sm);
    }
    
    .answer-container {
        margin-bottom: var(--spacing-sm);
    }
    
    .malus-bar {
        bottom: var(--spacing-sm);
    }
}

/* ===================== */
/* Print */
/* ===================== */

@media print {
    .bg-effects,
    .btn,
    .modal,
    #toast-container {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ===================== */
/* Reduced Motion */
/* ===================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================== */
/* High Contrast */
/* ===================== */

@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #0a0a0a;
        --bg-card: #151515;
        --border-color: #ffffff;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
    }
    
    .btn-primary {
        border: 2px solid white;
    }
}

/* ===================== */
/* Touch devices */
/* ===================== */

@media (hover: none) and (pointer: coarse) {
    .btn:hover::before {
        display: none;
    }
    
    .card:hover,
    .room-card:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn {
        min-height: 48px;
    }
    
    .input {
        min-height: 48px;
    }
    
    .btn-icon {
        width: 48px;
        height: 48px;
    }
}
