:root {
    --bg: #0f0b1e;
    --bg-2: #1a1433;
    --card: #1f1940;
    --card-2: #2a2252;
    --border: #3a3170;
    --text: #f2efff;
    --muted: #a49cc9;
    --primary: #ff4fa3;
    --primary-2: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 16px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, #3b1d6e 0%, transparent 60%),
        radial-gradient(900px 500px at 110% 10%, #5a1747 0%, transparent 55%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.5;
}

a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Layout */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    background: rgba(15, 11, 30, .6);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.logo { font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -.01em; }
.logo-icon {
    display: inline-grid; place-items: center;
    width: 2rem; height: 2rem; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    margin-right: .35rem;
}
.topbar-right { display: flex; gap: .5rem; align-items: center; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.hero { text-align: center; padding: 1.5rem 0 2rem; }
.hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    background: linear-gradient(90deg, #fff, #ffb3d9 50%, #c4b5fd);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.card {
    background: linear-gradient(180deg, var(--card), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    min-width: 0;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.how { margin-top: 1.25rem; }
.how ol { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.how strong { color: var(--text); }

.game-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }

/* ---------------------------------------------------------------- Forms & Buttons */

.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .9rem; }

input, select {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .65rem .8rem;
    width: 100%;
    min-width: 0;
}
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
input:focus, select:focus { outline: 2px solid var(--primary-2); outline-offset: 1px; }

/* Mehrfachauswahl im Look eines normalen Dropdowns */
.form .field { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
.multi-select { position: relative; }
.multi-select-button {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .65rem 2.2rem .65rem .8rem;
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}
.multi-select-button::after {
    content: '';
    position: absolute;
    right: .9rem;
    top: 50%;
    width: .45rem;
    height: .45rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-70%) rotate(45deg);
}
.multi-select-button:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 1px; }
.multi-select-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.multi-select-panel hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.form .multi-select-check,
.multi-select-option {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
    background: none;
    border: 0;
    border-radius: 7px;
    padding: .45rem .6rem;
    text-align: left;
    cursor: pointer;
}
.multi-select-check:hover,
.multi-select-option:hover,
.multi-select-option:focus-visible,
.multi-select-check:focus-within { background: var(--card-2); outline: none; }
.multi-select-option.active { color: var(--primary); font-weight: 600; }

.btn {
    font: inherit;
    font-weight: 600;
    color: var(--text);
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .6rem 1.1rem;
    cursor: pointer;
    transition: transform .08s, filter .15s, background .15s;
    white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: 0; }
.btn.big { padding: .9rem 1.4rem; font-size: 1.05rem; width: 100%; }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn.ghost { background: transparent; }

.alert {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .5);
    color: #fecaca;
    padding: .75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* ---------------------------------------------------------------- Lobby */

.code-join { display: flex; gap: .5rem; margin-bottom: 1rem; }
.code-join input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center; }

.room-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; max-height: 520px; overflow-y: auto; }
.room-list .empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.room-item {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .8rem 1rem; border-radius: 12px; text-decoration: none;
    background: var(--card-2); border: 1px solid transparent;
    transition: border-color .15s, transform .15s;
}
.room-item:hover { border-color: var(--primary); transform: translateY(-1px); }
.room-name { font-weight: 700; }
.room-side { display: grid; justify-items: end; gap: .25rem; flex-shrink: 0; }

.badge { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--border); }
.badge.open { background: rgba(34, 197, 94, .2); color: #86efac; }
.badge.live { background: rgba(255, 79, 163, .2); color: #ff9fcd; }

.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ---------------------------------------------------------------- Warteraum */

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.summary div { background: var(--card-2); border-radius: 10px; padding: .6rem .8rem; }
.summary dt { font-size: .8rem; color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; }

.share-box {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    margin: 1.25rem 0; padding: .8rem 1rem; border-radius: 12px;
    background: rgba(139, 92, 246, .12); border: 1px dashed var(--primary-2);
    font-size: .9rem;
}
.share-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c4b5fd; }

.spinner {
    width: 48px; height: 48px; margin: 1rem auto;
    border: 4px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Runde */

.round-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.pill { background: var(--card-2); border-radius: 999px; padding: .25rem .8rem; font-weight: 700; font-size: .9rem; }

.stage { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.25rem; }
.stage-info { flex: 1; min-width: 0; }
.phase-text { font-size: 1.4rem; font-weight: 800; margin-bottom: .6rem; }
.timer { height: 12px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.timer-bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--primary-2), var(--primary)); transition: width .2s linear; }
.timer-bar.waiting { background: var(--border); }
.timer-bar.urgent { background: var(--danger); }
.timer-text { margin-top: .4rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.disc {
    position: relative; flex-shrink: 0;
    width: 120px; height: 120px; border-radius: 50%;
    background: repeating-radial-gradient(circle, #111 0 2px, #1c1c1c 3px 5px);
    box-shadow: 0 0 0 4px var(--card-2), 0 10px 30px rgba(0, 0, 0, .5);
    display: grid; place-items: center; overflow: hidden;
}
.disc.spinning { animation: spin 3s linear infinite; }
.disc-label {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    display: grid; place-items: center; font-weight: 800; z-index: 1;
}
.disc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }

.audio-hint {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .5);
    padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1rem;
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.option {
    font: inherit; color: var(--text); text-align: left; cursor: pointer;
    padding: 1rem; border-radius: 12px; min-height: 76px;
    background: var(--card-2); border: 2px solid var(--border);
    display: grid; gap: .15rem; transition: border-color .15s, background .15s, transform .08s;
}
.option:hover:not(:disabled) { border-color: var(--primary); }
.option:active:not(:disabled) { transform: scale(.98); }
.option:disabled { cursor: default; opacity: .7; }
.option-title { font-weight: 700; overflow-wrap: anywhere; }
.option-artist { font-size: .85rem; color: var(--muted); }
.option.picked { border-color: var(--primary-2); background: rgba(139, 92, 246, .2); opacity: 1; }
.option.correct { border-color: var(--success); background: rgba(34, 197, 94, .2); opacity: 1; }
.option.wrong { border-color: var(--danger); background: rgba(239, 68, 68, .2); opacity: 1; }

.guess-form { display: flex; gap: .5rem; }
.guess-form input { font-size: 1.1rem; }
.skip-btn { display: block; margin: .75rem auto 0; font-size: .9rem; color: var(--muted); }
.skip-btn[hidden] { display: none; }

.feedback { min-height: 1.6rem; margin-top: .9rem; font-weight: 600; }
.feedback.correct { color: #86efac; }
.feedback.artist { color: #fcd34d; }
.feedback.close { color: #fcd34d; }
.feedback.wrong { color: #fca5a5; }
.feedback.info { color: var(--muted); }

.my-guesses { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.my-guesses li { font-size: .85rem; padding: .2rem .6rem; border-radius: 999px; background: var(--card-2); }
.my-guesses li span { margin-left: .3rem; color: var(--muted); }
.my-guesses li.correct { background: rgba(34, 197, 94, .2); }
.my-guesses li.artist, .my-guesses li.close { background: rgba(245, 158, 11, .2); }

.solution {
    margin-top: 1.25rem; padding: 1rem 1.2rem; border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 79, 163, .15), rgba(139, 92, 246, .15));
    border: 1px solid var(--border);
    animation: pop .35s ease-out;
}
.solution-title { font-size: 1.4rem; font-weight: 800; }
.solution-artist { font-size: 1.05rem; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.volume { display: flex; align-items: center; gap: .5rem; margin-top: 1.25rem; max-width: 260px; color: var(--muted); }
.volume input { padding: 0; accent-color: var(--primary); border: 0; background: transparent; }

/* ---------------------------------------------------------------- Scoreboard */

.scoreboard { position: sticky; top: 80px; }
.player-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.player-list li {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .65rem; border-radius: 10px; background: var(--card-2);
}
.player-list li.me { outline: 2px solid var(--primary-2); }
.player-list li.offline { opacity: .5; }
.player-list .rank { width: 1.6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.player-list .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .score { font-weight: 800; font-variant-numeric: tabular-nums; }
.tick { color: var(--success); font-weight: 800; }
.gain { color: #86efac; font-weight: 700; font-size: .85rem; animation: pop .35s ease-out; }

/* ---------------------------------------------------------------- Ergebnis */

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; margin: 1.5rem 0 2rem; }
.podium-place {
    text-align: center; padding: 1rem; border-radius: 12px; min-width: 120px;
    background: var(--card-2); border: 1px solid var(--border);
}
.podium-place.place-1 { order: 2; padding-top: 2rem; }
.podium-place.rank-1 { border-color: #fbbf24; box-shadow: 0 0 30px rgba(251, 191, 36, .25); }
.podium-place.place-2 { order: 1; padding-top: 1.4rem; }
.podium-place.place-3 { order: 3; }
.medal { font-size: 2.2rem; }
.podium-place .pname { font-weight: 800; overflow-wrap: anywhere; }
.podium-place .score { color: var(--muted); }

.played-list { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.played-list li { display: flex; gap: .7rem; align-items: center; background: var(--card-2); padding: .5rem; border-radius: 10px; min-width: 0; }
.played-list li > div { min-width: 0; }
.played-list img, .art-placeholder { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.art-placeholder { display: grid; place-items: center; background: var(--border); }

/* ---------------------------------------------------------------- Toast */

.toast {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    background: var(--card-2); border: 1px solid var(--border);
    padding: .75rem 1.2rem; border-radius: 12px; z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: calc(100% - 2rem);
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 860px) {
    .grid-2, .game-layout { grid-template-columns: 1fr; }
    .scoreboard { position: static; }
}
@media (max-width: 520px) {
    .options { grid-template-columns: 1fr; }
    .stage { gap: 1rem; }
    .disc { width: 84px; height: 84px; }
    .phase-text { font-size: 1.1rem; }
    .topbar { padding: .7rem 1rem; }
    .logo { font-size: 1rem; }
    .podium { gap: .5rem; }
    .podium-place { min-width: 0; flex: 1; }
}
