:root {
    --primary: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --danger: #e74c3c;
    --dark: #121212;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* --- DYNAMIC BACKGROUND --- */
#dynamic-bg {
    position: fixed;
    top: -10%; left: -10%; width: 120%; height: 120%;
    background-size: cover;
    background-position: center;
    filter: blur(60px) brightness(0.5) saturate(1.3) contrast(1.1);
    z-index: -2;
    transition: background-image 1s ease-in-out, filter 0.5s ease;
}

#overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.75) 100%);
    z-index: -1;
    pointer-events: none;
}

/* --- REVEAL MODAL --- */
.reveal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.reveal-modal.show {
    opacity: 1;
}

.reveal-content {
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-modal.show .reveal-content {
    transform: scale(1);
}

.reveal-icon {
    font-size: 6rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.reveal-title {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.reveal-owner {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(79, 70, 229, 0.5);
    margin: 0;
}

.reveal-bonus {
    font-size: 1.8rem;
    font-weight: 600;
    color: #f59e0b;
    margin-top: 1.5rem;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

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

/* --- SHARED MUSIC INDICATOR --- */
.shared-indicator {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    animation: pulseGlow 2s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(245, 158, 11, 0.7);
    }
}

/* --- VALIDATE BUTTON --- */
.btn-validate {
    width: 100%;
    padding: 1rem;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-validate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    filter: brightness(1.1);
}

.btn-validate:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* --- PREVIEW BUTTON --- */
.btn-preview {
    padding: 0.6rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(99, 102, 241, 0.2);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-preview:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    transform: translateY(-1px);
}

/* --- PLAYLIST PREVIEW MODAL --- */
.playlist-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.playlist-modal.show {
    opacity: 1;
}

.playlist-modal-content {
    background: var(--dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.playlist-modal.show .playlist-modal-content {
    transform: scale(1);
}

.playlist-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(79, 70, 229, 0.1);
    border-radius: 20px 20px 0 0;
}

.playlist-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.playlist-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.playlist-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.preview-songs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-song-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.preview-song-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    transform: translateX(5px);
}

.preview-song-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.preview-song-info {
    flex: 1;
    min-width: 0;
}

.preview-song-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-song-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- PREVIEW IN HISTORY --- */
.preview-in-history {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(99, 102, 241, 0.8);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
    margin: 0;
}

.preview-in-history:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.playlist-item {
    position: relative;
}

@media (max-width: 768px) {
    .reveal-icon {
        font-size: 4rem;
    }
    
    .reveal-title {
        font-size: 1.2rem;
    }
    
    .reveal-owner {
        font-size: 2.5rem;
    }
    
    .reveal-bonus {
        font-size: 1.3rem;
    }
}

/* --- MAIN CONTAINER --- */
#app {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    z-index: 1;
}

/* --- HOME PAGE LAYOUT --- */
.home-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 968px) {
    .home-container {
        grid-template-columns: 1fr;
    }
}

.left-panel, .right-panel {
    height: fit-content;
}

.action-card {
    margin: 1.5rem 0;
}

.action-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.action-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.btn-action {
    width: 100%;
    padding: 1rem;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
    filter: brightness(1.1);
}

/* --- PLAYLIST HISTORY --- */
.playlist-history-section {
    margin-top: 2rem;
    overflow: hidden;
}

.playlist-history-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.playlist-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
}

.playlist-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.playlist-item:hover::before {
    opacity: 0.1;
}

.playlist-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.playlist-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.playlist-info {
    flex: 1;
    min-width: 0;
}

.playlist-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-creator {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 2rem 0;
}

/* --- GLASSMORPHISM PANELS --- */
.glass-panel, #app > div {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeIn 0.5s ease-out;
}

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

/* --- TYPOGRAPHY --- */
h2 {
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

h3 {
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    color: var(--text-secondary);
}

p { margin-bottom: 1rem; }

/* --- FORMS & INPUTS --- */
.form-group { margin-bottom: 1.2rem; }

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

input::placeholder { color: rgba(255, 255, 255, 0.4); }

/* --- BUTTONS --- */
button, .guess-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

button:hover, .guess-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
    filter: brightness(1.1);
}

button:active, .guess-btn:active { transform: translateY(0); }

button:disabled, .guess-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* --- COPY BUTTON --- */
.copy-btn {
    display: inline-block;
    width: auto;
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

/* --- LOBBY & LISTS --- */
ul { list-style: none; padding: 0; }

li {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--primary);
    transition: background 0.2s;
}

li:hover { background: rgba(255, 255, 255, 0.1); }

/* --- GAME SCREEN --- */
#game-info {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem;
    border-radius: 12px;
}

#song-info {
    text-align: center;
    margin: 2rem 0;
}

#song-info img {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

#song-info img:hover { transform: scale(1.02); }

#song-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

#song-artist {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* --- GAME SECTIONS SPACING --- */
#guess-section {
    margin: 2.5rem 0 2rem 0;
}

#guess-section h4 {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    font-weight: 600;
}

#scores {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#scores h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

#scores-list {
    list-style: none;
    padding: 0;
}

#scores-list li {
    padding: 0.5rem 0;
    font-size: 1rem;
}

/* --- GUESS BUTTONS GRID --- */
#player-guesses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.guess-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: none;
    font-weight: 600;
    margin: 0;
}

.guess-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.guess-btn.selected {
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: 0 0 15px var(--primary);
    transform: scale(1.05);
    color: white;
}

/* --- FEEDBACK & SCORES --- */
#feedback-zone {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(79, 70, 229, 0.5);
    min-height: 1.5em;
}

#final-scores-list li:first-child {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.2), transparent);
    border-left-color: #d4af37;
    font-size: 1.2rem;
    font-weight: 800;
}

hr {
    border: 0;
    height: 1px;
    background: var(--glass-border);
    margin: 2rem 0;
}

/* --- SETTINGS --- */
#game-settings {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 16px;
    margin-bottom: 1rem;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* --- LOBBY LAYOUT --- */
.lobby-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    align-items: start;
}

.lobby-main {
    min-height: 500px;
}

.lobby-chat {
    position: sticky;
    top: 2rem;
}

/* --- GAME LAYOUT --- */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    align-items: start;
}

.game-main {
    min-height: 500px;
}

.game-chat {
    position: sticky;
    top: 2rem;
}

/* --- RESPONSIVE LAYOUTS --- */
@media (max-width: 1024px) {
    .lobby-layout,
    .game-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .lobby-chat,
    .game-chat {
        position: relative;
        top: 0;
    }
    
    #chat-container {
        height: 400px;
    }
}

/* --- LOBBY AND GAME CONTENT --- */
.lobby-content,
.game-content {
    margin-bottom: 80px;
}

/* --- CHAT STYLES --- */
#chat-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-container.minimized {
    height: 54px;
}

#chat-container.minimized #chat-messages,
#chat-container.minimized #chat-input-container {
    display: none;
}

#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    background: rgba(79, 70, 229, 0.2);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

#chat-header span {
    font-size: 1rem;
    color: var(--text);
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid var(--primary);
    animation: slideInMessage 0.3s ease;
}

.chat-message.own-message {
    background: rgba(79, 70, 229, 0.15);
    border-left-color: var(--primary-hover);
}

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

.chat-username {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-message.own-message .chat-username {
    color: var(--primary-hover);
}

.chat-message.system-message {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: #6366f1;
    font-style: italic;
    text-align: center;
}

.chat-message.system-message .chat-text {
    color: #a5b4fc;
    font-size: 0.85rem;
}

.chat-text {
    font-size: 0.9rem;
    color: var(--text);
    word-wrap: break-word;
    line-height: 1.4;
}

#chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    margin: 0;
    width: auto;
    transition: all 0.2s ease;
}

#chat-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#send-message {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#send-message:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

#send-message:active {
    transform: scale(0.95);
}

/* --- CHAT SCROLLBAR --- */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.5);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.7);
}

/* --- RESPONSIVE CHAT --- */
@media (max-width: 768px) {
    .lobby-layout,
    .game-layout {
        grid-template-columns: 1fr;
    }
    
    #chat-container {
        height: 350px;
    }
}

/* --- VOLUME CONTROL --- */
.volume-card {
    margin-top: 15px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 15px;
}

.volume-icon {
    font-size: 20px;
    user-select: none;
}

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

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.5);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-hover);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.5);
}

.volume-value {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    min-width: 40px;
    text-align: right;
    user-select: none;
}

/* --- DEBUG PANEL --- */
.debug-toggle-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    background: rgba(220, 38, 38, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.debug-toggle-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(220, 38, 38, 0.5);
}

.debug-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 450px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(220, 38, 38, 0.5);
    border-radius: 15px;
    z-index: 9998;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.debug-header {
    background: rgba(220, 38, 38, 0.2);
    padding: 15px 20px;
    border-bottom: 2px solid rgba(220, 38, 38, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h3 {
    margin: 0;
    font-size: 18px;
    color: white;
}

.debug-clear-btn,
.debug-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.debug-clear-btn:hover,
.debug-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.debug-close-btn {
    font-size: 24px;
    padding: 5px 12px;
}

.debug-content {
    max-height: calc(80vh - 70px);
    overflow-y: auto;
    padding: 15px;
}

.debug-section {
    margin-bottom: 20px;
}

.debug-section h4 {
    color: rgba(220, 38, 38, 1);
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(220, 38, 38, 0.3);
    padding-bottom: 5px;
}

#debug-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.8;
}

#debug-stats div {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#debug-stats div:last-child {
    border-bottom: none;
}

#debug-logs {
    max-height: 400px;
    overflow-y: auto;
}

.debug-log-entry {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 12px;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

.debug-log-entry.debug-error {
    background: rgba(220, 38, 38, 0.1);
    border-left-color: rgba(220, 38, 38, 1);
}

.debug-log-entry.debug-warning {
    background: rgba(251, 191, 36, 0.1);
    border-left-color: rgba(251, 191, 36, 1);
}

.debug-log-entry.debug-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: rgba(59, 130, 246, 1);
}

.debug-timestamp {
    color: rgba(255, 255, 255, 0.5);
    margin-right: 8px;
    font-family: monospace;
}

.debug-type {
    font-weight: 600;
    margin-right: 8px;
}

.debug-error .debug-type {
    color: rgba(220, 38, 38, 1);
}

.debug-warning .debug-type {
    color: rgba(251, 191, 36, 1);
}

.debug-info .debug-type {
    color: rgba(59, 130, 246, 1);
}

.debug-message {
    color: rgba(255, 255, 255, 0.9);
}

.debug-log-entry pre {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .debug-panel {
        width: calc(100% - 40px);
        right: 20px;
        max-height: 70vh;
    }
    
    .debug-toggle-btn {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 12px;
    }
}