:root {
    --primary-color: #7c3aed;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(36, 36, 36, 0.85);
    --bg-card-solid: #242424;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border-color: rgba(63, 63, 70, 0.6);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

* {
    padding: 0;
    box-sizing: border-box;
}

/* Video Background Styles */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    /* Removed opacity: 0 to make container visible */
}

/* Video element inside container */
#video-container video,
.video-background video,
#bgVideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
    z-index: 1;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    /* Improve mobile performance */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    flex-direction: column;
    position: relative;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(26, 26, 26, 0.3);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-bottom: 2px solid rgba(63, 63, 70, 0.3);
    animation: slideDown 0.5s ease;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.main-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    animation: glow 2s ease-in-out infinite alternate;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.title-text {
    background: var(--gradient-1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-emoji {
    font-size: 2.8rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    /* animation removed - was annoying */
}

.subtitle {
    color: var(--text-primary);
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Version Badge */
.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(236, 72, 153, 0.3));
    border: 1px solid rgba(124, 58, 237, 0.5);
    border-radius: 20px;
    padding: 6px 14px;
    margin: 8px 0;
    font-size: 0.85rem;
    color: #fff;
    backdrop-filter: blur(10px);
    animation: versionPulse 3s ease-in-out infinite;
    cursor: default;
    transition: all 0.3s ease;
}

.version-badge:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(236, 72, 153, 0.5));
    transform: scale(1.05);
}

.version-icon {
    font-size: 1rem;
}

#versionNumber {
    font-weight: 600;
    letter-spacing: 0.5px;
}

@keyframes versionPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(124, 58, 237, 0.3); }
    50% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.6); }
}

/* Base styles for all screens */
.screen {
    display: none !important;
    min-height: 80vh;
    animation: fadeIn 0.3s ease-in;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

#singleResultsScreen {
    display: none;
}

#singleResultsScreen.active {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Special case for screens that need block display */
.screen.active.block-display {
    display: block !important;
}

/* Specific styling for room screen */
#room.screen.active {
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 2rem;
    min-height: 100vh;
}

#room .room-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    gap: 1.5rem;
    margin: 0 auto;
}

/* Ensure room elements are visible without scrolling */
#room .room-header,
#room .teams-container,
#room .game-settings,
#room .room-actions {
    width: 100%;
}

/* Better spacing for room elements */
#room .teams-container {
    margin: 0.5rem 0;
}

#room .room-actions {
    margin-top: 0.5rem;
}

/* Removed background emoji decorations for cleaner design */
/* Removed unused animation keyframes for cleaner CSS */

/* ============= CATEGORY BACKGROUNDS ============= */
.category-bg-general {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.category-bg-programming {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

.category-bg-programming::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, 
            rgba(0, 255, 0, 0.03) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0, 255, 0, 0.03) 3px);
    pointer-events: none;
    z-index: 1;
}

.category-bg-default {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.mobile-gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============= LEADERBOARD TOGGLE BUTTON (SEPARATE) ============= */
.leaderboard-toggle-btn {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 0 15px 15px 0;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    transition: all 0.3s ease;
    z-index: 1001;
    font-weight: bold;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* ============= LEADERBOARD SIDEBAR ============= */
.leaderboard-sidebar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    background: var(--bg-card);
    border-radius: 0 15px 15px 0;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    border: 1px solid var(--border-color);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.leaderboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.leaderboard-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.leaderboard-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
    min-width: 30px;
}

.leaderboard-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.leaderboard-sidebar.collapsed .leaderboard-toggle span {
    transform: rotate(-180deg);
    display: inline-block;
}


@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    }
}

.leaderboard-content {
    padding: 20px;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}

.leaderboard-list {
    margin-bottom: 20px;
}

.leaderboard-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.leaderboard-rank {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    color: var(--text-primary);
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.leaderboard-score {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.leaderboard-stats {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.global-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
}

.global-stats h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1rem;
}

.global-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.global-stat-item:last-child {
    border-bottom: none;
}

.global-stat-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.global-stat-item strong {
    color: var(--text-primary);
    font-size: 1rem;
}

/* Scrollbar styling for leaderboard */
.leaderboard-content::-webkit-scrollbar {
    width: 6px;
}

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

.leaderboard-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* Empty state for leaderboard */
.leaderboard-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.leaderboard-empty p:first-child {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .leaderboard-sidebar {
        width: 280px;
        max-height: 60vh;
        top: auto;
        bottom: 20px;
        left: 20px;
        transform: none;
        border-radius: 15px;
        border: 2px solid var(--primary-color);
    }
    
    .leaderboard-sidebar.collapsed {
        transform: translateX(-100%);
        opacity: 0;
    }
    
    .leaderboard-toggle-btn {
        left: 10px;
        bottom: 20px;
        top: auto;
        transform: none;
    }
}

/* Transfer Notification Styles */
.transfer-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    text-align: center;
    animation: slideInScale 0.5s ease-out;
}

.transfer-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: rotate 2s linear infinite;
}

.transfer-text {
    font-size: 1.3rem;
    font-weight: bold;
}

.transfer-message {
    color: #f59e0b;
    font-size: 1.1rem;
    margin-top: 10px;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideInScale {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* General hidden class */
.hidden {
    display: none !important;
}

/* Text Answer Styles */
.text-answer-container {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    align-items: center;
}

.text-answer-input {
    flex: 1;
    padding: 20px 25px;
    font-size: 1.3rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 3px solid var(--border-color);
    border-radius: 15px;
    transition: all 0.3s;
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    min-height: 60px;
    text-align: center;
    letter-spacing: 1px;
}

.text-answer-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.1rem;
}

.text-answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.1);
}

.text-answer-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.3);
}

.submit-text-btn {
    padding: 18px 35px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    min-width: 150px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.submit-text-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.submit-text-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Answer feedback styles */
.text-answer-input.correct {
    border-color: #4caf50 !important;
    background: rgba(76, 175, 80, 0.1) !important;
    animation: correctPulse 0.5s ease;
}

.text-answer-input.incorrect {
    border-color: #f44336 !important;
    background: rgba(244, 67, 54, 0.1) !important;
    animation: wrongShake 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.submit-text-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Multi anime selection styles */
.multi-anime-selection {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 40, 0.98));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 350px;
    overflow-y: auto;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.multi-anime-selection h4 {
    grid-column: 1 / -1;
    margin: 5px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    font-size: 14px;
}

.multi-anime-selection.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    border: 1px solid transparent;
}

.checkbox-item:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.checkbox-item:has(input:checked) {
    background: rgba(102, 126, 234, 0.3);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.checkbox-item input[type="checkbox"] {
    margin-left: 10px;
    margin-right: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Host badge styles */
.host-badge {
    display: inline-block;
    margin-right: 5px;
    font-size: 0.9rem;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 5px gold); }
    50% { filter: brightness(1.2) drop-shadow(0 0 10px gold); }
}

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

.welcome-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.welcome-box h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.welcome-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.anime-icons {
    font-size: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    /* Simple static display - no annoying animations */
}

.anime-icons span {
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

.anime-icons span:hover {
    transform: scale(1.15) rotate(5deg);
    filter: brightness(1.3);
}

.player-setup {
    margin-bottom: 2rem;
}
.input-field {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.4);
}

.btn-gradient {
    background: var(--gradient-3);
    color: white;
    font-size: 1.2rem;
}

.btn-gradient:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4);
}

.btn-special {
    background: linear-gradient(135deg, #ffd700 0%, #ff6b6b 50%, #4ecdc4 100%);
    background-size: 200% 200%;
    animation: shineGradient 3s ease infinite;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.btn-special:before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff0080, #8000ff, #0080ff, #00ff80);
    background-size: 400% 400%;
    animation: borderGlow 4s linear infinite;
    border-radius: 15px;
    z-index: -1;
}

.btn-special:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 215, 0, 0.5);
}

@keyframes shineGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes borderGlow {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}

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

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.3rem;
}

.btn-hint {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    animation: pulse 2s infinite;
}

.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
}

.btn-hint:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

.question-only-mode {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 15px;
    border: 2px dashed var(--warning-color);
}

.question-only-mode.hidden {
    display: none;
}

.btn-icon {
    font-size: 1.3rem;
}

.join-room-section {
    display: flex;
    gap: 0.5rem;
}

.join-room-section .input-field {
    flex: 1;
}

.room-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    width: 100%;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.room-info h2 {
    margin: 0;
}

#roomCodeDisplay {
    color: var(--primary-color);
    font-family: monospace;
    font-size: 1.3rem;
}

.teams-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    align-items: stretch;
    justify-items: center;
}

.team {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 350px;
    min-width: 280px;
}

.team-1 {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.team-2 {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.team-name-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: bold;
    width: 60%;
    border-bottom: 2px dashed var(--border-color);
    padding: 0.3rem;
}

.team-name-input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

.team-score {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.team-players {
    min-height: 150px;
    margin-bottom: 1rem;
}

.player-item {
    background: var(--bg-secondary);
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
}

.player-item .player-icon {
    font-size: 1.2rem;
}

.player-item.is-host::after {
    content: "👑";
    margin-right: auto;
}

.btn-join-team {
    width: 100%;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-join-team:hover {
    background: var(--primary-color);
    color: white;
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.vs-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--warning-color);
    animation: pulse 2s infinite;
    text-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
    padding: 0 1rem;
}

.game-settings {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.game-settings h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.select-field {
    padding: 0.8rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.select-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.room-actions {
    text-align: center;
    width: 100%;
    margin-top: 1rem;
    padding: 1rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10;
    border-top: 1px solid var(--border-color);
}

.game-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.game-header {
    margin-bottom: 2rem;
}

.game-scores {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.score-box {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    border: 2px solid var(--border-color);
}

.team-1-score {
    border-color: #3b82f6;
}

.team-2-score {
    border-color: #ef4444;
}

.score-box .team-name {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.score-box .score {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
}

.timer-box {
    background: var(--gradient-2);
    color: white;
    padding: 1rem;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(236, 72, 153, 0.4);
}

.timer-box #timer {
    font-size: 1.8rem;
    font-weight: bold;
}

.timer-label {
    font-size: 0.8rem;
}

.question-container {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.question-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.anime-tag, .difficulty-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.anime-tag {
    background: var(--primary-color);
    color: white;
}

.difficulty-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.difficulty-tag.easy {
    border-color: var(--success-color);
    color: var(--success-color);
}

.difficulty-tag.medium {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.difficulty-tag.hard {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.question {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.current-turn {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 1.1rem;
    color: var(--warning-color);
}

.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.option-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
}

.option-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

.option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    animation: correctAnswer 0.5s ease;
}

.option-btn.wrong {
    background: var(--danger-color);
    border-color: var(--danger-color);
    animation: wrongAnswer 0.5s ease;
}

.answer-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border-color);
    min-width: 400px;
}

.answer-result.hidden {
    display: none;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-icon {
    font-size: 4rem;
}

.result-text {
    font-size: 1.5rem;
    font-weight: bold;
}

.correct-answer {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.explanation {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

.results-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
    margin: 0 auto;
    padding-top: 2rem;
}

.trophy-animation {
    font-size: 8rem;
    animation: trophy 1s ease;
}

.winner-title {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.winner-name {
    font-size: 3rem;
    background: var(--gradient-1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
}

.final-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.final-score-box {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.final-score {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.vs-text {
    font-size: 1.5rem;
    color: var(--warning-color);
}

.notifications {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border-right: 4px solid var(--primary-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification.success {
    border-right-color: var(--success-color);
}

.notification.error {
    border-right-color: var(--danger-color);
}

.notification.info {
    border-right-color: var(--primary-color);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.single-player-container {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
}

.setup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.setup-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.single-settings {
    margin-bottom: 2rem;
}

.setup-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.single-game-header {
    margin-bottom: 2rem;
}

.single-stats {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-box {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    border: 2px solid var(--border-color);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.single-player-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.results-title {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.player-name {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.single-results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-stat {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.result-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.result-stat.highlight {
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--bg-card) 0%, #7c3aed20 100%);
}

.result-stat .result-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.result-stat .result-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-stat .result-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.accuracy-meter {
    max-width: 400px;
    margin: 0 auto 2rem;
    text-align: center;
}

.accuracy-label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.accuracy-bar {
    width: 100%;
    height: 20px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.accuracy-fill {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 20px;
    transition: width 1s ease;
    width: 0%;
}

.accuracy-percentage {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.footer {
    background: rgba(26, 26, 26, 0.3);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-top: 1px solid rgba(63, 63, 70, 0.3);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.footer p {
    margin: 0.3rem 0;
    font-weight: 500;
}

.copyright {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
    }
    to {
        text-shadow: 0 0 20px rgba(124, 58, 237, 0.8), 0 0 30px rgba(124, 58, 237, 0.6);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes trophy {
    0% { transform: scale(0) rotate(0); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes wrongAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* Home Screen Styles */
.home-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

/* Authentication Styles */
.auth-container {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.auth-box {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.auth-forms {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* Username availability feedback */
.username-feedback {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    min-height: 1.5rem;
}

.username-feedback.checking {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.username-feedback.available {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    animation: fadeInUp 0.3s ease;
}

.username-feedback.unavailable {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.form-group small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    justify-content: center;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.auth-switch {
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

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

/* User Info Styles */
.user-info-box {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(79, 172, 254, 0.1));
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(15px);
    border: 1px solid var(--primary-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.user-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(124, 58, 237, 0.2);
}

.user-welcome h2 {
    margin: 0;
    font-size: 1.4rem;
    background: var(--gradient-1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

.stat-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.5));
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-number {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Rejoin Section */
.rejoin-section {
    margin-bottom: 1.5rem;
}

.rejoin-box {
    background: linear-gradient(135deg, rgba(126, 58, 237, 0.1), rgba(236, 72, 153, 0.1));
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--primary-color);
    text-align: center;
}

.rejoin-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .main-title {
        font-size: 1.8rem;
    }
    
    .rejoin-buttons {
        flex-direction: column;
    }
    
    .user-welcome {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .user-stats-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .stat-item {
        padding: 0.8rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }

    .teams-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        justify-items: center;
    }
    
    .team {
        max-width: 100%;
        width: 100%;
    }
    
    .vs-separator {
        margin: 1rem 0;
        order: -1;
        font-size: 2rem;
    }

    .game-scores {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .options {
        grid-template-columns: 1fr;
    }

    .final-scores {
        flex-direction: column;
    }

    .question {
        font-size: 1.3rem;
    }

    .winner-name {
        font-size: 2rem;
    }
}

/* Extra Small Devices (phones, 480px and down) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .main-title {
        font-size: 1.5rem;
        padding: 0.8rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .card {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .question {
        font-size: 1.1rem;
        padding: 1rem;
    }
    
    .options {
        gap: 0.8rem;
    }
    
    .option-btn {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .room-code {
        font-size: 1.8rem;
    }
    
    input, select, textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Small Devices (landscape phones, 481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .main-title {
        font-size: 1.6rem;
    }
    
    .card {
        padding: 1.8rem;
    }
    
    .teams-container {
        gap: 1rem;
    }
}

/* Medium Devices (tablets, 769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .teams-container {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .options {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
    
    .leaderboard-sidebar {
        width: 320px;
    }
}

/* Large Devices (desktops, 1025px to 1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }
    
    body {
        font-size: 16px;
    }
}

/* Extra Large Devices (large desktops, 1441px and up) */
@media (min-width: 1441px) {
    .container {
        max-width: 1400px;
    }
    
    body {
        font-size: 18px;
    }
    
    .main-title {
        font-size: 3rem;
    }
}

/* Landscape orientation fixes */
@media (orientation: landscape) and (max-height: 600px) {
    .main-title {
        font-size: 1.5rem;
        margin: 0.5rem 0;
    }
    
    .card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .option-btn {
        min-height: 60px;
        touch-action: manipulation;
    }
    
    input, select, button {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* Header Controls Container */
.header-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Connection Status Indicator */
.connection-indicator {
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

/* Music Controls */
.music-controls {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.music-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 5px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 30px;
    z-index: 10001;
    pointer-events: auto;
}

.music-toggle-btn:hover {
    transform: scale(1.2);
}

/* Volume Dropdown */
.volume-dropdown {
    position: absolute;
    top: 100%;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
    z-index: 10002;
}

.volume-dropdown.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    visibility: hidden;
}

/* Dropdown animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.volume-dropdown.show {
    animation: slideDown 0.3s ease-out forwards;
}

/* Play/Pause Button */
.play-pause-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    color: white;
}

.play-pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.volume-slider {
    width: 80px;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.volume-display {
    color: white;
    font-size: 0.85rem;
    min-width: 35px;
    text-align: center;
}

#connectionStatus {
    font-size: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Performance Optimizations */
* {
    will-change: auto;
}

.btn, .option-btn {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus States */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile Responsive for Music Controls */
@media (max-width: 768px) {
    .header-controls {
        top: 10px;
        right: 10px;
        gap: 10px;
    }
    
    .music-controls {
        padding: 5px 8px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .volume-display {
        font-size: 0.75rem;
        min-width: 30px;
    }
}

@media (max-width: 480px) {
    .header-controls {
        top: 5px;
        right: 5px;
        gap: 8px;
    }
    
    .music-controls {
        padding: 4px 6px;
    }
    
    .volume-slider {
        width: 50px;
    }
    
    .music-toggle-btn {
        font-size: 16px;
    }
    
    #connectionStatus {
        font-size: 16px;
    }
}

/* Disable focus outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}
