:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4f8cff;
  --accent-hover: #3d7bf0;
  --danger: #f0616d;
  --ok: #3fb950;
  --warn: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; }

/*
 * Jede Klasse mit eigenem display schlaegt sonst das hidden-Attribut - das
 * hat hier schon zweimal dazu gefuehrt, dass Verstecktes sichtbar blieb.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

/*
 * Der gewaehlte Hintergrund liegt fest hinter allem. Der Schleier darueber
 * haelt Text lesbar, egal wie hell das Bild ist - ohne ihn ist ein Kinofoto
 * huebsch und die Schrift unlesbar.
 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background: var(--page-bg, var(--bg));
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
/*
 * Der Schleier gilt nur fuer eigene Fotos. Die mitgelieferten Themen sind
 * schon dunkel gehalten - dort wuerde er sie einfach wegwischen.
 */
/*
 * Mehrere der Bildvorlagen sind nur Vorschaubilder von wenigen hundert Pixeln.
 * Bildschirmfuellend gestreckt wirken sie kaputt - die leichte Unschaerfe
 * laesst sie wie gewollte Tiefenschaerfe aussehen.
 */
:root[data-theme="bild"] body::before { filter: blur(3px); transform: scale(1.03); }

:root[data-theme="bild"] body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(14, 17, 22, .74), rgba(14, 17, 22, .88));
  pointer-events: none;
}

/* Flaechen leicht durchscheinend, damit der Hintergrund ueberhaupt wirkt. */
:root:not([data-theme="dunkel"]) .card,
:root:not([data-theme="dunkel"]) .panel,
:root:not([data-theme="dunkel"]) .topbar {
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(8px);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; font-size: 17px; color: var(--text); }
.topbar .brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 14px; margin-left: auto; align-items: center; font-size: 14px; }
.topbar .who { color: var(--muted); }

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.narrow { max-width: 430px; }
.wide { max-width: 1500px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

h1 { font-size: 22px; margin: 0 0 18px; }

/* ---------- Formulare ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  padding: 9px 15px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 500; }
button.ghost:hover { background: var(--panel-2); }
button.danger { background: var(--danger); }
button.ok { background: var(--ok); }
button.small { padding: 5px 10px; font-size: 13px; }

.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }
.actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { background: var(--panel-2); color: var(--muted); font-weight: 500; }
.tabs button.active { background: var(--accent); color: #fff; font-weight: 600; }

.msg { margin-top: 14px; padding: 10px 12px; border-radius: 8px; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(240,97,109,.13); color: #ff9aa2; border: 1px solid rgba(240,97,109,.35); }
.msg.ok { background: rgba(63,185,80,.13); color: #7ee787; border: 1px solid rgba(63,185,80,.35); }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td .row { flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pending  { background: rgba(210,153,34,.18); color: #e3b341; }
.badge.approved { background: rgba(63,185,80,.16);  color: #7ee787; }
.badge.rejected { background: rgba(240,97,109,.16); color: #ff9aa2; }
.badge.banned   { background: rgba(240,97,109,.28); color: #ffc0c5; }
.badge.admin    { background: rgba(79,140,255,.18); color: #86b6ff; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- Raumliste ---------- */
.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.room-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.room-card h3 { margin: 0; font-size: 16px; }
.room-card .meta { color: var(--muted); font-size: 13px; }
.room-card .foot { margin-top: 8px; display: flex; gap: 8px; }

/* ---------- Raum ---------- */
.room-layout {
  display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 16px;
  padding: 16px; max-width: 1600px; margin: 0 auto; align-items: start;
}
@media (max-width: 950px) { .room-layout { grid-template-columns: 1fr; } }

/*
 * Rasterfelder sind von Haus aus mindestens so breit wie ihr Inhalt. Ohne das
 * hier sprengt die Knopfreihe der Steuerleiste auf schmalen Schirmen die
 * ganze Seite und alles scrollt seitlich weg.
 */
.room-layout > * { min-width: 0; }

.stage {
  background: #000; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; position: relative; aspect-ratio: 16 / 9;
}
.stage iframe, .stage video { width: 100%; height: 100%; display: block; border: 0; background: #000; }
.stage .placeholder {
  position: absolute; inset: 0; display: grid; place-content: center;
  color: var(--muted); text-align: center; padding: 20px;
}
.side { display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.chat-log {
  height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px;
  font-size: 14px; padding-right: 4px;
}
.chat-log .m .u { color: var(--accent); font-weight: 600; }
.chat-log .sys { color: var(--muted); font-size: 13px; font-style: italic; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }

.members { display: flex; flex-wrap: wrap; gap: 6px; }
.member { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; }

.playlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.playlist li {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 13px;
}
.playlist li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: 8px; display: none; }
.progress.show { display: block; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.empty { color: var(--muted); font-size: 14px; }

/* ---------- Ergaenzungen: Host, Untertitel, Tastenkuerzel, Mobil ---------- */
.topbar nav .pill {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px;
  background: var(--warn); color: #1a1300; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-align: center;
}

.shortcuts {
  margin: 8px 0 0; color: var(--muted); font-size: 13px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
}
.shortcuts b { color: var(--text); font-weight: 600; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .upload-grid { grid-template-columns: 1fr; } }

.quota { float: right; text-transform: none; letter-spacing: 0; font-weight: 500; }

.member.host { border-color: var(--accent); color: var(--text); }
.member .link {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 0 0 0 6px; font-size: 13px; font-weight: 600;
}
.member .link:hover { color: var(--accent); background: none; }

.playlist li button { flex: 0 0 auto; }
.playlist li button:disabled { opacity: .3; }

#btn-older { width: 100%; margin-bottom: 8px; }

/* Untertitel gut lesbar ueber dem Bild */
.stage video::cue { background: rgba(0, 0, 0, .75); color: #fff; font-size: 1em; }

/* Auf kleinen Schirmen zaehlt die Hoehe: Chat kuerzer, Bedienung groesser. */
@media (max-width: 950px) {
  .room-layout { padding: 10px; gap: 10px; }
  .chat-log { height: 220px; }
  .playlist { max-height: 180px; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 12px; gap: 8px 12px; flex-wrap: wrap; }
  .topbar nav { gap: 10px; flex-wrap: wrap; row-gap: 6px; }
  .topbar .brand { font-size: 15px; }
  .topbar .who { font-size: 13px; }
  .wrap { padding: 16px 12px 40px; }
  .row { flex-wrap: wrap; }
  /* Eingabefeld auf eine eigene Zeile, sonst quetschen es die Knoepfe weg. */
  .row > input, .row > select { flex: 1 1 100%; }
  .row > button { flex: 1 1 auto; }
  button, input, select { min-height: 40px; }
  .room-list { grid-template-columns: 1fr; }
}

/* ---------- Eigene Steuerleiste ---------- */
.stage-wrap {
  background: #000; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.stage { border: 0; border-radius: 0; }

/*
 * YouTube blendet Titel- und Fortschrittsleiste ein, sobald der Rahmen
 * Mausereignisse bekommt - und laesst sie dann oft stehen. Ohne Maus im
 * iframe bleibt das Bild frei; bedient wird ueber die Leiste darunter.
 */
.stage iframe, .stage video { pointer-events: none; }
.stage { cursor: pointer; }

.controls {
  background: var(--panel); border-top: 1px solid var(--border);
  padding: 7px 10px 9px; display: flex; flex-direction: column; gap: 7px;
}

.seek { position: relative; height: 16px; }
.seek-track {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: 5px; background: var(--panel-2); border-radius: 999px;
}
.seek-track i { position: absolute; left: 0; top: 0; bottom: 0; display: block; border-radius: 999px; width: 0; }
.seek-track .buf { background: #39424f; }
.seek-track .pos { background: var(--accent); }
.seek-track .pos::after {
  content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
}
.seek input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; background: none; opacity: 0; cursor: pointer;
}
.seek.locked input[type="range"] { cursor: default; }
.seek.locked .seek-track .pos::after { opacity: .5; }

.controls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.controls-row .spacer { flex: 1; }
.controls-row .time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.controls-row .hint { white-space: nowrap; }
.controls .np-title {
  color: var(--text); font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

button.icon {
  background: transparent; border: 0; color: var(--text);
  padding: 5px 8px; min-width: 32px; font-size: 14px; line-height: 1; border-radius: 6px;
}
button.icon:hover { background: var(--panel-2); }
button.icon:disabled { opacity: .35; }
button.icon:disabled:hover { background: transparent; }
button.icon.active { color: var(--accent); }

input.volume {
  flex: 0 0 84px; width: 84px; height: 5px;
  padding: 0; border: 0; background: var(--panel-2); border-radius: 999px;
  accent-color: var(--accent); cursor: pointer;
}

/* Im Vollbild bleibt die Leiste unter dem Bild bedienbar. */
.stage-wrap:fullscreen { display: flex; flex-direction: column; border: 0; border-radius: 0; }
.stage-wrap:fullscreen .stage { flex: 1; aspect-ratio: auto; min-height: 0; }
.stage-wrap:fullscreen .controls { background: rgba(0, 0, 0, .8); border-top: 0; }

@media (max-width: 700px) {
  input.volume { flex-basis: 60px; width: 60px; }
  button.icon { min-height: 34px; }
}
@media (max-width: 480px) {
  .controls-row .hint { display: none; }
}

/* ---------- Gaeste ---------- */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.member .tag { margin-left: 5px; }

.gate {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(9, 12, 16, .92);
  display: grid; place-items: center; padding: 20px;
}
.gate .card { max-width: 420px; width: 100%; }
.gate h2 { margin-top: 0; }
.gate .alt { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }

.guest-hint {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; color: var(--muted); font-size: 14px;
}
.guest-hint b { color: var(--text); }

label.check {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 0; color: var(--text); font-size: 14px; cursor: pointer;
}
label.check input { width: auto; flex: 0 0 auto; margin: 0; }

/* ---------- Avatare ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: #0d1117; letter-spacing: .2px;
}
.chat-log .m { display: flex; gap: 7px; align-items: baseline; }
.chat-log .m .avatar { align-self: flex-start; margin-top: 1px; }
.chat-log .m .body { min-width: 0; word-break: break-word; }
.member { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Tempo ---------- */
select.rate {
  flex: 0 0 auto; width: auto; padding: 4px 6px;
  font-size: 12px; background: var(--panel-2); border-color: var(--border);
}

/* ---------- Reaktionen ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.reactions button {
  background: var(--panel); border: 1px solid var(--border);
  padding: 5px 10px; font-size: 16px; line-height: 1; border-radius: 999px;
}
.reactions button:hover { background: var(--panel-2); transform: translateY(-1px); }
.reactions button:active { transform: translateY(0) scale(.94); }

/* Die Schicht liegt ueber dem Bild, faengt aber keine Klicks ab. */
.floaters { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.floater {
  position: absolute; bottom: 8%; font-size: 30px; white-space: nowrap;
  animation: float-up 2.6s ease-out forwards;
}
.floater span { font-size: 12px; color: #fff; text-shadow: 0 1px 3px #000; margin-left: 6px; }
@keyframes float-up {
  0%   { opacity: 0; transform: translateY(0) scale(.6); }
  15%  { opacity: 1; transform: translateY(-12px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-190px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .floater { animation: float-fade 1.8s ease-out forwards; }
  @keyframes float-fade { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
}

/* Eingebettete Player fuellen die Buehne wie das eigene <video>. */
.stage .embed-mount, .stage .embed-mount iframe { width: 100%; height: 100%; border: 0; display: block; }
.stage-note { color: var(--danger); }

/* Nur-Ton-Quellen: statt schwarzer Flaeche das Widget in ruhiger Hoehe. */
.stage-wrap.audio .stage { aspect-ratio: auto; height: 200px; }
.stage-wrap.audio .stage iframe, .stage-wrap.audio .stage .embed-mount { height: 200px; }

/* ---------- Sync-Anzeige in der Anwesenheitsliste ---------- */
.member .sync { font-size: 11px; font-weight: 700; margin-left: 4px; }
.member .sync.ok { color: var(--ok); }
.member .sync.warn { color: var(--warn); }
.member .sync.bad { color: var(--danger); }
.member .sync.unknown { color: var(--muted); }
.member.muted { opacity: .6; }
.member.muted .avatar { filter: grayscale(1); }

/* ---------- Sprachchat ---------- */
.voice-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.voice-peer {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.voice-peer.speaking { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(63, 185, 80, .22); }
.voice-list .empty { font-size: 13px; }

/* Eigene Musikdateien haben kein Bild - Titel statt schwarzer Flaeche. */
.audio-note {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(160deg, #1b2430, #10161d);
  color: var(--muted); text-align: center; padding: 16px;
}
.audio-note span { font-size: 34px; color: var(--accent); line-height: 1; }
.audio-note b { color: var(--text); font-size: 15px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ---------- Hintergrund-Waehler ---------- */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes .theme {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 4px; font-size: 11px; font-weight: 500; color: var(--muted);
}
.themes .theme:hover { background: var(--panel-2); }
.themes .theme.active { border-color: var(--accent); color: var(--text); }
.themes .theme i {
  display: block; width: 100%; height: 26px; border-radius: 5px;
  border: 1px solid var(--border); background-size: cover;
}
.themes .theme span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- Abschnitte in den Einstellungen ---------- */
.settings-block + .settings-block { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.settings-block h4 {
  margin: 0 0 10px; font-size: 13px; color: var(--text); font-weight: 600;
}
.settings-block .hint-inline { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.settings-block > form { margin: 0; }

/* Vorschaukacheln zeigen das echte Bild. */
.themes .theme i { background-size: cover; background-position: center; }

/* Echte Profilbilder fuellen denselben Kreis wie die erzeugten. */
img.avatar { object-fit: cover; border: 1px solid var(--border); }
.topbar nav img.avatar { width: 20px; height: 20px; margin-right: 5px; vertical-align: -5px; }

/* ---------- Profilbild auf der Kontoseite ---------- */
.avatar-row { display: flex; align-items: center; gap: 16px; }
.avatar-row .avatar { width: 72px; height: 72px; font-size: 26px; }
.avatar-actions { flex: 1; min-width: 0; }

/* ---------- Bereichsumschaltung auf schmalen Schirmen ---------- */
/* Am Desktop gibt es sie nicht: dort ist fuer alles nebeneinander Platz. */
.pane-tabs { display: none; }

@media (max-width: 950px) {
  .pane-tabs {
    display: flex; gap: 6px; margin-top: 12px;
    position: sticky; top: 0; z-index: 9;
    background: var(--bg); padding: 8px 0;
  }
  .pane-tabs button {
    flex: 1; position: relative;
    background: var(--panel); border: 1px solid var(--border); color: var(--muted);
    font-size: 13px; font-weight: 500; padding: 9px 4px; min-height: 40px;
  }
  .pane-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

  /* Zahl der ungelesenen Nachrichten am Chat-Reiter */
  .pane-tabs button[data-count]::after {
    content: attr(data-count);
    position: absolute; top: 2px; right: 6px;
    background: var(--warn); color: #1a1300;
    border-radius: 999px; padding: 0 5px;
    font-size: 10px; font-weight: 700; line-height: 15px;
  }

  /* Nur der gewaehlte Bereich ist zu sehen. */
  .room-layout[data-pane] [data-pane] { display: none; }
  .room-layout[data-pane="chat"]     [data-pane="chat"],
  .room-layout[data-pane="playlist"] [data-pane="playlist"],
  .room-layout[data-pane="video"]    [data-pane="video"],
  .room-layout[data-pane="raum"]     [data-pane="raum"] { display: block; }
  /* Die Umschaltleiste selbst traegt auch data-pane-Kinder - die bleiben. */
  .room-layout .pane-tabs [data-pane] { display: block; }
  /* Bereits ausgeblendete Bereiche bleiben ausgeblendet. */
  .room-layout [data-pane][hidden] { display: none; }

}

/* ---------- Auf dem Handy zaehlt jeder Pixel Hoehe ---------- */
@media (max-width: 950px) {
  .controls { padding: 5px 8px 7px; gap: 5px; }
  .controls-row { gap: 5px; }
  .controls .np-title { font-size: 12px; }
  button.icon { min-width: 30px; min-height: 32px; padding: 4px 6px; font-size: 13px; }
  select.rate { padding: 2px 4px; font-size: 11px; }

  /* Eine Zeile zum Wischen statt zwei Zeilen, die den Chat wegdruecken. */
  .reactions {
    flex-wrap: nowrap; overflow-x: auto; gap: 4px; margin-top: 8px;
    scrollbar-width: none;
  }
  .reactions::-webkit-scrollbar { display: none; }
  .reactions button { flex: 0 0 auto; padding: 4px 9px; font-size: 15px; min-height: 34px; }

  .pane-tabs { margin-top: 8px; padding: 6px 0; }
  .panel { padding: 11px; }
}

@media (max-width: 560px) {
  /* Die Lautstaerke regelt am Handy ohnehin die Taste am Geraet. */
  input.volume { display: none; }
}

/* ---------- Raumseite auf dem Handy: ein fester Bildschirm ---------- */
/*
 * Statt einer langen Seite, an deren Ende der Chat liegt: Video oben fest,
 * darunter der gewaehlte Bereich. Gerollt wird nur noch innerhalb des
 * Bereichs - das Video bleibt dabei immer im Blick.
 */
@media (max-width: 950px) {
  body.room-page {
    /*
     * Zwei Zeilen mit Absicht: kennt ein Browser dvh nicht, verwirft er die
     * zweite und behaelt vh. Ohne den Rueckfall faellt die Hoehenangabe ganz
     * weg, die Seite ist dann nur so hoch wie ihr Inhalt - und unter dem Chat
     * klafft eine leere Flaeche.
     */
    height: 100vh;
    height: 100dvh;
    /* Die allgemeine Regel min-height: 100vh wuerde die feste Hoehe wieder
       aufblaehen, sobald die Adressleiste des Browsers eingeblendet ist. */
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.room-page .topbar { flex: 0 0 auto; position: static; }

  body.room-page .room-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px;
    overflow: hidden;
  }

  /* Die linke Spalte aufloesen, damit Video, Reaktionen und Reiter direkt
     im Flexfluss liegen und einzeln fest bleiben koennen. */
  body.room-page .room-layout > div:first-child { display: contents; }

  body.room-page .stage-wrap,
  body.room-page .shortcuts,
  body.room-page .pane-tabs { flex: 0 0 auto; }

  /*
   * Die Reaktionsleiste darf nicht wachsen, aber sehr wohl schrumpfen: acht
   * Knoepfe nebeneinander sind breiter als ein schmales Handy, und mit
   * "nicht schrumpfen" zog sie die ganze Seite auf. Sie rollt in sich selbst.
   */
  body.room-page .reactions { flex: 0 1 auto; min-width: 0; }

  /*
   * Flexelemente schrumpfen von sich aus nicht unter die Breite ihres
   * Inhalts. Der Videotitel steht auf einer Zeile ohne Umbruch und zog damit
   * die ganze Seite breiter als den Schirm - man konnte seitlich wischen und
   * sah das Video nicht mehr ganz. Die frueher dafuer zustaendige Regel
   * greift hier nicht mehr, seit die linke Spalte mit display: contents
   * aufgeloest wird.
   */
  body.room-page .room-layout,
  body.room-page .stage-wrap,
  body.room-page .stage,
  body.room-page .controls,
  body.room-page .controls > *,
  body.room-page .side,
  body.room-page .panel { min-width: 0; }

  /*
   * Entscheidend: eine ausdrueckliche Breite. Ohne sie bemisst sich ein
   * Flexelement nach seinem Inhalt - und der Videotitel steht auf einer Zeile
   * ohne Umbruch. Ein langer Titel machte damit die ganze Seite breiter als
   * den Schirm, das Video ragte rechts hinaus und liess sich wegwischen.
   * Mit width: 100% gibt der Schirm die Breite vor und der Titel kuerzt sich.
   */
  body.room-page .stage-wrap,
  body.room-page .reactions,
  body.room-page .shortcuts,
  body.room-page .pane-tabs,
  body.room-page .side,
  body.room-page .panel[data-pane="video"] { width: 100%; }

  /* Der sichtbare Bereich nimmt den Rest und rollt in sich. */
  body.room-page .side,
  body.room-page .panel[data-pane="video"] {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
  body.room-page .side { display: flex; flex-direction: column; gap: 10px; }

  /*
   * Im Chat bleibt die Eingabe unten stehen, der Verlauf rollt darueber.
   * Nur wenn der Chat auch der gewaehlte Bereich ist - sonst wuerde diese
   * Regel das Ausblenden der anderen Bereiche ueberstimmen.
   */
  body.room-page .room-layout[data-pane="chat"] .panel[data-pane="chat"] {
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0;
  }
  body.room-page .chat-log { height: auto; flex: 1 1 auto; min-height: 0; max-height: none; }
  body.room-page .playlist { max-height: none; }

  /* Die Kopfzeile darf keine zwei Zeilen fuellen. */
  body.room-page .topbar { padding: 8px 12px; gap: 6px 10px; }
  body.room-page .topbar nav { font-size: 13px; gap: 8px; }
}
