/* =========================================================
   Private Cinema — rose / lavender silk theme
   ========================================================= */
:root {
  --rose-1: #f6b6b2;
  --rose-2: #f7cdc4;
  --rose-3: #eec5d5;
  --lilac: #d8c9ec;
  --ink: #8a4a5b;          /* mauve text */
  --ink-soft: #a86b7b;
  --mauve: #8c4a5e;
  --mauve-2: #6e3346;
  --gold-1: #c4955d;
  --gold-2: #ecd3a2;
  --gold-3: #b9864f;
  --card: rgba(255, 238, 242, .55);
  --card-line: rgba(255, 255, 255, .7);
  --bubble-me: linear-gradient(135deg, #c99a63, #dcb47e 55%, #c08d55);
  --shadow: 0 10px 30px rgba(140, 74, 94, .18);
  --radius: 22px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --sub-scale: 1;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(160deg, var(--rose-1) 0%, var(--rose-2) 35%, var(--rose-3) 70%, var(--lilac) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body.screen-app { overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { display: block; }

/* ---------- buttons ---------- */
.btn-mauve, .btn-gold {
  display: block; width: 100%; border: 0; border-radius: 999px;
  padding: 17px 24px; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
}
.btn-mauve {
  color: #fff6f4;
  background: linear-gradient(180deg, #9a5468, var(--mauve-2));
  box-shadow: 0 10px 22px rgba(110, 51, 70, .35), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-gold {
  color: #fffaf1;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-1) 25%, var(--gold-2) 55%, var(--gold-1) 80%, var(--gold-3));
  background-size: 200% 100%;
  box-shadow: 0 10px 24px rgba(185, 134, 79, .4), inset 0 1px 0 rgba(255,255,255,.5);
  text-shadow: 0 1px 2px rgba(120, 80, 30, .35);
  animation: shimmer 6s linear infinite;
}
.btn-mauve:active, .btn-gold:active { transform: scale(.97); }
.btn-gold:disabled { opacity: .5; filter: grayscale(.4); animation: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pill-input {
  width: 100%; border-radius: 999px; padding: 16px 24px;
  border: 1.5px solid rgba(140, 74, 94, .45);
  background: rgba(255, 245, 246, .55);
  color: var(--ink); font: 400 1.1rem var(--sans); letter-spacing: .04em;
  outline: none; transition: border-color .2s, background .2s, box-shadow .2s;
}
.pill-input::placeholder { color: #b98694; letter-spacing: .08em; }
.pill-input:focus { border-color: var(--mauve); background: rgba(255,250,250,.8); box-shadow: 0 0 0 4px rgba(140,74,94,.12); }

.icon-btn { background: none; border: 0; padding: 8px; color: var(--ink); line-height: 0; border-radius: 50%; }
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn.small svg { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(.9); }
.link { background: none; border: 0; padding: 0; color: var(--mauve); text-decoration: underline; font-size: inherit; }
.chip {
  border: 1.5px solid rgba(140,74,94,.4); background: rgba(255,245,246,.6); color: var(--ink);
  padding: 10px 22px; border-radius: 999px; font-weight: 700; letter-spacing: .03em;
}
.chip.on, .chip:active { background: var(--mauve); color: #fff; border-color: var(--mauve); }

/* =========================================================
   LOCK SCREEN
   ========================================================= */
.lock {
  position: relative; min-height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(14vh + var(--safe-t)) 28px 40px;
}
.silk {
  position: absolute; inset: -20%; z-index: -1;
  background:
    radial-gradient(60% 40% at 20% 20%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(50% 35% at 80% 35%, rgba(255,220,225,.6), transparent 65%),
    radial-gradient(70% 45% at 30% 75%, rgba(220,200,240,.7), transparent 60%),
    radial-gradient(40% 30% at 85% 85%, rgba(255,255,255,.35), transparent 70%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0) 0 60px, rgba(255,255,255,.18) 90px, rgba(255,255,255,0) 140px);
  filter: blur(18px);
  animation: silk 22s ease-in-out infinite alternate;
}
@keyframes silk {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(6deg) scale(1.08) translate(2%, -2%); }
}
.lock-title {
  margin: 0 0 9vh; text-align: center; font: 400 clamp(1rem, 4.4vw, 1.3rem) var(--sans);
  letter-spacing: .05em; color: var(--ink);
}
.lock-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.lock-icon { width: 76px; height: 95px; color: var(--mauve); margin-bottom: 4vh; filter: drop-shadow(0 4px 8px rgba(140,74,94,.15)); }
.lock-error { min-height: 1.4em; margin: 0; font-size: .95rem; text-align: center; color: var(--mauve-2); }

/* =========================================================
   WELCOME
   ========================================================= */
.welcome {
  position: relative; min-height: 100dvh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b));
  transition: opacity .5s ease, transform .5s ease;
}
.welcome.leaving { opacity: 0; transform: scale(1.04); }
.florals {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("../img/florals.svg") center / cover no-repeat;
  opacity: .9;
}
.welcome-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.photo-ring {
  width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%; padding: 10px;
  background: linear-gradient(140deg, rgba(255,255,255,.9), rgba(236,211,162,.9) 40%, rgba(196,149,93,.85) 70%, rgba(255,255,255,.8));
  box-shadow: 0 0 0 10px rgba(255,255,255,.28), 0 18px 40px rgba(140,74,94,.25);
  animation: float 6s ease-in-out infinite;
}
.photo-ring img, .photo-placeholder { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.photo-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(160deg, #f8d6d3, #ead6ee); color: var(--mauve);
}
.photo-placeholder svg { width: 38%; }
.photo-placeholder small { font-size: .72rem; opacity: .7; }
@keyframes float { 50% { transform: translateY(-6px); } }
.welcome-title {
  font: 600 clamp(2.4rem, 11vw, 3.4rem)/1.1 var(--serif); color: var(--mauve);
  margin: 34px 0 30px; text-shadow: 0 2px 0 rgba(255,255,255,.35);
}
.who { margin: -8px 0 22px; }
.who p { margin: 0 0 10px; font-size: .95rem; }
.who-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.welcome .btn-gold { max-width: 340px; }
.whoami { margin: 18px 0 0; font-size: .88rem; color: var(--ink-soft); }

/* =========================================================
   LOBBY
   ========================================================= */
.lobby {
  height: 100dvh; display: flex; flex-direction: column;
  padding: var(--safe-t) 14px calc(10px + var(--safe-b));
  animation: fadeIn .5s ease;
  position: relative;
}
.lobby::before { /* soft backdrop echoing the mockup */
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(80% 50% at 50% 0%, rgba(255,255,255,.35), transparent 70%);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 2px; flex: none; }
.topbar h1 { margin: 0; font: 400 1.35rem var(--sans); letter-spacing: .06em; color: var(--ink); }
.heart-btn { color: var(--mauve); }
.heart-btn:active svg { transform: scale(1.25); }
.partner-bar {
  flex: none; align-self: center; display: flex; align-items: center; gap: 7px;
  font-size: .78rem; color: var(--ink-soft); padding: 2px 12px 8px;
}
.partner-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9a6ad; }
.partner-bar.online .dot { background: #6cc28d; box-shadow: 0 0 0 3px rgba(108,194,141,.25); }

/* ---------- player ---------- */
.player {
  position: relative; flex: none; width: 100%; aspect-ratio: 16 / 9; max-height: 52dvh;
  border-radius: var(--radius); overflow: hidden; background: #1d1216;
  box-shadow: var(--shadow); isolation: isolate;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-empty, .player-wait {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: #f6d9de; text-align: center; padding: 20px; z-index: 2;
}
.player-empty { background: linear-gradient(160deg, #4a2733, #2a1820); }
.player-empty svg { width: 46px; color: #e8a8b5; animation: beat 1.6s ease-in-out infinite; }
.player-empty p { margin: 0; font-size: .95rem; opacity: .85; }
@keyframes beat { 15% { transform: scale(1.15); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } 60% { transform: scale(1); } }
.player-wait { background: rgba(20, 10, 14, .35); pointer-events: none; }
.player-wait p { margin: 0; font-size: .9rem; text-shadow: 0 1px 3px #000; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--gold-2); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player[data-state="empty"] .controls, .player[data-state="empty"] .big-play { display: none; }

.big-play {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; z-index: 3;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; transition: opacity .25s, transform .2s;
}
.big-play svg { width: 40px; margin-left: 5px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.player.is-playing .big-play, .player.hide-ui .big-play { opacity: 0; pointer-events: none; transform: scale(.8); }

.tap-join {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  border: 0; border-radius: 999px; padding: 14px 24px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #9a5468, var(--mauve-2)); box-shadow: 0 8px 22px rgba(0,0,0,.35);
}

/* controls */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 26px 14px 8px;
  background: linear-gradient(180deg, transparent, rgba(20, 8, 12, .72));
  transition: opacity .3s ease, transform .3s ease;
}
.player.hide-ui .controls { opacity: 0; transform: translateY(10px); pointer-events: none; }
.player.hide-ui { cursor: none; }
.seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek-track { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,.28); }
.seek-buf, .seek-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; width: 0; }
.seek-buf { background: rgba(255,255,255,.35); }
.seek-fill { background: linear-gradient(90deg, var(--gold-1), var(--gold-2)); }
.seek-knob {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--gold-2); box-shadow: 0 0 0 4px rgba(236,211,162,.3), 0 2px 6px rgba(0,0,0,.4);
}
.seek.dragging .seek-knob { transform: scale(1.3); }
.seek-tip {
  position: absolute; bottom: 24px; transform: translateX(-50%); padding: 3px 8px; border-radius: 8px;
  background: rgba(0,0,0,.7); color: #fff; font-size: .75rem; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.seek.dragging .seek-tip { opacity: 1; }
.ctrl-row { display: flex; align-items: center; gap: 4px; color: #fff; }
.cbtn { background: none; border: 0; padding: 6px; color: #fff; line-height: 0; border-radius: 8px; }
.cbtn svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.cbtn:active { background: rgba(255,255,255,.15); }
.cbtn.active { color: var(--gold-2); }
.time { font-size: .78rem; margin-left: 4px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.spacer { flex: 1; }
.i-pause, .player.is-playing .i-play { display: none; }
.player.is-playing .i-pause { display: block; }
.i-mute, .player.muted .i-vol { display: none; }
.player.muted .i-mute { display: block; }
.i-fsx, .player.fs .i-fs { display: none; }
.player.fs .i-fsx { display: block; }
#fsChatBtn { display: none; }
.player.fs #fsChatBtn { display: block; }

/* subtitles */
.subs {
  position: absolute; left: 5%; right: 5%; bottom: 9%; z-index: 3; text-align: center; pointer-events: none;
  font: 700 calc(clamp(13px, 3.6vw, 22px) * var(--sub-scale))/1.3 var(--sans);
  color: #fff; transition: bottom .3s ease;
}
.player:not(.hide-ui) .subs { bottom: calc(9% + 46px); }
.subs span { display: inline; padding: .08em .35em; white-space: pre-line; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.subs[data-style="shadow"] span { text-shadow: 0 0 4px #000, 0 0 2px #000, 1px 1px 2px #000, -1px -1px 2px #000; }
.subs[data-style="box"] span { background: rgba(0,0,0,.62); border-radius: 6px; line-height: 1.5; }
.subs[data-style="soft"] span { color: #ffe9ec; text-shadow: 0 0 6px rgba(110,51,70,.95), 0 2px 3px #000; }
.player.fs .subs { font-size: calc(clamp(18px, 3.2vw, 40px) * var(--sub-scale)); }

/* toasts + floating reactions */
.toasts { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 5; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.toast {
  max-width: min(80%, 520px); padding: 8px 14px; border-radius: 16px; font-size: .9rem; color: #fff;
  background: rgba(60, 25, 36, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,.3); animation: toastIn .3s ease; overflow-wrap: anywhere;
}
.toast b { color: var(--gold-2); font-weight: 700; margin-right: 6px; }
.toast.sys { background: rgba(255,255,255,.2); font-size: .8rem; }
.toast.out { animation: toastOut .4s ease forwards; }
.player.fs .toast { font-size: 1.05rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
.floaters { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.floater { position: absolute; bottom: 12%; font-size: 34px; animation: floatUp 2.8s ease-out forwards; will-change: transform, opacity; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  12% { opacity: 1; transform: translate(0, -20px) scale(1.15); }
  100% { opacity: 0; transform: translate(var(--dx, 0), -260px) scale(1); }
}

/* settings menu */
.menu {
  position: absolute; right: 10px; bottom: 58px; z-index: 7; width: min(300px, calc(100% - 20px)); max-height: calc(100% - 70px); overflow: auto;
  padding: 12px; border-radius: 16px; color: #fff;
  background: rgba(45, 20, 28, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: .85rem; animation: toastIn .2s ease;
}
.menu-sec { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.menu-sec + .menu-sec { border-top: 1px solid rgba(255,255,255,.1); }
.menu-sec > span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .stepper button, .menu-link {
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff;
  padding: 6px 11px; border-radius: 999px; font-size: .8rem;
}
.seg button.on { background: var(--gold-2); color: #4a2a1a; border-color: var(--gold-2); font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
.menu-link { text-align: left; border-radius: 10px; }
.menu-sec:last-child { flex-direction: row; flex-wrap: wrap; }

/* fullscreen chat */
.fs-chat {
  position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 7;
  width: min(520px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px;
}
.fs-reacts { display: flex; gap: 6px; justify-content: center; }
.fs-reacts button { border: 0; background: rgba(255,255,255,.18); border-radius: 50%; width: 42px; height: 42px; font-size: 22px; backdrop-filter: blur(6px); }
.fs-row { display: flex; gap: 8px; }
.fs-row input {
  flex: 1; min-width: 0; border: 0; border-radius: 999px; padding: 12px 18px; font: 1rem var(--sans);
  background: rgba(255,245,246,.92); color: var(--ink); outline: none;
}
.fs-row button { border: 0; border-radius: 50%; width: 46px; background: var(--bubble-me); color: #fff; font-size: 1.1rem; }

/* fullscreen (native + pseudo for iPhone) */
.player.fs { border-radius: 0; max-height: none; aspect-ratio: auto; }
.player:fullscreen { width: 100vw; height: 100vh; }
.player:-webkit-full-screen { width: 100vw; height: 100vh; }
.player.pseudo-fs {
  position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100dvh; max-height: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.no-scroll { overflow: hidden; }

/* ---------- panels ---------- */
.panels {
  flex: 1; min-height: 0; margin-top: 14px;
  display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr); gap: 12px;
}
.card {
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: var(--shadow);
}
.card-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; flex: none; }
.card-head h2 { margin: 0; font: 400 1.35rem var(--sans); color: var(--ink); }
.head-actions { display: flex; align-items: center; }
.heart-mini { color: var(--mauve); }
#refreshList { color: var(--gold-1); }
#chatMenuBtn { font-size: .8rem; letter-spacing: -1px; padding: 8px 6px; }
.mini-menu {
  position: absolute; right: 8px; top: 44px; z-index: 10; min-width: 150px; padding: 6px;
  background: #fff7f7; border-radius: 14px; box-shadow: 0 10px 26px rgba(110,51,70,.25);
  display: flex; flex-direction: column;
}
.mini-menu button, .mini-menu a { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.mini-menu button:active, .mini-menu a:active { background: rgba(140,74,94,.1); }

/* playlist */
.movies { list-style: none; margin: 0; padding: 0 0 8px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.movies .muted { padding: 12px 16px; font-size: .88rem; color: var(--ink-soft); line-height: 1.45; }
.movies .muted code { font-size: .78rem; background: rgba(255,255,255,.5); padding: 1px 5px; border-radius: 5px; }
.movie {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer;
  transition: background .2s;
}
.movie:active { background: rgba(255,255,255,.35); }
.movie.current { background: rgba(255,255,255,.5); }
.movie .poster {
  flex: none; width: 52px; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden;
  background: linear-gradient(160deg, #a5566c, #5b2c3b); box-shadow: 0 3px 8px rgba(80,30,45,.3);
  display: flex; align-items: center; justify-content: center; color: #ffd9df; font: 600 1.3rem var(--serif);
}
.movie .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.movie .meta { min-width: 0; flex: 1; }
.movie .title { font-size: .98rem; line-height: 1.2; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.movie .tags { font-size: .66rem; color: var(--ink-soft); margin-top: 3px; letter-spacing: .04em; }
.movie .bar { margin-top: 6px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.75); overflow: hidden; }
.movie .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mauve), var(--ink-soft)); border-radius: 4px; }
.movie.current .title::before { content: "▶ "; color: var(--gold-1); font-size: .8em; }

/* chat */
.messages { flex: 1; overflow-y: auto; padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; animation: toastIn .25s ease; }
.msg .av {
  flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #c77d8f, #8c4a5e); color: #fff; font-size: .8rem; font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
}
.msg .av img { width: 100%; height: 100%; object-fit: cover; }
.msg .bubble {
  padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: #fffafa; color: #4e2a35;
  font-size: .9rem; line-height: 1.3; box-shadow: 0 3px 10px rgba(140,74,94,.12); overflow-wrap: anywhere; white-space: pre-wrap;
}
.msg .bubble time { display: block; font-size: .64rem; opacity: .55; margin-top: 3px; }
.msg.me { justify-content: flex-end; }
.msg.me .bubble { background: var(--bubble-me); color: #fff; border-radius: 16px 16px 4px 16px; text-shadow: 0 1px 1px rgba(110,70,30,.25); }
.msg.emoji-only .bubble { background: none !important; box-shadow: none; font-size: 2rem; padding: 0 4px; }
.day-sep { align-self: center; font-size: .68rem; color: var(--ink-soft); background: rgba(255,255,255,.45); padding: 2px 10px; border-radius: 999px; }
.chat-empty { margin: auto; text-align: center; font-size: .85rem; color: var(--ink-soft); padding: 10px; }

.composer { position: relative; flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 10px; }
.input-wrap {
  flex: 1; min-width: 0; display: flex; align-items: center; background: #fff; border-radius: 999px;
  border: 1px solid rgba(140,74,94,.15); box-shadow: inset 0 1px 3px rgba(140,74,94,.08); height: 44px;
}
.emoji-btn { flex: none; border: 0; background: none; padding: 0 4px 0 9px; color: var(--gold-1); line-height: 0; }
.emoji-btn svg { width: 26px; height: 26px; }
.input-wrap input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: 16px var(--sans); color: var(--ink); padding: 0 12px 0 4px; height: 100%; }
.voice-wrap { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.voice-wrap small { font-size: .62rem; color: var(--ink-soft); white-space: nowrap; }
.mic-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; color: #fff; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--gold-2), var(--gold-1) 50%, var(--gold-3)); box-shadow: 0 5px 14px rgba(185,134,79,.4);
}
.mic-btn svg { width: 24px; height: 24px; }
.mic-btn.on { background: linear-gradient(160deg, #b8667b, var(--mauve-2)); animation: pulse 1.6s ease-out infinite; }
.mic-btn.connected { background: linear-gradient(160deg, #6cc28d, #3e9363); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(140,74,94,.5); } 100% { box-shadow: 0 0 0 14px rgba(140,74,94,0); } }
.emoji-pop {
  position: absolute; left: 8px; right: 8px; bottom: 62px; z-index: 10;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px;
  max-height: 210px; overflow-y: auto; padding: 8px; border-radius: 16px;
  background: #fff8f8; box-shadow: 0 10px 28px rgba(110,51,70,.25); animation: toastIn .2s ease;
}
.emoji-pop button { border: 0; background: none; font-size: 24px; padding: 4px 0; border-radius: 8px; }
.emoji-pop button:active { background: rgba(140,74,94,.1); }

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .lobby { padding-left: 10px; padding-right: 10px; }
  .panels { gap: 8px; }
  .card-head h2 { font-size: 1.15rem; }
  .movie { padding: 7px 8px; gap: 8px; }
  .movie .poster { width: 42px; }
  .movie .title { font-size: .86rem; }
  .voice-wrap small { display: none; }
  .composer { padding: 6px; }
  .msg .av { width: 24px; height: 24px; font-size: .7rem; }
}
/* very narrow phones: stack playlist above chat, chat gets more room */
@media (max-width: 340px) {
  .panels { grid-template-columns: 1fr; grid-template-rows: minmax(0, .8fr) minmax(0, 1.2fr); }
}

/* phone in landscape: video left, panels right */
@media (orientation: landscape) and (max-height: 560px) {
  .lobby { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar { grid-column: 1 / -1; padding: 4px 0 0; }
  .partner-bar { grid-column: 1 / -1; padding-bottom: 4px; }
  .player { grid-column: 1; grid-row: 3; max-height: none; height: 100%; aspect-ratio: auto; align-self: stretch; }
  .panels { grid-column: 2; grid-row: 3; margin: 0; grid-template-columns: 1fr; grid-template-rows: minmax(0, .8fr) minmax(0, 1.2fr); }
}

/* tablets / desktop */
@media (min-width: 900px) and (min-height: 561px) {
  .lobby { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto minmax(0, 1fr); column-gap: 22px; padding: 10px 28px 22px; max-width: 1600px; margin: 0 auto; }
  .topbar, .partner-bar { grid-column: 1 / -1; }
  .player { grid-column: 1; grid-row: 3; max-height: calc(100dvh - 120px); align-self: start; }
  .panels { grid-column: 2; grid-row: 3; margin: 0; grid-template-columns: 1fr; grid-template-rows: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; }
  .topbar h1 { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
