/* Fox Кино — бархатный зал: баклажановый фон, малиновые кресла, янтарный свет проектора */
:root {
  --ink: #1c1224;
  --ink-deep: #150d1b;
  --velvet: #2a1b33;
  --velvet-hi: #372442;
  --velvet-line: rgba(255, 228, 240, 0.09);
  --text: #f5eaf0;
  --muted: #a993ae;
  --faint: #6f5a78;
  --crimson: #d8435f;
  --crimson-press: #b93650;
  --amber: #f2c27b;
  --ok: #86d3ab;

  --display: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Onest", "Segoe UI", Roboto, system-ui, sans-serif;

  --vh: var(--tg-viewport-stable-height, 100vh);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --pad: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); }
body {
  font: 400 15px/1.45 var(--body);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: var(--vh); overflow: hidden; position: relative; }
.screen { height: 100%; display: flex; flex-direction: column; }

/* ---------- иконки ---------- */
.ico { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ico svg { width: 100%; height: 100%; }
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- главный экран ---------- */
#home { background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--pad) 10px;
}
.wordmark { display: flex; align-items: center; gap: 10px; }
.wordmark span {
  font: 600 30px/1 var(--display);
  letter-spacing: 0.01em;
}
.wordmark-beam { width: 34px; height: 24px; }
.wordmark-beam path { fill: var(--amber); opacity: 0.28; }
.wordmark-beam circle { fill: var(--amber); }

.me-chip { width: 38px; height: 38px; border-radius: 50%; }
.me-chip .ava { --s: 38px; }

.views { flex: 1; min-height: 0; position: relative; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: 6px var(--pad) 28px; display: none;
  -webkit-overflow-scrolling: touch;
}
.view.is-active { display: block; }

.dock {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b));
  background: var(--ink-deep);
  border-top: 1px solid var(--velvet-line);
}
.dock-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; font-size: 12px; color: var(--faint);
  transition: color .15s;
}
.dock-btn.is-active { color: var(--amber); }
.dock-btn .dot {
  position: absolute; top: 5px; left: calc(50% + 8px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--crimson);
}

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; border-radius: 14px;
  background: var(--crimson); color: #fff;
  font-weight: 600; font-size: 16px;
  transition: background .15s, transform .1s;
}
.btn-primary:active { background: var(--crimson-press); transform: scale(.985); }
.btn-primary[disabled] { opacity: .5; }
.btn-create { margin: 6px 0 22px; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--velvet-hi); font-weight: 500;
}
.btn-ghost:active { background: var(--velvet); }
.btn-danger { color: #ff8da1; }
.btn-small {
  flex: none; height: 36px; padding: 0 14px; border-radius: 10px;
  background: var(--crimson); color: #fff; font-weight: 600; font-size: 14px;
}
.btn-small.muted { background: var(--velvet-hi); color: var(--text); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.section-title {
  font: 500 20px/1.2 var(--display);
  margin: 4px 0 12px; color: var(--text);
}
.section-title small { font: 400 14px var(--body); color: var(--muted); margin-left: 6px; }
.section { margin-bottom: 26px; }

.empty {
  color: var(--muted); font-size: 14px; line-height: 1.5;
  padding: 16px; border: 1px dashed var(--velvet-line); border-radius: 14px;
}

/* ---------- билет-комната ---------- */
.ticket {
  --stub: 78px;
  --notch: 9px;
  display: grid; grid-template-columns: 1fr var(--stub);
  width: 100%; margin-bottom: 12px; text-align: left;
  background: var(--velvet);
  border-radius: 14px;
  -webkit-mask:
    radial-gradient(circle var(--notch) at calc(100% - var(--stub)) 0, transparent 97%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle var(--notch) at calc(100% - var(--stub)) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
          mask:
    radial-gradient(circle var(--notch) at calc(100% - var(--stub)) 0, transparent 97%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle var(--notch) at calc(100% - var(--stub)) 100%, transparent 97%, #000) bottom / 100% 51% no-repeat;
  transition: transform .12s;
}
.ticket:active { transform: scale(.985); }
.ticket-main {
  position: relative; min-height: 104px; padding: 14px 14px 12px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background-size: cover; background-position: center;
  border-radius: 14px 0 0 14px; overflow: hidden;
}
.ticket-main::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--velvet) 38%, rgba(42, 27, 51, .78) 70%, rgba(42, 27, 51, .55));
}
.ticket-main > * { position: relative; }
.ticket-title {
  font: 500 19px/1.2 var(--display);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-now {
  font-size: 13px; color: var(--muted); margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticket-now span { overflow: hidden; text-overflow: ellipsis; }
.live-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--crimson); box-shadow: 0 0 0 3px rgba(216, 67, 95, .22); }
.ticket-owner { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ticket-stub {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-left: 2px dashed rgba(255, 228, 240, 0.16);
  color: var(--muted); font-size: 11px;
}
.ticket-stub b { font: 600 28px/1 var(--display); color: var(--amber); }
.ticket-stub .ico { width: 16px; height: 16px; margin-bottom: 6px; color: var(--faint); }

/* ---------- аватары ---------- */
.ava {
  --s: 36px;
  width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; overflow: hidden;
  font: 600 calc(var(--s) * .42)/1 var(--body); color: #fff;
  background: var(--velvet-hi);
  position: relative;
}
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ava.s20 { --s: 20px; }
.ava.s28 { --s: 28px; }
.ava.s44 { --s: 44px; }
.ava.s64 { --s: 64px; }

/* ---------- списки людей ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--velvet-line);
}
.row:last-child { border-bottom: 0; }
.row-text { flex: 1; min-width: 0; }
.row-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex: none; }
.crown { color: var(--amber); width: 16px; height: 16px; display: inline-flex; vertical-align: -2px; margin-left: 4px; }

.card { background: var(--velvet); border-radius: 16px; padding: 16px; margin-bottom: 18px; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ---------- статистика ---------- */
.stat-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 22px; }
.stat-head .name { font: 500 22px/1.2 var(--display); }
.stat-head .sub { color: var(--muted); font-size: 13px; }
.total {
  padding: 20px 18px 18px; border-radius: 18px; margin-bottom: 26px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(242, 194, 123, .16), transparent 60%),
    var(--velvet);
}
.total-label { color: var(--muted); font-size: 14px; }
.total-value { font: 600 44px/1.05 var(--display); color: var(--amber); margin-top: 6px; }
.pair { padding: 11px 0; border-bottom: 1px solid var(--velvet-line); }
.pair:last-child { border-bottom: 0; }
.pair-top { display: flex; align-items: center; gap: 12px; }
.pair-time { font: 500 16px var(--display); color: var(--text); flex: none; }
.pair-bar { height: 3px; border-radius: 3px; background: var(--velvet-hi); margin: 9px 0 0 48px; overflow: hidden; }
.pair-bar i { display: block; height: 100%; background: var(--amber); border-radius: 3px; }
.owner-note { font-size: 13px; color: var(--faint); margin-top: 18px; line-height: 1.55; }
.owner-note code { color: var(--muted); }

/* ---------- комната ---------- */
#room {
  background:
    radial-gradient(90% 40% at 50% 0%, rgba(242, 194, 123, .07), transparent 70%),
    var(--ink);
}
.stage {
  position: relative; flex: none; width: 100%;
  aspect-ratio: 16 / 9; max-height: 46vh;
  background: #07040a;
  box-shadow: 0 18px 60px -24px rgba(242, 194, 123, .35);
  overflow: hidden; user-select: none; -webkit-user-select: none;
}
.player-host, .player-host > *, .player-host iframe, .player-host video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000;
}
.player-host video { object-fit: contain; }
.shield { position: absolute; inset: 0; z-index: 2; }
.stage.passthrough .shield, .stage.passthrough .controls { display: none; }
.reactions { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.reaction {
  position: absolute; bottom: 12%; font-size: 30px;
  animation: float-up 2.6s ease-out forwards;
}
@keyframes float-up {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  12% { transform: translateY(-10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-160px) scale(1); opacity: 0; }
}

.stage-center {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center; text-align: center;
  padding: 18px; pointer-events: none;
}
.stage-center > * { pointer-events: auto; }
.stage-center:empty { display: none; }
.stage-note { max-width: 300px; color: var(--muted); font-size: 14px; }
.stage-note b { display: block; color: var(--text); font: 500 20px/1.25 var(--display); margin-bottom: 6px; }
.stage-dim { background: rgba(7, 4, 10, .72); }

.big-play {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--crimson); color: #fff;
  box-shadow: 0 0 0 10px rgba(216, 67, 95, .18);
}
.big-play .ico { width: 30px; height: 30px; margin-left: 4px; }
.join-box { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.join-box span { font-size: 14px; color: var(--text); }

.progress { width: 220px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); margin: 12px auto 0; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--amber); transition: width .4s; }
.progress.indeterminate i { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 26px 10px 6px;
  background: linear-gradient(180deg, transparent, rgba(7, 4, 10, .85));
  transition: opacity .25s;
}
.controls.is-hidden { opacity: 0; pointer-events: none; }
.controls-row { display: flex; align-items: center; gap: 4px; }
.c-btn { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; border-radius: 50%; }
.c-btn .ico { width: 22px; height: 22px; }
.c-btn[disabled] { opacity: .35; }
.c-time { font: 500 13px var(--display); letter-spacing: .02em; color: rgba(255, 255, 255, .88); padding: 0 6px; white-space: nowrap; }
.c-grow { flex: 1; }
.c-sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255, 255, 255, .7); }
.c-sync i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.c-sync.off i { background: var(--amber); }

.seek { padding: 8px 6px; touch-action: none; }
.seek-track { position: relative; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); }
.seek-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--amber); border-radius: 4px; width: 0; }
.seek-knob {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--amber); left: 0; display: none;
}
.seek.editable .seek-knob { display: block; }
.seek:not(.editable) { pointer-events: none; }

.tap-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6;
  background: rgba(7, 4, 10, .85); color: var(--text);
  font-size: 13px; padding: 7px 12px; border-radius: 20px; white-space: nowrap; pointer-events: none;
}

/* fullscreen / театр */
.stage:fullscreen { max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; }
.stage:-webkit-full-screen { max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; }
body.theater .stage {
  position: fixed; inset: 0; z-index: 50; max-height: none; aspect-ratio: auto;
  width: 100vw; height: var(--vh);
}

.roombar { display: flex; align-items: center; gap: 6px; padding: 12px 10px 8px var(--pad); }
.roombar-text { flex: 1; min-width: 0; }
.room-title {
  margin: 0; font: 500 21px/1.2 var(--display);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-sub { display: flex; align-items: center; gap: 10px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 7px; border-radius: 20px; background: var(--velvet); font-size: 12px; color: var(--muted);
}
.chip .ico { width: 14px; height: 14px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--text); }
.icon-btn:active { background: var(--velvet); }

.tabs { display: flex; gap: 22px; padding: 0 var(--pad); border-bottom: 1px solid var(--velvet-line); }
.tab {
  position: relative; padding: 10px 0 11px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab span { color: var(--faint); font-weight: 400; }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--amber); border-radius: 2px;
}
.badge { min-width: 8px; height: 8px; border-radius: 50%; background: var(--crimson); }

.panels { flex: 1; min-height: 0; position: relative; }
.panel { position: absolute; inset: 0; overflow-y: auto; display: none; -webkit-overflow-scrolling: touch; }
.panel.is-active { display: block; }

/* чат */
.chat { padding: 12px var(--pad) 8px; display: flex; flex-direction: column; gap: 2px; min-height: 100%; justify-content: flex-end; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg + .msg.new-author { margin-top: 10px; }
.msg .ava { visibility: hidden; }
.msg.last-of-group .ava { visibility: visible; }
.bubble {
  background: var(--velvet); border-radius: 16px 16px 16px 6px;
  padding: 7px 11px 8px; min-width: 0; word-wrap: break-word; overflow-wrap: anywhere;
}
.bubble .who { font-size: 12px; font-weight: 600; color: var(--amber); margin-bottom: 1px; }
.bubble .txt { white-space: pre-wrap; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .ava { display: none; }
.msg.mine .bubble { background: #5a2436; border-radius: 16px 16px 6px 16px; }
.sys { align-self: center; font-size: 12px; color: var(--faint); margin: 8px 0; text-align: center; max-width: 90%; }
.chat-empty { color: var(--faint); font-size: 14px; text-align: center; margin: auto 0; padding: 20px; }

.composer {
  flex: none; padding: 6px 10px calc(8px + var(--safe-b));
  background: var(--ink-deep); border-top: 1px solid var(--velvet-line);
}
.react-row { display: flex; gap: 2px; margin-bottom: 6px; }
.react-btn { font-size: 20px; width: 40px; height: 32px; border-radius: 10px; }
.react-btn:active { background: var(--velvet); transform: scale(1.15); }
.composer-row { display: flex; gap: 8px; align-items: center; }
.composer-row input {
  flex: 1; height: 42px; border-radius: 21px; padding: 0 16px;
  background: var(--velvet); border: 1px solid transparent; outline: none;
}
.composer-row input:focus { border-color: var(--velvet-hi); }
.composer-row input::placeholder, .field-row input::placeholder { color: var(--faint); }
.send-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--crimson); color: #fff; display: grid; place-items: center; }
.send-btn .ico { width: 20px; height: 20px; }

/* поиск видео */
.finder { padding: 14px var(--pad) 24px; }
.field-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--velvet); border-radius: 14px; padding: 5px 5px 5px 12px; margin-bottom: 12px;
}
.field-row input { flex: 1; min-width: 0; height: 36px; background: none; border: 0; outline: none; }
.field-ico { color: var(--faint); width: 18px; height: 18px; }
.src-switch { display: flex; gap: 8px; margin: 18px 0 10px; }
.src { padding: 7px 14px; border-radius: 20px; background: var(--velvet); color: var(--muted); font-size: 14px; font-weight: 500; }
.src.is-active { background: var(--text); color: var(--ink); }
.results { display: flex; flex-direction: column; gap: 4px; }
.result { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 8px 0; border-radius: 12px; width: 100%; }
.result:active { background: var(--velvet); }
.thumb { position: relative; width: 128px; flex: none; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--velvet); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur {
  position: absolute; right: 5px; bottom: 5px; font: 500 11px var(--display);
  background: rgba(7, 4, 10, .82); padding: 1px 5px; border-radius: 5px;
}
.result-title { font-size: 14px; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result-author { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hint { color: var(--faint); font-size: 13px; padding: 10px 2px; line-height: 1.5; }

/* зрители */
.people { padding: 6px var(--pad) 24px; }

/* ---------- шторка ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(7, 4, 10, .6); animation: fade .2s; }
.sheet {
  position: relative; background: var(--velvet); border-radius: 22px 22px 0 0;
  padding: 8px var(--pad) calc(18px + var(--safe-b));
  max-height: 88%; overflow-y: auto;
  animation: sheet-in .24s cubic-bezier(.2, .9, .3, 1);
}
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: var(--velvet-hi); margin: 0 auto 12px; }
.sheet-title { font: 500 22px/1.2 var(--display); margin: 0 0 14px; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 7px; }
.input {
  width: 100%; height: 48px; border-radius: 12px; padding: 0 14px;
  background: var(--ink); border: 1px solid var(--velvet-line); outline: none; margin-bottom: 18px;
}
.input:focus { border-color: var(--amber); }

.privacy { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.privacy-opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: 14px; background: var(--ink); border: 1.5px solid transparent;
}
.privacy-opt .ico { color: var(--muted); margin-top: 1px; }
.privacy-opt b { display: block; font-weight: 600; }
.privacy-opt small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.privacy-opt.is-active { border-color: var(--amber); }
.privacy-opt.is-active .ico { color: var(--amber); }

.link-box {
  background: var(--ink); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 13px; color: var(--muted); word-break: break-all;
}
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 200;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--ink); font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

.blocker { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 30px; text-align: center; background: var(--ink); color: var(--muted); }
.blocker b { display: block; font: 500 24px var(--display); color: var(--text); margin-bottom: 8px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--velvet-hi); border-top-color: var(--amber);
  animation: spin .8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

@media (min-width: 720px) {
  #app { max-width: 720px; margin: 0 auto; }
}
