/**
 * Top Head Guess - Main Game Styles
 * 
 * Features:
 * - Light & Dark mode via CSS variables
 * - RTL & LTR support
 * - Responsive design (portrait + landscape)
 * - 85/15 split (portrait) | 80/20 split (landscape)
 * - Animations & transitions
 */

/* ============================================
   CSS VARIABLES - LIGHT MODE (Default)
   ============================================ */
:root,
[data-theme="light"] {
    --bg-primary: #F8F9FA;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(255, 255, 255, 0.85);
    
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #B2BEC3;
    --text-on-primary: #FFFFFF;
    
    --color-primary: #6C5CE7;
    --color-primary-light: #A29BFE;
    --color-primary-dark: #5541D7;
    --color-secondary: #00CEC9;
    
    --color-correct: #00B894;
    --color-correct-light: #55EFC4;
    --color-pass: #FDCB6E;
    --color-error: #E17055;
    --color-premium: #FDCB6E;
    --color-premium-dark: #F39C12;
    
    --team-1: #FF6B6B;
    --team-2: #4ECDC4;
    --team-3: #FFE66D;
    --team-4: #A8E6CF;
    
    --border-color: #DFE6E9;
    --border-light: #F1F3F4;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-glow-green: 0 0 20px rgba(0, 184, 148, 0.4);
    --shadow-glow-yellow: 0 0 20px rgba(253, 203, 110, 0.4);
    
    --overlay-dark: rgba(0, 0, 0, 0.5);
    --overlay-correct: rgba(0, 184, 148, 0.2);
    --overlay-pass: rgba(253, 203, 110, 0.2);
    
    --ad-bg: #F1F3F4;
    --ad-text: #B2BEC3;
}

/* ============================================
   CSS VARIABLES - DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bg-primary: #1A1A2E;
    --bg-surface: #16213E;
    --bg-elevated: #1F2F50;
    --bg-overlay: rgba(22, 33, 62, 0.9);
    
    --text-primary: #EAEAEA;
    --text-secondary: #B2BEC3;
    --text-muted: #636E72;
    --text-on-primary: #FFFFFF;
    
    --color-primary: #A29BFE;
    --color-primary-light: #B8B3FE;
    --color-primary-dark: #6C5CE7;
    --color-secondary: #00D2D3;
    
    --color-correct: #55EFC4;
    --color-correct-light: #00B894;
    --color-pass: #FDCB6E;
    --color-error: #FF7675;
    --color-premium: #FFD32A;
    --color-premium-dark: #FDCB6E;
    
    --team-1: #FF8A80;
    --team-2: #69F0AE;
    --team-3: #FFD740;
    --team-4: #B9F6CA;
    
    --border-color: #2D3436;
    --border-light: #263238;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 24px rgba(85, 239, 196, 0.5);
    --shadow-glow-yellow: 0 0 24px rgba(253, 203, 110, 0.5);
    
    --overlay-dark: rgba(0, 0, 0, 0.7);
    --overlay-correct: rgba(85, 239, 196, 0.25);
    --overlay-pass: rgba(253, 203, 110, 0.25);
    
    --ad-bg: #16213E;
    --ad-text: #636E72;
}

/* ============================================
   GLOBAL RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    width: 100dvw;
    transition: background-color 0.3s ease, color 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 50;
    background-color: transparent;
    pointer-events: none;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
}

.top-bar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: none;
    border-radius: 20px;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    font-family: var(--font-body);
}

.top-bar-btn:active {
    transform: scale(0.95);
}

html[dir="rtl"] .top-bar-left {
    order: 1;
}
html[dir="rtl"] .top-bar-right {
    order: 0;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

/* ============================================
   SCREEN SYSTEM
   ============================================ */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SETUP SCREENS
   ============================================ */
.setup-screen {
    padding: 60px 20px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

#screen-setup-language {
    justify-content: center;
    padding-top: 50px;
    padding-bottom: 40px;
    min-height: 100vh;
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

.setup-screen .logo {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
}

.setup-screen h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.setup-screen .tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.setup-screen h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 8px;
}

/* ============================================
   LANDING BUTTONS
   ============================================ */
.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 85%;
    max-width: 340px;
    margin-top: 16px;
}

.screen-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 85%;
    max-width: 340px;
    margin-top: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 14px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: 100px;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover { background-color: var(--color-primary-dark); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 2px solid transparent;
}

.btn-success {
    background-color: var(--color-correct);
    color: white;
    box-shadow: var(--shadow-glow-green);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: 16px;
}

.btn-block { width: 100%; }

/* ============================================
   MODE CARDS (Side by Side)
   ============================================ */
.mode-cards-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-card {
    flex: 1;
    min-width: 140px;
    background-color: var(--bg-surface);
    border: 3px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mode-card.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
    color: white;
}

.mode-card .mode-icon { font-size: 2rem; margin-bottom: 6px; }
.mode-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.mode-card p { font-size: 0.8rem; color: var(--text-secondary); }
.mode-card.selected p { color: rgba(255, 255, 255, 0.8); }

/* Mode Options Dropdowns */
.mode-options {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-options.hidden { display: none; }

.mode-options select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1rem;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

/* ============================================
   TEAM INPUTS
   ============================================ */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.option-pill {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-pill.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.team-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.team-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-surface);
    border-radius: 12px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.team-input-group:focus-within { border-color: var(--color-primary); }

.team-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-input-group input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.team-input-group input::placeholder { color: var(--text-muted); }

/* ============================================
   CATEGORY GRID
   ============================================ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.category-tile {
    position: relative;
    background-color: var(--bg-surface);
    border: 3px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.category-tile.selected {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.category-tile .category-icon { font-size: 2rem; margin-bottom: 6px; }
.category-tile .category-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.category-tile .category-count { font-size: 0.75rem; color: var(--text-secondary); }

.category-tile .premium-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--color-premium);
    color: #2D3436;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
}

html[dir="rtl"] .category-tile .premium-badge {
    right: auto; left: 6px;
}

.category-tile .owned-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--color-correct);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
}

html[dir="rtl"] .category-tile .owned-badge {
    right: auto; left: 6px;
}

/* ============================================
   HANDOVER SCREEN
   ============================================ */
.handover-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}

.handover-screen .next-team-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.handover-screen .next-team-name {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.handover-screen .team-color-strip {
    height: 8px;
    width: 80%;
    margin: 0 auto 30px;
    border-radius: 4px;
}

.handover-screen .handover-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* ============================================
   COUNTDOWN SCREEN
   ============================================ */
.countdown-screen {
    justify-content: center;
    align-items: center;
    background-color: var(--bg-primary);
}

.countdown-number {
    font-family: var(--font-mono);
    font-size: 10rem;
    font-weight: 800;
    color: var(--color-primary);
    animation: countdownPop 0.8s ease-out;
}

.countdown-go {
    font-size: 6rem;
    color: var(--color-correct);
    animation: countdownGo 0.5s ease-out;
}

@keyframes countdownPop {
    0% { transform: scale(2); opacity: 0; }
    50% { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes countdownGo {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   GAMEPLAY SCREEN (Portrait: 85/15)
   ============================================ */
.gameplay-screen {
    flex-direction: column;
    background-color: var(--bg-primary);
}

/* Image Zone - 85% */
.image-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    position: relative;
    background-color: var(--bg-surface);
    min-height: 0;
}

.image-zone img {
    max-width: 98%;
    max-height: 98%;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.1s ease;
}

/* Pulse/Flash Overlay */
.image-zone .pulse-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    border-radius: 8px;
}

.image-zone .pulse-overlay.correct {
    background-color: var(--overlay-correct);
    box-shadow: inset 0 0 0 4px var(--color-correct), var(--shadow-glow-green);
    opacity: 1;
    animation: pulseFlash 0.3s ease-out;
}

.image-zone .pulse-overlay.pass {
    background-color: var(--overlay-pass);
    box-shadow: inset 0 0 0 4px var(--color-pass), var(--shadow-glow-yellow);
    opacity: 1;
    animation: pulseFlash 0.3s ease-out;
}

@keyframes pulseFlash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

/* Scoreboard Strip - 15% (Portrait) */
.scoreboard-strip {
    height: 15%;
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 3px solid var(--border-color);
    gap: 10px;
    transition: background-color 0.3s ease;
}

.scoreboard-strip .team-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.scoreboard-strip .team-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scoreboard-strip .timer-display {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    min-width: 70px;
}

.scoreboard-strip .timer-display.warning {
    color: var(--color-pass);
    animation: timerPulse 0.5s ease infinite;
}

.scoreboard-strip .timer-display.danger {
    color: var(--color-error);
    animation: timerPulse 0.3s ease infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scoreboard-strip .score-display {
    display: flex;
    gap: 14px;
    align-items: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.score-item.correct { color: var(--color-correct); }
.score-item.pass { color: var(--color-pass); }

.score-item .score-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.score-item .score-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
}

/* Scoreboard Sidebar (Landscape - hidden in portrait) */
.scoreboard-sidebar {
    display: none;
}

/* ============================================
   GAMEPLAY - LANDSCAPE MODE (80/20 Split)
   ============================================ */
@media (orientation: landscape) {
    .gameplay-screen {
        flex-direction: row;
    }
    
    /* Image Zone - 80% */
    .image-zone {
        flex: 0 0 80%;
        width: 80%;
        padding: 3px;
    }
    
    /* Hide portrait scoreboard strip */
    .scoreboard-strip {
        display: none;
    }
    
    /* Show landscape sidebar - 20% */
    .scoreboard-sidebar {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        flex: 0 0 20%;
        width: 20%;
        background-color: var(--bg-elevated);
        border-left: 2px solid var(--border-color);
        padding: 16px 8px;
    }
    
    html[dir="rtl"] .scoreboard-sidebar {
        border-left: none;
        border-right: 2px solid var(--border-color);
    }
    
    .sidebar-timer {
        font-family: var(--font-mono);
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--text-primary);
    }
    
    .sidebar-score {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-weight: 600;
    }
    
    .sidebar-score.correct { color: var(--color-correct); }
    .sidebar-score.pass { color: var(--color-pass); }
    
    .sidebar-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
    }
    
    .sidebar-team {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        font-weight: 700;
        font-size: 0.9rem;
        text-align: center;
    }
    
    .sidebar-team-dot {
        width: 14px;
        height: 14px;
        border-radius: 50%;
    }
}

/* ============================================
   LEADERBOARD SCREEN
   ============================================ */
.leaderboard-screen {
    padding: 60px 20px 20px;
    overflow-y: auto;
    align-items: center;
}

.leaderboard-screen h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-surface);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid transparent;
}

.leaderboard-item.winner {
    border-left-color: var(--color-premium);
    box-shadow: var(--shadow-glow-yellow);
}

html[dir="rtl"] .leaderboard-item {
    border-left: none;
    border-right: 5px solid transparent;
}

html[dir="rtl"] .leaderboard-item.winner {
    border-right-color: var(--color-premium);
}

.leaderboard-item .rank {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    min-width: 35px;
    text-align: center;
    color: var(--text-secondary);
}

.leaderboard-item.winner .rank {
    color: var(--color-premium-dark);
    font-size: 1.8rem;
}

.leaderboard-item .team-color-bar {
    width: 5px;
    height: 35px;
    border-radius: 3px;
}

.leaderboard-item .team-details { flex: 1; }
.leaderboard-item .team-details .name { font-weight: 700; font-size: 1rem; }
.leaderboard-item .team-details .stats { font-size: 0.8rem; color: var(--text-secondary); }

.leaderboard-item .score-final {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-primary);
}

/* ============================================
   AUTH SCREENS
   ============================================ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 340px;
}

.auth-form.hidden { display: none; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1rem;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--color-primary);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.form-error {
    background-color: rgba(225, 112, 85, 0.1);
    color: var(--color-error);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid var(--color-error);
}

.form-success {
    background-color: rgba(0, 184, 148, 0.1);
    color: var(--color-correct);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid var(--color-correct);
}

.hidden { display: none !important; }

/* ============================================
   AD SLOTS
   ============================================ */
.ad-slot {
    width: 100%;
    min-height: 50px;
    background-color: var(--ad-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ad-text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    overflow: hidden;
}

.ad-banner {
    max-width: 320px;
    margin: 10px auto;
}

.ad-interstitial {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background-color: var(--overlay-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-interstitial .ad-content {
    background-color: var(--bg-surface);
    border-radius: 16px;
    padding: 20px;
    max-width: 90%;
    text-align: center;
}

.ad-close-btn {
    margin-top: 12px;
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.hidden { display: none !important; }
.mt-lg { margin-top: 24px; }
.w-full { width: 100%; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-slide-up { animation: slideUp 0.4s ease-out; }
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-bounce-in { animation: bounceIn 0.5s ease-out; }

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 360px) {
    html { font-size: 14px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .category-tile { padding: 10px 8px; }
    .mode-card { min-width: 120px; padding: 12px 8px; }
}

@media (min-width: 768px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .mode-cards-row { max-width: 500px; }
}

/* Landscape adjustments for setup screens */
@media (orientation: landscape) {
    .setup-screen {
        padding: 50px 20px 20px;
        gap: 12px;
    }
    
    .setup-screen h1 { font-size: 1.4rem; }
    .setup-screen h2 { font-size: 1.1rem; }
    
    #screen-setup-language {
        padding-top: 40px;
        min-height: auto;
    }
    
    .setup-screen .logo {
        width: 60px;
        height: 60px;
    }
    
    .landing-buttons,
    .screen-buttons {
        max-width: 400px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .setup-screen {
        padding: 40px 10px 10px;
        gap: 8px;
    }
    
    .setup-screen h1 { font-size: 1.2rem; }
    .setup-screen h2 { font-size: 1rem; }
    .setup-screen .logo { width: 40px; height: 40px; }
    .setup-screen .tagline { margin-bottom: 8px; }
    
    .handover-screen .next-team-name { font-size: 2rem; }
    .countdown-number { font-size: 6rem; }
}

/* ============================================
   SAFE AREA (Notch/Home Indicator)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .scoreboard-strip {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .top-bar {
        padding-top: env(safe-area-inset-top);
        height: calc(44px + env(safe-area-inset-top));
    }
    
    .setup-screen {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
}

/* ============================================
   iPAD FIXES
   ============================================ */

/* iPad Portrait (768px - 1024px width) */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (orientation: portrait) {
    
    .setup-screen {
        padding: 80px 40px 40px;
        gap: 24px;
    }
    
    .setup-screen h1 {
        font-size: 2.5rem;
    }
    
    .setup-screen h2 {
        font-size: 1.6rem;
    }
    
    .landing-buttons,
    .screen-buttons {
        max-width: 400px;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
        gap: 16px;
    }
    
    .category-tile {
        padding: 20px 16px;
    }
    
    .mode-cards-row {
        max-width: 600px;
        gap: 16px;
    }
    
    .mode-card {
        padding: 24px 16px;
    }
    
    .team-inputs {
        max-width: 450px;
    }
    
    .scoreboard-strip {
        min-height: 80px;
        padding: 14px 24px;
    }
    
    .scoreboard-strip .timer-display {
        font-size: 2.2rem;
    }
}

/* iPad Landscape (1024px+ width) */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (orientation: landscape) {
    
    .setup-screen {
        padding: 60px 60px 20px;
    }
    
    .image-zone {
        flex: 0 0 80%;
        width: 80%;
    }
    
    .scoreboard-sidebar {
        flex: 0 0 20%;
        width: 20%;
        padding: 20px 12px;
    }
    
    .sidebar-timer {
        font-size: 2rem;
    }
    
    .sidebar-score {
        font-size: 1.1rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 700px;
    }
}

/* iPad Pro (1024px+) */
@media only screen 
  and (min-device-width: 1024px) {
    
    .landing-buttons,
    .screen-buttons {
        max-width: 450px;
    }
    
    .category-grid {
        max-width: 700px;
    }
    
    .mode-cards-row {
        max-width: 700px;
    }
}