/* H&S Movie Night: a deep-violet screening room. Laptop: movie + cameras side by side.
   Phone: movie on top, cameras below, and a fullscreen mode with cameras floating in the corner. */
:root {
  --bg: #120C1C; --panel: #1D1430; --line: #34264D; --fg: #F1EAFB; --muted: #A796C2;
  --accent: #B98CFF; --accent-ink: #1E0B3D; --glow: rgba(185, 140, 255, .28);
  --good: #7FD4A0; --bad: #FF8A9A;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font: 15px/1.5 var(--body); -webkit-tap-highlight-color: transparent; }
body.no-scroll { overflow: hidden; }
h1, h2 { font-family: var(--display); margin: 0; text-wrap: balance; }
.mark { color: var(--accent); }
.btn {
  font: 600 15px var(--body); border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.off { background: var(--bad); color: #2a0610; border-color: var(--bad); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); }

/* ---------- landing ---------- */
.landing { min-height: 100%; display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(ellipse at 50% 110%, var(--glow), transparent 60%), var(--bg); }
.landing .box { max-width: 520px; display: flex; flex-direction: column; gap: 18px; }
.landing h1 { font-size: clamp(44px, 9vw, 72px); letter-spacing: -.02em; line-height: 1; }
.landing h1 small { display: block; font-size: .32em; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-family: var(--body); font-weight: 600; margin-top: 10px; }
.landing { grid-template-columns: minmax(0, 520px) auto; gap: clamp(32px, 6vw, 96px); justify-content: center; }
.snap {
  margin: 0; width: clamp(240px, 30vw, 380px); padding: 12px 12px 44px; background: #F6F0FF; border-radius: 4px;
  transform: rotate(3deg); box-shadow: 0 30px 70px -20px var(--glow), 0 10px 30px rgba(0,0,0,.5);
}
.snap img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; }
@media (max-width: 760px) {
  .landing { grid-template-columns: minmax(0, 1fr); }
  .snap { order: -1; width: min(70vw, 280px); justify-self: center; }
}
.landing p { margin: 0; font-size: 17px; max-width: 40ch; }
.landing .lede { font-family: var(--display); font-weight: 500; font-size: clamp(22px, 3vw, 28px); color: var(--fg); line-height: 1.2; }
.landing ul { margin: 0; padding-left: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* ---------- room ---------- */
.room { min-height: 100%; height: 100%; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 22px; letter-spacing: -.01em; }
.top h1 small { font: 600 11px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-left: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.good { color: var(--fg); } .pill.good .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.pill.bad .dot { background: var(--bad); }

.stage {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px;
  padding: 16px 20px; background: var(--bg); position: relative;
}
.screen { position: relative; background: #000; border-radius: 12px; overflow: hidden; min-height: 0;
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px -30px var(--glow); }
.screen video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 24px; z-index: 2;
  background: radial-gradient(ellipse at 50% 120%, var(--glow), transparent 60%), #0B0712;
}
.overlay h2 { font-weight: 500; font-size: clamp(20px, 2.6vw, 28px); }
.overlay p { margin: 0; color: var(--muted); max-width: 46ch; }

.cams { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.cam { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam.me video { transform: scaleX(-1); }
.cam .tag { position: absolute; left: 8px; bottom: 8px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(18,12,28,.75); }
.cam .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 10px; }

.fs-exit { display: none; }
.rotate-tip { display: none; }

/* ---------- theater / fullscreen: movie fills the screen, cameras float ---------- */
.stage:fullscreen, .stage.theater {
  display: block; padding: 0; background: #000;
}
.stage.theater { position: fixed; inset: 0; z-index: 100; }
.stage:fullscreen .screen, .stage.theater .screen { position: absolute; inset: 0; border-radius: 0; box-shadow: none; }
.stage:fullscreen .cams, .stage.theater .cams {
  position: absolute; z-index: 5; flex-direction: column; gap: 8px; opacity: .95;
  right: max(14px, env(safe-area-inset-right)); bottom: max(80px, env(safe-area-inset-bottom));
  width: clamp(110px, 18vw, 220px);
}
.stage:fullscreen .cam.me, .stage.theater .cam.me { width: 60%; align-self: flex-end; }
.stage:fullscreen .cam .tag, .stage.theater .cam .tag { display: none; }
.stage:fullscreen .fs-exit, .stage.theater .fs-exit {
  display: grid; place-items: center; position: absolute; z-index: 6;
  top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(18,12,28,.7); color: var(--fg); font-size: 20px;
}
@media (orientation: portrait) {
  .stage.theater .rotate-tip {
    display: block; position: absolute; z-index: 6; left: 50%; transform: translateX(-50%);
    top: max(14px, env(safe-area-inset-top)); padding: 6px 12px; border-radius: 999px;
    background: rgba(18,12,28,.75); color: var(--fg); font-size: 13px; white-space: nowrap;
  }
}

.bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
}
.bar .spacer { flex: 1; }
.invite { display: flex; align-items: center; gap: 8px; min-width: 0; }
.invite input { font: 13px var(--body); background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 300px; max-width: 40vw; }
.vol { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.vol input { accent-color: var(--accent); }
.tip { font-size: 13px; color: var(--muted); }

/* ---------- phones (her side) ---------- */
@media (max-width: 760px) {
  .top { padding-block: 10px; }
  .top h1 { font-size: 20px; }
  .stage { display: flex; flex-direction: column; gap: 10px; padding: 10px max(10px, env(safe-area-inset-left)); flex: none; }
  .screen { aspect-ratio: 16 / 9; width: 100%; border-radius: 10px; }
  .overlay { padding: 16px; gap: 8px; }
  .overlay h2 { font-size: 18px; }
  .overlay p { font-size: 13px; }
  .cams { flex-direction: row; gap: 10px; }
  .cam { flex: 1; aspect-ratio: 3 / 4; }
  .bar { gap: 8px; }
  .bar .btn { flex: 1; padding: 13px 10px; font-size: 14px; }
  .bar .spacer, .bar .tip { display: none; }
  .vol { width: 100%; order: 5; }
  .vol input { flex: 1; }
  .invite { width: 100%; }
  .invite input { flex: 1; max-width: none; }
}
/* phone held sideways: go straight to a movie-first layout */
@media (max-height: 500px) and (orientation: landscape) {
  .top, .bar { display: none; }
  .room { height: 100%; }
  .stage { display: block; padding: 0; height: 100%; background: #000; }
  .stage .screen { position: absolute; inset: 0; border-radius: 0; aspect-ratio: auto; box-shadow: none; }
  .stage .cams { position: absolute; z-index: 5; flex-direction: column; gap: 8px; width: 120px;
    right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
  .stage .cam { aspect-ratio: 4 / 3; flex: none; }
  .stage .cam .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
