/* Кино вдвоём — тёмный зал, жёлтый зонтик, розовые сердечки */

:root {
  --bg: #120f1a;
  --panel: #1b1726;
  --panel-2: #241f33;
  --line: #322b47;
  --text: #f3eef9;
  --muted: #a99fbd;
  --yellow: #f7c948;
  --pink: #ff6fa5;
  --blue: #5aa9ff;
  --radius: 14px;
  --side: 360px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a1d3d 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #1d2440 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
input {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  outline: none;
}
input:focus { border-color: var(--yellow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2);
  padding: 8px 14px; border-radius: 10px; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: #4a3f68; background: #2c2640; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--yellow); color: #231a05; border-color: var(--yellow); font-weight: 600; }
.btn.primary:hover { background: #ffd866; }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 22px; font-size: 17px; border-radius: 12px; }
.error { color: #ff8fa3; margin: 12px 0 0; }

/* ---------- вход ---------- */

.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(420px, 100%); text-align: center; padding: 34px 26px 28px;
  background: rgba(27, 23, 38, .85); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.gate-logo { animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 8px 24px rgba(247, 201, 72, .35)); }
.gate h1 { margin: 10px 0 4px; font-size: 30px; letter-spacing: .3px; }
.gate-sub { margin: 0 0 22px; color: var(--muted); }
.gate-form { display: grid; gap: 10px; text-align: left; }
.gate-form label { color: var(--muted); font-size: 14px; }
.gate-form .btn { margin-top: 6px; }
.gate-pass { display: grid; gap: 10px; }
.gate-hint { margin: 0; color: var(--muted); font-size: 13px; }

@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

/* ---------- зал ---------- */

.hall { height: 100dvh; display: flex; flex-direction: column; }

.top {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: rgba(18, 15, 26, .7);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.now { color: var(--yellow); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.conn { font-size: 13px; white-space: nowrap; }
.conn.bad { color: #ffb36b; }

.theater {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--side);
  gap: 14px; padding: 14px 16px 16px;
}

.screen { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.stage-wrap {
  position: relative; flex: 1; min-height: 0; display: grid; place-items: center;
  background: #000; border-radius: var(--radius); overflow: hidden; container-type: size;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.stage { width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; position: relative; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
  color: var(--muted); padding: 20px;
}
.stage-umbrella { margin: 0 auto 6px; animation: bob 3.2s ease-in-out infinite; }

.reactions { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.reactions::-webkit-scrollbar { display: none; }
.react {
  flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  min-width: 44px; height: 40px; padding: 0 10px; font-size: 20px; line-height: 1;
  transition: transform .1s ease, background .15s ease;
}
.react.wide { font-size: 15px; }
.react:hover { background: var(--panel-2); transform: translateY(-2px); }
.react:active { transform: scale(.9); }
.sep { flex: none; width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

/* ---------- эффекты поверх видео ---------- */

.fx, .fx-top { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fx-top { display: grid; place-items: center; }
.float {
  position: absolute; bottom: 0; display: flex; flex-direction: column; align-items: center;
  animation: rise 2.6s cubic-bezier(.2, .7, .3, 1) forwards;
}
.float-emoji { font-size: 44px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.float-name {
  font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: var(--who, #fff);
}
@keyframes rise {
  0% { bottom: 0; opacity: 0; transform: translateX(0) scale(.6); }
  12% { opacity: 1; transform: translateX(calc(var(--sway) * .3)) scale(1.1); }
  100% { bottom: 78%; opacity: 0; transform: translateX(var(--sway)) scale(1); }
}

.hug {
  text-align: center; font-size: 22px; font-weight: 700; padding: 22px 30px; border-radius: 22px;
  background: rgba(18, 15, 26, .78); border: 1px solid rgba(255, 111, 165, .5);
  box-shadow: 0 0 60px rgba(255, 111, 165, .35); animation: pop-in .5s cubic-bezier(.2, 1.4, .4, 1);
}
.hug-emoji { font-size: 84px; line-height: 1.1; animation: squeeze 1.2s ease-in-out infinite; }
@keyframes squeeze { 50% { transform: scale(1.15); } }
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } }

.legend {
  font-size: clamp(28px, 6vw, 64px); font-weight: 900; letter-spacing: 2px; color: var(--yellow);
  text-shadow: 0 0 30px rgba(247, 201, 72, .6), 0 4px 0 #6b4a00; text-align: center; padding: 0 16px;
  animation: pop-in .4s ease;
}
.countdown {
  font-size: clamp(90px, 22cqh, 200px); font-weight: 900; color: #fff;
  text-shadow: 0 0 40px rgba(247, 201, 72, .8);
}
.countdown.pop { animation: count-pop 1s ease-out; }
@keyframes count-pop { from { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }

.banner {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; max-width: calc(100% - 24px);
  background: rgba(18, 15, 26, .92); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.banner-close { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 4px 6px; }

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

.side {
  display: flex; flex-direction: column; min-height: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.members { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.member {
  display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px;
  border-radius: 999px; background: var(--panel-2);
}
.member span { color: var(--muted); }
.member.away { opacity: .6; }
.member.waiting { color: var(--muted); background: none; font-style: italic; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #7ee0b5; box-shadow: 0 0 8px currentColor; }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: 0; background: none; padding: 10px; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; position: relative;
}
.tab.on { color: var(--text); border-bottom-color: var(--yellow); }
.tab.hide-chat { flex: none; display: none; }
.badge {
  font-style: normal; font-size: 11px; background: var(--pink); color: #fff; border-radius: 999px;
  padding: 0 6px; margin-left: 4px; vertical-align: 2px;
}

.panel { flex: 1; min-height: 0; }
.chat-panel { display: flex; flex-direction: column; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.msg { max-width: 92%; align-self: flex-start; background: var(--panel-2); border-radius: 12px 12px 12px 4px; padding: 6px 10px 8px; }
.msg.mine { align-self: flex-end; background: #2e2547; border-radius: 12px 12px 4px 12px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.msg-head time, .msg.sys time { color: var(--muted); font-size: 11px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.sys {
  align-self: center; background: none; color: var(--muted); font-size: 13px; text-align: center;
  display: flex; gap: 8px; align-items: baseline; padding: 2px 6px;
}
.msg.hug { color: var(--pink); }
.timecode, .msg-play, .tc-chip {
  border: 1px solid rgba(247, 201, 72, .45); background: rgba(247, 201, 72, .12); color: var(--yellow);
  border-radius: 8px; padding: 1px 8px; font-size: 13px; font-weight: 600;
}
.msg-play { display: block; margin-top: 6px; padding: 4px 10px; }

.typing { height: 0; overflow: hidden; color: var(--muted); font-size: 13px; padding: 0 14px; transition: height .2s; }
.typing.on { height: 22px; }

.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: center; }
.chat-form input { flex: 1; min-width: 0; }
.send { padding: 10px 14px; }
.tc-chip { flex: none; padding: 8px; }

.eps-panel { overflow-y: auto; padding: 12px; }
.season-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.season-tab { flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px; color: var(--muted); }
.season-tab.on { color: #231a05; background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
.season-progress { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: inherit; }

.ep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ep { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.ep.current { background: rgba(247, 201, 72, .12); outline: 1px solid rgba(247, 201, 72, .4); }
.ep-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  background: none; border: 0; padding: 8px; border-radius: 10px;
}
.ep-main:hover { background: var(--panel-2); }
.ep-num { flex: none; width: 26px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.ep-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep.watched .ep-title { color: var(--muted); }
.ep-state { flex: none; font-size: 12px; color: var(--muted); }
.ep.current .ep-state { color: var(--yellow); }
.ep-icon {
  flex: none; width: 32px; height: 32px; border: 1px solid transparent; background: none;
  border-radius: 8px; font-size: 14px; opacity: .55;
}
.ep-icon:hover { opacity: 1; background: var(--panel-2); }
.ep-icon.check.on { opacity: 1; color: #7ee0b5; border-color: rgba(126, 224, 181, .4); }

/* ---------- окна и подсказки ---------- */

.dialog {
  width: min(480px, calc(100% - 32px)); background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
}
.dialog::backdrop { background: rgba(5, 3, 10, .7); }
.dialog h3 { margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.welcome { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(5, 3, 10, .75); }
.welcome-card {
  width: min(460px, 100%); text-align: center; padding: 30px 26px; border-radius: 22px;
  background: var(--panel); border: 1px solid rgba(247, 201, 72, .35);
  box-shadow: 0 0 80px rgba(247, 201, 72, .15); animation: pop-in .5s ease;
}
.welcome-card img { animation: bob 3.2s ease-in-out infinite; }
.welcome-card h2 { margin: 8px 0 10px; }
.welcome-card p { color: #d9d0e8; margin: 0 0 10px; }
.welcome-sign { font-style: italic; color: var(--yellow) !important; }

.toasts {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: grid; gap: 8px; justify-items: center; pointer-events: none; width: calc(100% - 32px);
}
.toast {
  background: rgba(36, 31, 51, .96); border: 1px solid var(--line); padding: 8px 14px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: pop-in .25s ease; transition: opacity .4s, transform .4s;
  max-width: 100%;
}
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- кинорежим ---------- */

body.cinema .top { display: none; }
body.cinema .theater { position: fixed; inset: 0; z-index: 50; padding: 0; gap: 0; background: #000; }
body.cinema .screen { gap: 0; }
body.cinema .toolbar, body.cinema .reactions { padding: 6px 10px; background: #0b0910; }
body.cinema .stage-wrap { border-radius: 0; box-shadow: none; }
body.cinema .side { border-radius: 0; border-width: 0 0 0 1px; background: rgba(20, 17, 28, .92); }
body.cinema .tab.hide-chat { display: block; }
body.cinema.chat-hidden .theater { grid-template-columns: minmax(0, 1fr); }
body.cinema.chat-hidden .side { display: none; }
body.cinema.chat-hidden .show-chat { display: block !important; }
.show-chat {
  display: none; position: fixed; right: 16px; bottom: 70px; z-index: 60; width: 52px; height: 52px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 22px;
}

/* ---------- телефон и узкие экраны ---------- */

@media (max-width: 960px) {
  .hall { height: auto; min-height: 100dvh; }
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 10px 16px; }
  .now { order: 3; width: 100%; }
  .theater { display: flex; flex-direction: column; padding: 10px 16px 16px; }
  .stage-wrap { flex: none; aspect-ratio: 16 / 9; container-type: inline-size; }
  .stage { width: 100%; }
  .toolbar .btn { padding: 7px 10px; }
  .side { height: 72dvh; min-height: 420px; }
  body.cinema .theater { display: flex; }
  body.cinema .stage-wrap { flex: 1; aspect-ratio: auto; container-type: size; }
  body.cinema .stage { width: min(100cqw, 100cqh * 16 / 9); }
  body.cinema .side { height: 38dvh; min-height: 0; border-width: 1px 0 0; }
  .countdown { font-size: 110px; }
}

@media (max-width: 480px) {
  .stats { display: none; }
  #btn-resync { display: none; }
  .float-emoji { font-size: 34px; }
}

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