/* --- GRUNDINSTÄLLNINGAR --- */
:root {
    --accent-color: #4a1a63; 
    --accent-hover: #5d227c;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --input-bg: rgba(0, 0, 0, 0.4);
    
    /* Mörkare färger */
    --success-color: #2a9d3f; /* Mörkare grön */
    --error-color: #cc2e25;   /* Mörkare röd */
    
    --spotify-green: #1DB954;
    --youtube-red: #ff0000;
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 15px;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: url('bg-theme.jpg') no-repeat center center fixed; 
    background-size: cover;
    display: flex; justify-content: center; align-items: center;
    color: var(--text-color);
    text-align: center;
}

#score-header { 
    position: fixed; top: 0; left: 0; width: 100%; 
    background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 12px 0; color: white; font-weight: 900; font-size: 1.2rem; 
    display: none; z-index: 100; border-bottom: 2px solid rgba(255,255,255,0.1);
    letter-spacing: 1px; text-shadow: 0 2px 5px rgba(0,0,0,0.5); text-transform: uppercase;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-radius: 25px; border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    padding: 30px 40px; width: 100%; max-width: 800px; 
    margin: 0 auto; animation: fadeUp 0.6s ease-out;
    display: flex; flex-direction: column; align-items: center; position: relative;
}

h1, h2, h3, h4 { margin: 0 0 15px 0; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
h3 { font-size: 1.1rem; opacity: 0.9; margin-top: 20px; margin-bottom: 10px; }
p { color: rgba(255,255,255,0.95); font-size: 1rem; margin: 5px 0; }
.green-text { color: var(--success-color); }
.gold-text { color: #FFD700; }

.url-text-style {
    font-size: 2rem; font-weight: 900; color: white; margin-bottom: 25px; letter-spacing: 1px;
    text-shadow: -1px -1px 0 rgba(0,0,0,0.3), 1px -1px 0 rgba(0,0,0,0.3), -1px 1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(0,0,0,0.3), 0 5px 15px rgba(0,0,0,0.5); 
}
.code-container {
    background: rgba(0,0,0,0.6); padding: 15px 40px; border-radius: 20px; display: inline-block; margin-bottom: 20px;
    border: 2px solid rgba(255,255,255,0.15); box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.code-label { font-size: 0.9rem; letter-spacing: 3px; opacity: 0.8; display: block; font-weight: bold; margin-bottom: 5px;}
.game-code { font-size: 5rem; font-weight: 900; letter-spacing: 5px; line-height: 1; text-shadow: 0 5px 10px rgba(0,0,0,0.5); }

.selected-list-badge {
    font-size: 1rem; color: white; background: var(--success-color); padding: 10px 20px; border-radius: 30px;
    display: inline-block; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.3); border: 2px solid rgba(255,255,255,0.3); margin: 0;
}

/* --- TOP RIGHT CONTROLS --- */
.top-right-controls {
    position: absolute; top: 25px; right: 30px; z-index: 10;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.source-buttons {
    background: rgba(0, 0, 0, 0.4);
    padding: 3px;
    border-radius: 50px;
    display: flex;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-source {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 15px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}
#btn-yt.active-source { background: #ff0000; color: white; box-shadow: 0 2px 10px rgba(255,0,0,0.3); }
#btn-sp.active-source { background: #1DB954; color: white; box-shadow: 0 2px 10px rgba(29, 185, 84, 0.3); }

.login-badge {
    background: #1DB954; color: white; font-size: 0.7rem; font-weight: bold;
    text-transform: uppercase; text-align: center; border-radius: 10px;
    padding: 4px 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    animation: fadeUp 0.3s ease; display: none;
}

/* NY KNAPP: LOBBY MUSIK */
.lobby-music-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 2px;
    display: flex; align-items: center; gap: 5px;
}
.lobby-music-btn:hover { background: rgba(255, 255, 255, 0.2); }
.lobby-music-btn.playing { background: #1DB954; border-color: #1DB954; box-shadow: 0 0 10px rgba(29, 185, 84, 0.4); }

/* --- KNAPPAR & INPUTS --- */
.btn {
    display: inline-block; width: 100%; padding: 15px 30px; border-radius: 15px; font-size: 1.1rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s ease; border: none; text-decoration: none; margin-top: 10px; text-transform: uppercase; letter-spacing: 1px;
}
.btn-start, .btn-youtube, .btn-join {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover)); color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-start:hover, .btn-youtube:hover, .btn-join:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }

.btn-host { background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.3); color: white; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.btn-host:hover { background: rgba(255, 255, 255, 0.2); border-color: white; transform: translateY(-3px); }

.btn-small-secondary {
    background: transparent; border: 2px solid rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.9);
    padding: 8px 20px; font-size: 0.85rem; font-weight: 700; width: auto; display: inline-block; border-radius: 30px; margin: 0; 
}
.btn-small-secondary:hover { background: rgba(255, 255, 255, 0.2); color: white; border-color: white;}

input, select {
    width: 100%; padding: 12px; margin: 8px 0; border-radius: 12px; border: 1px solid var(--glass-border);
    background: var(--input-bg); color: white; font-size: 1rem; outline: none;
}
select option { background: #222; color: white; }

.songs-input-container {
     display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.4); padding: 0 15px;
     border-radius: 15px; gap: 15px; border: 1px solid rgba(255,255,255,0.2); height: 54px;
}
.songs-label { font-size: 0.9rem; font-weight: bold; white-space: nowrap; color: rgba(255,255,255,0.9); text-transform: uppercase; }
.songs-input-field {
    margin: 0 !important; width: 65px !important; text-align: center; font-weight: bold; font-size: 1.2rem;
    padding: 8px !important; background: rgba(255,255,255,0.1) !important; height: 40px; border: 1px solid rgba(255,255,255,0.3); color: white;
}

#players-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; margin: 15px 0 20px 0; }
#players-list li {
    background: rgba(255,255,255,0.15); padding: 8px 15px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px; font-weight: bold; font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.kick-btn { background: rgba(0,0,0,0.3); border: none; color: white; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }

#question-text { font-size: 3rem; margin: 10px 0 20px 0; line-height: 1.1; color: #ffffff; font-weight: 900; text-shadow: 0 4px 15px rgba(0,0,0,0.6); }

#timer-section { margin: 20px auto; padding: 15px 30px; background: rgba(0, 0, 0, 0.4); border-radius: 20px; border: 2px solid rgba(255,255,255,0.1); display: inline-block; min-width: 200px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
#timer-label { font-size: 1rem; letter-spacing: 3px; color: rgba(255,255,255,0.9); margin-bottom: 5px; text-transform: uppercase; font-weight: 800; }
#timer { font-size: 6rem; font-weight: 900; color: white; text-shadow: 0 0 20px rgba(255,255,255,0.5); margin: 0; line-height: 1; }

.timer-mini { 
    position: absolute !important; 
    top: 90px !important; 
    right: 20px !important; 
    width: auto !important; min-width: 0 !important; 
    padding: 10px 20px !important; margin: 0 !important; 
    background: rgba(0,0,0,0.8) !important; 
    border-radius: 30px !important; z-index: 100; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3) !important; 
    border: 1px solid rgba(255,255,255,0.3) !important; 
}
.timer-mini #timer { font-size: 2rem !important; text-shadow: none !important; }
.timer-mini #timer-label { font-size: 0.7rem !important; display: inline-block; margin-right: 5px; margin-bottom: 0 !important; }

#live-ranking { width: 100%; background: rgba(0, 0, 0, 0.2); border-radius: 15px; padding: 15px; margin-top: 20px; border: 1px solid rgba(255,255,255,0.1); }
#ranking-title { color: #ffffff; font-weight: bold; text-transform: uppercase; font-size: 0.9rem; margin-bottom: 10px; opacity: 1; }
#ingame-players-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0; list-style: none; }

#ingame-players-list li { 
    background: rgba(255, 255, 255, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    color: rgba(255, 255, 255, 0.6); 
    padding: 8px 15px; 
    border-radius: 15px; 
    font-size: 0.9rem; 
    transition: all 0.3s ease; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    min-width: 80px;
}
/* HÄR ÄR ÄNDRINGEN: Tog bort transform: scale(1.05) */
#ingame-players-list li.has-answered { 
    background: #ffffff; 
    color: #000000; 
    font-weight: bold; 
    transform: scale(1); /* Ingen förstoring */
}
#ingame-players-list li.round-correct { background: var(--success-color); color: white; font-weight: 900; transform: scale(1.1); }
#ingame-players-list li.round-wrong { background: var(--error-color); color: white; font-weight: 900; opacity: 0.9; }

.time-badge { 
    font-size: 0.75rem; 
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
    display: none; 
}

#ingame-players-list li.has-answered .time-badge,
#ingame-players-list li.round-correct .time-badge,
#ingame-players-list li.round-wrong .time-badge {
    display: block;
}

.result-layout { display: flex; flex-direction: column; width: 100%; gap: 20px; align-items: center; justify-content: center; }
#album-art { width: 100%; max-width: 300px; border-radius: 20px; border: 4px solid rgba(255,255,255,0.3); box-shadow: 0 15px 40px rgba(0,0,0,0.5);}

/* HÄR ÄR ÄNDRINGEN: Tog bort ramen och ökade max-width */
.total-leaderboard-container { 
    background: rgba(0,0,0,0.3); 
    border-radius: 15px; 
    padding: 15px; 
    width: 100%; 
    max-width: 550px; /* BREDDARE */
    border: none;     /* INGEN RAM */
    max-height: 65vh; 
    overflow-y: auto; 
}

.total-leaderboard-header { font-size: 0.9rem; font-weight: bold; margin-bottom: 10px; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 5px;}
.total-leaderboard-list { list-style: none; padding: 0; margin: 0; }
.total-leaderboard-list li { display: flex; justify-content: space-between; padding: 5px 0; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.res-list { list-style: none; padding: 0; margin: 0; font-size: 1.1rem; }
.res-list li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; }

.option-grid { display: flex; flex-direction: column; width: 100%; gap: 15px; margin-top: 20px; }
.option-btn { background: rgba(0, 0, 0, 0.8); border: 2px solid rgba(255, 255, 255, 0.5); color: white; padding: 20px; border-radius: 15px; font-size: 1.2rem; font-weight: 800; text-align: center; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.5); text-shadow: 0 1px 3px black; opacity: 1; }
.option-btn.selected { background: #ffffff !important; color: #000000 !important; border-color: #ffffff !important; }
.option-btn.reveal-correct { background: var(--success-color) !important; border-color: #fff !important; color: white !important; box-shadow: 0 0 20px var(--success-color); transform: scale(1.03); }
.option-btn.reveal-wrong { background: var(--error-color) !important; border-color: #fff !important; color: white !important; opacity: 0.9; }
.option-btn.dimmed { opacity: 0.4; cursor: default; }

.results-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; font-size: 1rem; background: rgba(0,0,0,0.3); border-radius: 15px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.results-table thead { background: rgba(255,255,255,0.1); border-bottom: 2px solid rgba(255,255,255,0.2); }
.results-table th { text-align: center; padding: 15px; color: #ffffff !important; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; }
.results-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: center; }
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:nth-child(even) { background: rgba(255,255,255,0.03); }

.rank-col { width: 50px; font-weight: 900; color: #FFD700; font-size: 1.2rem; }
.player-col { text-align: left !important; font-weight: bold; }
.score-col { font-weight: 900; font-size: 1.2rem; }
.stat-col { opacity: 0.8; font-size: 0.9rem; }

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

@media (min-width: 768px) {
    .result-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: 40px;}
    .option-grid { display: grid; grid-template-columns: 1fr 1fr; }
    .total-leaderboard-container { margin-top: 0; }
}
@media (max-width: 480px) {
    #question-text { font-size: 2rem; } 
    #timer { font-size: 4rem; }
    #score-header { font-size: 1rem; padding: 10px 0; }
    .source-switch-container { top: 15px; right: 15px; }
}

#end-game-quit-btn { background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.6); font-size: 0.8rem; padding: 10px 20px; margin-top: 30px; width: auto; border-radius: 20px; text-transform: uppercase; font-weight: bold; cursor: pointer; }
#end-game-quit-btn:hover { border-color: #ff3b30; color: #ff3b30; background: rgba(255, 59, 48, 0.1); }
