/* ══════════════════════════════════════════════════════════════
   Watch-party room — restyles the original structure. The room
   script (Ably sync, chat, presence, reactions) is unchanged.
   Nothing here blurs or repaints over the playing video.
══════════════════════════════════════════════════════════════ */
:root { --chat-width: 320px; --topbar-h: 52px; --controls-h: 54px; }

html, body { height: 100%; overflow: hidden; }
body { font-size: 13.5px; display: flex; flex-direction: column; height: 100dvh; }

/* ── Top bar ── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0; z-index: 50; position: relative;
  display: flex; align-items: center; gap: 0.7rem; padding: 0 0.9rem;
  background: #0b0b0f; border-bottom: 1px solid var(--border);
}
.logo-sm { font-size: 1.2rem; }
.logo-sm .brand-mark { width: 22px; height: 22px; }
.topbar-divider { width: 1px; height: 22px; background: var(--border-hover); flex-shrink: 0; }
.room-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.room-title-wrapper { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.room-name { font-size: 0.86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.room-meta { font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-badge { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; padding: 1px 6px 1px 5px; border-radius: 5px;
  background: rgba(229, 9, 20, 0.16); border: 1px solid rgba(229, 9, 20, 0.45); color: #ff6b70; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.12em; }
.live-badge .pulse-dot { width: 5px; height: 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

.viewer-stack { display: flex; align-items: center; margin-right: 0.2rem; }
.v-chip { width: 26px; height: 26px; margin-left: -8px; border-radius: 50%; display: grid; place-items: center; cursor: default;
  border: 2px solid #0b0b0f; font-size: 0.6rem; font-weight: 800; color: #fff; animation: chipIn 0.4s var(--ease-spring) both; transition: transform 0.2s var(--ease); }
.v-chip:first-child { margin-left: 0; }
.v-chip:hover { transform: translateY(-2px); z-index: 5; }
.v-count { background: var(--surface3); color: var(--muted); font-size: 0.56rem; }
@keyframes chipIn { from { transform: scale(0); } }

.btn-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; cursor: pointer; text-decoration: none;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--text); font-size: 0.8rem; transition: background 0.2s, border-color 0.2s; }
.btn-icon:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--border-hover); }
.btn-share { height: 32px; padding: 0 0.85rem; border: none; border-radius: 999px; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; font-weight: 700; color: #fff; background: var(--grad-red); transition: transform 0.2s var(--ease); }
.btn-share:hover { transform: translateY(-1px); }
.btn-share:active { transform: scale(0.95); }

/* ── Layout ── */
.main { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.video-col { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* ── Stage ── */
.player-wrap { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 55%, #140708 0%, #050507 70%); }
#videoPlayer { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
#videoPlayer.video-hidden { display: none; }

/* URL loader */
.url-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem;
  padding: 1.5rem 1.25rem; text-align: center; overflow: hidden; }
.url-overlay-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(229, 9, 20, 0.2), transparent); }
.url-overlay > *:not(.url-overlay-glow) { position: relative; animation: rise 0.6s var(--ease) both; }
.url-overlay > :nth-child(3) { animation-delay: 0.04s; } .url-overlay > :nth-child(4) { animation-delay: 0.08s; } .url-overlay > :nth-child(5) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.url-overlay-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.25rem; color: #fff;
  background: var(--grad-red); box-shadow: 0 12px 30px -12px rgba(229, 9, 20, 0.9); }
.url-overlay h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 3.5vw, 2.4rem); letter-spacing: 0.03em; line-height: 1; }
.url-overlay p { color: var(--muted); font-size: 0.86rem; max-width: 380px; line-height: 1.55; }
.url-input-row { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.3rem; }
.url-field { display: flex; align-items: center; gap: 0.45rem; padding: 4px 4px 4px 0.95rem; border-radius: 999px;
  background: #0d0d11; border: 1px solid var(--border-hover); transition: border-color 0.3s, box-shadow 0.3s; }
.url-field:focus-within { border-color: rgba(229, 9, 20, 0.65); box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.12); }
.url-field > i { color: var(--muted); font-size: 0.8rem; }
.url-input { flex: 1; min-width: 0; background: none; border: none; outline: none; padding: 0.5rem 0.3rem; font-size: 0.84rem; color: var(--text); }
.url-input::placeholder { color: var(--muted2); }
.btn-load { height: 34px; padding: 0 1rem; border: none; border-radius: 999px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; font-weight: 700; color: #fff; background: var(--grad-red); transition: transform 0.2s var(--ease); }
.btn-load:hover { transform: scale(1.04); }
.url-extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.sample-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.34rem 0.75rem; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: rgba(255, 255, 255, 0.75); font-size: 0.74rem; font-weight: 500;
  transition: background 0.2s, border-color 0.2s, color 0.2s; }
.sample-chip:hover { background: rgba(229, 9, 20, 0.1); border-color: rgba(229, 9, 20, 0.45); color: #fff; }

/* Sync overlay */
#syncOverlay { display: none; position: absolute; inset: 0; z-index: 20; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  cursor: pointer; background: rgba(3, 3, 5, 0.8); }
#syncOverlay .sync-play-icon { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.25rem; padding-left: 4px; color: #fff;
  background: var(--grad-red); box-shadow: 0 14px 40px -10px rgba(229, 9, 20, 0.9); transition: transform 0.3s var(--ease-spring); }
#syncOverlay .sync-play-icon::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(229, 9, 20, 0.6); animation: ring 2s var(--ease) infinite; }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
#syncOverlay:hover .sync-play-icon { transform: scale(1.08); }
#syncOverlay p { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: 0.04em; line-height: 1; }
#syncOverlay small { color: var(--muted); font-size: 0.76rem; }

/* ── Controls bar ── */
.controls-bar { height: var(--controls-h); flex-shrink: 0; display: flex; align-items: center; gap: 0.45rem; padding: 0 0.8rem;
  background: #0b0b0f; border-top: 1px solid var(--border); }
.ctrl { position: relative; width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border: none; border-radius: 9px;
  background: none; color: var(--text); cursor: pointer; font-size: 0.88rem; transition: background 0.2s, transform 0.15s var(--ease); }
.ctrl small { position: absolute; font-size: 0.45rem; font-weight: 800; bottom: 4px; right: 4px; }
.ctrl:hover { background: rgba(255, 255, 255, 0.08); }
.ctrl:active { transform: scale(0.9); }
.ctrl-main { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-red); color: #fff; }
.ctrl-main:hover { background: var(--grad-red); transform: scale(1.06); }
.ctrl-main i.fa-play { margin-left: 2px; }

.progress-area { flex: 1; display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.time-label { font-size: 0.7rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-track { flex: 1; height: 4px; position: relative; cursor: pointer; border-radius: 6px; background: rgba(255, 255, 255, 0.1); }
.progress-track::before { content: ''; position: absolute; inset: -10px 0; }
.progress-fill-bar { height: 100%; width: 0%; border-radius: inherit; background: var(--grad-heat); position: relative; pointer-events: none; transition: width 0.25s linear; }
.progress-fill-bar::after { content: ''; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: #fff; transform: scale(0); transition: transform 0.2s var(--ease-spring); }
.progress-track:hover .progress-fill-bar::after { transform: scale(1); }

.volume-group { display: flex; align-items: center; gap: 0.15rem; }
input[type=range].vol-slider { --v: 100%; width: 70px; height: 3px; -webkit-appearance: none; appearance: none; border-radius: 4px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #fff var(--v), rgba(255, 255, 255, 0.15) var(--v)); }
input[type=range].vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: #fff; }
input[type=range].vol-slider::-moz-range-thumb { width: 11px; height: 11px; border: none; border-radius: 50%; background: #fff; }

.sync-badge { display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; cursor: default; padding: 0.22rem 0.65rem; border-radius: 999px;
  background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.32); color: #4ade80; font-size: 0.66rem; font-weight: 700; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
button.sync-badge { cursor: pointer; font-family: var(--font-ui); transition: background 0.2s, border-color 0.2s; }
button.sync-badge:hover { background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.6); }
button.sync-badge:active { transform: scale(0.95); }

/* ── Stream lookup status ── */
.media-status { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem;
  padding: 1.5rem; text-align: center; background: radial-gradient(ellipse at 50% 40%, rgba(229, 9, 20, 0.12), transparent 60%), #08080b; }
.media-status[hidden] { display: none; }
.media-status p { max-width: 420px; font-size: 0.86rem; color: rgba(255, 255, 255, 0.78); line-height: 1.55; }
.media-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--red-hot); animation: spinMedia 0.8s linear infinite; }
@keyframes spinMedia { to { transform: rotate(360deg); } }
.media-status.error .media-spinner { display: none; }
/* The title's poster while it loads: blurred to fill the player, sharp in front */
.media-status { overflow: hidden; transition: opacity 0.4s ease; }
.media-status > * { position: relative; }
.media-status > .media-art { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(24px) brightness(0.38) saturate(1.2);
  opacity: 0; transition: opacity 0.5s ease; }
.media-status.has-art > .media-art { opacity: 1; }
.media-poster { display: none; height: min(34%, 170px); aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1); }
.media-status.has-art .media-poster { display: block; animation: posterIn 0.5s var(--ease) both; }
@keyframes posterIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
.media-status.has-art p { color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
/* Waiting for the first frame: taps reach the player underneath (only the buttons are in the way) */
.media-status.starting { pointer-events: none; }
.media-status.starting button { pointer-events: auto; }
.media-status.ready .media-spinner { display: none; }
.media-status.leaving { opacity: 0; }
@media (max-height: 300px) { .media-poster { display: none !important; } }
.media-status.error p { color: #ff9a9a; }
.btn-retry { display: inline-flex; align-items: center; gap: 0.45rem; height: 36px; padding: 0 1.1rem; border: none; border-radius: 999px; cursor: pointer;
  font: 700 0.8rem var(--font-ui); color: #fff; background: var(--grad-red); }
.btn-retry[hidden] { display: none; }

/* ── Quality / subtitle menu ── */
.player-menu { position: absolute; right: 0.8rem; bottom: 0.8rem; z-index: 25; width: 260px; max-height: calc(100% - 1.6rem); overflow-y: auto;
  padding: 0.8rem; border-radius: 14px; background: #121218; border: 1px solid var(--border-hover); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.95); }
.player-menu[hidden] { display: none; }
.menu-section + .menu-section { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.menu-section h4 { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.menu-opts { display: flex; flex-direction: column; gap: 2px; }
.menu-scroll { max-height: 180px; overflow-y: auto; }
.menu-opt { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; padding: 0.42rem 0.6rem; border: none; border-radius: 8px; cursor: pointer;
  font: 500 0.8rem var(--font-ui); color: rgba(255, 255, 255, 0.8); background: none; text-align: left; transition: background 0.15s, color 0.15s; }
.menu-opt:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.menu-opt.active { color: #fff; background: rgba(229, 9, 20, 0.16); box-shadow: inset 2px 0 0 var(--red); }
.menu-opt small { font-size: 0.66rem; color: var(--muted); }
.menu-empty { font-size: 0.76rem; color: var(--muted); padding: 0.2rem 0.6rem; }

/* ── Chat sidebar ── */
.chat-sidebar { width: var(--chat-width); flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; background: #0d0d11; border-left: 1px solid var(--border); }
.chat-grip { display: none; }
.chat-header { height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 0.65rem; border-bottom: 1px solid var(--border); }
.chat-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.chat-tab { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.32rem 0.7rem; border: none; border-radius: 8px; cursor: pointer;
  background: none; color: var(--muted); font-size: 0.75rem; font-weight: 600; transition: color 0.2s, background 0.25s; }
.chat-tab:hover { color: #fff; }
.chat-tab.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.tab-badge { display: none; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; align-items: center; justify-content: center;
  background: var(--red-hot); color: #fff; font-size: 0.6rem; font-weight: 800; animation: badgePop 0.3s var(--ease-spring); }
.online-count { display: inline-flex; align-items: center; gap: 0.35rem; padding: 2px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  color: #4ade80; background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.25); }
.online-count::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

.tab-panel { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.tab-panel.active { display: flex; animation: panelIn 0.3s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateX(8px); } }

.messages-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0.8rem 0.75rem; display: flex; flex-direction: column; gap: 0.1rem; scroll-behavior: smooth; }
.msg-group { margin-bottom: 0.55rem; animation: msgIn 0.35s var(--ease-spring) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem; }
.msg-avatar { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 0.55rem; font-weight: 800; color: #fff; }
.msg-name { font-size: 0.74rem; font-weight: 700; }
.msg-time { font-size: 0.62rem; color: var(--muted2); }
.msg-bubble { display: inline-block; max-width: calc(100% - 28px); margin-left: 28px; padding: 0.42rem 0.7rem; word-break: break-word;
  background: rgba(255, 255, 255, 0.06); border-radius: 4px 13px 13px 13px; font-size: 0.8rem; line-height: 1.45; color: rgba(255, 255, 255, 0.92); }
.msg-bubble.own { background: var(--grad-red); border-radius: 13px 4px 13px 13px; color: #fff; }
.msg-own { text-align: right; animation-name: msgInOwn; }
.msg-own .msg-header { flex-direction: row-reverse; }
.msg-own .msg-name { text-align: right; }
.msg-own .msg-bubble { margin-left: 0; margin-right: 0; float: right; }
.msg-own::after { content: ''; display: table; clear: both; }
@keyframes msgInOwn { from { opacity: 0; transform: translateX(10px); } }

.system-msg { text-align: center; padding: 0.35rem 0; font-size: 0.68rem; color: var(--muted); }
.system-msg span { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }

.reactions-bar { flex-shrink: 0; display: flex; gap: 0.25rem; padding: 0.45rem 0.65rem; border-top: 1px solid var(--border); }
.reaction-btn { flex: 1; height: 32px; border-radius: 9px; cursor: pointer; font-size: 0.98rem; line-height: 1;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); transition: transform 0.25s var(--ease-spring), background 0.2s; }
.reaction-btn:hover { transform: translateY(-2px) scale(1.1); background: rgba(255, 255, 255, 0.08); }
.reaction-btn:active { transform: scale(0.85); }

.chat-input-area { flex-shrink: 0; padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.chat-name-row { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.45rem; padding: 0 0.15rem; color: var(--muted); font-size: 0.74rem; }
.name-input { flex: 1; min-width: 0; background: none; border: none; border-bottom: 1px dashed var(--border-hover); outline: none; padding: 0.2rem 0.1rem;
  color: var(--text); font-size: 0.75rem; font-weight: 600; }
.name-input:focus { border-bottom-color: var(--red-hot); border-bottom-style: solid; }
.name-input::placeholder { color: var(--muted2); }
.msg-input-row { display: flex; align-items: flex-end; gap: 0.4rem; padding: 4px 4px 4px 0.8rem; border-radius: 18px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-hover); transition: border-color 0.25s; }
.msg-input-row:focus-within { border-color: rgba(229, 9, 20, 0.6); }
.msg-input { flex: 1; min-width: 0; height: 32px; max-height: 88px; resize: none; background: none; border: none; outline: none;
  padding: 0.42rem 0; color: var(--text); font-size: 0.82rem; line-height: 1.4; }
.msg-input::placeholder { color: var(--muted2); }
.send-btn { width: 32px; height: 32px; flex-shrink: 0; border: none; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 0.75rem;
  background: var(--grad-red); transition: transform 0.25s var(--ease-spring); }
.send-btn:hover { transform: scale(1.08) rotate(-12deg); }
.send-btn:active { transform: scale(0.88); }

.viewers-list { flex: 1; overflow-y: auto; padding: 0.65rem; display: flex; flex-direction: column; gap: 0.25rem; }
.viewer-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.55rem; border-radius: 11px; transition: background 0.2s; }
.viewer-row:hover { background: rgba(255, 255, 255, 0.05); }
.v-avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 0.66rem; font-weight: 800; color: #fff; }
.viewer-info { flex: 1; min-width: 0; }
.viewer-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-status { font-size: 0.66rem; color: var(--muted); }
.host-badge { padding: 1px 7px; border-radius: 6px; font-size: 0.6rem; font-weight: 800; color: var(--imdb-gold); background: rgba(245, 197, 24, 0.1); border: 1px solid rgba(245, 197, 24, 0.3); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* Floating reactions (spawned by the room script) */
.float-reaction { position: fixed; z-index: 999; pointer-events: none; font-size: 1.6rem; animation: floatUp 2s var(--ease) forwards; }
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.4); }
  15% { opacity: 1; transform: translateY(-18px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-190px) rotate(10deg); }
}

/* ── Share modal ── */
.modal-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(3, 3, 5, 0.82); opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { width: 100%; max-width: 400px; padding: 1.5rem 1.4rem 1.3rem; border-radius: 18px; text-align: center;
  background: linear-gradient(180deg, #1b1b23, #0f0f14); border: 1px solid var(--border-hover); box-shadow: 0 30px 80px -25px rgba(0, 0, 0, 0.95);
  transform: translateY(20px) scale(0.96); transition: transform 0.4s var(--ease-spring); }
.modal-overlay.open .modal { transform: none; }
.modal-ic { width: 42px; height: 42px; margin: 0 auto 0.8rem; border-radius: 13px; display: grid; place-items: center; font-size: 1rem; color: #fff; background: var(--grad-red); }
.modal h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; letter-spacing: 0.03em; line-height: 1; margin-bottom: 0.4rem; }
.modal p { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.1rem; }
.copy-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; padding: 4px 4px 4px 0.85rem; border-radius: 999px; text-align: left;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border-hover); }
.copy-row > i { color: var(--muted); font-size: 0.8rem; }
.copy-url { flex: 1; min-width: 0; font-size: 0.74rem; color: rgba(255, 255, 255, 0.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-copy { flex-shrink: 0; height: 30px; padding: 0 0.85rem; border: none; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.74rem; font-weight: 700; color: #fff; background: var(--grad-red); }
.modal-close { width: 100%; padding: 0.6rem 1rem; border-radius: 11px; cursor: pointer; font-size: 0.82rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--muted); transition: color 0.2s, border-color 0.2s; }
.modal-close:hover { color: var(--text); border-color: var(--border-hover); }

/* ── Toast ── */
.toast { position: fixed; left: 50%; bottom: 1.3rem; z-index: 999; pointer-events: none; white-space: nowrap;
  padding: 0.55rem 1.1rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: #1c1c24; border: 1px solid var(--border-hover);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.9);
  opacity: 0; transform: translateX(-50%) translateY(18px); transition: opacity 0.25s var(--ease), transform 0.4s var(--ease-spring); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes badgePop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* ── Mobile: chat becomes a bottom sheet ── */
/* "Watching alone?" card on the video (room.html): ways to invite while nobody else is here */
.alone-card { position: absolute; left: 50%; bottom: 18px; z-index: 30; width: min(440px, calc(100% - 24px)); transform: translateX(-50%);
  padding: 14px 14px 13px; border-radius: 16px; background: rgba(20, 20, 26, 0.94); border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: aloneIn 0.45s var(--ease) both; }
.alone-card[hidden], body.fs .alone-card { display: none; }
@keyframes aloneIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.alone-x { position: absolute; top: 9px; right: 9px; width: 26px; height: 26px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.06); }
.alone-x:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.alone-card h4 { margin: 0 0 3px; padding-right: 28px; font-size: 0.95rem; font-weight: 700; }
.alone-card h4 i { margin-right: 4px; font-size: 0.8rem; color: var(--red-hot); }
.alone-card p { margin: 0 0 11px; font-size: 0.8rem; line-height: 1.4; color: var(--muted); }
.alone-row { display: flex; gap: 8px; }
.alone-row button { flex: 1; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; cursor: pointer;
  border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.1);
  font: 700 0.82rem var(--font-ui); color: #fff; transition: background 0.2s, transform 0.2s var(--ease); }
.alone-row button:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.alone-row .alone-wa { flex: 1.35; border-color: transparent; background: #1faa53; }
.alone-row .alone-wa:hover { background: #22bd5c; }
.alone-row .alone-more { flex: 0.8; }
/* Phones: above the floating chat button; the narrowest keep the Invite pill to its icon */
@media (max-width: 700px) { .alone-card { bottom: 96px; } }
@media (max-width: 350px) { .topbar .share-text { display: none; } .topbar .btn-share { width: 32px; padding: 0; justify-content: center; } }

.mobile-chat-bubble { display: none; }
@media (max-width: 700px) {
  :root { --topbar-h: 50px; --controls-h: 50px; }
  .logo-text-full { display: none; }
  .topbar { padding: 0 0.6rem; gap: 0.5rem; }
  .topbar-divider { display: none; }
  .room-name { max-width: 120px; font-size: 0.8rem; }
  .room-meta, .viewer-stack { display: none; }
  .btn-share { padding: 0 0.8rem 0 0.7rem; }
  .main { flex-direction: column; }
  .video-col { flex: 1; width: 100%; }
  .controls-bar { gap: 0.2rem; padding: 0 0.45rem; }
  .volume-group input, .time-label, .sync-text { display: none; }
  .sync-badge { padding: 0.45rem; }
  .player-menu { right: 0.5rem; bottom: 0.5rem; width: min(260px, calc(100% - 1rem)); }
  .progress-area { gap: 0; }

  .chat-sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 150; width: 100%; height: 70dvh;
    border-left: none; border-top: 1px solid var(--border-hover); border-radius: 18px 18px 0 0; background: #0f0f14;
    box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.9); transform: translateY(105%); transition: transform 0.4s var(--ease); }
  .chat-sidebar.open, .chat-sidebar.mobile-open { transform: none; }
  .chat-grip { display: block; width: 38px; height: 4px; margin: 0.5rem auto 0; border-radius: 4px; background: rgba(255, 255, 255, 0.2); flex-shrink: 0; }
  .chat-header { height: 44px; }

  .chat-backdrop { position: fixed; inset: 0; z-index: 149; background: rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); }
  .chat-backdrop.visible { opacity: 1; pointer-events: all; }

  .mobile-chat-bubble { position: fixed; right: 14px; bottom: calc(var(--controls-h) + 14px + env(safe-area-inset-bottom)); z-index: 140;
    width: 48px; height: 48px; display: grid; place-items: center; border: none; border-radius: 50%; cursor: pointer; font-size: 1.1rem; color: #fff;
    background: var(--grad-red); box-shadow: 0 10px 24px -8px rgba(229, 9, 20, 0.9); transition: transform 0.25s var(--ease-spring); }
  .mobile-chat-bubble:active { transform: scale(0.88); }
  .toast { bottom: calc(var(--controls-h) + 0.8rem); }
}
@media (min-width: 701px) { .chat-backdrop { display: none; } }

/* ── Seek bar: buffered range, drag preview ── */
.progress-track { touch-action: none; }
.progress-buffer { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: rgba(255, 255, 255, 0.18); pointer-events: none; transition: width 0.3s linear; }
.progress-track.scrubbing .progress-fill-bar { transition: none; }
.progress-track.scrubbing .progress-fill-bar::after { transform: scale(1.15); }
.progress-track:hover, .progress-track.scrubbing { height: 6px; }
.scrub-tip { position: absolute; bottom: 14px; left: 0; transform: translateX(-50%); padding: 3px 7px; border-radius: 6px; pointer-events: none;
  font: 700 0.68rem var(--font-ui); font-variant-numeric: tabular-nums; color: #fff; background: rgba(10, 10, 14, 0.95); border: 1px solid var(--border-hover);
  opacity: 0; transition: opacity 0.15s; white-space: nowrap; }
.scrub-tip.show { opacity: 1; }

/* ── Buffering / waiting-for-the-room spinner ── */
#videoPlayer { touch-action: manipulation; }
.buffer-spin { position: absolute; left: 50%; top: 50%; z-index: 12; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; pointer-events: none;
  border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: #fff; animation: spinMedia 0.8s linear infinite; }
.buffer-spin[hidden] { display: none; }

/* ── Fullscreen keeps our controls bar ── */
.video-col:fullscreen { width: 100%; height: 100%; background: #000; }
.video-col:fullscreen .player-wrap { flex: 1; }

/* ── Sync status light (button states set by the room script) ── */
.sync-badge[data-state="ok"]      { background: rgba(34, 197, 94, 0.1);  border-color: rgba(34, 197, 94, 0.32);  color: #4ade80; }
.sync-badge[data-state="busy"]    { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.4);  color: #93c5fd; }
.sync-badge[data-state="behind"]  { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.55); color: #fbbf24; }
.sync-badge[data-state="offline"],
.sync-badge[data-state="idle"]    { background: rgba(255, 255, 255, 0.05); border-color: var(--border-hover); color: var(--muted); }
.sync-badge[data-state="busy"] .sync-dot    { background: #3b82f6; animation: syncPulse 1s ease-in-out infinite; }
.sync-badge[data-state="behind"] .sync-dot  { background: #f59e0b; }
.sync-badge[data-state="offline"] .sync-dot,
.sync-badge[data-state="idle"] .sync-dot    { background: var(--muted2); }
@keyframes syncPulse { 50% { opacity: 0.3; } }
button.sync-badge[data-state="behind"]:hover { background: rgba(245, 158, 11, 0.24); border-color: rgba(245, 158, 11, 0.8); }

.behind-note { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 14; max-width: calc(100% - 24px);
  padding: 6px 12px; border-radius: 999px; font: 600 0.74rem var(--font-ui); text-align: center; color: #fbbf24;
  background: rgba(10, 10, 14, 0.9); border: 1px solid rgba(245, 158, 11, 0.45); pointer-events: none; }
.behind-note[hidden] { display: none; }

/* Phones hide the label to save room — but never when something needs attention */
@media (max-width: 700px) {
  .sync-badge[data-state="behind"] .sync-text,
  .sync-badge[data-state="offline"] .sync-text { display: inline; }
  .sync-badge[data-state="behind"], .sync-badge[data-state="offline"] { padding: 0.22rem 0.55rem; }
}

/* ── YouTube player ── */
.yt-wrap { position: absolute; inset: 0; z-index: 1; background: #000; }
.yt-wrap[hidden] { display: none; }
.yt-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
/* Taps land here so play/pause/seek go through the room, not straight to YouTube */
.tap-layer { position: absolute; inset: 0; z-index: 2; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
body.fs .tap-layer { cursor: pointer; }
.tap-layer[hidden] { display: none; }

/* ?debug=1 readout */
.sync-debug { position: absolute; left: 10px; bottom: 10px; z-index: 30; padding: 4px 8px; border-radius: 6px; pointer-events: none;
  font: 600 11px ui-monospace, Consolas, monospace; color: #a7f3d0; background: rgba(0, 0, 0, 0.75); border: 1px solid rgba(255, 255, 255, 0.12); }

/* ── Unread dot on the chat bubble: red, with the count ── */
.notification-badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; display: none; align-items: center; justify-content: center;
  border-radius: 9px; border: 2px solid #050507; background: #ff2d2d; color: #fff; font-size: 0.6rem; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.7); animation: unreadPing 1.6s ease-out infinite; }
@keyframes unreadPing { 0% { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.6); } 80%, 100% { box-shadow: 0 0 0 9px rgba(255, 45, 45, 0); } }

/* ── Fullscreen: the whole room page fills the screen; chat lives behind the bubble ── */
body.fs .topbar { display: none; }
body.fs .main { position: fixed; inset: 0; z-index: 100; background: #000; }
/* min-height: 0 — on a turned phone (fs-rotate) the column would otherwise grow to the movie's
   own height and push the picture and controls past the screen edge */
body.fs .video-col { width: 100%; min-height: 0; }
body.fs .chat-sidebar { position: fixed; top: 0; right: 0; bottom: 0; left: auto; z-index: 150; width: min(340px, 88vw); height: 100%;
  border-left: 1px solid var(--border-hover); border-top: none; border-radius: 0; background: #0f0f14;
  transform: translateX(105%); transition: transform 0.35s var(--ease); }
body.fs .chat-sidebar.mobile-open { transform: none; }
body.fs .chat-grip { display: none; }
body.fs .chat-backdrop { display: block; position: fixed; inset: 0; z-index: 149; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); }
body.fs .chat-backdrop.visible { opacity: 1; pointer-events: all; }
body.fs .mobile-chat-bubble { position: fixed; right: 14px; bottom: calc(var(--controls-h) + 14px + env(safe-area-inset-bottom)); z-index: 140;
  width: 48px; height: 48px; display: grid; place-items: center; border: none; border-radius: 50%; cursor: pointer; font-size: 1.1rem; color: #fff;
  background: var(--grad-red); box-shadow: 0 10px 24px -8px rgba(229, 9, 20, 0.9); opacity: 0.92; }
body.fs .toast { bottom: calc(var(--controls-h) + 0.8rem); z-index: 1000; }
/* With the chat panel open in fullscreen, the bubble sits just left of it (and closes it) */
body.fs.chat-open .mobile-chat-bubble { right: calc(min(340px, 88vw) + 12px); }
body.fs .mobile-chat-bubble { transition: right 0.35s var(--ease), transform 0.25s var(--ease-spring); }

/* ── Phones that won't rotate on request: turn the whole room 90° while held upright.
   Rotating <body> carries everything with it — the fixed chat bubble, toasts and chat panel
   are positioned inside the transformed body. Rotating the phone itself switches this off. ── */
@media (orientation: portrait) {
  body.fs.fs-rotate:not(.fs-typing) {
    position: fixed; top: 0; left: 100vw; width: 100vh; height: 100vw;
    width: 100dvh; height: 100dvw; left: 100dvw;
    transform-origin: top left; transform: rotate(90deg); overflow: hidden;
  }
  body.fs.fs-rotate:not(.fs-typing) .main { position: absolute; inset: 0; }
}

/* iPhones zoom the page into any text field under 16px, and leave it zoomed */
@media (pointer: coarse) {
  .msg-input, .name-input, .url-input { font-size: 16px; }
  .msg-input { padding: 0.3rem 0; line-height: 1.25; }
}

/* ── Fullscreen: picture only; a tap shows the controls over it for a few seconds ── */
body.fs .controls-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--controls-h) + 18px); padding-top: 18px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.85) 55%); border-top: none;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); }
body.fs.show-controls .controls-bar { opacity: 1; transform: none; pointer-events: auto; }
body.fs .player-wrap { flex: 1; }
/* The quality/subtitle menu belongs to the controls, so it hides with them */
body.fs:not(.show-controls) .player-menu { display: none; }

/* ── Double-tap skip feedback ── */
.skip-flash { position: absolute; top: 50%; z-index: 16; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
  padding: 14px 18px; border-radius: 50%; color: #fff; font: 700 0.78rem var(--font-ui); background: rgba(0, 0, 0, 0.45);
  transform: translateY(-50%) scale(0.85); opacity: 0; animation: skipFlash 0.65s var(--ease) forwards; }
.skip-flash i { font-size: 1.1rem; }
.skip-flash.left { left: 12%; }
.skip-flash.right { right: 12%; }
@keyframes skipFlash { 20% { opacity: 1; transform: translateY(-50%) scale(1); } 100% { opacity: 0; transform: translateY(-50%) scale(1.05); } }
.skip-flash.mid { left: 50%; margin-left: -32px; width: 64px; height: 64px; padding: 0; justify-content: center; }
.skip-flash.mid i { font-size: 1.4rem; }

/* "Open in the HexTV app" — only shown on Windows browsers */
.btn-icon[hidden] { display: none; }
.btn-icon.open-app { color: #7cc2ff; }

/* ── Host controls ─────────────────────────────── */
.host-card { margin: 0 0 0.5rem; padding: 0.75rem 0.8rem 0.55rem; border-radius: 14px; background: linear-gradient(180deg, rgba(229, 9, 20, 0.12), rgba(229, 9, 20, 0.04)); border: 1px solid rgba(229, 9, 20, 0.28); }
.host-card h5 { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 700; margin: 0 0 0.4rem; }
.host-card h5 i { color: var(--imdb-gold); }
.host-opt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; padding: 0.4rem 0; border: none; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.host-opt b { display: block; font-size: 0.75rem; font-weight: 600; }
.host-opt small { display: block; margin-top: 1px; font-size: 0.64rem; color: var(--muted); }
.switch { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: rgba(255, 255, 255, 0.15); transition: background 0.2s, box-shadow 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left 0.2s var(--ease); }
.switch.on { background: var(--grad-red); box-shadow: 0 0 12px rgba(229, 9, 20, 0.5); }
.switch.on::after { left: 17px; }
.make-host { flex: none; padding: 0.3rem 0.55rem; border-radius: 999px; cursor: pointer; font-family: inherit; font-size: 0.62rem; font-weight: 700; color: #ddd;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.18); transition: border-color 0.2s, color 0.2s; }
.make-host:hover { color: #fff; border-color: rgba(245, 197, 24, 0.6); }
.make-host i { color: var(--imdb-gold); margin-right: 3px; }
/* A guest while the host has locked playback (tapping still explains why) */
body.guest-locked .controls-bar .ctrl:not(#fullscreenBtn), body.guest-locked .progress-track { opacity: 0.4; }
body.guest-noload .url-input-row { opacity: 0.4; pointer-events: none; }

/* ── Up next (auto-play the next episode) ───────── */
.up-next { position: absolute; inset: 0; z-index: 25; display: flex; align-items: flex-end; justify-content: flex-end; padding: 22px; pointer-events: none;
  background: linear-gradient(0deg, rgba(5, 5, 7, 0.9) 0%, rgba(5, 5, 7, 0.5) 45%, rgba(5, 5, 7, 0.15) 100%); animation: upNextIn 0.4s var(--ease); }
.up-next[hidden] { display: none; }
@keyframes upNextIn { from { opacity: 0; } }
.up-next-card { pointer-events: all; width: 340px; max-width: 100%; display: flex; gap: 14px; padding: 14px; border-radius: 16px;
  background: rgba(17, 17, 22, 0.92); border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 20px 50px -20px #000; backdrop-filter: blur(10px);
  animation: upNextCard 0.5s var(--ease-spring); }
@keyframes upNextCard { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.up-next-card img { width: 78px; aspect-ratio: 2 / 3; flex: none; border-radius: 8px; object-fit: cover; background: var(--surface2, #1a1a20); }
.up-next-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.up-next-k { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; color: var(--red-hot); text-transform: uppercase; }
.up-next-ep { font-weight: 700; font-size: 0.95rem; margin: 3px 0 2px; }
.up-next-sub { font-size: 0.7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-next-btns { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.up-next-play, .up-next-cancel { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; cursor: pointer; font-family: inherit; font-size: 0.72rem; font-weight: 700; color: #fff; border: none; }
.up-next-play { background: var(--grad-red); box-shadow: 0 6px 16px -6px rgba(229, 9, 20, 0.9); }
.up-next-cancel { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); }
.up-next-ring { position: relative; width: 22px; height: 22px; }
.up-next-ring svg { transform: rotate(-90deg); display: block; }
.up-next-ring circle { fill: none; stroke-width: 2.5; stroke: rgba(255, 255, 255, 0.25); }
.up-next-ring circle + circle { stroke: #fff; stroke-dasharray: 56.5; stroke-dashoffset: 0; transition: stroke-dashoffset 0.25s linear; }
.up-next-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.62rem; }
/* Guests who can't control it just see the countdown */
body.guest-locked .up-next-cancel, body.guest-noload .up-next-play { display: none; }
@media (max-width: 640px) { .up-next { padding: 12px; } .up-next-card { width: 100%; } }

/* "Tap for sound": shown when a phone started YouTube silently */
.sound-btn { position: absolute; z-index: 26; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: none; cursor: pointer; font-family: inherit; font-size: 0.95rem; font-weight: 700; color: #fff;
  background: var(--grad-red); box-shadow: 0 12px 30px -10px rgba(229, 9, 20, 0.9); animation: soundPulse 1.6s ease-in-out infinite; }
.sound-btn[hidden] { display: none; }
@keyframes soundPulse { 50% { transform: translate(-50%, -50%) scale(1.06); } }

/* "This title's sound can't play here": a version with no decodable sound and nothing else to try */
.audio-note { position: absolute; z-index: 26; left: 12px; right: 12px; top: 12px; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border-radius: 12px; font-size: 0.8rem; line-height: 1.4; color: #fff; background: rgba(20, 20, 26, 0.94); border: 1px solid rgba(255, 45, 58, 0.45);
  box-shadow: 0 12px 30px -12px #000; }
.audio-note[hidden] { display: none; }
.audio-note > i { color: var(--red-hot); margin-top: 2px; }
.audio-note span { flex: 1; }
.audio-note button { border: none; background: none; color: #9a9aa8; cursor: pointer; font-size: 0.85rem; padding: 0 2px; }

/* ── Windows browser → HexTV app hand-off ── */
.app-handoff { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(60% 45% at 50% 40%, rgba(229, 9, 20, 0.18), transparent 70%), rgba(5, 5, 7, 0.96); }
.app-handoff[hidden] { display: none; }
.handoff-card { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.handoff-logo { width: 64px; height: 64px; filter: drop-shadow(0 0 24px rgba(229, 9, 20, 0.55)); margin-bottom: 0.3rem; }
.handoff-card h2 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; letter-spacing: 0.04em; line-height: 1; }
.handoff-card p { color: rgba(255, 255, 255, 0.72); font-size: 0.9rem; line-height: 1.55; max-width: 340px; }
.handoff-actions { display: flex; flex-direction: column; gap: 0.6rem; width: 100%; max-width: 300px; margin-top: 0.6rem; }
.handoff-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; padding: 0.85rem 1.2rem; border-radius: 999px;
  font-family: inherit; font-weight: 600; font-size: 0.92rem; color: #fff; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, background 0.15s ease; }
.handoff-btn:hover { background: rgba(255, 255, 255, 0.12); }
.handoff-btn:active { transform: scale(0.97); }
.handoff-btn.primary { border-color: transparent; background: linear-gradient(135deg, #ff2d3a 0%, #e50914 45%, #b20710 100%); box-shadow: 0 8px 28px rgba(229, 9, 20, 0.35); }
.handoff-btn.primary:hover { filter: brightness(1.08); }
.handoff-card small { color: #ffb4b4; font-size: 0.8rem; line-height: 1.5; max-width: 320px; }

/* Paused for a while (room.html #idleBox): over everything, fullscreen included */
.idle-box { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(5, 5, 7, 0.84); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: idleIn 0.35s var(--ease) both; cursor: pointer; }
.idle-box[hidden] { display: none; }
@keyframes idleIn { from { opacity: 0; } }
.idle-card { width: min(400px, 100%); padding: 28px 22px 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.idle-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; color: var(--red-hot); background: rgba(229, 9, 20, 0.16); }
.idle-card h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; letter-spacing: 0.04em; line-height: 1; }
.idle-card p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: rgba(255, 255, 255, 0.72); }
.idle-card p b { color: var(--text); }
.idle-go { width: 100%; height: 50px; justify-content: center; gap: 8px; font-size: 1rem; }
.idle-card .idle-who { font-size: 0.78rem; color: var(--muted); }
.idle-lib { font-size: 0.82rem; color: var(--muted); text-decoration: underline; }
.idle-lib:hover { color: var(--text); }

/* Guests (room.html #guestGate, #guestCard) */
.guest-gate .idle-go { width: 100%; box-sizing: border-box; text-decoration: none; }
.guest-gate .guest-login { height: 48px; }
.guest-back { background: none; border: 0; cursor: pointer; font: inherit; padding: 10px; }
.guest-card { position: relative; margin: 10px 12px 0; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; line-height: 1.45; color: rgba(255, 255, 255, 0.72); }
.guest-card[hidden] { display: none; }
.guest-card b { color: var(--text); font-size: 0.9rem; padding-right: 28px; }
.guest-card-row { display: flex; gap: 8px; margin-top: 6px; }
.guest-card-row .btn { flex: 1; text-decoration: none; }
.guest-card-x { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%; }
.guest-card-x:hover { color: var(--text); }
