/* tv.lilchan.net — стили. Токены-в-родстве с lilchan (малиновый акцент, тёмная база). */
:root, [data-theme="dark"] {
  --brand: #d93654;
  --brand-700: #b82b48;
  --brand-300: #f27a98;
  --bg-page: #0f1117;
  --bg-header: #0b0d12;
  --bg-form: #1a1d26;
  --bg-panel: #181b23;
  --bg-op: #1e212c;
  --bg-input: #101218;
  --bg-tag: #262a36;
  --border: #262b36;
  --border-input: #2f3542;
  --border-sep: #1e232e;
  --text-main: #eef2ff;
  --text-dim: #8b92b0;
  --text-muted: #555c77;
  --text-link: #5dc8cd;
  --text-btn: #ffffff;
  --ok: #a3d16b;
  --danger: #e2502a;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.6);
  --shadow-md: 0 8px 24px rgba(0,0,0,.8);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --media-bg: #000;
}
/* Темы-пресеты из lilchan (палитры совпадают). Переопределяют семантические токены. */
[data-theme="light"] {
  color-scheme: light;
  --brand: #cf6a2e; --brand-700: #b3571f; --brand-300: #dd8a55;
  --bg-page: #eeeeee; --bg-header: #dddddd; --bg-form: #dddddd; --bg-panel: #dddddd; --bg-op: #e6e6e6; --bg-input: #ffffff; --bg-tag: #e2e2e2;
  --border: #cccccc; --border-input: #bbbbbb; --border-sep: #d4d4d4;
  --text-main: #333333; --text-dim: #555555; --text-muted: #888888; --text-link: #cf6a2e;
  --shadow-sm: 0 2px 8px rgba(30,40,80,.08); --shadow-md: 0 10px 30px rgba(30,40,80,.14);
}
[data-theme="latte"] {
  color-scheme: light;
  --brand: #8839ef; --brand-700: #7a2fd8; --brand-300: #a877f0;
  --bg-page: #eff1f5; --bg-header: #e6e9ef; --bg-form: #e9ebf1; --bg-panel: #f1f3f7; --bg-op: #e8eaf0; --bg-input: #ffffff; --bg-tag: #dce0e8;
  --border: #ccd0da; --border-input: #acb0be; --border-sep: #d6d9e1;
  --text-main: #4c4f69; --text-dim: #5c5f77; --text-muted: #8c8fa1; --text-link: #1e66f5;
  --shadow-sm: 0 2px 8px rgba(30,40,80,.08); --shadow-md: 0 10px 30px rgba(30,40,80,.14);
}
[data-theme="nord"] {
  --brand: #5e81ac; --brand-700: #4c6f99; --brand-300: #88c0d0;
  --bg-page: #2e3440; --bg-header: #272c36; --bg-form: #3b4252; --bg-panel: #353b49; --bg-op: #3b4252; --bg-input: #272c36; --bg-tag: #434c5e;
  --border: #434c5e; --border-input: #4c566a; --border-sep: #353b49;
  --text-main: #eceff4; --text-dim: #d8dee9; --text-muted: #7b88a1; --text-link: #88c0d0;
}
[data-theme="peach"] {
  --brand: #d1541f; --brand-700: #b04114; --brand-300: #e67e51;
  --bg-page: #141517; --bg-header: #1b1c1e; --bg-form: #1e2022; --bg-panel: #1a1b1d; --bg-op: #222426; --bg-input: #111213; --bg-tag: #2a2c30;
  --border: #2a2c30; --border-input: #33363b; --border-sep: #222426;
  --text-main: #e3e4e6; --text-dim: #9a9da3; --text-muted: #62656b; --text-link: #5c8fc2;
}
[data-theme="bocchi"] {
  --brand: #ff94b8; --brand-700: #d66b8f; --brand-300: #ffbcd3;
  --bg-page: #12131a; --bg-header: #0b0c10; --bg-form: #1c1d26; --bg-panel: #171921; --bg-op: #242633; --bg-input: #0f1014; --bg-tag: #2b2d3d;
  --border: #2b2e3d; --border-input: #363a4d; --border-sep: #1e202b;
  --text-main: #f5eff2; --text-dim: #888da8; --text-muted: #585d75; --text-link: #5dcbe3;
}
[data-theme="cohee"] {
  --brand: #d97736; --brand-700: #b55a22; --brand-300: #f0a16c;
  --bg-page: #161211; --bg-header: #100d0c; --bg-form: #211a18; --bg-panel: #1e1817; --bg-op: #261f1d; --bg-input: #130f0f; --bg-tag: #2e2522;
  --border: #322825; --border-input: #3c302c; --border-sep: #261f1d;
  --text-main: #f4ebd9; --text-dim: #a89984; --text-muted: #7c6f64; --text-link: #6ca8a8;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg-page); color: var(--text-main);
  font: 14px/1.55 var(--font); -webkit-text-size-adjust: 100%;
  overflow-x: hidden;                 /* ничего не расширяет вьюпорт по горизонтали */
  overflow-wrap: anywhere;
}
/* медиа/эмбеды не вылезают за контейнер */
img, video, iframe, canvas { max-width: 100%; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; }

/* ── Шапка ── */
.hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--bg-header);
  border-bottom: 1px solid var(--border-sep); position: sticky; top: 0; z-index: 20;
}
.hdr__logo { color: var(--text-main); font-weight: 700; font-size: 16px; flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr__logo:hover { text-decoration: none; color: var(--brand-300); }
.hdr__spacer { flex: 1; }
.hdr__room {
  font-family: ui-monospace, monospace; background: var(--bg-tag);
  padding: 3px 10px; border-radius: var(--radius-pill); color: var(--text-dim); font-size: 13px;
}
.hdr__online { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; }
.hdr__online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.hdr__theme {
  background: var(--bg-tag); color: var(--text-main); border: 1px solid var(--border);
  border-radius: var(--radius-sm); height: 30px; line-height: 1; padding: 0 8px; flex: none; max-width: 140px;
}

.main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* ── Кнопки/поля ── */
.btn {
  background: var(--bg-tag); color: var(--text-main); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--brand); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--text-btn); }
.btn--primary:hover { background: var(--brand-700); }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.fld { display: flex; flex-direction: column; gap: 5px; }
.fld--sm { gap: 3px; }
.fld__l { color: var(--text-dim); font-size: 13px; }
.fld__opt { color: var(--text-muted); font-weight: 400; }
.fld__i {
  background: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-input);
  border-radius: var(--radius-sm); padding: 9px 11px; width: 100%;
}
.fld__i:focus { outline: none; border-color: var(--brand); }
.chk { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.copyrow { display: flex; gap: 6px; }
.copyrow .fld__i { flex: 1; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }
.alert--err { background: color-mix(in srgb, var(--danger) 15%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }

/* ── Главная ── */
.landing { max-width: 900px; margin: 0 auto; }
.landing__hero { text-align: center; padding: 26px 10px 10px; }
.landing__title { font-size: 30px; margin: 0 0 8px; }
.landing__sub { color: var(--text-dim); margin: 0; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.card { background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.card--narrow { max-width: 420px; margin: 40px auto; }
.card__h { margin: 0 0 14px; font-size: 17px; }
.card__note { color: var(--text-muted); font-size: 12px; margin: 12px 0 0; }
.form { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 720px) { .cards { grid-template-columns: 1fr; } }

/* Список комнат */
.rooms { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.roomcard { display: flex; align-items: center; gap: 12px; background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.roomcard__main { flex: 1; min-width: 0; }
.roomcard__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roomcard__meta { color: var(--text-muted); font-size: 12px; }
.roomcard__act { flex: none; display: flex; gap: 6px; }
.knock-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); padding: 16px; }
.knock-modal[hidden] { display: none; }
.knock-modal__box { background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; width: 100%; max-width: 360px; box-shadow: var(--shadow-md); }
.knock-modal__row { display: flex; gap: 8px; margin-top: 12px; }
.knock-modal__status { color: var(--text-dim); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* Модалка трансляции с ПК */
.stream-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); padding: 16px; }
.stream-modal[hidden] { display: none; }
.stream-modal__box { background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; width: 100%; max-width: 440px; box-shadow: var(--shadow-md); max-height: 90vh; overflow: auto; }
.stream-modal__box .fld { margin-top: 8px; }
.stream-modal__row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.stream-modal__warn { color: var(--danger); font-size: 12px; margin: 10px 0 0; }
.stream-modal__warn[hidden] { display: none; }

/* ── Комната ── */
.room {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start;
}
.stage { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stage__screen {
  position: relative; background: var(--media-bg); border-radius: var(--radius-lg);
  overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-md);
}
.player, .player iframe, .player video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000;
}
.stage__idle {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--text-dim); text-align: center; padding: 20px;
}
/* [hidden] сам по себе перебивается display:flex автор-правилом выше — гасим явно,
   иначе плашка «Пока ничего не играет» висит поверх играющего видео. */
.stage__idle[hidden] { display: none; }
.stage__idle-ico { font-size: 48px; opacity: .6; }
.stage__idle-t { font-size: 16px; }
.stage__idle-s { font-size: 13px; color: var(--text-muted); }
.buffer {
  position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.7); color: #fff;
  padding: 4px 10px; border-radius: var(--radius-pill); font-size: 12px;
}

/* Реакции — всплывают снизу вверх */
.reacts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.react-fly {
  position: absolute; bottom: 8%; font-size: 30px; will-change: transform, opacity;
  animation: reactFly 2.6s ease-out forwards;
}
.react-fly small { display: block; font-size: 11px; color: #fff; text-align: center; text-shadow: 0 1px 3px #000; }
@keyframes reactFly {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { transform: translateY(-220px) scale(1.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .react-fly { animation-duration: 1.2s; } }

/* Панель управления */
.ctl {
  display: flex; align-items: center; gap: 10px; background: var(--bg-form);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px;
  flex-wrap: wrap;
}
.ctl__seek { min-width: 120px; }
.ctl__btn { background: transparent; border: none; color: var(--text-main); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: var(--radius-sm); }
.ctl__btn:hover:not(:disabled) { background: var(--bg-tag); }
.ctl__btn--sm { font-size: 15px; }
.ctl__time { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; }
.ctl__seek { flex: 1; accent-color: var(--brand); }
.ctl__vol { width: 90px; accent-color: var(--brand); }
.ctl__seek:disabled { cursor: not-allowed; }

/* Инфо о текущем видео */
.nowinfo { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--text-dim); }
.nowinfo[hidden] { display: none; }
.nowinfo__badge { flex: none; background: var(--brand); color: var(--text-btn); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); text-transform: uppercase; }
.nowinfo__title { flex: 1; min-width: 0; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowinfo__open { flex: none; font-size: 12px; }

/* Строка источника */
.source__form { display: flex; gap: 8px; flex-wrap: wrap; }
.source__input {
  flex: 1; min-width: 160px; background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: 9px 11px;
}
.source__input:focus { outline: none; border-color: var(--brand); }

/* Предложить паузу */
.underbar { display: flex; gap: 8px; flex-wrap: wrap; }
.votepause {
  display: inline-flex; align-items: center; gap: 7px; background: var(--bg-form);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 14px; color: var(--text-main);
}
.votepause:hover { border-color: var(--brand); }
.votepause[aria-pressed="true"] { background: color-mix(in srgb, var(--brand) 22%, transparent); border-color: var(--brand); }
.votepause__ico { font-size: 13px; }
.votepause__count { background: var(--brand); color: var(--text-btn); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); }
.votepause__count[hidden] { display: none; }

/* Реакции-кнопки — компактнее */
.reactbar { display: flex; flex-wrap: wrap; gap: 4px; }
.reactbar__b {
  background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: 16px; width: 32px; height: 30px; line-height: 1; padding: 0;
}
.reactbar__b:hover { border-color: var(--brand); transform: translateY(-1px); }

/* ── Сайдбар ── */
.side { background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; min-width: 0; height: calc(100vh - 120px); position: sticky; top: 76px; }
.copyrow .fld__i { min-width: 0; }
.side__tabs { display: flex; border-bottom: 1px solid var(--border-sep); }
.tab { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 10px 6px; border-bottom: 2px solid transparent; }
.tab.is-on { color: var(--text-main); border-bottom-color: var(--brand); }
.tab__n { color: var(--text-muted); font-size: 12px; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane[hidden] { display: none; }
.pane__note { color: var(--text-muted); font-size: 12px; padding: 10px 12px; }

/* Чат */
.chat { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.msg { font-size: 13.5px; word-break: break-word; overflow-wrap: anywhere; }
.msg__row { display: flex; align-items: baseline; gap: 2px; }
.msg__body { flex: 1; min-width: 0; }
.msg__nick { font-weight: 600; flex: none; }
.msg--host .msg__nick::after { content: " ведущий"; font-size: 10px; color: var(--brand-300); font-weight: 700; text-transform: uppercase; }
.msg--sys { color: var(--text-muted); font-style: italic; font-size: 12px; text-align: center; }
.msg__acts { flex: none; display: inline-flex; gap: 2px; opacity: 0; transition: opacity .1s; }
.msg:hover .msg__acts { opacity: 1; }
.msg__act { background: transparent; border: none; color: var(--text-dim); font-size: 12px; line-height: 1; padding: 2px 4px; border-radius: var(--radius-sm); }
.msg__act:hover { background: var(--bg-tag); color: var(--text-main); }
.msg__reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0; }
.msg__reacts[hidden] { display: none; }
.msg__chip { background: var(--bg-tag); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 11px; padding: 1px 7px; color: var(--text-main); line-height: 1.5; }
.msg__chip:hover { border-color: var(--brand); }
.msgreact-pop {
  position: fixed; z-index: 60; display: flex; flex-wrap: wrap; gap: 2px; max-width: 220px;
  background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius); padding: 5px; box-shadow: var(--shadow-md);
}
.msgreact-pop button { background: transparent; border: none; font-size: 18px; line-height: 1; padding: 3px 4px; border-radius: var(--radius-sm); }
.msgreact-pop button:hover { background: var(--bg-tag); }
.msg__sticker { height: 84px; max-width: 100%; vertical-align: bottom; }
.react-fly__stk { width: 72px; height: 72px; object-fit: contain; display: block; }
.chat__form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border-sep); }
.chat__stk { flex: none; background: var(--bg-tag); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-main); width: 34px; font-size: 15px; }
.chat__stk:hover { border-color: var(--brand); }
.chat__stk[hidden] { display: none; }
/* Пикер стикеров */
.stk-pick { position: fixed; z-index: 65; width: min(320px, 92vw); background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 8px; }
.stk-pick__search { width: 100%; background: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: 6px 9px; margin-bottom: 8px; }
.stk-pick__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; max-height: 260px; overflow-y: auto; }
.stk-pick__cell { background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 3px; cursor: pointer; }
.stk-pick__cell:hover { border-color: var(--brand); background: var(--bg-tag); }
.stk-pick__cell img { width: 100%; height: 52px; object-fit: contain; display: block; }
.chat__input { flex: 1; background: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: 8px 10px; }
.chat__input:focus { outline: none; border-color: var(--brand); }
.chat__send { padding: 8px 12px; }

/* Очередь */
.queue { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.qitem { display: flex; align-items: center; gap: 8px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.qitem__body { flex: 1; min-width: 0; }
.qitem__title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem__meta { font-size: 11px; color: var(--text-muted); }
.qitem__act { background: transparent; border: none; color: var(--text-dim); font-size: 15px; padding: 3px 5px; border-radius: var(--radius-sm); }
.qitem__act:hover { background: var(--bg-tag); color: var(--text-main); }
.qkind { font-size: 10px; text-transform: uppercase; color: var(--text-muted); }

/* Люди */
.people { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.person__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.person__host { font-size: 10px; color: var(--brand-300); font-weight: 700; text-transform: uppercase; }
.side__share { border-top: 1px solid var(--border-sep); padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Предложения зрителей — тосты для ведущего */
.suggests { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; max-width: 320px; }
.suggests[hidden] { display: none; }
.stoast { background: var(--bg-form); border: 1px solid var(--brand); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-md); }
.stoast__t { font-size: 13px; margin-bottom: 4px; }
.stoast__from { color: var(--text-dim); }
.stoast__row { display: flex; gap: 6px; margin-top: 6px; }

/* Общий тост */
.toast {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  background: var(--bg-form); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 8px 16px; box-shadow: var(--shadow-md); z-index: 50; font-size: 13px; color: var(--text-dim);
}

@media (max-width: 900px) {
  .room { grid-template-columns: 1fr; }
  .side { height: 460px; position: static; }
}
