:root {
    --primary-color: #00e5ff;
    /* Neon Cyan */
    --secondary-color: #d500f9;
    /* Neon Purple */
    --bg-dark: #050510;
    /* Deep space background */
    --text-primary: #ffffff;
    --text-secondary: #b0bec5;

    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(0, 229, 255, 0.2);
    --glass-blur: 8px;

    --neon-glow: 0 0 10px var(--primary-color), 0 0 20px rgba(0, 229, 255, 0.4);
    --neon-glow-secondary: 0 0 10px var(--secondary-color), 0 0 20px rgba(213, 0, 249, 0.4);

    --font-heading: 'Righteous', cursive;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    /* Optional: subtle background gradient/image */
    background: radial-gradient(circle at 50% 10%, #1a1a40 0%, var(--bg-dark) 80%);
    color: var(--text-primary);
    font-family: var(--font-body);
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

/* --- LAYOUT GRID --- */
#app-container {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    height: 100vh;
    padding: 20px;
    max-width: 100%;
    margin: 0;
}

/* Header spans all columns */
header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.brand img {
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.6)) drop-shadow(0 0 20px rgba(213, 0, 249, 0.4));
    animation: neon-flicker 6s infinite;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

@keyframes neon-flicker {

    0%,
    18%,
    22%,
    25%,
    53%,
    57%,
    100% {
        opacity: 1;
    }

    20%,
    24%,
    55% {
        opacity: 0.7;
    }
}

.brand:hover img {
    filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.8)) drop-shadow(0 0 30px rgba(213, 0, 249, 0.6));
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Layout Zones */
.zone-host {
    grid-column: 1;
    overflow-y: auto;
}

.zone-game {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.zone-controls {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* --- GLASS PANELS (Host Panel, Controls) --- */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.host-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.host-header h2 {
    font-family: var(--font-heading);
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    letter-spacing: 1px;
}

/* --- LOBBY & PLAYERS --- */
.lobby-info {
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#qrcode img {
    margin: 0 auto;
    border: 4px solid white;
    border-radius: 8px;
}

#game-code-display {
    color: #00ffff;
    text-shadow: none;
    font-family: 'Righteous', cursive;
    letter-spacing: 2px;
}

#players-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

/* Individual Player Card */
.player-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.player-card .player-name {
    display: block;
    color: var(--text-primary);
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-card .player-countdown {
    color: var(--primary-color);
    font-size: 1.2em;
    font-weight: 700;
}

/* --- Player States --- */
/* Answered */
.player-card.player-answered {
    border-color: #00e676;
    background: rgba(0, 230, 118, 0.15);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
    transform: scale(1.05);
    z-index: 2;
}

/* Almost Win (1 left) */
.player-card.almost-win {
    border-color: #ff5252;
    background: rgba(255, 82, 82, 0.15);
    animation: pulse-red 1.5s infinite;
}

/* Winner */
.player-card.winner {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    animation: pulse-gold 1.5s infinite;
    z-index: 3;
}

.winner-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Offline */
.player-card.player-offline {
    opacity: 0.5;
    filter: grayscale(1);
    border-style: dashed;
}

/* Interaction (checking box) */
.validating-dots {
    display: block;
    font-size: 1.5em;
    /* Visible dots */
    color: var(--secondary-color);
    animation: blink 1s infinite;
    line-height: 0.5;
    margin-top: 2px;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.4);
        border-color: #ff5252;
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 82, 82, 0);
        border-color: rgba(255, 82, 82, 0.5);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
        border-color: #ff5252;
    }
}

@keyframes pulse-gold {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.2;
    }

    50% {
        opacity: 1;
    }
}

/* --- CONTROLS SECTION --- */
/* Controls panel headers */
.controls-panel h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Buttons */
button {
    font-family: var(--font-body);
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
}

/* Default Primary (Cyan/Blue) */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #00b0ff 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}

/* Pink Button for Host Panel Actions */
#btn-start-game,
#btn-create-game {
    background: #ff00ff;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 255, 0.3);
}

#btn-start-game:hover,
#btn-create-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: transparent;
    color: #ff00ff;
    border: 2px solid #ff00ff;
    border-radius: 50px;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), inset 0 0 10px rgba(255, 0, 255, 0.2);
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    padding: 10px 24px;
}

.btn-danger:hover {
    background: rgba(255, 0, 255, 0.1);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.7), inset 0 0 15px rgba(255, 0, 255, 0.4);
    transform: translateY(-2px) scale(1.05);
}

/* Play/Replay buttons variants */
#play-button {
    font-size: 1.1rem;
    padding: 16px;
    width: 100%;
    margin-bottom: 10px;
}

/* Pause Button State Override */
#play-button.btn-danger {
    background: transparent;
    border: 2px solid #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4), inset 0 0 10px rgba(255, 0, 255, 0.2);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1rem;
    text-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    display: flex;
    justify-content: center;
    align-items: center;
}

#play-button.btn-danger:hover {
    background: rgba(0, 229, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
    transform: translateY(-2px);
    border-color: #fff;
    color: #fff;
}

/* Options Stack */
.controls-panel button {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 8px;
    text-align: left;
}

/* Input Fields */
input[type="text"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    padding: 10px 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
}

/* Toggle Switch (Settings) */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* --- GAME ZONE MID --- */
#challenge-box {
    text-align: center;
    width: 100%;
    max-width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#challenge-text {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin: 20px 0;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: font-size 0.3s ease;
}

/* Restore large size for active challenges */
.bg-jaune #challenge-text,
.bg-vert #challenge-text,
.bg-bleu #challenge-text,
.bg-violet #challenge-text,
.bg-rose #challenge-text {
    font-size: 5rem;
}

/* Mobile styles moved to end of file for specificity */

#playlist-info-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.08);
    /* Fallback */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    align-self: center;
    /* Ensure centered in flex column */
}

/* Answer Reveal */
#answer-box {
    margin-top: 30px;
    text-align: center;
    width: 100%;
    max-width: 100%;
}

#album-cover {
    width: 200px;
    height: 200px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

#answer-title {
    font-family: var(--font-heading);
    font-size: 3.9rem;
    color: var(--primary-color);
    margin: 0 0 5px 0;
}

/* Answer Info Container - Stack elements vertically */
.answer-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Closest Answer Info - Readability Fix */
.closest-info {
    font-size: 0.5em;
    /* relative to challenge text size */
    display: block;
    margin-top: 15px;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.7);
    /* Light gray for readability on dark */
    text-transform: none;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

#answer-artist {
    font-size: 3.3rem;
    color: white;
    margin: 0;
}

/* Updated Answer Box Elements */
#answer-header {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.date-badge {
    display: inline-block;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    margin-top: 15px;
    font-size: 2.3rem;
    font-weight: 600;
    color: var(--text-secondary);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-apple-music {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    padding: 12px 25px;
    background: #000;
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.70rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.btn-apple-music:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
    border-color: white;
    background: #111;
}

.btn-apple-music.hidden {
    display: none !important;
}

/* --- MODALS --- */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #101018;
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.close-modal {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: white;
}

/* --- SETTINGS CARDS (Neon Theme) --- */
.setting-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.setting-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    flex: 1;
    padding-right: 10px;
}

.setting-info span {
    white-space: normal;
    line-height: 1.4;
}

.setting-icon {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

/* --- MODERN TOGGLE SWITCH --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: var(--active-gradient, linear-gradient(135deg, #00e676, #00c853));
}

input:checked+.slider:before {
    transform: translateX(22px);
}


/* --- LIBRARY MODAL STYLES (Neon & Consistent) --- */
#library-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

#library-list::-webkit-scrollbar {
    width: 6px;
}

#library-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

#library-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#library-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
    transform: translateX(4px);
}

.pl-info {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

/* Playlist Text Styles */
.pl-title {
    font-weight: bold;
    color: white;
    font-size: 1rem;
    margin-bottom: 2px;
}

.pl-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Custom Playlist Input Section */
.custom-playlist-section {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
}

.section-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: left;
}

.input-group-large {
    display: flex;
    gap: 10px;
}

.input-group-large input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    border-radius: 12px;
    color: white;
    font-family: var(--font-body);
}

.input-group-large input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
    outline: none;
}

.input-group-large button {
    white-space: nowrap;
}

.playlist-help {
    margin-top: 15px;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 5px 0;
    line-height: 1.4;
}


.no-premium-badge {
    display: inline-block;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--primary-color);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: normal;
}


/* --- BURGER MENU BUTTON (hidden on desktop) --- */
.burger-btn {
    display: none;
    /* Hidden on desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.burger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.burger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #ff00ff;
    box-shadow: 0 0 5px #ff00ff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- MOBILE DRAWER --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.drawer-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: #0a0a14;
    border-left: 1px solid var(--glass-border);
    z-index: 600;
    transform: translateX(0);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.mobile-drawer.hidden {
    transform: translateX(100%);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-header .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    color: #ff00ff;
    background: rgba(255, 0, 255, 0.08);
    border: 1px solid rgba(255, 0, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drawer-header .btn-icon:hover {
    color: #ff66ff;
    background: rgba(255, 0, 255, 0.15);
    border-color: rgba(255, 0, 255, 0.4);
}

/* Drawer Icon Alignment */
.drawer-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    flex-shrink: 0;
}

/* Drawer Avatar */
.drawer-avatar {
    font-size: 1.2rem;
}

.drawer-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    object-fit: cover;
}

.drawer-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #00ffff;
    margin: 0;
    text-shadow: none;
}

.drawer-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.drawer-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.drawer-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
    transform: translateX(-3px);
}

.drawer-item-premium {
    background: rgba(255, 0, 255, 0.1) !important;
    border-color: rgba(255, 0, 255, 0.3) !important;
    color: #ff66ff !important;
}

.drawer-item-premium:hover {
    background: rgba(255, 0, 255, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3) !important;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    #app-container {
        grid-template-columns: 260px 1fr 260px;
    }
}

@media (max-width: 900px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }

    /* Disable backdrop-filter on mobile to prevent Chrome crashes and improve performance */
    .glass-panel,
    #challenge-box {
        backdrop-filter: none !important;
        background: rgba(15, 23, 42, 0.95);
        /* More opaque background since we lack blur */
    }

    .drawer-overlay,
    .modal,
    #auto-countdown-overlay,
    #custom-modal {
        backdrop-filter: none !important;
        background: rgba(0, 0, 0, 0.95);
    }

    #app-container {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    header {
        position: relative;
        z-index: 100;
    }

    /* Show burger button on mobile */
    .burger-btn {
        display: flex !important;
    }

    /* Hide fullscreen button on mobile */
    #btn-fullscreen {
        display: none !important;
    }

    /* Hide the Options panel on mobile (moved to drawer) */
    .zone-controls .controls-panel:last-child {
        display: none;
    }

    /* Mobile Modal Adjusments */
    #library-modal .modal-content {
        max-height: 90vh;
        display: flex;
        flex-direction: column;
        padding: 0;
        overflow: hidden;
        position: relative;
    }

    #library-modal .modal-content>h3 {
        margin: 15px 20px 10px;
        flex-shrink: 0;
    }

    #library-modal .close-modal {
        position: absolute;
        top: 12px;
        right: 16px;
        z-index: 10;
        font-size: 1.8rem;
        color: var(--text-secondary);
        margin: 0;
    }

    /* Compact playlist items on mobile */
    .playlist-item {
        padding: 8px 10px;
        border-radius: 8px;
    }

    .playlist-item .pl-artist {
        display: none;
    }

    .playlist-item .btn-secondary {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    /* REORDER SECTIONS: Game (Visuals), Controls (Actions), Host Panel (Bottom) */
    .zone-game {
        order: 2;
    }

    .zone-controls {
        order: 3;
    }

    .zone-host {
        order: 4;
    }

    #library-list {
        flex: 1;
        overflow-y: auto;
        padding: 10px 20px;
        margin: 0;
    }

    .custom-playlist-section {
        flex-shrink: 0;
        padding: 20px;
        background: rgba(0, 0, 0, 0.2);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 5;
    }

    .input-group-large {
        flex-direction: column;
    }

    .playlist-item {
        padding: 10px;
    }
}


/* Large Screens Landscape Optimizations for Library Modal */
@media (min-width: 992px) and (orientation: landscape) {
    #library-modal .modal-content {
        max-width: 1000px;
        width: 90vw;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    #library-modal .modal-content>h3 {
        padding: 30px 40px 10px;
        margin: 0;
        font-size: 2rem;
        background: transparent;
    }

    #library-modal .close-modal {
        position: absolute;
        top: 30px;
        right: 40px;
        font-size: 2rem;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 50%;
        transition: all 0.3s;
    }

    #library-modal .close-modal:hover {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        transform: rotate(90deg);
    }

    #library-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        padding: 20px 40px;
        margin-bottom: 0;
        overflow-y: auto;
    }

    .playlist-item {
        flex-direction: column;
        text-align: center;
        padding: 25px 20px;
        height: 100%;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .playlist-item:hover {
        transform: translateY(-5px);
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--primary-color);
        box-shadow: 0 10px 30px rgba(0, 229, 255, 0.15);
    }

    .pl-info {
        flex-direction: column;
        width: 100%;
        gap: 10px;
        justify-content: center;
    }

    .pl-title {
        font-size: 1.1rem;
        line-height: 1.3;
        margin-bottom: 0px;
    }

    .pl-artist {
        margin-top: 5px;
    }

    .custom-playlist-section {
        padding: 30px 40px;
        background: rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .input-group-large {
        max-width: 600px;
        width: 100%;
    }

    .input-group-large input {
        padding: 15px 25px;
        border-radius: 50px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
        font-size: 1.1rem;
    }

    .input-group-large input:focus {
        background: rgba(255, 255, 255, 0.1);
        text-align: left;
        padding-left: 30px;
    }

    .input-group-large button {
        border-radius: 50px;
        padding: 0 40px;
        font-size: 1.1rem;
    }

    .section-label {
        text-align: center;
        font-size: 1rem;
        margin-bottom: 20px;
    }
}

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

/* Challenge Colors (From previous files) */
.bg-jaune {
    border: 2px solid #ffab00 !important;
    background: rgba(255, 171, 0, 0.1) !important;
}

.bg-jaune #challenge-text,
.bg-jaune #answer-header {
    color: #ffab00;
}

.bg-vert {
    border: 2px solid #00e676 !important;
    background: rgba(0, 230, 118, 0.1) !important;
}

.bg-vert #challenge-text,
.bg-vert #answer-header {
    color: #00e676;
}

.bg-bleu {
    border: 2px solid #2979ff !important;
    background: rgba(41, 121, 255, 0.1) !important;
}

.bg-bleu #challenge-text,
.bg-bleu #answer-header {
    color: #2979ff;
}

.bg-violet {
    border: 2px solid #651fff !important;
    background: rgba(101, 31, 255, 0.1) !important;
}

.bg-violet #challenge-text,
.bg-violet #answer-header {
    color: #9900f9;
}

.bg-rose {
    border: 2px solid #f50057 !important;
    background: rgba(245, 0, 87, 0.1) !important;
}

.bg-rose #challenge-text,
.bg-rose #answer-header {
    color: #f50057;
}


/* --- CUSTOM MODAL (Alert/Confirm) - ADDED FOR STOP BUTTON --- */
#custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

#custom-modal.hidden {
    display: none;
}

#custom-modal .modal-content {
    background: #101018;
    /* Consistent with other neon modals */
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

#custom-modal .modal-title {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-family: var(--font-heading);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#custom-modal .modal-body {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

#custom-modal .modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

#custom-modal .btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

#custom-modal .modal-confirm {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

#custom-modal .modal-confirm:hover {
    background: #00b0ff;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

#custom-modal .modal-cancel {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
}

#custom-modal .modal-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- MOBILE TEXT SIZING (Appended for specificity) --- */
@media (max-width: 600px) {
    #challenge-text {
        font-size: 1.8rem;
        margin: 10px 0;
    }

    /* Force smaller font for active challenges on mobile */
    .bg-jaune #challenge-text,
    .bg-vert #challenge-text,
    .bg-bleu #challenge-text,
    .bg-violet #challenge-text,
    .bg-rose #challenge-text {
        font-size: 2.5rem !important;
    }

    /* Force smaller font for active challenges on mobile */
    .bg-jaune #challenge-text,
    .bg-vert #challenge-text,
    .bg-bleu #challenge-text,
    .bg-violet #challenge-text,
    .bg-rose #challenge-text {
        font-size: 2.5rem;
    }

    .date-badge {
        font-size: 1.3rem;
    }

    #answer-title {
        font-size: 2.1rem;
        line-height: 1.2;
    }

    #answer-artist {
        font-size: 1.5rem;
    }

    #answer-header {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    #challenge-box {
        padding: 20px;
    }
}

/* --- AUTO COUNTDOWN STYLES --- */
#auto-countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    /* Flex to center */
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

#auto-countdown-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.countdown-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: popupScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-label {
    font-family: var(--font-body);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

#countdown-number {
    font-family: var(--font-heading);
    font-size: clamp(5rem, 20vw, 10rem);
    color: var(--primary-color);
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.8);
    line-height: 1;
    position: relative;
    z-index: 2;
}

.countdown-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(200px, 50vw, 400px);
    height: clamp(200px, 50vw, 400px);
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    z-index: 1;
    animation: spinRing 2s linear infinite;
}

@keyframes popupScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spinRing {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}