:root {
  --bg: #0d0b10;
  --card: #1a1620;
  --text: #f4eef6;
  --muted: #a99db0;
  --accent: #ff5d8f;
  --accent2: #ffb86b;
  --mine: #8fd3ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }

/* Lobby */
#lobby { display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, #3a1830 0, transparent 50%), radial-gradient(circle at 75% 80%, #2a1a10 0, transparent 50%), var(--bg); }
.card, .center-card { background: var(--card); border: 1px solid #ffffff14; border-radius: 18px;
  padding: 28px; width: min(400px, 100%); text-align: center; box-shadow: 0 20px 60px #0008; }
.logo { font-size: 52px; }
.logo.small { font-size: 36px; }
h1, h2 { margin: 6px 0; }
.sub { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }
.err { color: #ff7a7a; min-height: 1em; font-size: 14px; margin: 10px 0 0; }
.card input, .invite input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #ffffff22;
  background: #0006; outline: none; margin-bottom: 12px; }
.card input:focus { border-color: var(--accent); }
.primary { display: inline-block; width: 100%; padding: 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #1a0a10; font-weight: 700; }
.primary:hover { filter: brightness(1.08); }

/* Theater */
#stage { position: absolute; inset: 0; background: #000; }
#stage.idle { cursor: none; }
video { width: 100%; height: 100%; object-fit: contain; display: block; }
.center-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; }
.file-btn { box-sizing: border-box; }
.invite { margin-top: 20px; text-align: left; }
.invite .sub { margin-bottom: 6px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input { margin: 0; font-size: 13px; }
.invite-row button { padding: 0 14px; border-radius: 10px; border: 1px solid #ffffff22; background: #ffffff10; cursor: pointer; }
.view-wait { width: min(420px, calc(100vw - 32px)); font-size: 15px; line-height: 1.5; color: var(--text);
  background: rgba(26, 22, 32, 0.92); }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid #ffffff22; border-top-color: #e6e3dc; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tap { width: auto; font-size: 20px; font-weight: 700; cursor: pointer; color: var(--text); }

.status { position: absolute; top: 14px; left: 16px; z-index: 6; font-size: 13px; padding: 6px 12px;
  border-radius: 999px; background: #0009; color: var(--muted); transition: opacity .4s, color .2s; cursor: pointer; }
.status:hover { color: var(--text); }
/* Presence: grey dot while waiting, green name + glowing dot when your partner is online */
.status { display: flex; align-items: center; gap: 7px; background: rgba(20, 20, 22, 0.45);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; flex: none; }
.status .room { opacity: .6; font-size: 12px; margin-left: 2px; }
.status.online { color: #c9f7d2; }
.status.online b { color: #34c759; font-weight: 700; }
.status.online .dot { background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, .22); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(52, 199, 89, .08); } }
.secondary { display: inline-block; width: 100%; padding: 11px; border-radius: 10px; cursor: pointer; font-weight: 600;
  border: 1px solid #ffffff2a; background: #ffffff0d; color: var(--text); }
.secondary:hover { background: #ffffff18; }
.sub.small { font-size: 12.5px; margin: 8px 0 0; }
.sub.warn { color: #ffd79a; background: rgba(255, 180, 60, 0.08); border: 1px solid rgba(255, 180, 60, 0.25);
  border-radius: 10px; padding: 8px 10px; text-align: left; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #ffffff2a; background: #0006; color: var(--text); outline: none; font-size: 14px; }
.join-row input:focus { border-color: #e6e3dc; }
.join-row .secondary, .join-row .primary { width: auto; padding: 0 18px; }
button.secondary { font-size: 15px; }
#picker { max-height: calc(100vh - 140px); overflow-y: auto; }
.clip-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; text-align: left; }
.clip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid #ffffff1f; background: #ffffff0a; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; }
.clip:hover { background: #ffffff16; }
.clip span { font-size: 11px; opacity: .7; }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #ffffff1a; }

/* Watching a video your partner shares: no seek/play (they control it) */
.live { display: none; flex: 1; padding-left: 12px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stage.viewing .live { display: block; }
#stage.viewing #playBtn, #stage.viewing #seek, #stage.viewing #curTime, #stage.viewing #durTime, #stage.viewing .thumb { display: none; }
#stage.viewing .live::first-letter { color: #ff5a5f; }

.linkish { margin-top: 14px; background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--text); }
.notice-actions { margin-top: 10px; }
.notice-btn { border: 0; border-radius: 999px; padding: 7px 16px; cursor: pointer; font-weight: 600; font-size: 13px;
  background: #e6e3dc; color: #1d1d1f; }
.notice-btn:hover { background: #fff; }
.notice-btn.ghost { background: rgba(255, 255, 255, 0.1); color: #e6e3dc; }
.notice-btn.ghost:hover { background: rgba(255, 255, 255, 0.18); }
.progress { margin-top: 10px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; }
.progress i { display: block; height: 100%; background: #e6e3dc; transition: width .3s; }
#stage.idle .status { opacity: 0; }

/* Twitch-style overlay chat */
.chat-wrap { position: absolute; left: 20px; bottom: 96px; z-index: 7; width: min(440px, 75vw);
  pointer-events: none; transition: bottom .3s; }
#stage.idle .chat-wrap { bottom: 28px; }
.chat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* Glassy iMessage-style bubbles: mostly see-through, with a soft blur and
   text shadow so the words stay readable over bright scenes. */
/* Slim, mostly see-through pills: one line, name inline. A light blur and a
   text shadow keep the words readable without hiding the movie. */
.msg { max-width: 100%; padding: 3px 11px 4px; border-radius: 14px;
  background: rgba(20, 20, 22, 0.16); color: #fff;
  -webkit-backdrop-filter: blur(8px) brightness(0.85); backdrop-filter: blur(8px) brightness(0.85);
  font: 500 14.5px/1.35 -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.45);
  overflow-wrap: anywhere; transform-origin: bottom left;
  animation: pop .3s cubic-bezier(.2, .9, .3, 1.2); transition: opacity 1s, transform 1s; }
.msg b { font-size: 12.5px; font-weight: 700; margin-right: 6px; color: #ffb3cb; }
.msg.mine b { color: #a9d4ff; }
.msg.sys { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: #ffffffc0;
  background: rgba(28, 28, 30, 0.22); }
.msg.fade { opacity: 0; transform: translateY(-6px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.92); } }

.chat-input { margin-top: 8px; pointer-events: auto; }
.chat-input input { width: 100%; padding: 10px 16px; border-radius: 999px; color: #fbfaf7;
  border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(28, 28, 30, 0.38); outline: none;
  -webkit-backdrop-filter: blur(14px) saturate(140%) brightness(0.72); backdrop-filter: blur(14px) saturate(140%) brightness(0.72); }
.chat-input input::placeholder { color: #ffffff8c; }

/* Movie title (top center) */
.title { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); z-index: 6;
  max-width: min(70vw, 900px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 600 22px/1.2 -apple-system, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.01em; color: #f6f4ef; text-shadow: 0 2px 12px #000c, 0 1px 3px #000a;
  transition: opacity .8s ease, transform .8s ease; pointer-events: none; }
.title:empty { display: none; }
#stage.calm .title { opacity: 0; }
#stage.calm .title { transform: translate(-50%, -6px); }

/* Playback bar: discreet dark-grey pill, centered at the bottom (easy on the eyes at night) */
.controls {
  --ink: #e6e3dc; --ink-soft: #e6e3dc8c;
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 8;
  width: min(1100px, calc(100vw - 48px)); height: 56px; padding: 0 12px 0 8px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(32, 32, 34, 0.72); color: var(--ink);
  -webkit-backdrop-filter: blur(14px) brightness(0.7); backdrop-filter: blur(14px) brightness(0.7);
  border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 999px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  font-family: -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  transition: opacity .35s ease, transform .35s ease; }
#stage.idle .controls { opacity: 0; transform: translate(-50%, 10px); pointer-events: none; }

.icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
  transition: background .15s, transform .1s; }
.icon:hover { background: rgba(255, 255, 255, 0.08); }
.icon:active { transform: scale(0.92); }
.icon svg { width: 20px; height: 20px; fill: currentColor; }
.icon.play { width: 40px; height: 40px; background: rgba(255, 255, 255, 0.10); color: var(--ink); }
.icon.play:hover { background: rgba(255, 255, 255, 0.16); }
.icon.play svg { width: 18px; height: 18px; }

.time { flex: none; min-width: 42px; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; text-align: center; }
.divider { flex: none; width: 1px; height: 22px; background: rgba(255, 255, 255, 0.10); }
.vol { display: flex; align-items: center; gap: 2px; }

/* Thin Apple-style sliders; --p is the filled fraction (set from JS) */
.track { -webkit-appearance: none; appearance: none; height: 18px; margin: 0; background: transparent; cursor: pointer; }
#seek { flex: 1; min-width: 60px; }
#volume { width: 72px; }
.track::-webkit-slider-runnable-track { height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--ink) calc(var(--p, 0) * 100%), rgba(255,255,255,.16) 0); }
.track::-moz-range-track { height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--ink) calc(var(--p, 0) * 100%), rgba(255,255,255,.16) 0); }
.track::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%;
  background: var(--ink); border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.3); transform: scale(0); transition: transform .15s; }
.track::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 0; }
.track:hover::-webkit-slider-thumb, .track:active::-webkit-slider-thumb { transform: scale(1); }
.track:hover::-webkit-slider-runnable-track { height: 6px; }
.track:hover::-webkit-slider-thumb { margin-top: -3px; }
/* The timeline: bigger and easier to grab precisely (taller hit area, thicker track, larger handle). */
#seek { height: 30px; min-width: 80px; }
#seek::-webkit-slider-runnable-track { height: 7px; border-radius: 7px; transition: height .12s; }
#seek::-moz-range-track { height: 7px; border-radius: 7px; }
#seek::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -4.5px; }
#seek::-moz-range-thumb { width: 16px; height: 16px; }
#seek:hover::-webkit-slider-runnable-track, #seek:active::-webkit-slider-runnable-track { height: 10px; }
#seek:hover::-webkit-slider-thumb, #seek:active::-webkit-slider-thumb { margin-top: -3px; transform: scale(1); }
.time { font-size: 13.5px; }
@media (max-width: 420px) { #curTime { display: none; } }

/* Subtitles: centered above the playback pill; drop lower when the pill hides */
.subs { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 6;
  width: min(1100px, 86vw); text-align: center; pointer-events: none; transition: bottom .35s ease;
  font: 600 calc(clamp(18px, 2.3vw, 34px) * var(--sub-scale, 1))/1.3 var(--sub-font, -apple-system), -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: #fff; }
#stage.idle .subs { bottom: 44px; }
.subs, .sub-preview span { color: var(--sub-color, #fff); }

/* Subtitle color controls (CC menu) */
.swatches { display: flex; gap: 6px; }
.swatch { width: 20px; height: 20px; padding: 0; border-radius: 50%; cursor: pointer; background: var(--c);
  border: 2px solid rgba(255, 255, 255, 0.25); transition: transform .1s; }
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35); }
.color-pick { width: 34px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.color-pick::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick::-webkit-color-swatch { border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 7px; }
.hex-input { width: 86px; padding: 5px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35); color: var(--ink); font: 600 12.5px ui-monospace, Consolas, monospace; text-transform: uppercase; outline: none; }
.hex-input:focus { border-color: #e6e3dc; }
.hex-input.bad { border-color: #ff6b6b; }
.sub-preview { margin: 8px 4px 2px; padding: 10px; border-radius: 10px; text-align: center;
  background: linear-gradient(135deg, #3a4a5a, #1c2430 60%, #50413a); }
.sub-preview span { font: 600 16px var(--sub-font, -apple-system), -apple-system, "Segoe UI", system-ui, sans-serif;
  padding: 1px 8px; border-radius: 6px; background: rgba(0, 0, 0, var(--sub-bg, 0.35));
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 2px 4px #000; }
.bg-track { width: 96px; }
.font-name { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-soft); }
.cc-mini { border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer; font-weight: 600; font-size: 12.5px;
  background: rgba(255, 255, 255, 0.10); color: var(--ink); }
.cc-mini:hover { background: rgba(255, 255, 255, 0.18); }
.subs span { display: inline; padding: 1px 8px; border-radius: 6px; background: rgba(0, 0, 0, var(--sub-bg, 0.35));
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 2px 4px #000; }
#stage.viewing .subs { display: none; }

.cc-menu { position: absolute; bottom: 64px; right: 70px; width: 270px; padding: 12px; border-radius: 18px;
  background: rgba(32, 32, 34, 0.94); border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); color: var(--ink); font-size: 13.5px; }
.cc-menu { max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; }
.cc-head { font-weight: 700; font-size: 14px; margin: 0 4px 2px; }
.cc-name { margin: 0 4px 10px; color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-load { display: block; text-align: center; padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 600;
  background: rgba(255, 255, 255, 0.10); margin-bottom: 8px; }
.cc-load:hover { background: rgba(255, 255, 255, 0.16); }
.cc-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px; }
.cc-ctl { display: flex; align-items: center; gap: 6px; }
.cc-ctl b { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.cc-ctl button, .cc-pill { border: 0; border-radius: 999px; padding: 4px 11px; cursor: pointer; font-weight: 600;
  background: rgba(255, 255, 255, 0.10); color: var(--ink); }
.cc-ctl button:hover, .cc-pill:hover { background: rgba(255, 255, 255, 0.18); }
.cc-pill.on { background: #e6e3dc; color: #1d1d1f; }
.cc-remove { width: 100%; margin-top: 6px; padding: 7px; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: #ff9a9a; font-weight: 600; }
.cc-remove:hover { background: rgba(255, 90, 90, 0.1); }
.cc-hint { margin: 6px 4px 0; font-size: 11.5px; color: var(--ink-soft); }
#ccBtn.has-subs { color: #fff; }
#ccBtn { position: relative; }
#ccBtn.has-subs::after { content: ""; position: absolute; right: 5px; bottom: 6px; width: 6px; height: 6px; border-radius: 50%; background: #34c759; }

/* Connection panel (Wi-Fi button, top right) */
.info-btn.net-btn { right: 54px; display: grid; place-items: center; padding: 0; }
.net-btn svg { width: 16px; height: 16px; fill: #e6e3dc; }
.net-panel { position: absolute; top: 50px; right: 16px; z-index: 12; width: min(380px, calc(100vw - 32px)); padding: 14px;
  border-radius: 18px; background: rgba(28, 28, 30, 0.92); border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color: #ece9e3; font-size: 13px; animation: netIn .22s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes netIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.net-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 8px; }
.net-head b { font-size: 15px; }
.net-head small { color: rgba(235, 235, 245, .5); }
.net-canvas { width: 100%; height: 150px; display: block; border-radius: 10px; background: rgba(0, 0, 0, 0.35); }
.net-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 2px 4px; color: rgba(235, 235, 245, .6); font-size: 11.5px; }
.net-legend > span { display: flex; align-items: center; gap: 5px; }
.net-legend i, .net-who i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.net-legend i.dash { background: repeating-linear-gradient(90deg, #ffd60a 0 4px, transparent 4px 7px); }
.net-row { display: grid; grid-template-columns: 70px 1fr; gap: 2px 8px; align-items: center; padding: 8px 2px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.net-who { display: flex; align-items: center; gap: 6px; font-weight: 600; grid-row: span 2; }
.net-stats { color: rgba(235, 235, 245, .6); font-size: 12px; }
.net-stats b { color: #ece9e3; font-weight: 600; }
.nv { font-weight: 600; }
.nv.ok { color: #30d158; } .nv.warn { color: #ffd60a; } .nv.bad { color: #ff453a; } .nv.wait { color: rgba(235, 235, 245, .5); }
#stage.idle .net-btn { opacity: 0; pointer-events: none; }
.net-mic { padding: 10px 2px 4px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.net-mic .net-who { margin-bottom: 6px; }
.mic-row { display: flex; gap: 8px; }
.mic-select { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35); color: #ece9e3; font: 12.5px system-ui, sans-serif; }
.mic-meter { height: 5px; margin: 8px 0 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.mic-meter i { display: block; height: 100%; width: 0; background: #30d158; transition: width .06s; }
.talk-badge .lvl { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; vertical-align: middle; }
.talk-badge .lvl i { display: block; height: 100%; background: #30d158; transition: width .08s; }

/* Push-to-talk */
.talk-badge { position: absolute; top: 52px; left: 16px; z-index: 9;
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: rgba(20, 20, 22, 0.7); color: #fbfaf7; font-size: 14px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none; }
.talk-badge small { opacity: .65; }
.talk-badge .rec { width: 9px; height: 9px; border-radius: 50%; background: #ff453a; animation: pulse-rec 1s ease-in-out infinite; }
@keyframes pulse-rec { 50% { opacity: .35; } }
#micBtn.on { background: #ff453a; color: #fff; }
#micBtn { touch-action: none; }

/* Drag-and-drop hint */
/* Dragging a video over the movie: two halves — watch together / share it.
   (Subtitles or a font: one area.) The half under the file lights up. */
.drop-hint { position: absolute; inset: 14px; z-index: 30; display: flex; gap: 14px; pointer-events: none;
  font-family: -apple-system, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; }
.drop-hint .dz, .drop-hint .dz-single { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed rgba(216, 216, 220, 0.3); border-radius: 22px; background: rgba(12, 12, 14, 0.62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #d8d8dc; transition: all .15s ease; }
.drop-hint b { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.drop-hint small { font-size: 14px; color: rgba(216, 216, 220, 0.6); }
.drop-hint .dz.active { border-color: rgba(230, 230, 235, 0.9); background: rgba(40, 40, 44, 0.78); transform: scale(1.01); }
.drop-hint .dz-single { display: none; }
.drop-hint.single .dz { display: none; }
.drop-hint.single .dz-single { display: flex; border-color: rgba(216, 216, 220, 0.75); }

/* Stickers */
.sticker-menu { position: absolute; bottom: 64px; right: 110px; width: 330px; padding: 12px; border-radius: 18px;
  background: rgba(32, 32, 34, 0.94); border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); color: var(--ink); }
.sticker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 8px; }
.sticker { border: 0; background: transparent; font-size: 24px; line-height: 1; padding: 6px 0; border-radius: 10px; cursor: pointer;
  transition: transform .1s, background .1s; }
.sticker:hover, .sticker:focus { background: rgba(255, 255, 255, 0.12); transform: scale(1.18); outline: none; }
.sticker-layer { position: absolute; inset: 0; pointer-events: none; z-index: 7; overflow: hidden; }
.float-sticker { position: absolute; bottom: 110px; display: flex; flex-direction: column; align-items: center;
  animation: floatUp 3.1s cubic-bezier(.2, .7, .3, 1) forwards; }
.float-sticker .e { font-size: 76px; line-height: 1; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .45)); }
.float-sticker .n { margin-top: 4px; font: 700 12px system-ui, sans-serif; color: #ffb3cb; text-shadow: 0 1px 3px #000; }
.float-sticker.mine .n { color: #a9d4ff; }
@keyframes floatUp {
  0% { transform: translateY(30px) scale(.3); opacity: 0; }
  12% { transform: translateY(0) scale(1.15); opacity: 1; }
  22% { transform: translateY(-10px) scale(1); }
  75% { opacity: 1; }
  100% { transform: translateY(-240px) scale(.9); opacity: 0; }
}

/* Help: "i" button (top right) and panel */
.info-btn { position: absolute; top: 12px; right: 16px; z-index: 9; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(20, 20, 22, 0.45); color: #e6e3dc; cursor: pointer;
  font: italic 700 15px Georgia, serif; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: opacity .4s, background .15s; }
.info-btn:hover { background: rgba(255, 255, 255, 0.14); }
#stage.idle .info-btn { opacity: 0; pointer-events: none; }
.info { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.info-card { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 24px 26px; border-radius: 22px; background: rgba(30, 28, 34, 0.97); border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); color: #ece9e3; font-size: 14px; line-height: 1.5; }
.info-card h2 { margin: 0 0 2px; font-size: 22px; }
.info-lead { margin: 0 0 14px; color: #a99db0; }
.info-card h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #a99db0; }
.info-card ol, .info-card ul { margin: 0; padding-left: 20px; }
.info-card li { margin: 5px 0; }
.info-card .green { color: #34c759; font-weight: 700; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; align-items: center; }
kbd { display: inline-block; min-width: 22px; padding: 2px 7px; border-radius: 6px; text-align: center;
  font: 600 12px system-ui, sans-serif; color: #fff; background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16); border-bottom-width: 2px; }
.info-card a { color: #a9d4ff; }
.token-row { display: flex; gap: 8px; margin: 12px 0 6px; }
.token-row input { flex: 1; padding: 11px 13px; border-radius: 10px; border: 1px solid #ffffff2a; background: #0006; color: #fff; outline: none; }
.token-row input:focus { border-color: #e6e3dc; }
.token-row .primary { width: auto; padding: 0 18px; }
.setup-msg { min-height: 1.4em; margin: 4px 0 8px; font-weight: 600; }
.info-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: #ece9e3; cursor: pointer; }
.info-close:hover { background: rgba(255, 255, 255, 0.16); }

/* All messages (Tab): the same bubbles, revealed in place over the movie.
   No panel; scrolls if long, with the oldest fading out at the top edge. */
.chat-all { display: none; flex-direction: column; align-items: flex-start; gap: 4px;
  max-height: calc(100vh - 200px); overflow-y: auto; pointer-events: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 40px); mask-image: linear-gradient(to bottom, transparent 0, #000 40px);
  padding-top: 40px; }
.chat-all::-webkit-scrollbar { display: none; }
/* Many bubbles at once: skip the per-bubble blur (costly while video plays)
   and use a touch more tint instead, so it still reads the same. */
.chat-all .msg { animation: none; flex: none; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(20, 20, 22, 0.34); }
/* Tab: bubbles ripple in (newest first) with a soft spring, and drift away on close */
.chat-all .msg.pop-in { transform-origin: left bottom; animation: msgIn .46s cubic-bezier(.2, 1.35, .4, 1) both; }
@keyframes msgIn {
  0% { opacity: 0; transform: translate(-22px, 12px) scale(.86); filter: blur(2px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
.chat-all.closing .msg { animation: msgOut .24s cubic-bezier(.4, 0, 1, 1) forwards !important; animation-delay: 0s !important; }
@keyframes msgOut { to { opacity: 0; transform: translate(-16px, 6px) scale(.95); } }
@media (prefers-reduced-motion: reduce) {
  .chat-all .msg.pop-in { animation: fadeOnly .2s ease both; }
  .chat-all.closing .msg { animation: msgOutFade .18s ease forwards !important; }
  @keyframes fadeOnly { from { opacity: 0; } }
  @keyframes msgOutFade { to { opacity: 0; } }
}
#stage.show-all .chat-all { display: flex; }
#stage.show-all .chat { display: none; }

/* Scrub thumbnail, floating above the pill */
.thumb { position: absolute; bottom: 64px; left: 50%; transform: translate(-50%, 6px) scale(.96);
  padding: 4px; border-radius: 14px; background: rgba(32, 32, 34, 0.85); border: 1px solid rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); pointer-events: none;
  opacity: 0; transition: opacity .15s, transform .15s; }
.thumb.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.thumb canvas { display: block; width: 224px; height: auto; border-radius: 10px; background: #111; }
.thumb span { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.notice b { color: #fff; }
/* Small notice under the title (e.g. "no sound") */
.notice { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 9;
  width: min(560px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px 12px 18px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  background: rgba(32, 32, 34, 0.88); color: #e6e3dc; border: 1px solid rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 10px 40px rgba(0,0,0,.4); }
#noticeClose { flex: none; border: 0; background: rgba(255,255,255,.10); color: #e6e3dc; width: 26px; height: 26px;
  border-radius: 50%; cursor: pointer; font-size: 12px; }

/* Phones: a tighter pill so every button fits, and menus that span the screen */
@media (max-width: 600px) {
  .vol, .divider, #durTime { display: none; }
  .controls { gap: 2px; padding: 0 6px; height: 48px; bottom: 14px; }
  .icon { width: 30px; height: 30px; }
  .talk-badge { top: 86px; }
  .icon svg { width: 18px; height: 18px; }
  .icon.play { width: 36px; height: 36px; }
  .time { min-width: 34px; font-size: 12px; }
  #seek { min-width: 40px; }
  .thumb canvas { width: 160px; }
  .cc-menu, .sticker-menu { left: 0; right: 0; width: auto; bottom: 56px; }
  .chat-wrap { bottom: 74px; left: 12px; }
  .subs { bottom: 76px; }
  .info-btn { top: 10px; right: 10px; }
  .info-btn.net-btn { right: 46px; }
  .net-panel { right: 8px; left: 8px; width: auto; }
  .status .room { display: none; }
  .title { top: 52px; font-size: 18px; max-width: 86vw; }
}

/* ================= Start screen + movie picker (Apple-style) ================= */
#lobby, .picker {
  --ui: -apple-system, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --label: #f5f5f7; --label2: rgba(235, 235, 245, 0.6); --label3: rgba(235, 235, 245, 0.3);
  --fill: rgba(118, 118, 128, 0.24); --blue: #0a84ff;
  font-family: var(--ui);
}
.glass {
  background: rgba(28, 28, 30, 0.58);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Start screen: soft light drifting behind frosted glass */
#lobby { display: grid; place-items: center; padding: 20px; overflow: hidden; background: #000; }
.orb { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .5; pointer-events: none; }
.orb-a { background: radial-gradient(circle, #5e5ce6 0, transparent 62%); top: -22vmax; left: -14vmax; animation: drift 24s ease-in-out infinite alternate; }
.orb-b { background: radial-gradient(circle, #ff375f 0, transparent 62%); bottom: -26vmax; right: -16vmax; animation: drift 30s ease-in-out infinite alternate-reverse; }
.orb-c { background: radial-gradient(circle, #0a84ff 0, transparent 62%); width: 40vmax; height: 40vmax; top: 40%; left: 55%; opacity: .28; animation: drift 36s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.12); } }
.lobby-card { position: relative; width: min(380px, 100%); padding: 44px 34px 26px; border-radius: 30px; text-align: center;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.app-mark { width: 68px; height: 68px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(145deg, #ff375f, #5e5ce6 60%, #0a84ff);
  box-shadow: 0 10px 30px rgba(94, 92, 230, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.app-mark svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
#lobby h1 { margin: 20px 0 6px; font-size: 32px; font-weight: 700; letter-spacing: -0.025em; color: var(--label); }
#lobby .sub, .picker .sub { color: var(--label2); font-size: 15px; margin: 0 0 26px; letter-spacing: -0.01em; }
.field { display: block; width: 100%; height: 50px; padding: 0 16px; margin: 0 0 12px; border-radius: 14px;
  border: 1px solid transparent; background: var(--fill); color: var(--label); font: 500 17px var(--ui); letter-spacing: -0.01em;
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.field::placeholder { color: var(--label3); }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.28); background: rgba(118, 118, 128, 0.3); }
.btn-primary { display: block; width: 100%; height: 50px; border: 0; border-radius: 14px; cursor: pointer;
  background: #f5f5f7; color: #000; font: 600 17px var(--ui); letter-spacing: -0.01em;
  transition: transform .12s, background .15s, box-shadow .15s; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.btn-primary:hover { background: #fff; }
.btn-primary:active { transform: scale(0.98); }
.text-link { margin-top: 16px; background: none; border: 0; color: var(--blue); font: 500 15px var(--ui); cursor: pointer; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
#lobby .err { color: #ff453a; font-size: 14px; margin: 10px 0 0; min-height: 1.2em; }
.lobby-foot { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; margin: 0;
  color: var(--label3); font: 500 12px var(--ui); letter-spacing: 0.04em; }

/* Movie picker: a grouped list, like Settings */
.picker.center-card { width: min(420px, calc(100vw - 32px)); padding: 30px 22px 22px; border-radius: 28px; text-align: center;
  max-height: calc(100vh - 140px); overflow-y: auto; scrollbar-width: none; }
.picker h2 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--label); }
.picker .sub { margin-bottom: 20px; }
.options { border-radius: 16px; overflow: hidden; background: rgba(118, 118, 128, 0.16); text-align: left; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; margin: 0; border: 0;
  background: transparent; color: var(--label); cursor: pointer; font: inherit; text-align: left; transition: background .15s; }
.option + .option, .options .join-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.option:hover { background: rgba(255, 255, 255, 0.06); }
.option:active { background: rgba(255, 255, 255, 0.1); }
.opt-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--g1), var(--g2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.opt-icon svg { width: 20px; height: 20px; fill: #fff; }
.opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.opt-text b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.opt-text small { margin-top: 1px; font-size: 13px; color: var(--label2); }
.chev { flex: none; color: var(--label3); font-size: 22px; line-height: 1; }
.options .join-row { padding: 12px 14px; display: flex; gap: 8px; }
.options .join-row .field { height: 44px; margin: 0; font-size: 15px; }
.options .join-row .btn-primary { width: auto; height: 44px; padding: 0 20px; font-size: 15px; box-shadow: none; }
.picker .section-label { margin: 22px 4px 8px; text-align: left; color: var(--label2); font: 600 12px var(--ui); letter-spacing: 0.06em; text-transform: uppercase; }
.picker .clip { border-radius: 12px; background: rgba(118, 118, 128, 0.16); border: 0; padding: 12px 14px; }
.picker .invite { margin-top: 22px; }
.picker .invite .sub { margin: 0 4px 8px; font-size: 13px; text-align: left; }
.picker .invite-row input { height: 40px; border-radius: 12px; border: 0; background: var(--fill); color: var(--label); padding: 0 12px; font: 13px var(--ui); }
.picker .invite-row button { border: 0; border-radius: 12px; background: var(--fill); color: var(--blue); font: 600 14px var(--ui); padding: 0 16px; }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } .lobby-card { animation: none; } }

/* Night palette: same Apple-style layout, in deep graphite greys — no bright
   whites or saturated colors, so it's easy on the eyes in a dark room. */
#lobby, .picker {
  --label: #d8d8dc; --label2: rgba(200, 200, 206, 0.55); --label3: rgba(200, 200, 206, 0.3);
  --fill: rgba(99, 99, 102, 0.22); --blue: #a1a1a6;
}
#lobby { background: #0b0b0c; }
.orb { opacity: .55; filter: blur(100px); }
.orb-a { background: radial-gradient(circle, #3a3a3d 0, transparent 62%); }
.orb-b { background: radial-gradient(circle, #2a2a2d 0, transparent 62%); }
.orb-c { background: radial-gradient(circle, #464649 0, transparent 62%); opacity: .22; }
.glass { background: rgba(26, 26, 28, 0.74); border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.app-mark { background: linear-gradient(145deg, #5a5a5e, #2c2c2f); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.app-mark svg { fill: #d8d8dc; }
.btn-primary { background: #c7c7cc; color: #161618; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); }
.btn-primary:hover { background: #d4d4d8; }
.field:focus { border-color: #8e8e93; box-shadow: 0 0 0 4px rgba(142, 142, 147, 0.22); background: rgba(99, 99, 102, 0.28); }
.text-link { color: #a1a1a6; }
.text-link:hover { color: #d8d8dc; }
.opt-icon { background: linear-gradient(145deg, #4a4a4e, #2a2a2d); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.opt-icon svg { fill: #c7c7cc; }
.options { background: rgba(99, 99, 102, 0.14); }
.picker .invite-row button { color: #d8d8dc; }
#lobby .err { color: #e0857f; }

/* Dragging a file over the picker: the two rows become drop zones */
.option { position: relative; }
.picker.dragging #optChoose, .picker.dragging #optShare {
  outline: 1.5px dashed rgba(216, 216, 220, 0.28); outline-offset: -5px; border-radius: 14px; transition: outline-color .15s, background .15s; }
.picker .option.drop-target { outline: 2px dashed rgba(216, 216, 220, 0.85); background: rgba(255, 255, 255, 0.07); }
.picker .option.drop-target::after {
  content: attr(data-drop); position: absolute; inset: 6px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(28, 28, 30, 0.9); color: var(--label); font: 600 15px var(--ui); letter-spacing: -0.01em;
  pointer-events: none; animation: dropIn .15s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: scale(.97); } }

/* Room links on the start screen */
.lobby-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.lobby-links .text-link { font-size: 14px; }

/* Waiting screen: two little cinema seats with a heart floating above */
.wait-card.center-card { width: min(400px, calc(100vw - 32px)); padding: 34px 26px 22px; border-radius: 28px; text-align: center;
  animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.wait-card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--label); }
.wait-card .sub { color: var(--label2); font-size: 15px; line-height: 1.5; margin: 0; }
.wait-card .progress { margin: 12px auto; max-width: 260px; }
.wait-card .text-link { margin-top: 18px; font-size: 14px; }
.wait-art { position: relative; height: 74px; margin: 0 auto 18px; display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.wait-art::before { content: ''; position: absolute; left: 50%; top: -6px; width: 150px; height: 46px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(ellipse, rgba(216, 216, 220, 0.16), transparent 70%); animation: glow 4s ease-in-out infinite; }
.wait-art .seat { position: relative; width: 38px; height: 34px; border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, #4a4a4e, #2c2c2f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 14px rgba(0, 0, 0, 0.4); }
.wait-art .seat::after { content: ''; position: absolute; left: -4px; right: -4px; bottom: -6px; height: 12px; border-radius: 6px;
  background: #3a3a3d; }
.wait-art .heart { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-style: normal; font-size: 20px;
  color: #ff6b8b; text-shadow: 0 0 14px rgba(255, 107, 139, 0.55); animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: translateX(-50%) translateY(0) scale(1); } 15% { transform: translateX(-50%) translateY(-3px) scale(1.18); }
  30% { transform: translateX(-50%) translateY(-1px) scale(1); } 45% { transform: translateX(-50%) translateY(-4px) scale(1.12); } }
@keyframes glow { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .wait-art .heart, .wait-art::before, .wait-card.center-card { animation: none; } }

/* Streamed from Netlify: the timeline shows just the time (no picture preview, saves bandwidth) */
#thumb.time-only canvas { display: none; }
#thumb.time-only { padding: 2px; border-radius: 999px; }
#thumb.time-only span { position: static; display: block; transform: none; background: none; padding: 3px 10px; }

/* ============ Night sky: prettier opening screens ============
   A faint twinkling starfield and a soft projector beam, in the same graphite
   greys. Only on the start screen and behind the picker / waiting card; it's
   switched off completely while a movie plays. */
.sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.stage-sky { display: none; z-index: 1; }
#stage.empty .stage-sky { display: block; }
#stage.empty { background: radial-gradient(120% 80% at 50% -10%, #17171b 0%, #0b0b0d 55%, #060607 100%); }
#lobby { background: radial-gradient(120% 80% at 50% -10%, #18181c 0%, #0b0b0d 55%, #050506 100%); }
.stars { position: absolute; inset: -50px; background-repeat: repeat; }
.stars.s1 {
  background-image:
    radial-gradient(1.4px 1.4px at 23px 41px, rgba(235, 235, 245, .85), transparent 60%),
    radial-gradient(1.4px 1.4px at 141px 17px, rgba(235, 235, 245, .34), transparent 60%),
    radial-gradient(1.6px 1.6px at 87px 133px, rgba(235, 235, 245, .36), transparent 60%),
    radial-gradient(1.4px 1.4px at 199px 96px, rgba(235, 235, 245, .65), transparent 60%),
    radial-gradient(1.4px 1.4px at 61px 209px, rgba(235, 235, 245, .75), transparent 60%),
    radial-gradient(1.8px 1.8px at 233px 187px, rgba(235, 235, 245, .35), transparent 60%);
  background-size: 260px 240px; animation: twinkle 7s ease-in-out infinite; }
.stars.s2 {
  background-image:
    radial-gradient(1.4px 1.4px at 47px 77px, rgba(220, 222, 235, .35), transparent 60%),
    radial-gradient(2px 2px at 303px 41px, rgba(230, 232, 245, .85), transparent 60%),
    radial-gradient(1.4px 1.4px at 181px 251px, rgba(220, 222, 235, .34), transparent 60%),
    radial-gradient(1.6px 1.6px at 359px 199px, rgba(220, 222, 235, .75), transparent 60%);
  background-size: 410px 330px; animation: twinkle 11s ease-in-out -4s infinite; }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .35; } }
/* A projector's soft cone of light from the top */
.beam { position: absolute; left: 50%; top: -4%; width: 160vmin; height: 100vh; transform: translateX(-50%);
  background: conic-gradient(from 180deg at 50% 0%, rgba(255, 248, 236, .085) 0deg, rgba(255, 248, 236, .035) 13deg, transparent 27deg, transparent 333deg, rgba(255, 248, 236, .035) 347deg, rgba(255, 248, 236, .085) 360deg);
  -webkit-mask: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 45%, transparent 90%); mask: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 45%, transparent 90%);
  animation: flicker 6s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .82; } 50% { opacity: .95; } 53% { opacity: .86; } }
#lobby .orb { opacity: .35; }

/* Cards: a fine edge that catches the light */
.lobby-card::before, .wait-card::before, .picker.center-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .04) 35%, rgba(255, 255, 255, .015) 65%, rgba(255, 255, 255, .1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.lobby-card, .wait-card.center-card, .picker.center-card {
  background: linear-gradient(180deg, rgba(34, 34, 38, .78), rgba(22, 22, 25, .82));
  border-color: transparent;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .65), 0 0 0 .5px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05); }

/* App icon: soft moonlit glow and a slow shine */
.app-mark { position: relative; overflow: hidden; width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(150deg, #616166 0%, #3a3a3e 45%, #1f1f22 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 14px 36px rgba(0, 0, 0, .6), 0 0 70px rgba(210, 212, 230, .09), inset 0 1px 0 rgba(255, 255, 255, .18); }
.app-mark::after { content: ''; position: absolute; inset: -40%; transform: translateX(-120%) rotate(25deg);
  background: linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, .16) 50%, transparent 60%);
  animation: shine 7s ease-in-out 1.2s infinite; }
@keyframes shine { 0%, 70% { transform: translateX(-120%) rotate(25deg); } 100% { transform: translateX(120%) rotate(25deg); } }
.app-mark svg { position: relative; z-index: 1; fill: #e4e4e8; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4)); }

/* Title: soft silver */
#lobby h1, .picker h2 {
  background: linear-gradient(180deg, #f6f6f8 20%, #a9a9b0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
#lobby h1 { font-size: 34px; letter-spacing: -0.03em; }
.wait-card h2 { padding-bottom: 2px; }

/* Satin button */
.btn-primary { background: linear-gradient(180deg, #dcdce0, #b7b7bd); color: #141416;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .12); }
.btn-primary:hover { background: linear-gradient(180deg, #e6e6ea, #c4c4ca); }
.field { background: rgba(99, 99, 102, .18); border-color: rgba(255, 255, 255, .04); }
.lobby-foot .moon { display: inline-block; margin-right: 4px; color: rgba(220, 220, 228, .55); transform: translateY(1px); }

@media (prefers-reduced-motion: reduce) { .stars, .beam, .app-mark::after { animation: none; } }

/* ============ Drifting ASCII clouds (clouds.js) ============ */
/* z-index makes the layer its own stack, so clouds always stay behind the cards */
.clouds { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.cloud { position: absolute; left: 0; top: 0; margin: 0; white-space: pre;
  font: 9px/10px ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* moonlit: bright tops, soft lavender undersides */
  background: linear-gradient(180deg, #f4f2ff 0%, #d9d3f5 55%, #9c93c9 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  will-change: transform; user-select: none; }

/* Logo: projector beaming a cloud. The beam flickers softly; the cloud floats. */
.app-mark svg.logo { width: 58px; height: 44px; margin-left: 0; }
.logo .lbeam { animation: lbeam 3.2s ease-in-out infinite; }
.logo .lcloud { animation: lcloud 6s ease-in-out infinite; }
@keyframes lbeam { 0%, 100% { opacity: 1; } 47% { opacity: .75; } 50% { opacity: .95; } 53% { opacity: .8; } }
@keyframes lcloud { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.6px); } }
@media (prefers-reduced-motion: reduce) { .logo .lbeam, .logo .lcloud { animation: none; } }

/* ============ Smooth playback: nothing extra over the movie while you watch ============
   Once the controls have faded away, the blurred-glass panels are taken out of
   rendering completely (not just made invisible), so the graphics chip only
   draws the film, and the partner's pulsing dot stops repainting. They come
   back instantly when you move the mouse. */
#stage.idle .controls { visibility: hidden; transition: opacity .35s ease, transform .35s ease, visibility 0s linear .4s; }
#stage.idle .status { visibility: hidden; transition: opacity .4s, color .2s, visibility 0s linear .45s; }
#stage.idle .info-btn { visibility: hidden; transition: opacity .4s, background .15s, visibility 0s linear .45s; }
#stage.idle .status .dot { animation: none; }
.thumb:not(.show) { visibility: hidden; transition: opacity .15s, transform .15s, visibility 0s linear .15s; }
