/* MyWatch2Gether – im Stil von Quest: ruhig, Inter, Bernstein-Akzent, Hell/Dunkel.
   Aufbau: oben Kopfzeile; Desktop: Bühne links, Seitenleiste rechts; Handy: untereinander, Reiter unten. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/Inter-SemiBold.woff") format("woff"); }

:root {
  --bg: #f8f7f4;
  --bg-2: #f1efea;
  --card: #ffffff;
  --card-2: #faf9f6;
  --line: #e6e2da;
  --line-2: #d6d1c7;
  --text: #1d1c1a;
  --text-2: #5d5953;
  --text-3: #8e8980;
  --accent: #d4952a;
  --accent-ink: #1d1c1a;
  --accent-soft: rgba(212, 149, 42, .14);
  --danger: #cf4b42;
  --ok: #3f9d5d;
  --hover: rgba(40, 32, 20, .05);
  --shadow: 0 1px 2px rgba(40, 30, 10, .05), 0 6px 20px rgba(40, 30, 10, .06);
  --shadow-lg: 0 10px 40px rgba(30, 20, 5, .18);
  --overlay: rgba(30, 26, 20, .32);
  --screen: #0d0d0d;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  --r-sm: 7px;
  --topbar: 52px;
  --tabbar: 0px;
  --side: 380px;
  /* Anbieter-Punkte */
  --p-youtube: #e0645b;
  --p-soundcloud: #e8894a;
  --p-vimeo: #4fa3d1;
  --p-twitch: #9b7be0;
  --p-file: var(--text-3);
  color-scheme: light;
}
:root.theme-dark {
  --bg: #0d0d0d;
  --bg-2: #121212;
  --card: #171717;
  --card-2: #1b1b1b;
  --line: #252525;
  --line-2: #323232;
  --text: #ebe9e5;
  --text-2: #a8a5a0;
  --text-3: #6d6b67;
  --accent: #e8b453;
  --accent-ink: #141414;
  --accent-soft: rgba(232, 180, 83, .14);
  --danger: #e0645b;
  --ok: #5fc07c;
  --hover: rgba(255, 255, 255, .045);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, .6);
  --overlay: rgba(0, 0, 0, .55);
  --screen: #000;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: .875rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input { background: transparent; border: 0; outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; text-wrap: balance; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible { outline: none; }

.ic {
  width: 16px; height: 16px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.logo { width: 22px; height: 22px; flex: none; color: var(--text); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.accent { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- Knöpfe & Felder (wie Quest) */
.btn {
  height: 32px; padding: 0 .8rem; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line-2); background: var(--card); color: var(--text); font-size: .8125rem; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 .6rem; font-size: .75rem; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn.wide { width: 100%; height: 38px; font-size: .875rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 1.25rem; }

.icon-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 7px; color: var(--text-3); flex: none;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.on { color: var(--accent); }
.icon-btn.done { color: var(--ok); }
.icon-btn.danger-hover:hover { color: var(--danger); }
.icon-btn.armed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--card-2); gap: 2px; flex: none; }
.seg button { padding: .2rem .55rem; border-radius: 6px; font-size: .75rem; color: var(--text-3); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.seg button .ic { width: 13px; height: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field > label { font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.field-row { display: flex; gap: .5rem; }
.field-row .input { flex: 1; min-width: 0; }
.field-error { color: var(--danger); font-size: .75rem; }
.input {
  height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 .7rem; background: var(--card-2); width: 100%;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.empty {
  border: 1px dashed var(--line-2); border-radius: 10px; padding: 1rem; color: var(--text-3); font-size: .8125rem; text-align: center;
}
.empty b { color: var(--text-2); font-weight: 500; }

.warn {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: space-between;
  background: var(--accent-soft); border-radius: 9px; padding: .6rem .75rem; font-size: .8125rem;
}
.warn-title { font-weight: 500; }
.warn-text { color: var(--text-2); font-size: .75rem; }

/* ---------- Startseite (wie die Anmeldung in Quest) */
.authwrap { min-height: 100%; display: grid; place-items: center; padding: calc(2rem + env(safe-area-inset-top)) 1rem calc(2rem + env(safe-area-inset-bottom)); }
.authstack { width: min(400px, 100%); }
.authcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.75rem 1.5rem 1.4rem; box-shadow: var(--shadow); }
.authbrand { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9375rem; margin-bottom: 1.4rem; }
.authbrand .logo { width: 26px; height: 26px; }
.authcard h1 { font-size: 1.5rem; letter-spacing: -.02em; margin-bottom: .35rem; }
.authcard > p.muted { margin: 0 0 1.4rem; font-size: .8125rem; }
.or { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--text-3); font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#join-form .field { margin-bottom: 0; }
.authfoot { margin-top: 1rem; text-align: center; font-size: .75rem; color: var(--text-3); }

/* ---------- Raum: Gerüst */
body.is-room { overflow: hidden; }
.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "stage side";
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  grid-area: top; display: flex; align-items: center; gap: .75rem; min-width: 0;
  padding: env(safe-area-inset-top) 1rem 0; height: calc(var(--topbar) + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9375rem; padding-right: .25rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.roomchip {
  display: inline-flex; align-items: center; gap: .45rem; height: 28px; padding: 0 .6rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card-2); font-size: .75rem; white-space: nowrap;
}
.room-label { color: var(--text-3); }
.room-code { color: var(--text); font-weight: 500; letter-spacing: .03em; }

.people { display: flex; align-items: center; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
  background: var(--card-2); border: 1px solid var(--line-2); font-size: .75rem; font-weight: 600; color: var(--text);
}
.people .avatar { width: 26px; height: 26px; font-size: .6875rem; margin-left: -5px; border: 1.5px solid var(--c, var(--line-2)); box-shadow: 0 0 0 2px var(--bg); }
.people .avatar:first-child { margin-left: 0; }
.people .count-label { margin-left: .55rem; color: var(--text-3); font-size: .75rem; white-space: nowrap; }
.avatar.me { border-color: var(--c, var(--line-2)); }
.avatar.me:hover { border-color: var(--text-3); }
.syncdot { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--bg); background: var(--text-3); }
.syncdot.synced { background: var(--ok); }
.syncdot.syncing { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.syncdot.offline { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Bühne */
.stage {
  --frame-w: min(100%, calc((100dvh - var(--topbar) - 190px) * 16 / 9));
  grid-area: stage; display: flex; flex-direction: column; justify-content: center; gap: .75rem;
  min-height: 0; min-width: 0; overflow-y: auto; padding: 1.25rem 1.5rem;
}
.screen { display: grid; justify-items: center; }
.frame {
  position: relative; width: var(--frame-w); aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: var(--screen); border: 1px solid var(--line);
  transition: box-shadow .3s, border-color .3s;
}
.screen[data-state="playing"] .frame {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 32px color-mix(in srgb, var(--accent) 10%, transparent);
}
.player-host, .mount { position: absolute; inset: 0; }
.mount iframe, .mount video, .mount > div { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }
.mount video { background: #000; object-fit: contain; }
.mount-audio { display: flex; flex-direction: column; background: var(--bg-2); }
.audio-card { flex: 1; display: grid; place-items: center; align-content: center; gap: .75rem; padding: 1.25rem; text-align: center; }
.audio-card .ic { width: 44px; height: 44px; stroke-width: 1.6; color: var(--accent); }
.audio-card span { max-width: 30em; font-size: 1.0625rem; font-weight: 500; }
.mount .media-audio { position: static !important; width: calc(100% - 2rem) !important; height: 44px !important; margin: 0 1rem 1rem; }

.empty-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  padding: 1.5rem; text-align: center; background: var(--bg-2);
}
.empty-stage .logo { width: 44px; height: 44px; margin-bottom: .4rem; color: var(--text-3); }
.empty-title { font-size: 1.0625rem; font-weight: 500; }
.empty-text { max-width: 32em; color: var(--text-3); font-size: .8125rem; }

.player-msg {
  position: absolute; left: .75rem; right: .75rem; bottom: .75rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
  padding: .65rem .75rem; border-radius: 10px; background: var(--card); border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line)); box-shadow: var(--shadow-lg);
}
.player-msg p { flex: 1 1 220px; font-size: .8125rem; }
.player-msg-actions { display: flex; gap: .4rem; }

.stage > .warn { width: var(--frame-w); max-width: 100%; margin: 0 auto; }

/* Nur direkt auf YouTube (altersbeschränkt / Einbetten gesperrt) */
.ext-card { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.25rem; background: var(--bg-2); overflow: auto; }
.ext-inner { max-width: 30rem; display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.ext-title { font-size: 1.0625rem; font-weight: 500; letter-spacing: -.01em; }
.ext-text { color: var(--text-2); font-size: .8125rem; }
.ext-steps { margin: .2rem 0 0; padding-left: 1.2rem; color: var(--text-2); font-size: .8125rem; display: grid; gap: .15rem; }
.ext-steps b { color: var(--text); font-weight: 500; }
.ext-status { font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: .4rem; }
.ext-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.ext-status.run { color: var(--accent); }
.ext-status.run::before { background: var(--accent); animation: pulse 1.6s infinite; }
.ext-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .35rem; }
.tag {
  display: inline-flex; align-items: center; font-size: .625rem; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-2);
  border-radius: 20px; padding: .05rem .45rem; color: var(--text-2); white-space: nowrap; line-height: 1.5;
}
.tag.acc { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); color: var(--accent); }

/* Gemeinsamer Countdown */
.countdown {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(3px); animation: fadein .15s;
}
.countdown-num { font-size: clamp(4rem, 14vw, 8rem); font-weight: 400; letter-spacing: -.04em; line-height: 1; color: var(--text); }
.countdown.go .countdown-num { color: var(--accent); }
.countdown small { font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

/* Steuerleiste */
.controls { display: flex; align-items: center; gap: .3rem; width: var(--frame-w); max-width: 100%; margin: 0 auto; }
.controls .icon-btn { width: 34px; height: 34px; color: var(--text-2); }
.controls .icon-btn .ic { width: 18px; height: 18px; }
.playbtn {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink);
}
.playbtn:hover:not(:disabled) { filter: brightness(1.05); }
.playbtn:disabled { opacity: .4; cursor: default; }
.playbtn .ic { width: 18px; height: 18px; }
.time { min-width: 2.9rem; text-align: center; color: var(--text-3); font-size: .75rem; }
.seek-wrap { flex: 1; min-width: 60px; display: flex; align-items: center; }

input[type="range"] {
  --p: 0%; -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; touch-action: none;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line-2) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line-2) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 0 3px var(--bg); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 0 3px var(--bg); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
input[type="range"]:disabled { cursor: default; opacity: .45; }
.vol { width: 84px !important; flex: none; }

/* Läuft gerade */
.now { display: flex; align-items: center; gap: 1rem; width: var(--frame-w); max-width: 100%; margin: 0 auto; min-height: 42px; }
.now-text { flex: 1; min-width: 0; }
.now-title { font-size: 1.0625rem; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; row-gap: .1rem; color: var(--text-3); font-size: .75rem; }
.meta > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.now-sub { margin-top: .15rem; }
.pchip {
  display: inline-flex; align-items: center; gap: .35rem; height: 20px; padding: 0 .45rem; border-radius: 20px; border: 1px solid var(--line);
  font-size: .6875rem; color: var(--text-2); background: var(--card-2);
}
.pchip i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--pc, var(--text-3)); }
.live { color: var(--danger); font-weight: 500; }
.now-link { color: var(--text-3); }

/* ---------- Seitenleiste */
.side {
  grid-area: side; display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--line); background: var(--bg-2); padding-bottom: env(safe-area-inset-bottom);
}
.omni { padding: .9rem .9rem .6rem; }
.addrow {
  display: flex; align-items: center; gap: .45rem; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 9px; padding: 0 .3rem 0 .65rem; height: 38px;
}
.addrow:focus-within { border-color: var(--line-2); background: var(--card); }
.addrow > .ic { color: var(--text-3); }
.addrow input { flex: 1; min-width: 0; height: 100%; font-size: .8125rem; }
.addrow input::placeholder { color: var(--text-3); }
.addrow input::-webkit-search-cancel-button { opacity: .5; }
.addrow .seg { margin-left: auto; }

/* Link-Vorschau */
.linkcard {
  margin: 0 .9rem .7rem; padding: .75rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.linkcard.busy { opacity: .6; pointer-events: none; }
.linkcard-warn { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.lc-top { display: flex; gap: .7rem; align-items: flex-start; }
.lc-meta { flex: 1; min-width: 0; }
.lc-title { font-size: .875rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-sub { margin-top: .2rem; }
.lc-close { margin: -.2rem -.2rem 0 0; }
.lc-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.lc-note { margin-top: .55rem; color: var(--text-3); font-size: .75rem; }

/* Vorschaubilder */
.thumb {
  position: relative; flex: none; width: 64px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden;
  background: var(--card-2); border: 1px solid var(--line); display: grid; place-items: center;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.thumb-fallback { color: var(--text-3); width: 16px; height: 16px; }
.thumb-soundcloud { aspect-ratio: 1; width: 40px; }
.lc-thumb { width: 88px; }
.lc-thumb.thumb-soundcloud { width: 52px; }
.result-thumb { width: 96px; }
.result-thumb.thumb-soundcloud { width: 54px; }
.dur {
  position: absolute; right: 3px; bottom: 3px; z-index: 2; padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, .78); color: #fff;
  font-size: .625rem; font-weight: 500; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.dur.live { background: var(--danger); }

/* Reiter (Desktop: wie die Navigation in Quest) */
.tabs { display: flex; gap: .125rem; padding: 0 .9rem .6rem; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .65rem; border-radius: 7px; color: var(--text-2); font-size: .8125rem;
}
.tab .ic { display: none; }
@media (hover: hover) { .tab:hover { color: var(--text); background: var(--hover); } }
.tab[aria-selected="true"] { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.count { color: var(--text-3); font-size: .75rem; }
.badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: .625rem; font-weight: 600; line-height: 16px; text-align: center;
}

.panel { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .9rem .9rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; min-height: 28px; }
.sec-head h2 {
  font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 500;
  display: flex; align-items: center; gap: .5rem; white-space: nowrap;
}
.sec-head h2 .faint { letter-spacing: .04em; text-transform: none; font-size: .75rem; }
.sec-head .tools { display: flex; gap: .15rem; align-items: center; }
.search-status.err { color: var(--danger); }

/* Karten-Listen (Playlist, Suchtreffer) – wie die Aufgaben-Karten in Quest */
.cardlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.pl-item, .result {
  position: relative; display: flex; align-items: center; gap: .4rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: .45rem .35rem .45rem .45rem; transition: border-color .15s, box-shadow .2s, opacity .2s;
}
.pl-item { border-left: 3px solid var(--line-2); padding-left: .2rem; }
.pl-item:hover, .result:hover { border-color: var(--line-2); }
.pl-item.is-current {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); border-left-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.pl-item.dragging { z-index: 5; transition: none; box-shadow: var(--shadow-lg); }
.pl-list.is-dragging .pl-item:not(.dragging) { pointer-events: none; transition: transform .18s ease; }
.pl-item.removing { opacity: .4; }
.grip { width: 24px; height: 34px; display: grid; place-items: center; color: var(--text-3); opacity: .5; cursor: grab; touch-action: none; flex: none; border-radius: 6px; }
.pl-item:hover .grip, .grip:focus-visible { opacity: .9; }
.dragging .grip { cursor: grabbing; }
.pl-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; text-align: left; padding: .1rem .2rem; border-radius: 6px; }
.pl-meta, .result-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.pl-title, .result-title { font-size: .8125rem; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-current .pl-title { font-weight: 500; }
.pl-state { display: inline-flex; align-items: center; gap: .3rem; color: var(--accent); }
.pl-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.is-playing .pl-state::before { animation: pulse 1.6s infinite; }
.pl-item .pl-rm { opacity: 0; }
.pl-item:hover .pl-rm, .pl-rm:focus-visible { opacity: 1; }
.result-acts { display: flex; flex: none; }
.result-acts .r-play { color: var(--accent); }
.warn-text-inline { color: var(--accent); }
.skeleton { height: 62px; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(90deg, var(--card), var(--card-2), var(--card)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Chat */
.panel-chat:not([hidden]) { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.msg-head { display: flex; align-items: baseline; gap: .5rem; }
.msg-name { color: var(--c, var(--accent)); font-weight: 500; font-size: .8125rem; }
.msg-time { color: var(--text-3); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.msg-text { overflow-wrap: anywhere; white-space: pre-wrap; font-size: .8125rem; }
.msg-sys { display: flex; gap: .5rem; align-items: baseline; color: var(--text-3); font-size: .75rem; }
.msg-sys .msg-text { flex: 1; font-size: .75rem; }
.chat-form { padding: .6rem .9rem .9rem; border-top: 1px solid var(--line); }
.chat-form .icon-btn { color: var(--accent); }

/* ---------- Menü, Dialoge, Meldungen (wie Quest) */
.menu {
  position: fixed; z-index: 80; min-width: 230px; max-width: min(320px, calc(100vw - 16px)); background: var(--card); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: .3rem; animation: fadein .12s ease;
}
.menu-item { width: 100%; display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border-radius: 7px; font-size: .8125rem; text-align: left; color: var(--text); text-decoration: none; }
.menu-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item .ic { color: var(--text-3); }
.menu-sep { height: 1px; background: var(--line); margin: .3rem .2rem; }
.menu-head { font-size: .625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: .45rem .55rem .2rem; }
.menu-seg { padding: .2rem .45rem .4rem; }
.menu-seg .seg { display: flex; }
.menu-seg .seg button { flex: 1; justify-content: center; }
@keyframes fadein { from { opacity: 0; } }

.modal-wrap { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 1rem 1rem; z-index: 60; animation: fadein .15s; }
.modal {
  width: 100%; max-width: 560px; max-height: 84vh; overflow: auto; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: modal-in .18s ease;
}
@keyframes modal-in { from { transform: translateY(8px) scale(.99); } }
.modal.small { max-width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1rem 0 1.25rem; min-height: 2.6rem; }
.modal-head h2 { font-size: 1.0625rem; }
.modal-body { padding: .75rem 1.25rem 1.25rem; }
.modal-body > p.muted { font-size: .8125rem; margin-bottom: 1rem; }

.toasts {
  position: fixed; left: 50%; bottom: calc(1.25rem + var(--tabbar) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 2rem);
}
.toast {
  display: flex; align-items: center; gap: .75rem; background: var(--text); color: var(--bg); border-radius: 10px; padding: .55rem .9rem;
  font-size: .8125rem; box-shadow: var(--shadow-lg); animation: fadein .15s; transition: opacity .3s;
}
.toast-error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; }

/* Vollbild */
.screen:fullscreen { display: block; background: #000; }
.screen:fullscreen .frame { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; border: 0; box-shadow: none; }
.screen:-webkit-full-screen { display: block; background: #000; }
.screen:-webkit-full-screen .frame { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; border: 0; }

/* ---------- Tablet */
@media (max-width: 1100px) {
  :root { --side: 340px; }
  .vol { width: 64px !important; }
  .people .count-label { display: none; }
}

/* Tablet hochkant: untereinander */
@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "top" "stage" "side";
  }
  .stage { --frame-w: 100%; padding: 0; gap: 0; overflow: visible; }
  .frame { max-height: 46dvh; border-radius: 0; border-width: 0 0 1px; }
  .screen[data-state="playing"] .frame { box-shadow: none; border-color: var(--accent); }
  .controls { padding: .35rem .6rem 0; }
  .now { padding: 0 1rem .6rem; min-height: 0; }
  .now-title { font-size: .9375rem; }
  .now-link span { display: none; }
  .stage > .warn { width: auto; margin: .5rem .75rem 0; }
  .frame.ext { aspect-ratio: auto; max-height: none; min-height: 56vw; }
  .frame.ext .ext-card { position: relative; inset: auto; min-height: 56vw; padding: 1rem; }
  .frame.ext .countdown { position: absolute; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .omni { padding: .7rem .75rem .5rem; }
  .linkcard { margin: 0 .75rem .6rem; }
  .tabs { padding: 0 .75rem .5rem; }
  .panel { padding: .75rem .75rem 1.25rem; }
}

/* ---------- Handy: Reiter unten wie die Tab-Leiste in Quest */
@media (max-width: 720px) {
  :root { --topbar: 50px; --tabbar: 58px; }
  .topbar { gap: .5rem; padding-left: .75rem; padding-right: .75rem; }
  .brand span { display: none; }
  .room-label { display: none; }
  #invite-btn span { display: none; }
  #invite-btn { width: 28px; padding: 0; }
  .vol, #prev-btn { display: none; }
  .controls { gap: .15rem; }
  .controls .icon-btn { width: 38px; height: 38px; }
  .playbtn { width: 42px; height: 42px; }
  .time { min-width: 2.6rem; font-size: .6875rem; }
  .now-sub > :nth-child(n+3) { display: none; }
  .addrow { height: 42px; }
  .addrow input { font-size: 1rem; } /* kein Zoom auf iOS */
  .input { font-size: 1rem; height: 40px; }
  .seg.src button { padding: .25rem .45rem; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 0 0 env(safe-area-inset-bottom); gap: 0;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); border-bottom: 0;
  }
  .tab {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px; border-radius: 0; padding: 0; font-size: .625rem; color: var(--text-3); position: relative;
  }
  .tab .ic { display: block; width: 20px; height: 20px; }
  .tab[aria-selected="true"] { background: none; box-shadow: none; color: var(--text); }
  .tab[aria-selected="true"] .ic { color: var(--accent); }
  .tab .count { position: absolute; top: 6px; left: calc(50% + 10px); font-size: .625rem; }
  .tab .badge { position: absolute; top: 5px; left: calc(50% + 8px); }
  .panel { padding-bottom: calc(var(--tabbar) + 1rem + env(safe-area-inset-bottom)); }
  .panel-chat:not([hidden]) { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .pl-item .pl-rm { opacity: 1; }
  .grip { width: 30px; height: 40px; opacity: .75; }
  .result-thumb { width: 80px; }
  .result-acts .icon-btn { width: 34px; height: 34px; }
  .pl-sub .pl-by { display: none; }
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal { max-width: none !important; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .menu.sheet { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); max-width: none; }
  .menu.sheet .menu-item { padding: .7rem .6rem; font-size: .875rem; }
}

@media (max-width: 360px) {
  .roomchip { display: none; }
}

/* Handy quer: Video so groß wie möglich, Rest darunter */
@media (max-height: 520px) and (orientation: landscape) {
  body.is-room { overflow: auto; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; }
  .frame { max-height: none; height: calc(100dvh - 54px); width: auto; margin: 0 auto; border-width: 0; }
  .screen { background: #000; }
  .side { min-height: 100dvh; }
  .tabs { position: static; height: auto; padding: 0 .75rem .5rem; border-top: 0; border-bottom: 1px solid var(--line); background: none; }
  .tab { flex: none; flex-direction: row; padding: .3rem .65rem; font-size: .8125rem; border-radius: 7px; }
  .tab .ic { display: none; }
  .tab .count, .tab .badge { position: static; }
  .panel { padding-bottom: 1.25rem; }
  :root { --tabbar: 0px; }
}

@media (hover: none) {
  .pl-item:hover, .result:hover { border-color: var(--line); }
  .pl-item.is-current:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
