.tvx { display: grid; gap: 10px; min-width: 0; margin-block: 12px; color: var(--text, #f6f3ef); }
.tvx [hidden], .tvx-picker:empty, .tvx-status:empty { display: none; }
.tvx-button {
  display: grid; grid-template-columns: minmax(0,1fr); align-content: center; gap: 3px; min-width: 0; min-height: 44px;
  padding: 9px 13px; border: 1px solid var(--line, #46433e); border-radius: 12px;
  background: var(--panel, #242425); color: inherit; font: inherit; font-weight: 600;
  line-height: 1.3; white-space: normal; overflow-wrap: break-word; hyphens: auto; text-align: start;
  touch-action: manipulation; cursor: pointer; transition: transform 100ms var(--ease-out, cubic-bezier(.23,1,.32,1));
}
.tvx-button:focus-visible { outline: 2px solid var(--gold, #edcb88); outline-offset: 2px; }
.tvx-button:active:enabled { transform: scale(.98); }
.tvx-button:disabled { cursor: wait; opacity: .66; }
.tvx-button small, .tvx-status { color: var(--muted, #c3c0ba); font-weight: 400; }
.tvx-button small { font-size: .875em; font-variant-numeric: tabular-nums; }
.tvx-picker { display: grid; gap: 7px; min-width: 0; }
.tvx-sources { display: grid; gap: 7px; min-width: 0; }
.tvx-sort { display: grid; gap: 4px; font-size: .9rem; }
.tvx-sort select { min-width: 0; max-width: 100%; min-height: 44px; padding-inline: 10px; font: inherit;
  font-size: 1rem; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.tv-presence-notice { margin: 0; font-size: .9rem; color: var(--muted); }
.tv-presence-notice:not(:empty) { margin-block: 10px; }
.tvx-picker h4, .tvx-status { margin: 0; overflow-wrap: break-word; hyphens: auto; }
.tvx-picker h4 { padding-block: 4px; }
.tvx-back { justify-self: start; color: var(--gold, #edcb88); background: transparent; }
@media (hover: hover) and (pointer: fine) {
  .tvx-button:enabled:hover { border-color: var(--gold, #edcb88); }
}
@media (prefers-reduced-motion: reduce) {
  .tvx-button { transition: none; }
  .tvx-button:active:enabled { transform: none; }
}

dialog.tv-screen {
  position: fixed; inset: 0; margin: 0; width: 100%; max-width: none;
  height: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0;
  box-sizing: border-box; overflow: auto; overscroll-behavior: contain;
  color: #f7efdf; background: radial-gradient(ellipse at 48% 45%, #292622 0%, #171819 42%, #101112 78%);
}
.tv-screen::backdrop { background: #101112; }
.tv-screen[open] { animation: screen-appear 160ms var(--ease-out, cubic-bezier(.23,1,.32,1)) both; }
.screen-frame {
  box-sizing: border-box; min-height: 100%; width: min(100%, 520px); margin: 0 auto;
  padding: calc(14px + var(--safe-top,0px)) max(22px,var(--safe-right,0px))
    calc(12px + var(--safe-bottom,0px)) max(22px,var(--safe-left,0px));
  display: flex; flex-direction: column; gap: 12px;
}
.screen-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tv-screen[data-ios-fullscreen] .screen-frame {
  --ios-hardware-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--reported-system-top, 0px));
  --ios-telegram-top: max(44px, var(--tg-content-safe-area-inset-top, 0px), var(--reported-content-top, 0px));
  padding-top: calc(10px + var(--ios-hardware-top) + var(--ios-telegram-top));
}
@media (orientation: portrait) {
  .tv-screen[data-ios-fullscreen] .screen-frame {
    padding-top: calc(10px + max(48px, var(--ios-hardware-top)) + var(--ios-telegram-top));
  }
}
.tv-screen[data-native-back] .screen-bar { justify-content: center; }
.tv-screen[data-native-back] .screen-bar .screen-key { display: none; }
.tv-screen button { cursor: pointer; touch-action: manipulation; font: inherit; color: inherit; }
.tv-screen button:focus-visible { outline: 2px solid #ffdd9b; outline-offset: 3px; }
.tv-screen .remote-retry { align-self: center; }
.tv-screen [aria-disabled=true] { opacity: .65; cursor: wait; }
.screen-key { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px;
  min-height: 46px; border-radius: 24px; border: 1px solid #ffffff20; background: #242424; }
.screen-key svg,.screen-device svg { width: 20px; height: 20px; }
.screen-bar .screen-key { width: 46px; padding: 0; }
.screen-bar .key-label,.remote-rocker .key-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.screen-device { display: flex; align-items: center; gap: 8px; color: #e1d5c3; font-size: .83rem; }
.screen-device svg { color: #d9ae71; }
.screen-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(22px,5vh,46px); padding-block: 10px; min-width: 0; }
.screen-identity { text-align: center; max-width: 100%; }
.screen-meta,.volume-caption { margin: 0; font-weight: 600; font-size: .73rem; letter-spacing: .12em; text-transform: uppercase; color: #d1b185; }
.tv-screen .screen-title { margin: 9px 0 0; font: 500 clamp(1.85rem,8vw,3rem)/1.08 var(--cinema-title);
  text-wrap: balance; overflow-wrap: break-word; hyphens: auto; color: #faf2e4; outline: none; }
.screen-notice { margin: 0; min-height: 2.8em; text-align: center; color: #cec3b3; font-size: .88rem; line-height: 1.4; }
.remote-controls { display: grid; justify-items: center; gap: clamp(24px,5.3vh,48px); }
.remote-dial {
  --wheel: clamp(182px,min(61vw,34vh),252px);
  width: var(--wheel); height: var(--wheel); box-sizing: border-box; display: flex;
  border: 1px solid #7a6e5b; border-radius: 50%; padding: 12px;
  background: repeating-radial-gradient(circle,#302f2c 0 1px,#45423c 2px,#2a2927 3px);
  box-shadow: 0 0 0 5px #161615, 0 0 0 6px #484139, 0 15px 32px #0007;
}
.remote-dial .screen-key { width: 50%; min-width: 0; padding: 0; border: 1px solid #ffffff19; gap: 9px;
  flex-direction: column; color: #f4e9d7; border-radius: 200px 0 0 200px;
  background: linear-gradient(145deg,#484640,#252524 75%); font-size: .84rem; font-weight: 600; }
.remote-dial .screen-key:last-child { border-radius: 0 200px 200px 0; color: #352719;
  background: linear-gradient(125deg,#f3d9a9,#d6ab6d 78%,#b78851); }
.remote-dial svg { width: 35px; height: 35px; }
.remote-dial .pause-glyph { width: 23px; height: 26px; border-inline: 7px solid currentColor; border-radius: 2px; box-sizing: border-box; margin-block: 4.5px; }
.remote-volume { display: grid; justify-items: center; gap: 10px; }
.volume-caption { font-size: .68rem; color: #c3bbb0; }
.remote-rocker { display: flex; padding: 4px; border: 1px solid #514c44; border-radius: 32px;
  background: #151616; box-shadow: inset 0 2px 4px #0009,0 1px 0 #ffffff12; }
.remote-rocker .screen-key { min-width: 82px; min-height: 48px; border-radius: 26px 5px 5px 26px; background: linear-gradient(#373735,#282827); }
.remote-rocker .screen-key + .screen-key { margin-left: 3px; border-radius: 5px 26px 26px 5px; }
.minus-glyph,.plus-glyph { display: grid; place-items: center; width: 20px; height: 20px; }
.minus-glyph::before,.plus-glyph::before,.plus-glyph::after { content: ''; grid-area: 1/1; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
.plus-glyph::after { transform: rotate(90deg); }
.tv-screen button:active:enabled { box-shadow: inset 0 2px 7px #0005; }
.screen-options { display: grid; gap: 8px; width: min(100%,380px); }
.screen-options button { min-width: 0; }
.tv-screen[data-mode=remote] .remote-controls { animation: controls-arrive 220ms var(--ease-out, cubic-bezier(.23,1,.32,1)) both; }
.tv-screen[data-mode=loading] .screen-panel { flex-direction: column-reverse; gap: 20px; }
.projector-stage { display: grid; place-items: center; width: 100%; height: 160px; overflow: hidden; }
.projector { width: 152px; height: 124px; position: relative; transform: translateX(-10px); }
.projector i { position: absolute; display: block; }
.projector-case { bottom: 17px; left: 29px; width: 85px; height: 49px; border-radius: 9px 12px 8px 8px;
  border: 1px solid #d5ba8b; background: linear-gradient(150deg,#c6a878,#796349 40%,#493e31 95%); box-shadow: inset 0 -5px #302a23; }
.projector-vents { bottom: 30px; left: 39px; width: 29px; height: 13px;
  background: repeating-linear-gradient(0deg,#43392e 0 2px,transparent 2px 5px); }
.projector-foot { bottom: 9px; left: 34px; width: 70px; height: 11px; border-inline: 8px solid #8f7759; transform: skewX(-8deg); }
.projector-lens { bottom: 30px; left: 111px; width: 20px; height: 23px; background: linear-gradient(#b18e5d,#473b2c 48%,#806a4b);
  border-right: 4px solid #ffdaa0; border-radius: 3px; }
.projector-reel { top: 12px; left: 17px; width: 58px; height: 58px; border: 2px solid #ccae80; border-radius: 50%;
  background: radial-gradient(circle,#d8bf99 0 5%,#534737 6% 11%,transparent 12%),
    radial-gradient(circle at 50% 23%,#262421 0 12%,transparent 13%),
    radial-gradient(circle at 76% 43%,#262421 0 12%,transparent 13%),
    radial-gradient(circle at 65% 72%,#262421 0 12%,transparent 13%),
    radial-gradient(circle at 34% 72%,#262421 0 12%,transparent 13%),
    radial-gradient(circle at 24% 43%,#262421 0 12%,transparent 13%),#a38c6c;
  box-shadow: inset 0 0 0 3px #76654e; animation: film-reel 2.7s linear infinite; }
.projector-reel.takeup { top: 19px; left: 78px; width: 49px; height: 49px; animation-duration: 2.3s; }
.projector-light { left: 128px; bottom: -1px; width: 82px; height: 86px; clip-path: polygon(0 40%,100% 0,100% 100%,0 62%);
  background: linear-gradient(90deg,#edc17bb8,#e4b46a00); animation: lens-light 1.8s ease-in-out infinite alternate; }
@keyframes film-reel { to { transform: rotate(1turn); } }
@keyframes lens-light { from {opacity:.58} to {opacity:1} }
@keyframes screen-appear { from {opacity:0} to {opacity:1} }
@keyframes controls-arrive { from {opacity:.4;transform:translateY(7px)} to {opacity:1;transform:translateY(0)} }
@media (max-height: 500px) and (min-width: 530px) {
  .screen-frame { width: min(100%,720px); gap: 4px; }
  .screen-panel,.tv-screen[data-mode=loading] .screen-panel { flex-direction: row; gap: 24px; }
  .remote-controls { display:flex; align-items:center; gap:20px; }
  .remote-dial { --wheel:150px; }
  .remote-rocker .screen-key { min-width:52px; }
  .projector-stage { width:230px; flex:none; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-screen[open],.tv-screen[data-mode=remote] .remote-controls,.projector i { animation:none; }
}
