:root {
  --bg: #0b0b11;
  --panel: #14141c;
  --panel-2: #1b1b25;
  --panel-3: #23232f;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #ececf3;
  --muted: #9b9bad;
  --accent: #ff5c8a;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(255, 92, 138, 0.16);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f43f5e;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #ff8fb0; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.grow { flex: 1; }

.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Кнопки ---------- */

.primary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.primary {
  background: linear-gradient(135deg, var(--accent), #ff7a6b);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 92, 138, 0.25);
}
.primary:hover { filter: brightness(1.07); }
.primary:active, .ghost:active { transform: translateY(1px); }
.primary.big { height: 48px; font-size: 16px; width: 100%; }
.ghost { background: rgba(255, 255, 255, 0.06); border-color: var(--line-2); }
.ghost:hover { background: rgba(255, 255, 255, 0.11); }
.small { height: 30px; padding: 0 12px; font-size: 13px; }

.round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.round:hover { background: #2d2d3b; }
.round.off { background: rgba(244, 63, 94, 0.18); border-color: rgba(244, 63, 94, 0.45); color: #ff9aa9; }
.round.danger { background: var(--danger); border-color: transparent; color: #fff; }
.round.danger:hover { filter: brightness(1.1); }

/* ---------- Лобби ---------- */

.lobby {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(255, 92, 138, 0.14), transparent 60%),
    var(--bg);
}
.lobby-card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: rgba(20, 20, 28, 0.85);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo h1 { font-size: 24px; }
.logo p { margin: 2px 0 0; }
.logo-mark {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-left: 14px solid #fff;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  transform: translateX(2px);
}
.logo-mark.small { width: 26px; height: 26px; border-radius: 8px; }
.logo-mark.small::after { border-left-width: 9px; border-top-width: 6px; border-bottom-width: 6px; transform: translateX(1px); }

.preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #07070b;
  border: 1px solid var(--line);
}
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.preview-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.preview-buttons {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.preview-buttons .round { background: rgba(20, 20, 28, 0.75); backdrop-filter: blur(8px); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 13px; }
.field input, .field select, .dialog input[type="url"] {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #0f0f16;
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus, .dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
.lobby .hint:empty { display: none; }

/* ---------- Комната ---------- */

.room {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; margin-right: 6px; white-space: nowrap; }
.chip, .tbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.chip { background: var(--accent-soft); border-color: rgba(255, 92, 138, 0.4); color: #ffc2d2; }
.chip:hover { background: rgba(255, 92, 138, 0.25); }
.tbtn:hover { background: rgba(255, 255, 255, 0.09); }
.tbtn .i, .chip .i { width: 17px; height: 17px; }
.tbtn.icon-only { width: 34px; padding: 0; justify-content: center; }
.room.theater #theaterBtn { background: var(--accent-soft); border-color: rgba(255, 92, 138, 0.4); }
.status { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.status[data-s="online"]::before { background: var(--ok); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}
.room.theater .layout { grid-template-columns: minmax(0, 1fr); }
.room.theater .side { display: none; }

/* ---------- Сцена с плеером ---------- */

.stage {
  position: relative;
  min-height: 0;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  container-type: size;
  user-select: none;
}
.stage:fullscreen { border-radius: 0; }
.stage.idle { cursor: none; }
.stage.drop::after {
  content: "Отпусти файл — видео или субтитры";
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: rgba(255, 92, 138, 0.12);
  font-size: 18px;
  font-weight: 600;
  z-index: 20;
  pointer-events: none;
}
#player { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }

/* Встроенный плеер (Kodik/CVH): он занимает сцену, наша панель — полоской под ним,
   чтобы не перекрывать его собственные кнопки. */
.frame-host { position: absolute; inset: 0; display: none; }
.frame-host iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.stage.iframe-mode #player { display: none; }
.stage.iframe-mode .frame-host { display: block; bottom: 76px; }
.stage.iframe-mode .subs-layer { bottom: 76px; }
.stage.iframe-mode .subs-bottom { bottom: 7%; }
.stage.iframe-mode .controls {
  height: 76px;
  padding: 8px 14px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  opacity: 1 !important;
  pointer-events: auto !important;
}
.stage.iframe-mode.idle { cursor: auto; }
.ov-poster { width: 120px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.ctl.text { display: inline-flex; gap: 4px; align-items: center; }
.ctl.text .i { width: 18px; height: 18px; }
#nextBtn.pulse { color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { background: var(--accent-soft); } }

.subs-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.subs-top, .subs-bottom {
  position: absolute;
  left: 4%;
  right: 4%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  text-align: center;
  font-size: 24px;
  font-size: clamp(14px, 4.8cqh, 64px);
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}
.subs-top { top: 5%; }
.subs-bottom { bottom: 7%; transition: bottom 0.2s; }
.stage.has-source:not(.idle) .subs-bottom { bottom: max(7%, 92px); }
.cue {
  padding: 0.04em 0.35em;
  border-radius: 0.2em;
  text-shadow:
    0 0 3px #000, 0 0 3px #000,
    1.5px 1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px -1.5px 0 #000;
  white-space: pre-line;
}
.cue.sign { font-size: 0.72em; color: #f4f4f4; opacity: 0.95; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 8, 12, 0.78);
  backdrop-filter: blur(6px);
  overflow: auto;
}
.ov-card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.ov-card h2 { font-size: 22px; }
.ov-card p { margin: 0; }
.ov-title { word-break: break-word; font-size: 18px !important; }
.ov-small { gap: 14px; }
.ov-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 92, 138, 0.22), rgba(139, 92, 246, 0.22));
  border: 1px solid var(--line-2);
}
.ov-icon .i { width: 26px; height: 26px; }
.ov-icon.big { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); border: 0; }
.ov-icon.big .i { width: 34px; height: 34px; color: #fff; transform: translateX(2px); }
.ov-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.ov-play { background: none; border: 0; padding: 20px; }
.ov-play:hover .ov-icon.big { filter: brightness(1.1); }

.dl { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; text-align: left; }
.progress { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.25s; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Панель управления */
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 26px 14px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.45) 60%, transparent);
  transition: opacity 0.25s;
}
.stage:not(.has-source) .controls { display: none; }
.stage.idle .controls { opacity: 0; pointer-events: none; }
.ctrl-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ctl {
  height: 38px;
  min-width: 38px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #fff;
  opacity: 0.9;
}
.ctl:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.ctl .i { width: 22px; height: 22px; }
#playBtn .i { width: 24px; height: 24px; }
.ctl.text { font-weight: 700; font-size: 13px; }
.ctl.active { color: var(--accent); }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: #e6e6ee; margin-left: 6px; white-space: nowrap; }
.stall { font-size: 13px; color: var(--warn); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.seek { position: relative; height: 18px; display: flex; align-items: center; margin: 0 4px 2px; --p: 0%; --b: 0%; }
.seek input, .vol input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.seek input::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(to right,
    var(--accent) var(--p), rgba(255, 255, 255, 0.4) var(--p),
    rgba(255, 255, 255, 0.4) var(--b), rgba(255, 255, 255, 0.16) var(--b));
}
.seek input::-moz-range-track {
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(to right,
    var(--accent) var(--p), rgba(255, 255, 255, 0.4) var(--p),
    rgba(255, 255, 255, 0.4) var(--b), rgba(255, 255, 255, 0.16) var(--b));
}
.seek input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 92, 138, 0.4);
  transform: scale(0);
  transition: transform 0.12s;
}
.seek input::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #fff; transform: scale(0); transition: transform 0.12s; }
.seek:hover input::-webkit-slider-thumb { transform: scale(1); }
.seek:hover input::-moz-range-thumb { transform: scale(1); }
.seek-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.85);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}
.seek:hover .seek-tip:not(:empty) { opacity: 1; }

.vol { display: flex; align-items: center; }
.vol input { width: 0; opacity: 0; transition: width 0.2s, opacity 0.2s; --p: 100%; }
.vol:hover input, .vol input:focus-visible { width: 84px; opacity: 1; margin-right: 6px; }
.vol input::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.25) var(--p)); }
.vol input::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.25) var(--p)); }
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #fff; }
.vol input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }

/* Камеры поверх видео — в кинозале и на полном экране */
.float-cams {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  display: none;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.room.theater .float-cams, .stage:fullscreen .float-cams { display: flex; }
.float-cam {
  position: relative;
  width: clamp(140px, 16cqw, 260px);
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line-2);
}
.float-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.float-cam .avatar { display: none; }
.float-cam.cam-off video { display: none; }
.float-cam.cam-off .avatar { display: grid; }
.float-name { position: absolute; left: 8px; bottom: 6px; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px #000; }

.toasts {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(560px, calc(100% - 32px));
}
.toast {
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(20, 20, 28, 0.92);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  text-align: center;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.3s;
}
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Боковая панель ---------- */

.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.tiles { position: relative; display: grid; grid-template-columns: 1fr; gap: 8px; overflow: auto; max-height: 55%; flex: none; }
.tiles:has(.tile:nth-child(4)) { grid-template-columns: 1fr 1fr; }
/* Своя камера — маленькой вставкой в углу, когда в комнате есть кто-то ещё */
.tile.self:not(:only-child) {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34%;
  z-index: 2;
  border-color: var(--line-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.tile.self:not(:only-child) .avatar { font-size: 16px; }
.tile.self:not(:only-child) .tile-bar { left: 4px; bottom: 4px; padding: 1px 5px; font-size: 11px; }
.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: box-shadow 0.15s;
}
.tile.speaking { box-shadow: 0 0 0 2px var(--ok), 0 0 18px rgba(52, 211, 153, 0.35); }
.tile.bad { border-color: rgba(244, 63, 94, 0.5); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video.mirror { transform: scaleX(-1); }
.avatar {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 30%;
  aspect-ratio: 1;
  max-width: 72px;
  border-radius: 50%;
  display: none;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.tile.cam-off video { display: none; }
.tile.cam-off .avatar { display: grid; }
.tile-bar {
  position: absolute;
  left: 8px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 12px;
  font-weight: 600;
}
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-mic { display: inline-flex; color: #ff8a9c; }
.tile-mic .i { width: 14px; height: 14px; }
.tile-stats {
  position: absolute;
  left: 8px;
  top: 7px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px #000;
  opacity: 0;
  transition: opacity 0.15s;
}
.tile:hover .tile-stats, .tile[data-conn="failed"] .tile-stats, .tile[data-conn="new"] .tile-stats, .tile[data-conn="connecting"] .tile-stats, .tile:not([data-conn]) .tile-stats { opacity: 1; }
.tile-vol-wrap {
  position: absolute;
  right: 8px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s;
}
.tile-vol-wrap .i { width: 15px; height: 15px; }
.tile:hover .tile-vol-wrap { opacity: 1; }
.tile-vol { width: 80px; accent-color: var(--accent); }

.media-bar { display: flex; align-items: center; gap: 8px; padding: 2px 0; }

.transfers { display: flex; flex-direction: column; gap: 6px; }
.transfers:empty { display: none; }
.xfer { padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }

.panel {
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.tabs { display: flex; gap: 4px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  position: relative;
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.tab.unread::after { content: ""; position: absolute; top: 9px; margin-left: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chat, .anime { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msg-action { margin-top: 6px; }

/* Панель «Аниме» */
.anime-search { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); flex: none; }
.anime-search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #0f0f16;
  outline: none;
}
.anime-search input:focus { border-color: var(--accent); }
.anime-search .send { width: 36px; height: 36px; }
.anime-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.anime-msg { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.anime-msg.error { color: #ff9aa9; }
.anime-hint { color: var(--muted); font-size: 12px; }
.anime-head { display: flex; gap: 12px; align-items: flex-start; }
.anime-poster { width: 64px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; flex: none; background: var(--panel-3); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.anime-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.anime-title { font-weight: 650; font-size: 15px; line-height: 1.3; }
.anime-meta { color: var(--muted); font-size: 12px; }
.anime-link { font-size: 12px; text-decoration: none; }
.anime-link:hover { text-decoration: underline; }
.anime-field { display: flex; flex-direction: column; gap: 4px; }
.anime-field > span { color: var(--muted); font-size: 12px; }
.anime-field select {
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #0f0f16;
  outline: none;
  width: 100%;
}
.anime-field select:focus { border-color: var(--accent); }
.anime-warn { font-size: 12px; color: var(--warn); background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.3); padding: 8px 10px; border-radius: 9px; }
.anime-section { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.ep {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ep:hover { border-color: var(--accent); background: var(--accent-soft); }
.ep.current { background: linear-gradient(135deg, var(--accent), #ff7a6b); border-color: transparent; color: #fff; }
.order { display: flex; flex-direction: column; gap: 4px; }
.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.order-item:hover { background: var(--panel-2); border-color: var(--line); }
.order-item.current { background: var(--accent-soft); border-color: rgba(255, 92, 138, 0.4); }
.order-n { width: 18px; flex: none; color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.order-item img, .order-noimg { width: 34px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; background: var(--panel-3); }
.order-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-title { font-size: 13px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.order-meta { font-size: 11px; color: var(--muted); }
.anime-desc summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.anime-desc p { margin: 8px 0 0; font-size: 13px; color: #d4d4de; white-space: pre-line; }
.back { align-self: flex-start; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; flex: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 100%; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-name { font-weight: 650; color: #c4b5fd; }
.msg.mine .msg-name { color: #ff9cb8; }
.msg-time { font-size: 11px; color: var(--muted); }
.msg.sys { font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #0f0f16;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.send { width: 38px; height: 38px; border-radius: 9px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; }
.send .i { width: 18px; height: 18px; }

/* ---------- Диалоги ---------- */

.dialog {
  width: min(480px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-size: 19px; }
.dialog p { margin: 0; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); cursor: pointer; }
.check b { color: var(--text); }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }

/* ---------- Узкие экраны ---------- */

@media (max-width: 1100px) {
  .tbtn span { display: none; }
  .tbtn { width: 34px; padding: 0; justify-content: center; }
}

@media (max-width: 900px) {
  .room { height: auto; min-height: 100dvh; }
  .layout { grid-template-columns: minmax(0, 1fr); align-content: start; padding: 8px; }
  .stage { aspect-ratio: 16 / 9; }
  .stage:fullscreen { aspect-ratio: auto; }
  /* Под встроенным плеером ещё полоса управления — добавляем её высоту к 16:9. */
  .stage.iframe-mode:not(:fullscreen) { aspect-ratio: auto; height: calc((100vw - 16px) * 9 / 16 + 76px); }
  .tiles { max-height: none; }
  .panel { min-height: 420px; }
  .brand span:last-child { display: none; }
  .room.theater .side { display: flex; }
  .room.theater .float-cams { display: none; }
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; padding: 8px; }
  .chip span { display: none; }
  .vol { display: none; }
  #skipBtn, #backBtn, #fwdBtn { display: none; }
  .lobby-card { padding: 20px; }
}
