@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter/inter-cyrillic-400-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter/inter-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter/inter-cyrillic-500-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter/inter-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/playfair/playfair-display-cyrillic-500-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/playfair/playfair-display-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #0a0a0a; --gold: #c9a84c; --gold-l: #dfc06e; --gold-15: rgba(201, 168, 76, .15); --gold-30: rgba(201, 168, 76, .3);
  --fg-strong: #fafafa; --fg: #e8e4df; --muted: rgba(232, 228, 223, .6); --subtle: rgba(232, 228, 223, .4);
  --glass: rgba(255, 255, 255, .03); --glass-h: rgba(255, 255, 255, .06); --line: rgba(255, 255, 255, .08); --line-s: rgba(255, 255, 255, .16);
  --ok: #7bc47f; --err: #e57373;
  --display: 'Playfair Display', 'Times New Roman', serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--body); }
body { min-height: 100vh; padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: var(--fg); }
svg { flex: none; }
#app { max-width: 520px; margin: 0 auto; padding: 0 16px calc(100px + var(--safe-b)); }
body.in-room #app { padding-bottom: 8px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.brand { font-family: var(--display); font-weight: 500; font-size: 17px; color: var(--fg-strong); }
.label { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--gold); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.label-line { width: 24px; height: 1px; background: var(--gold); }
.title { margin: 0 0 18px; font-family: var(--display); font-weight: 500; font-size: 36px; line-height: 1.05; letter-spacing: -.03em; color: var(--fg-strong); }
.title em { font-style: normal; color: var(--gold); }
.title.sm { font-size: 24px; margin: 0 0 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.muted { margin: 0; color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--ok); margin: 0; }
.err { color: var(--err); margin: 0; }
.gold, .gold-text { color: var(--gold); }

.card { background: var(--glass); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.card-title { margin: 0; font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.2; color: var(--fg-strong); }
.empty-card { display: flex; flex-direction: column; gap: 10px; padding: 28px 18px; text-align: center; }
.film { padding: 0; overflow: hidden; }
.film-cover { position: relative; aspect-ratio: 16 / 9; background: #1a1a2e; }
.cover-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--subtle); background: #1a1a2e; }
.badge { position: absolute; top: 12px; left: 12px; padding: 3px 10px; border-radius: 8px; background: var(--gold); color: #1a1408; font-size: 11px; font-weight: 500; letter-spacing: .08em; }
.badge.right { left: auto; right: 12px; background: rgba(0, 0, 0, .6); color: var(--fg); }
.film-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.thumb { width: 64px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.row-title { margin: 0; color: var(--fg-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skeleton { height: 260px; border-radius: 20px; background: linear-gradient(90deg, var(--glass), var(--glass-h), var(--glass)); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 500; font-size: 15px; transition: transform .2s var(--ease), opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.gold { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: #1a1408; box-shadow: 0 4px 24px rgba(201, 168, 76, .3), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.outline { background: var(--glass); border: 1px solid var(--line-s); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; }
.icon-btn:active { background: var(--glass-h); }
.icon-btn.danger { color: var(--err); }
.link-btn { padding: 8px 0; font-size: 14px; }

.tabbar { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 20; display: flex; gap: 4px; padding: 6px; border-radius: 100px; background: rgba(20, 20, 20, .78); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.tabbar[hidden] { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 18px; border-radius: 100px; border: 1px solid transparent; color: var(--muted); font-size: 11px; }
.tab.active { color: var(--gold-l); background: var(--gold-15); border-color: var(--gold-30); }

.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.avatar-lg { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; flex: none; border-radius: 50%; object-fit: cover; background: var(--gold-15); color: var(--gold); font-family: var(--display); font-size: 26px; }
.howto { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.howto li { margin: 4px 0; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.field input { padding: 12px; border-radius: 12px; border: 1px solid var(--line-s); background: rgba(255, 255, 255, .04); font-size: 16px; outline: none; }
.field input:focus { border-color: var(--gold); }

.spinner { width: 32px; height: 32px; border: 2px solid var(--gold-30); border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); z-index: 60; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-s); background: #1c1c1c; font-size: 14px; animation: toast-in .25s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .6); animation: fade-in .2s; }
.sheet { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 520px; padding: 20px 16px calc(20px + var(--safe-b)); border-radius: 24px 24px 0 0; background: #141414; animation: sheet-up .3s var(--ease); }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet .label { margin: 0; }
.invite-link { padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(201, 168, 76, .5); color: var(--gold-l); font-size: 13px; word-break: break-all; }
.sheet a { color: var(--gold-l); word-break: break-all; }

.room { display: flex; flex-direction: column; gap: 10px; height: calc(var(--tg-viewport-stable-height, 100vh) - 8px); }
.player { position: relative; flex: none; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; background: #000; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: rgba(10, 10, 10, .72); }
.player-overlay[hidden] { display: none; }
.player-overlay .btn { width: auto; }
.controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
.controls input[type=range] { flex: 1; height: 4px; border-radius: 2px; outline: none; -webkit-appearance: none; appearance: none; background: linear-gradient(90deg, var(--gold) var(--p, 0%), rgba(255, 255, 255, .25) var(--p, 0%)); }
.controls input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold-l); }
.controls input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--gold-l); }
.time { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.buffer-note { position: absolute; top: 10px; left: 50%; z-index: 2; max-width: 90%; transform: translateX(-50%); padding: 6px 12px; border-radius: 100px; border: 1px solid var(--gold-30); background: rgba(0, 0, 0, .72); color: var(--gold-l); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buffer-note[hidden] { display: none; }
.reactions-layer { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.fly { position: absolute; bottom: 44px; font-size: 30px; animation: fly 2.6s var(--ease) forwards; }
@keyframes fly { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; transform: translateY(-20px) scale(1.1); } 100% { opacity: 0; transform: translateY(-220px) scale(1); } }
.room-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--subtle); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--gold); }
.dot.err { background: var(--err); }
.reaction-bar { display: flex; gap: 8px; }
.reaction-btn { flex: 1; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); font-size: 20px; }
.reaction-btn:active { transform: scale(.92); }
.chat { display: flex; flex: 1; flex-direction: column; gap: 8px; min-height: 160px; padding: 10px; }
.chat-list { display: flex; flex: 1; flex-direction: column; gap: 8px; overflow-y: auto; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 85%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-name { color: var(--gold-l); font-size: 11px; }
.bubble { padding: 7px 12px; border-radius: 14px; background: var(--glass-h); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.mine .bubble { background: rgba(201, 168, 76, .18); }
.sys { align-self: center; color: var(--subtle); font-size: 12px; text-align: center; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; padding: 9px 14px; border-radius: 100px; border: 1px solid rgba(255, 255, 255, .12); background: transparent; font-size: 16px; outline: none; }
.send-btn { display: flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--gold); color: #1a1408; }
.landscape-toasts { display: none; }
.room.is-full .player { position: fixed; inset: 0; z-index: 30; border-radius: 0; aspect-ratio: auto; }
.room.is-full .reaction-bar { position: fixed; right: 12px; bottom: 60px; z-index: 31; flex-direction: column; width: 44px; }
.room.is-full .landscape-toasts { position: fixed; top: 12px; left: 12px; z-index: 31; display: flex; flex-direction: column; gap: 6px; max-width: 50%; pointer-events: none; }
.ltoast { padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .65); font-size: 13px; animation: fade-in .25s var(--ease); }
