/* ============================================================
   YORU — смотрим аниме вместе
   Тёплый графит, кремовая бумага, глиняный акцент.
   Книжная антиква для голоса, Golos для интерфейса,
   рисунки мелом от руки для пустых состояний.
   ============================================================ */

:root {
  --bg: #262624;
  --bg-deep: #1d1d1b;
  --surface: #30302e;
  --raised: #3a3a37;
  --hover: #43433f;
  --line: rgb(250 249 245 / 0.08);
  --line-2: rgb(250 249 245 / 0.14);

  --text: #faf9f5;
  --text-2: #e0ded5;
  --muted: #b0aea5;
  --faint: #918f87;

  --accent: #e08a6c;
  --accent-strong: #d97757;
  --accent-ink: #141413;
  --accent-soft: rgb(217 119 87 / 0.16);
  --sage: #9db37f;
  --sage-soft: rgb(157 179 127 / 0.16);
  --sky: #85afd8;
  --sand: #e8e6dc;
  --cocoa: #4b3127;
  --olive: #45443c;
  --danger: #e5776c;
  --danger-soft: rgb(229 119 108 / 0.14);
  --warn: #e3c17d;

  --serif: 'Source Serif 4', 'Source Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;

  --r: 14px;
  --r-sm: 10px;
  --r-lg: 20px;
  --topbar: 60px;
  --sidebar: 360px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.22), 0 14px 34px rgb(0 0 0 / 0.3);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  caret-color: var(--accent);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: var(--raised) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--raised); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i { width: 22px; height: 22px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 18px; height: 18px; }
.i-xs { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-strong); flex: none; display: inline-block; }

/* ---------- Рисунок от руки ---------- */
.draw path, .scene path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.draw path { stroke: var(--accent-strong); stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.6s ease-out forwards; animation-delay: calc(var(--i, 0) * 0.14s + 0.1s); }
.draw path.thin { opacity: 0.7; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 32px);
  background: var(--bg);
  transition: margin-top 0.35s var(--ease-out), opacity 0.25s;
}
body[data-view='room'] .topbar { border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.brand-word { font: 500 21px/1 var(--serif); letter-spacing: 0.02em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.conn[data-state='open'] i { background: var(--sage); }
.conn[data-state='open'] span { display: none; }
.conn[data-state='closed'] i { background: var(--danger); }

.profile-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  background: var(--surface); border: 0;
  transition: background 0.2s;
}
.profile-chip:hover { background: var(--raised); }
.profile-name { font-weight: 600; font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  --c: var(--accent);
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--c); color: var(--accent-ink);
  font: 600 12px/1 var(--sans); letter-spacing: 0.02em;
}
.avatar-sm { width: 24px; height: 24px; font-size: 11px; letter-spacing: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r);
  border: 0; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--ease-out), opacity 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #e8977a; }
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--raised); }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); background: var(--surface); }
.btn-danger { background: var(--danger-soft); color: #f2a097; }
.btn-danger:hover { background: rgb(229 119 108 / 0.24); }
.btn-danger-solid { background: var(--danger); color: var(--accent-ink); }
.btn-danger-solid:hover { background: #ec8a80; }
.btn-xl { height: 54px; font-size: 17px; border-radius: var(--r); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-grid; place-items: center;
  background: var(--surface); border: 0; color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn-accent { background: var(--accent); color: var(--accent-ink); }
.icon-btn-accent:hover { background: #e8977a; color: var(--accent-ink); }

/* Подсказки: при наведении и при фокусе с клавиатуры */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  padding: 6px 10px; border-radius: 8px;
  background: var(--text); color: var(--accent-ink);
  font: 500 12.5px/1.2 var(--sans); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s var(--ease-out);
  z-index: 50;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 0.3s; }
.room-bar [data-tip]::after { bottom: auto; top: calc(100% + 10px); }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field > span, .field > legend { font-size: 14px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; gap: 8px; padding: 0; }
.field > span em { font-style: normal; font-weight: 400; color: var(--faint); }
.field-value { margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.field-hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }
.field-hint:empty { display: none; }
.field-hint.warn { color: var(--warn); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input:not([type='range']):not([type='checkbox']), select {
  height: 46px; padding: 0 14px; border-radius: 12px;
  background: var(--bg-deep); border: 1px solid var(--line-2);
  outline: none; transition: border-color 0.2s, background 0.2s;
  min-width: 0;
}
input::placeholder { color: var(--faint); }
input:not([type='range']):not([type='checkbox']):focus, select:focus { border-color: var(--accent); background: #1a1a18; }
select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--surface); }

.range { -webkit-appearance: none; appearance: none; background: transparent; height: 22px; cursor: pointer; --p: 100%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--text) var(--p), rgb(250 249 245 / 0.22) var(--p)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--text); transition: transform 0.15s; }
.range:hover::-webkit-slider-thumb { transform: scale(1.2); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: rgb(250 249 245 / 0.22); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
.range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }
.range-lg::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(to right, var(--accent) var(--p), var(--raised) var(--p)); }
.range-lg::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; background: var(--text); }
.range-lg::-moz-range-progress { background: var(--accent); height: 6px; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 13px; background: var(--bg-deep); }
.segmented button { height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; transition: background 0.2s, color 0.2s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--raised); color: var(--text); }

.view { position: relative; }

/* ============ ЛОББИ ============ */
.lobby { padding: clamp(24px, 7vh, 72px) clamp(16px, 4vw, 32px) 64px; }
.lobby-col { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.lobby-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.lobby-head h1 { margin: 0; font: 500 clamp(30px, 4vw, 40px)/1.1 var(--serif); letter-spacing: -0.015em; }
.rooms-count { flex: 1; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.create-form {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--r-lg); background: var(--surface);
  animation: unfold 0.3s var(--ease-out);
}
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
.create-form input { background: var(--bg); }
.create-actions { display: flex; gap: 8px; margin-top: 4px; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; }
.join input:not(:placeholder-shown) { text-transform: uppercase; letter-spacing: 0.16em; font-weight: 600; }

.room-list { display: grid; gap: 8px; margin-top: 10px; }
.rooms-empty { padding: 28px 22px; border-radius: var(--r-lg); background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1.5; }
.rooms-empty b { display: block; margin-bottom: 4px; font: 500 20px/1.25 var(--serif); color: var(--text); }

.room-tile {
  --tile: var(--accent-strong); --ink: var(--accent-ink); --ink-2: rgb(20 20 19 / 0.86);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: end;
  width: 100%; padding: 18px; border: 0; border-radius: 18px; text-align: left;
  background: var(--tile); color: var(--ink);
  transition: transform 0.25s var(--ease-out), filter 0.2s;
  animation: tileIn 0.4s var(--ease-out) both; animation-delay: calc(var(--n, 0) * 50ms);
}
.room-tile:hover { transform: translateY(-2px); filter: brightness(1.05); }
.room-tile.t-sage { --tile: #93a876; }
.room-tile.t-sky { --tile: #85afd8; }
.room-tile.t-cream { --tile: #faf9f5; }
.room-tile.t-cocoa { --tile: #4b3127; --ink: #faf9f5; --ink-2: rgb(250 249 245 / 0.72); }
.room-tile.t-olive { --tile: #45443c; --ink: #faf9f5; --ink-2: rgb(250 249 245 / 0.72); }
@keyframes tileIn { from { opacity: 0; transform: translateY(8px); } }
.rt-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rt-status .dot { background: currentColor; }
.rt-title { grid-column: 1 / -1; margin: 6px 0 0; font: 500 26px/1.1 var(--serif); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-now { grid-column: 1 / -1; margin: 0; font-size: 15px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-now:empty { display: none; }
.rt-people { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.rt-go { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 15px; }
.rt-go .i { width: 16px; height: 16px; }
.stack { display: flex; }
.stack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--tile); }
.stack .avatar:first-child { margin-left: 0; }

/* ============ КОМНАТА ============ */
.room {
  height: calc(100vh - var(--topbar));
  height: calc(100dvh - var(--topbar));
  display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar);
  transition: grid-template-columns 0.35s var(--ease-out);
}
.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px clamp(12px, 2vw, 28px); gap: 14px; }

.room-bar { display: flex; align-items: center; gap: 14px; min-height: 48px; }
.room-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.room-title h1 { margin: 0; font: 500 26px/1.1 var(--serif); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; max-width: 100%; padding: 2px 0; border: 0; background: none; color: var(--muted); font-size: 14px; text-align: left; border-radius: 6px; }
.now-playing .i { color: var(--faint); opacity: 0.6; transition: opacity 0.2s; }
.now-playing:hover { color: var(--text-2); }
.now-playing:hover .i { opacity: 1; }
.np-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing.empty .np-text { color: var(--faint); }
.np-form input { height: 34px; width: min(420px, 100%); font-size: 14px; }
.room-actions { display: flex; align-items: center; gap: 8px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--r);
  background: var(--surface); border: 0;
  font: 600 15px/1 var(--sans); letter-spacing: 0.14em; font-variant-numeric: tabular-nums;
  transition: background 0.2s;
}
.code-chip:hover { background: var(--raised); }
.code-chip .i { color: var(--accent); }
.live-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--r);
  border: 0; background: var(--accent-soft); color: #f0b39e; font-weight: 600; font-size: 15px;
}
.live-chip b { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-2); }
.live-chip:hover { background: rgb(217 119 87 / 0.24); }
.streamer-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 8px; border-radius: var(--r); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.streamer-chip b { color: var(--text); font-weight: 600; }

/* ---------- Плеер ---------- */
.player-wrap { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.player {
  position: relative; overflow: hidden; outline: none;
  width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9;
  border-radius: var(--r-lg); background: var(--bg-deep);
  isolation: isolate; container-type: inline-size;
}
.player[data-state='playing'], .player[data-state='host'] { background: #000; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.player.idle { cursor: none; }

/* Рисованные сцены пустых состояний */
.player-screen {
  position: absolute; inset: 0; z-index: 3;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center; padding: 20px 24px; background: var(--bg-deep);
}
.player[data-state='waiting'] .player-screen,
.player[data-state='loading'] .player-screen,
.player[data-state='ended'] .player-screen { display: flex; }
.scene { width: min(440px, 62%); height: auto; color: var(--sand); overflow: visible; }
.scene path { stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.55s ease-out forwards; animation-delay: calc(var(--i, 0) * 0.08s); }
.scene path.ac { stroke: var(--accent-strong); stroke-width: 3.4; }
.scene .hand { font: 600 21px var(--hand); fill: var(--sand); animation: handIn 0.6s var(--ease-out) 1s backwards; }
.scene .hand.big { font-size: 34px; fill: var(--accent); }
@keyframes handIn { from { opacity: 0; transform: translateY(4px); } }
.scene .bob { animation: draw 0.4s ease-out forwards, bob 0.9s ease-in-out infinite alternate; animation-delay: 1s, calc(1.2s + var(--b) * 0.18s); }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-7px); } }
.scene g { display: none; }
.scene .g-base { display: inline; }
.player[data-state='waiting'] .g-wait, .player[data-state='loading'] .g-load, .player[data-state='ended'] .g-end { display: inline; }
.scene-copy h2 { margin: 18px 0 6px; font: 500 clamp(19px, 2.4cqw, 28px)/1.2 var(--serif); letter-spacing: -0.01em; }
.scene-copy p { margin: 0 auto; max-width: 30em; color: var(--muted); font-size: 15px; }
.scene-copy p:empty { display: none; }
.scene-copy .btn { margin-top: 16px; }
.player:not([data-state='waiting']):not([data-state='ended']) #emptyStreamBtn { display: none; }

/* Контролы */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 56px 14px 12px;
  background: linear-gradient(to top, rgb(20 20 19 / 0.88), rgb(20 20 19 / 0.4) 60%, transparent);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}
.player.idle:not(:focus-within) .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player[data-state='waiting'] .controls, .player[data-state='loading'] .controls, .player[data-state='ended'] .controls { display: none; }
.controls-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ctl {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--text);
  display: inline-grid; place-items: center; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.ctl:hover { background: rgb(250 249 245 / 0.12); }
.ctl:active { transform: scale(0.94); }
.ctl[aria-pressed='false'] { color: rgb(250 249 245 / 0.5); }
.live-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; margin-right: 6px; border-radius: 999px; background: rgb(20 20 19 / 0.7); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; }
.live-pill b { font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.volume { display: flex; align-items: center; }
.volume .range { width: 0; opacity: 0; transition: width 0.25s var(--ease-out), opacity 0.2s, margin 0.25s; }
.volume:hover .range, .volume:focus-within .range, .volume.flash .range { width: 96px; opacity: 1; margin: 0 8px 0 2px; }
.quality-tag { margin-left: 6px; font-size: 12.5px; color: rgb(250 249 245 / 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.menu-anchor { position: relative; }
.menu {
  position: absolute; right: -40px; bottom: calc(100% + 10px); z-index: 20;
  width: 280px; padding: 8px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
  animation: menuIn 0.18s var(--ease-out);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(6px); } }
.menu-title { margin: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: 14px; font-weight: 500; }
.menu button small { flex-basis: 100%; color: var(--muted); font-size: 12.5px; margin-top: -2px; }
.menu button[data-buffer] { padding-left: 32px; position: relative; }
.menu button[data-buffer].active::before { content: ''; position: absolute; left: 12px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.menu button:hover { background: var(--raised); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-toggle { position: relative; padding-right: 54px !important; }
.menu-toggle::after { content: ''; position: absolute; right: 10px; top: 12px; width: 32px; height: 18px; border-radius: 9px; background: var(--bg-deep); transition: background 0.2s; }
.menu-toggle::before { content: ''; position: absolute; right: 26px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--faint); z-index: 1; transition: transform 0.2s var(--ease-out), background 0.2s; }
.menu-toggle.active::after { background: var(--sage); }
.menu-toggle.active::before { transform: translateX(13px); background: var(--accent-ink); }

.unmute-cta {
  position: absolute; left: 50%; top: 50%; z-index: 7; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 26px; border-radius: 999px;
  border: 0; background: var(--text); color: var(--accent-ink); font-weight: 600; font-size: 16px;
  box-shadow: var(--shadow); animation: ctaIn 0.4s var(--ease-out);
}
.unmute-cta:hover { background: #fff; }
@keyframes ctaIn { from { opacity: 0; transform: translate(-50%, -42%); } }
.host-preview-tag { position: absolute; top: 14px; left: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgb(20 20 19 / 0.75); font-size: 13px; font-weight: 600; }

.stats-overlay {
  position: absolute; top: 14px; right: 14px; z-index: 5; margin: 0;
  min-width: 260px; padding: 12px 14px; border-radius: 12px;
  background: rgb(20 20 19 / 0.8); font: 12.5px/1.7 var(--sans); font-variant-numeric: tabular-nums;
  color: var(--text-2); white-space: pre; pointer-events: none;
}

/* Комментарии поверх видео */
.danmaku-layer { position: absolute; inset: 0 0 18% 0; z-index: 4; overflow: hidden; pointer-events: none; }
.danmaku {
  position: absolute; left: 100%; white-space: nowrap;
  font: 600 clamp(15px, 1.9cqw, 30px)/1.25 var(--sans);
  color: #fff;
  text-shadow: 0 0 2px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  animation: danmaku var(--dur, 9s) linear forwards;
  will-change: transform;
}
.danmaku b { color: var(--c, var(--accent)); font-weight: 700; margin-right: 0.4em; }
.danmaku.mine { text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.5); text-underline-offset: 0.2em; }
@keyframes danmaku { to { transform: translateX(calc(-100cqw - 100%)); } }

/* Реакции */
.reaction-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.reaction { position: absolute; bottom: 12%; display: flex; flex-direction: column; align-items: center; gap: 3px; animation: floatUp var(--dur, 2.6s) var(--ease-out) forwards; }
.reaction span { font-size: clamp(30px, 3.4cqw, 52px); line-height: 1; animation: sway 1s ease-in-out infinite alternate; }
.reaction small { font: 600 11.5px/1 var(--sans); padding: 3px 7px; border-radius: 6px; background: var(--c, var(--accent)); color: var(--accent-ink); white-space: nowrap; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(0, 16px) scale(0.6); }
  14% { opacity: 1; transform: translate(0, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), -260px); }
}
@keyframes sway { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }

/* Кто говорит — сверху слева, подальше от надписей в аниме */
.voice-speakers { position: absolute; top: 14px; left: 14px; z-index: 6; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.player:has(#previewTag:not([hidden])) .voice-speakers { top: 54px; }
.speaker-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 4px; border-radius: 16px; background: rgb(20 20 19 / 0.75); font-size: 13px; font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--sage); animation: fadeIn 0.15s; }
@keyframes fadeIn { from { opacity: 0; } }

/* Чат в полноэкранном режиме */
.fs-chat { display: none; position: absolute; left: 18px; bottom: 84px; z-index: 5; width: min(420px, 40%); margin: 0; padding: 0; list-style: none; flex-direction: column; gap: 6px; pointer-events: none; }
.player.fs.no-danmaku .fs-chat { display: flex; }
.fs-chat li { padding: 7px 12px; border-radius: 12px; background: rgb(20 20 19 / 0.72); font-size: 14.5px; animation: fsMsg 9s var(--ease-out) forwards; align-self: flex-start; max-width: 100%; overflow-wrap: anywhere; }
.fs-chat li b { color: var(--c); margin-right: 6px; }
@keyframes fsMsg { 0% { opacity: 0; transform: translateY(8px); } 6%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.fs-input { position: absolute; left: 50%; bottom: 84px; z-index: 8; transform: translateX(-50%); width: min(560px, 80%); }
.fs-input input { width: 100%; height: 52px; border-radius: 14px; background: rgb(20 20 19 / 0.85) !important; font-size: 16px; }

/* Под плеером */
.under-player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.under-player #pauseBtn { margin-left: auto; }
.reactions { display: flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--surface); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.reactions::-webkit-scrollbar { display: none; }
.reaction-btn { position: relative; flex: none; width: 44px; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 21px; line-height: 1; transition: transform 0.2s var(--ease-out), background 0.15s; }
.reaction-btn:hover { background: var(--raised); transform: translateY(-2px); }
.reaction-btn:active { transform: scale(0.92); }
.reaction-btn kbd { position: absolute; right: 3px; bottom: 2px; font: 600 11px/1 var(--sans); color: var(--faint); background: none; border: 0; padding: 0; min-width: 0; height: auto; }
.reaction-btn.pop { animation: pop 0.3s var(--ease-out); }
@keyframes pop { 40% { transform: scale(1.25); } }

/* Голосовой чат */
.voice-dock { display: flex; align-items: center; }
.voice-join .voice-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center; background: var(--sage); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.voice-live { display: flex; align-items: center; gap: 6px; height: 48px; padding: 4px; border-radius: 14px; background: var(--sage-soft); }
.vbtn { width: 40px; height: 40px; border-radius: 10px; border: 0; display: grid; place-items: center; background: var(--surface); color: var(--text); transition: background 0.15s, transform 0.15s; }
.vbtn:hover { background: var(--raised); }
.vbtn:active { transform: scale(0.94); }
.vbtn.off { background: var(--danger-soft); color: #f2a097; }
.vbtn.leave { background: var(--danger); color: var(--accent-ink); }
.vbtn.leave:hover { background: #ec8a80; }
.voice-avatars { display: flex; gap: 4px; padding: 0 6px; }
.voice-av { position: relative; border-radius: 50%; transition: box-shadow 0.12s; }
.voice-av.muted::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.voice-av.speaking, .person.speaking .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sage); }
.person .avatar { transition: box-shadow 0.12s; }

/* Кинорежим */
.is-theater .room { grid-template-columns: minmax(0, 1fr) 0px; }
.is-theater .sidebar { visibility: hidden; }
.is-theater .topbar { margin-top: calc(var(--topbar) * -1); opacity: 0; }
.is-theater .room { height: 100vh; height: 100dvh; }
.is-theater .room-bar, .is-theater .under-player { display: none; }
.is-theater .stage { padding: 0; }
.is-theater .player { border-radius: 0; }

.player.fs { border-radius: 0; width: 100%; height: 100%; aspect-ratio: auto; }

/* ---------- Сайдбар ---------- */
.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 15px; border-radius: 10px 10px 0 0; }
.tabs button:hover { color: var(--text); }
.tabs button::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform 0.25s var(--ease-out); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { transform: scaleX(1); }
.tab-count { font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.tab-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-hint { margin: auto 18px 16px; font-size: 13px; color: var(--faint); }
.pane-title { margin: 22px 18px 8px; font: 500 18px/1.2 var(--serif); }

/* Чат */
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 14px 12px 8px; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 0 10px; padding: 5px 6px; border-radius: 10px; animation: msgIn 0.25s var(--ease-out); }
.msg .avatar { grid-row: span 2; margin-top: 2px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg-name { font-weight: 600; font-size: 14px; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.msg-text { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; color: var(--text-2); }
.msg-text a { color: var(--accent); text-underline-offset: 3px; }
.msg.cont { padding-top: 0; }
.msg.cont .avatar, .msg.cont .msg-head { display: none; }
.msg.cont .msg-text { grid-column: 2; }
.msg-system { align-self: center; margin: 8px 0; font-size: 13px; color: var(--faint); text-align: center; animation: msgIn 0.25s var(--ease-out); }
.msg-system.k-stream-start, .msg-system.k-pause { color: var(--accent); }
.msg-system.k-nowplaying { color: var(--text-2); font-family: var(--serif); font-size: 14.5px; }
@keyframes msgIn { from { opacity: 0; transform: translateY(5px); } }
.chat-empty { margin: auto; text-align: center; color: var(--faint); font-size: 14.5px; padding: 24px; }
.chat-empty b { display: block; font: 500 19px/1.3 var(--serif); color: var(--text-2); margin-bottom: 4px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }

/* Зрители */
.people-list, .peer-list { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; }
.person.offline { opacity: 0.45; }
.person-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person-name .i { width: 14px; height: 14px; color: var(--warn); }
.person-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: #f0b39e; }
.badge-you { background: var(--surface); color: var(--muted); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 3px; border-radius: 1px; background: var(--raised); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; } .bars i:nth-child(4) { height: 14px; }
.bars[data-q='4'] i { background: var(--sage); }
.bars[data-q='3'] i:nth-child(-n+3) { background: var(--sage); }
.bars[data-q='2'] i:nth-child(-n+2) { background: var(--warn); }
.bars[data-q='1'] i:nth-child(1) { background: var(--danger); }
.voice-state { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--sage); background: var(--sage-soft); }
.voice-state.muted { color: #f2a097; background: var(--danger-soft); }
.voice-vol-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--faint); }
.voice-vol { width: 100%; max-width: 160px; height: 18px; }

/* Эфир */
.pane-live { overflow-y: auto; }
.live-card { margin: 14px 12px 0; padding: 16px; border-radius: 18px; background: var(--surface); }
.live-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-pill-solid { margin: 0; background: var(--accent-soft); color: #f0b39e; }
.live-source { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 12px; }
.live-metrics div { padding: 10px 12px; border-radius: 12px; background: var(--bg); min-width: 0; }
.live-metrics dt { font-size: 12.5px; color: var(--faint); }
.live-metrics dd { margin: 4px 0 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-warning { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: rgb(227 193 125 / 0.12); color: var(--warn); font-size: 13.5px; line-height: 1.45; }
.live-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.live-actions #hostStop { grid-column: 1 / -1; }
.live-actions .btn { padding: 0 10px; }
.peer { padding: 12px; border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.peer + .peer { margin-top: 6px; }
.peer-top { display: flex; align-items: center; gap: 10px; }
.peer-name { flex: 1; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-state { font-size: 13px; font-weight: 600; color: var(--warn); }
.peer-state.ok { color: var(--sage); }
.peer-state.bad { color: var(--danger); }
.peer-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.peer-metrics b { display: block; font-weight: 600; color: var(--text-2); font-size: 13.5px; }
.peer-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; border-radius: 14px; background: var(--surface); list-style: none; }

/* ---------- Диалоги ---------- */
.dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: 22px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); overflow: hidden;
}
.dialog[open] { animation: dialogIn 0.3s var(--ease-out); display: flex; flex-direction: column; }
.dialog::backdrop { background: rgb(20 20 19 / 0.7); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(12px); } }
.dialog > form { padding: 26px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; min-height: 0; }
.dialog-wide { width: min(1000px, calc(100vw - 32px)); }
.dialog-wide > form { padding: 0; gap: 0; overflow: hidden; }
.dialog-body { padding: 26px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-title { margin: 0; font: 500 26px/1.15 var(--serif); letter-spacing: -0.01em; }
.dialog-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.dialog-actions.sticky { padding: 14px 26px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.dialog-foot { font-size: 13px; color: var(--faint); }
.spacer { flex: 1; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); transition: transform 0.2s var(--ease-out); }
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }

.stream-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 26px; }
.source-pane { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.source-tabs { display: flex; gap: 6px; }
.source-tabs button { height: 36px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--bg); color: var(--muted); font-weight: 600; font-size: 14px; }
.source-tabs button.active { color: var(--text); background: var(--raised); }
.source-refresh { margin-left: auto; width: 36px; padding: 0 !important; display: grid; place-items: center; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; padding: 3px; }
.source { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; border: 0; background: var(--bg); text-align: left; box-shadow: inset 0 0 0 1px transparent; transition: background 0.2s, box-shadow 0.2s; }
.source:hover { background: var(--bg-deep); }
.source.active { box-shadow: inset 0 0 0 2px var(--accent); }
.source img.thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 9px; background: #000; display: block; }
.source-name { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; min-width: 0; }
.source-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-name img { width: 16px; height: 16px; flex: none; }
.source-skeleton { aspect-ratio: 16 / 11; border-radius: 14px; background: linear-gradient(90deg, var(--bg) 0%, var(--raised) 50%, var(--bg) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.browser-note { padding: 22px; border-radius: 16px; background: var(--bg); }
.browser-note h3 { margin: 0 0 6px; font: 500 20px/1.2 var(--serif); }
.browser-note p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.browser-note ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.browser-note b { color: var(--text); }
.settings-pane { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.presets { display: grid; gap: 6px; }
.presets button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 0; border-radius: 13px; background: var(--bg); text-align: left; box-shadow: inset 0 0 0 1px transparent; transition: background 0.2s, box-shadow 0.2s; }
.presets button:hover { background: var(--bg-deep); }
.presets button b { font: 500 18px/1.2 var(--serif); }
.presets button small { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.presets button[aria-checked='true'] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--bg-deep); }
.fine { border-radius: 14px; background: var(--bg); }
.fine summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--text-2); list-style: none; border-radius: 14px; }
.fine summary::-webkit-details-marker { display: none; }
.fine summary .i { transition: transform 0.2s var(--ease-out); color: var(--muted); }
.fine[open] summary .i { transform: rotate(90deg); }
.fine-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 14px 16px; }
.fine-body .segmented { background: var(--bg-deep); }

.shortcuts { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.shortcuts div { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; }
.shortcuts dt { display: flex; gap: 4px; align-items: center; color: var(--faint); }
.shortcuts dd { margin: 0; color: var(--text-2); font-size: 14.5px; }
kbd { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 -2px 0 var(--bg-deep); font: 600 13px/1 var(--sans); color: var(--text); }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.switch-row small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* ---------- Тосты ---------- */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  max-width: 420px; padding: 12px 16px; border-radius: 14px;
  background: var(--raised); color: var(--text); box-shadow: var(--shadow); font-size: 14.5px; line-height: 1.4;
  animation: toastIn 0.3s var(--ease-out);
}
.toast.out { animation: toastOut 0.22s ease-in forwards; }
.toast.accent { background: var(--accent); color: var(--accent-ink); }
.toast.error { background: #4a2a26; color: #f8d3cd; }
.toast .btn { height: 32px; padding: 0 12px; font-size: 13.5px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  :root { --sidebar: 320px; }
  .stream-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .room { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - var(--topbar)); }
  .stage { padding: 0 0 10px; gap: 10px; position: static; }
  .room-bar { padding: 10px 12px 0; flex-wrap: wrap; }
  .room-actions { width: 100%; }
  .room-actions .btn, .room-actions .live-chip, .room-actions .streamer-chip { flex: 1; justify-content: center; }
  /* Видео прилипает к верху, пока пишешь в чат */
  .player-wrap { position: sticky; top: var(--topbar); z-index: 20; flex: none; container-type: inline-size; background: var(--bg); }
  .player { width: 100%; border-radius: 0; }
  .under-player { padding: 0 12px; }
  .under-player #pauseBtn { margin-left: 0; }
  .reactions { width: 100%; }
  .sidebar { border-left: 0; border-top: 1px solid var(--line); min-height: 60dvh; }
  .field-row { grid-template-columns: 1fr; }
  .profile-name { display: none; }
  .volume .range { width: 70px; opacity: 1; margin: 0 6px 0 0; }
  #pipBtn, #shotBtn, .quality-tag, #statsBtn { display: none; }
  .reaction-btn kbd { display: none; }
  .now-playing .i { opacity: 1; }
  .menu { right: -6px; }
  .lobby-head { flex-wrap: wrap; }
  .lobby-head .rooms-count { order: 3; flex-basis: 100%; }
}
/* Телефон боком и другие низкие экраны: видео на всю высоту, чат справа,
   управление комнатой — ниже видео (докручивается). */
@media (orientation: landscape) and (max-height: 560px) {
  body[data-view='room'] .topbar { display: none; }
  .room { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 30vw, 320px); height: 100vh; height: 100dvh; min-height: 0; }
  .stage { padding: 6px 8px 12px; gap: 10px; overflow-y: auto; }
  .player-wrap { order: -1; position: static; flex: none; height: calc(100dvh - 12px); container-type: size; background: none; }
  .player { width: min(100cqw, 100cqh * 16 / 9); border-radius: 12px; }
  .room-bar { padding: 0; flex-wrap: wrap; }
  .room-actions { width: auto; }
  .room-actions .btn, .room-actions .live-chip, .room-actions .streamer-chip { flex: none; }
  .room-title h1 { font-size: 20px; }
  .under-player { padding: 0; }
  .reactions { width: auto; }
  .sidebar { height: 100vh; height: 100dvh; min-height: 0; border-top: 0; border-left: 1px solid var(--line); }
  .tabs { padding: 4px 8px 0; }
  .tabs button { height: 38px; font-size: 14px; }
  .chat-form { padding: 8px; }
  .chat-form input { height: 40px; }
  .scene { width: min(360px, 52%); }
  .scene-copy h2 { margin-top: 8px; }
  .scene-copy p { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
