/* Drop In — layouts: phone (≤760px), tablet (761–1099px), desktop (≥1100px). */
:root {
  --yellow: #FFD60A;
  --yellow-soft: #FFE45C;
  --ink: #1B1B1B;
  --ink-soft: #4A4A4A;
  --muted: rgba(0, 0, 0, .5);
  --white: #FFFFFF;
  --stage-bg: #0E0E0E;
  --tile-bg: #262626;
  --red: #FF4B4B;
  --green: #2ECC71;
  --radius: 18px;
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Safe areas: notch / Dynamic Island / home indicator */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--yellow);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  /* Feel like an app, not a web page */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
body.in-app { background: var(--stage-bg); }
input, textarea, .selectable { -webkit-user-select: text; user-select: text; }
button, a, input { touch-action: manipulation; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
svg { display: block; }

/* ---------- Landing ---------- */
.landing {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(var(--sat) + 24px) calc(var(--sar) + 20px) calc(var(--sab) + 24px) calc(var(--sal) + 20px);
  background:
    radial-gradient(circle at 12% 16%, rgba(255,255,255,.35) 0 90px, transparent 91px),
    radial-gradient(circle at 90% 82%, rgba(255,255,255,.25) 0 130px, transparent 131px),
    var(--yellow);
}
.landing-inner { width: 100%; max-width: 380px; margin: auto; text-align: center; }
.landing-logo {
  width: 76px; height: 76px; border-radius: 20px;
  box-shadow: 0 8px 0 rgba(0,0,0,.08);
  animation: bob 2.4s ease-in-out infinite;
}
.wordmark { font-size: 42px; font-weight: 900; letter-spacing: -1px; margin: 10px 0 2px; }
.tagline { font-size: 17px; font-weight: 700; color: var(--ink-soft); margin: 0 0 22px; }

.preview {
  position: relative;
  width: clamp(130px, 24vh, 190px); aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink);
  border: 6px solid var(--white);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 52px; }
.media-note { min-height: 20px; font-size: 14px; font-weight: 700; color: var(--ink-soft); margin: 10px 0 16px; }

.join-form { display: flex; flex-direction: column; gap: 10px; }
.join-form input {
  font: inherit; font-size: 17px; font-weight: 800;
  text-align: center;
  padding: 15px 20px;
  border: 0; border-radius: 999px;
  background: var(--white); color: var(--ink);
  outline: none;
  box-shadow: 0 3px 0 rgba(0,0,0,.08);
}
.join-form input::placeholder { color: #9A9A9A; }
.join-form input:focus { box-shadow: 0 0 0 3px var(--ink); }
.btn-primary {
  font-size: 18px; font-weight: 900;
  padding: 15px 20px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--white);
  box-shadow: 0 5px 0 #000;
  transition: transform .08s, box-shadow .08s, opacity .15s;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.btn-primary:disabled { opacity: .6; }
.room-note { font-weight: 800; margin-top: 14px; }

.auth-tabs {
  display: flex; gap: 4px;
  background: rgba(0,0,0,.08);
  border-radius: 999px; padding: 4px;
  margin-bottom: 12px;
}
.auth-tabs button {
  flex: 1; border: 0; border-radius: 999px;
  padding: 10px; font-weight: 900; font-size: 16px;
  background: none; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.auth-tabs button[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.form-hint { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 0; }
.form-hint:empty { display: none; }
.form-error {
  margin: 0; padding: 10px 14px;
  border-radius: 14px;
  background: var(--white); color: #C62828;
  font-weight: 800; font-size: 14px;
}
#offline-note { margin-top: 14px; }
.welcome { display: flex; flex-direction: column; gap: 8px; }
.welcome-line { font-size: 22px; font-weight: 800; margin: 0 0 12px; }
.link-btn {
  border: 0; background: none; padding: 8px;
  font-weight: 800; font-size: 14px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px;
}

.install-hint {
  display: flex; align-items: center; gap: 12px;
  margin-top: 22px; padding: 12px 14px;
  background: var(--white);
  border-radius: 20px;
  text-align: left;
  box-shadow: 0 4px 0 rgba(0,0,0,.07);
}
.install-hint img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.install-text { flex: 1; display: flex; flex-direction: column; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.install-text b { color: var(--ink); font-weight: 900; font-size: 15px; }
.install-hint button {
  border: 0; border-radius: 999px; padding: 9px 16px;
  font-weight: 900; background: var(--ink); color: var(--white);
}

/* ---------- App shell ---------- */
.app {
  position: fixed; inset: 0;
  display: flex;
  background: var(--stage-bg);
}
.stage-wrap { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: absolute; left: 0; right: 0; z-index: 5;
  top: calc(var(--sat) + 12px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 calc(var(--sar) + 16px) 0 calc(var(--sal) + 16px);
  pointer-events: none;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 17px;
  background: var(--yellow); color: var(--ink);
  padding: 5px 14px 5px 5px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.room-status {
  font-weight: 800; font-size: 13px;
  background: rgba(0,0,0,.55); color: var(--white);
  padding: 7px 13px; border-radius: 999px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.room-status:empty { display: none; }

/* ---------- Video grid ---------- */
.stage-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage-area.alone .tile.me .label { display: none; }
.stage {
  flex: 1; min-height: 0;
  display: grid;
  gap: 6px;
  padding: 6px calc(var(--sar) + 6px) 6px calc(var(--sal) + 6px);
  padding-top: calc(var(--sat) + 6px);
}
.tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tile-bg);
  min-width: 0; min-height: 0;
  animation: pop-in .35s cubic-bezier(.2,1.4,.4,1);
  transition: box-shadow .15s;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.me video { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: none; place-items: center; }
.tile .avatar span {
  width: clamp(64px, 26%, 140px); aspect-ratio: 1;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: clamp(28px, 5vmin, 60px); font-weight: 900; color: var(--white);
  box-shadow: 0 0 0 6px rgba(255,255,255,.1);
}
.tile.no-video video { visibility: hidden; }
.tile.no-video .avatar { display: grid; }
.tile.speaking { box-shadow: inset 0 0 0 4px var(--yellow); }
.tile .label {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 20px);
  font-weight: 900; font-size: 14px;
  color: var(--white);
  background: rgba(0,0,0,.45);
  padding: 5px 12px; border-radius: 999px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tile .label .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .label .muted { display: none; width: 16px; height: 16px; fill: var(--red); flex: none; }
.tile.no-audio .label .muted { display: block; }
.tile .connecting {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, 70px);
  font-size: 13px; font-weight: 800; color: var(--white);
  background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 999px;
  display: none; white-space: nowrap;
}
.tile.is-connecting .connecting { display: block; }

/* ---------- Alone card ---------- */
.alone-card {
  position: absolute; z-index: 4;
  left: 50%; bottom: calc(var(--sab) + 100px);
  transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 14px;
  padding: 16px;
  background: var(--yellow);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  animation: rise .4s cubic-bezier(.2,1.2,.4,1);
}
.alone-wave { font-size: 38px; animation: wave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
.alone-text { display: flex; flex-direction: column; min-width: 0; }
.alone-text b { font-size: 18px; font-weight: 900; }
.alone-text span { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.alone-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.alone-actions .pill { flex: 1; }

.pill {
  border: 0; border-radius: 999px;
  padding: 12px 18px;
  font-weight: 900; font-size: 15px;
  background: var(--white); color: var(--ink);
  transition: transform .1s;
}
.pill:active { transform: scale(.96); }
.pill.dark { background: var(--ink); color: var(--white); }
.pill.danger { background: var(--red); color: var(--white); }

/* ---------- Connection status ---------- */
.net-status {
  position: absolute; z-index: 6;
  top: calc(var(--sat) + 60px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 14px;
  background: var(--white); color: var(--ink);
  padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,.15); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}

/* ---------- Controls ---------- */
.controls {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 18px);
  transform: translateX(-50%);
  z-index: 5;
  display: flex; gap: 10px;
  padding: 10px;
  background: rgba(20,20,20,.72);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.ctl {
  position: relative;
  width: 54px; height: 54px;
  border: 0; border-radius: 50%;
  background: var(--white);
  display: grid; place-items: center;
  transition: transform .1s, background .15s;
}
.ctl:active { transform: scale(.9); }
.ctl svg { width: 24px; height: 24px; fill: var(--ink); }
.ctl .off { display: none; }
.ctl.is-off .on { display: none; }
.ctl.is-off .off { display: block; }
#btn-mic.is-off, #btn-cam.is-off { background: var(--red); }
#btn-mic.is-off svg, #btn-cam.is-off svg { fill: var(--white); }
#btn-lock:not(.is-off) { background: var(--yellow); }
.ctl-leave { background: #2B2B2B; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.ctl-leave svg { fill: var(--white); }
.badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  background: var(--yellow); color: var(--ink);
  font-size: 12px; font-weight: 900;
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px #141414;
}
@media (hover: hover) {
  .ctl:hover { transform: scale(1.07); }
  .ctl:active { transform: scale(.94); }
  .wave-btn:hover { background: var(--yellow); }
}

/* ---------- Sidebar ("In the house") ---------- */
.sidebar {
  width: 360px; flex: none;
  background: var(--yellow);
  display: flex; flex-direction: column;
  min-height: 0;
  transition: margin-right .28s ease, transform .3s cubic-bezier(.2,.9,.3,1);
}
.sheet-grab { display: none; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--sat) + 18px) 18px 6px;
}
.sidebar-head h2 { font-size: 26px; font-weight: 900; margin: 0; }
.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.08);
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--ink); }
.house {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 14px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.house-empty { text-align: center; padding: 22px 10px 8px; font-weight: 700; color: var(--ink-soft); }
.house-empty .big { font-size: 40px; display: block; margin-bottom: 6px; }
.section-label { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 6px 4px -4px; }

.room-card {
  background: var(--white);
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 4px 0 rgba(0,0,0,.07);
}
.room-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.room-card-title { font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.join-btn {
  flex: none;
  border: 0; border-radius: 999px;
  padding: 9px 18px;
  font-weight: 900; font-size: 14px;
  background: var(--ink); color: var(--white);
}
.join-btn:disabled { background: #D6D6D6; color: #8A8A8A; cursor: not-allowed; }
.person { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
.dot {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; color: var(--white);
  position: relative;
  background: #BDBDBD;
}
.dot.online::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 2px var(--white);
}
.dot.offline { filter: grayscale(.7); opacity: .6; }
.person .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .sub { font-size: 12.5px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .actions { display: flex; gap: 6px; flex: none; }
.others { font-size: 13px; font-weight: 800; color: var(--muted); padding: 2px 4px 0; }
.small-btn {
  min-height: 36px;
  border: 0; border-radius: 999px;
  padding: 0 14px;
  font-weight: 900; font-size: 13px;
  background: var(--ink); color: var(--white);
}
.small-btn.ghost { background: rgba(0,0,0,.07); color: var(--ink); min-width: 36px; padding: 0 10px; }
.wave-btn {
  min-width: 40px; min-height: 36px;
  border: 0; background: rgba(0,0,0,.06);
  border-radius: 999px; padding: 0 10px;
  font-size: 18px; line-height: 1;
}
.wave-btn:disabled { opacity: .4; cursor: default; }
.friend-list { background: rgba(255,255,255,.55); border-radius: 20px; padding: 4px 12px; }
.muted-note { font-weight: 700; color: var(--muted); font-size: 14px; padding: 10px 4px; }

.add-friend { display: flex; gap: 8px; }
.add-friend input {
  flex: 1; min-width: 0;
  font: inherit; font-weight: 800; font-size: 16px; /* 16px stops iOS zooming in */
  padding: 12px 16px;
  border: 0; border-radius: 999px;
  background: var(--white); color: var(--ink);
  outline: none;
}
.add-friend input:focus { box-shadow: 0 0 0 3px var(--ink); }
.add-friend button {
  border: 0; border-radius: 999px; padding: 0 20px;
  font-weight: 900; background: var(--ink); color: var(--white);
}

.me-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px calc(var(--sab) + 12px);
  border-top: 2px solid rgba(0,0,0,.08);
}
.me-names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.me-names b { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-names span { font-size: 13px; font-weight: 700; color: rgba(0,0,0,.55); }

.scrim {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}

/* ---------- Dialog ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.5);
  animation: fade-in .15s;
}
.modal-card {
  width: min(360px, 100%);
  background: var(--white);
  border-radius: 24px;
  padding: 22px 20px 18px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: pop-in .25s cubic-bezier(.2,1.3,.4,1);
}
.modal-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.modal-card p { margin: 0 0 18px; font-weight: 700; color: var(--ink-soft); word-break: break-word; -webkit-user-select: text; user-select: text; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .pill { flex: 1; }
.modal-actions .pill:not(.dark):not(.danger) { background: rgba(0,0,0,.07); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 50;
  top: calc(var(--sat) + 10px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(420px, calc(100% - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--white); color: var(--ink);
  font-weight: 800; font-size: 15px;
  padding: 12px 12px 12px 18px;
  min-height: 52px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: drop .35s cubic-bezier(.2,1.4,.4,1);
}
.toast .msg { flex: 1; }
.toast button {
  flex: none;
  border: 0; border-radius: 999px; padding: 8px 14px;
  background: var(--yellow); color: var(--ink); font-weight: 900;
}
.toast.bye { animation: fade .3s forwards; }

.wave-burst {
  position: fixed; left: 50%; top: 45%;
  font-size: 140px; z-index: 40; pointer-events: none;
  animation: burst 1.6s ease-out forwards;
}

/* ---------- Animations ---------- */
@keyframes pop-in { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes drop { from { transform: translateY(-20px) scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { to { opacity: 0; transform: translateY(-10px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(18deg); } 20%, 40% { transform: rotate(-10deg); } }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(0); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.1) rotate(18deg); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1) rotate(-12deg); }
  60% { transform: translate(-50%, -50%) scale(1) rotate(14deg); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(.9) rotate(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Desktop (≥1100px): sidebar docked beside the video ---------- */
@media (min-width: 1100px) {
  .app:not(.sidebar-open) .sidebar { margin-right: -360px; }
  #btn-close-sidebar { display: none; }
  .scrim { display: none; }
}

/* ---------- Tablet & phone (<1100px): sidebar slides over the video ---------- */
@media (max-width: 1099px) {
  .sidebar {
    position: fixed; z-index: 30;
    top: 0; right: 0; bottom: 0;
    width: min(400px, 88vw);
    padding-right: var(--sar);
    transform: translateX(105%);
    box-shadow: -10px 0 40px rgba(0,0,0,.3);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .scrim { opacity: 1; pointer-events: auto; }
}

/* ---------- Phone (≤760px) ---------- */
@media (max-width: 760px) {
  :root { --radius: 16px; }
  .brand span { display: none; }
  .brand { padding: 5px; }
  .stage { gap: 4px; padding: calc(var(--sat) + 4px) calc(var(--sar) + 4px) 4px calc(var(--sal) + 4px); }
  .tile .label { font-size: 13px; left: 8px; bottom: 8px; }

  /* Controls become a bar under the video instead of floating over it */
  .controls {
    position: relative; left: auto; bottom: auto; transform: none;
    justify-content: space-evenly;
    gap: 4px;
    border-radius: 0;
    padding: 10px calc(var(--sar) + 8px) calc(var(--sab) + 10px) calc(var(--sal) + 8px);
    background: var(--stage-bg);
    box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .ctl { width: clamp(44px, 13vw, 54px); height: clamp(44px, 13vw, 54px); }
  .ctl svg { width: 22px; height: 22px; }
  .alone-card { bottom: 16px; }

  /* Sidebar becomes a bottom sheet */
  .sidebar {
    top: calc(var(--sat) + 28px); left: 0; right: 0; bottom: 0;
    width: auto; padding-right: 0;
    border-radius: 26px 26px 0 0;
    transform: translateY(105%);
    box-shadow: 0 -10px 40px rgba(0,0,0,.35);
  }
  .sheet-grab { display: grid; place-items: center; padding: 10px 0 0; touch-action: none; }
  .sheet-grab span { width: 42px; height: 5px; border-radius: 99px; background: rgba(0,0,0,.2); }
  .sidebar-head { padding: 6px 18px 6px; touch-action: none; }
  .sidebar.dragging { transition: none; }
}

/* Short screens (phones in landscape) */
@media (max-height: 500px) {
  .alone-card { grid-template-columns: auto 1fr auto; bottom: calc(var(--sab) + 90px); padding: 10px 14px; }
  .alone-actions { grid-column: auto; }
  .alone-wave { font-size: 28px; }
  .controls { padding-top: 6px; padding-bottom: calc(var(--sab) + 6px); }
  .ctl { width: 44px; height: 44px; }
  .landing-logo { display: none; }
  /* Floating controls would cover name tags at the bottom, so tags move to the top */
  .brand { display: none; }
  .tile .label { bottom: auto; top: 8px; }
}

/* ---------- Sign-up legal line ---------- */
.legal { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 4px 6px 0; line-height: 1.4; }
.legal a { color: var(--ink); font-weight: 900; }

/* ---------- Tile buttons: mute for me / more ---------- */
.tile-actions {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: flex; gap: 6px;
}
.tile-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tile-btn svg { width: 20px; height: 20px; fill: var(--white); }
.tile-btn .off { display: none; }
.tile-btn.is-off { background: var(--red); }
.tile-btn.is-off .on { display: none; }
.tile-btn.is-off .off { display: block; }
.tile .label .muted-tag { display: none; } /* the red speaker button shows it instead */
.tile.fit video { object-fit: contain; background: #000; }
@media (hover: hover) {
  .tile .tile-actions { opacity: 0; transition: opacity .15s; }
  .tile:hover .tile-actions, .tile.muted-by-me .tile-actions { opacity: 1; }
}

#btn-games.active { background: var(--yellow); }
.room-card .playing { display: block; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.small-btn.more { display: grid; place-items: center; }
.small-btn.more svg { width: 18px; height: 18px; fill: var(--ink); }

/* ---------- Choice list (games, person menu, settings) ---------- */
.picker { place-items: center; }
.picker-card {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  overflow-y: auto;
  background: var(--white);
  border-radius: 24px;
  padding: 20px 16px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: pop-in .25s cubic-bezier(.2,1.3,.4,1);
}
.picker-card h3 { margin: 0 4px 2px; font-size: 20px; font-weight: 900; }
.picker-card > p { margin: 0 4px 12px; font-weight: 700; color: var(--ink-soft); font-size: 14px; }
.picker-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 12px; }
.picker-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  border: 0; border-radius: 16px;
  padding: 12px 14px;
  background: rgba(0,0,0,.05);
}
.picker-item:active { background: rgba(0,0,0,.1); }
.picker-item:disabled { opacity: .45; }
.picker-item.danger b { color: #D32F2F; }
.pi-icon { font-size: 24px; width: 32px; text-align: center; flex: none; }
.pi-text { display: flex; flex-direction: column; min-width: 0; }
.pi-text b { font-weight: 900; font-size: 16px; }
.pi-text span { font-weight: 700; font-size: 13px; color: var(--ink-soft); }
#picker-cancel { width: 100%; background: rgba(0,0,0,.07); }
#modal-input {
  width: 100%; margin: -6px 0 16px;
  font: inherit; font-size: 16px; font-weight: 800;
  padding: 12px 16px; border: 0; border-radius: 14px;
  background: rgba(0,0,0,.06); color: var(--ink); outline: none;
}
#modal-input:focus { box-shadow: 0 0 0 3px var(--ink); }

/* ---------- Games: layout ---------- */
.play-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.play-area.gaming .stage-area { flex: 0 0 36%; }
.game-panel {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--yellow);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  animation: rise-panel .35s cubic-bezier(.2,1,.3,1);
}
@keyframes rise-panel { from { transform: translateY(40px); opacity: 0; } }
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  .stage-wrap:has(.play-area.gaming) .room-status { display: none; } /* would sit on the game's ✕ */
  .play-area.gaming { flex-direction: row; }
  .play-area.gaming .stage-area { flex: 1 1 45%; }
  .game-panel { flex: 1 1 55%; max-width: 760px; margin: calc(var(--sat) + 6px) calc(var(--sar) + 6px) 6px 0; border-radius: 22px; }
}
@media (min-width: 761px) {
  .game-panel .game-body { padding-bottom: 100px; } /* room for the floating buttons */
}
@media (max-height: 500px) {
  .play-area.gaming { flex-direction: row; }
  .play-area.gaming .stage-area { flex: 1 1 40%; }
  .game-panel { border-radius: 18px; margin: 6px 6px 6px 0; }
}

.game-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px 18px; }
.game-title { font-weight: 900; font-size: 18px; }
.game-sub { flex: 1; font-size: 13px; font-weight: 800; color: var(--muted); }
.game-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(0,0,0,.08); font-weight: 900; }
.game-timebar { height: 5px; margin: 0 16px; border-radius: 99px; background: rgba(0,0,0,.1); overflow: hidden; }
.game-timebar span { display: block; height: 100%; width: 100%; background: var(--ink); border-radius: 99px; transition: background .3s; }
.game-timebar span.low { background: var(--red); }
.game-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px 16px; }
.secs { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 900; }
.row { display: flex; gap: 8px; }
.row .pill { flex: 1; }

.scores { list-style: none; margin: 12px 0 0; padding: 6px 12px; background: rgba(255,255,255,.55); border-radius: 18px; }
.scores li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-weight: 800; }
.scores li.me { color: var(--ink); }
.scores li .medal { width: 26px; text-align: center; }
.scores li .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores li .who::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); margin-right: 8px; }
.scores li .plus { color: #1B8E3E; font-weight: 900; font-size: 13px; }
.scores li b { font-variant-numeric: tabular-nums; }

.game-over { text-align: center; padding: 10px 4px; }
.game-over .big-emoji { font-size: 56px; animation: bob 2s ease-in-out infinite; }
.game-over h3 { font-size: 26px; font-weight: 900; margin: 6px 0 4px; }
.game-over .row { margin-top: 16px; }

/* ---------- Color Clash ---------- */
.clash { display: flex; flex-direction: column; gap: 10px; }
.clash-players { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  display: flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.55);
  font-weight: 800; font-size: 13px;
  border: 2px solid transparent;
}
.chip.turn { background: var(--white); border-color: var(--ink); }
.chip .dot { width: 10px; height: 10px; }
.chip .count { color: var(--ink-soft); }
.clash-table { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 0; }
.current-color {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px; border-radius: 14px;
  color: var(--white); font-weight: 900; font-size: 13px;
}
.current-color .dir { font-size: 20px; line-height: 1; }
.clash-log { text-align: center; font-weight: 800; font-size: 14px; color: var(--ink-soft); min-height: 20px; }
.clash-status { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; font-size: 16px; }
.clash-status.mine { color: var(--ink); animation: pulse 1.2s ease-in-out infinite; }
.clash-status .secs { margin-left: 0; background: var(--ink); color: var(--white); border-radius: 99px; padding: 1px 9px; font-size: 13px; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.hand { display: flex; padding: 16px 8px 8px 26px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hand .card { margin-left: -18px; flex: none; }
.pass-btn { align-self: center; min-width: 140px; }

.card {
  position: relative;
  width: 62px; height: 94px; flex: none;
  border: 3px solid var(--white); border-radius: 12px;
  display: grid; place-items: center;
  color: var(--white); font-weight: 900;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
  transition: transform .15s;
  padding: 0;
}
.card:disabled { cursor: default; }
.card .corner { position: absolute; top: 3px; left: 6px; font-size: 13px; }
.card .oval {
  width: 46px; height: 72px; border-radius: 50%;
  background: var(--white);
  transform: rotate(24deg);
  display: grid; place-items: center;
}
.card .oval span { transform: rotate(-24deg); font-size: 22px; }
.card.playable { transform: translateY(-12px); box-shadow: 0 0 0 3px var(--ink), 0 8px 16px rgba(0,0,0,.3); }
.card.playable:active { transform: translateY(-16px) scale(.97); }
.c-r { background: #E53935; }
.c-y { background: #F9C80E; }
.c-g { background: #43A047; }
.c-b { background: #1E88E5; }
.c-w { background: #1B1B1B; }
.card.c-r .oval span { color: #E53935; }
.card.c-y .oval span { color: #C79A00; }
.card.c-g .oval span { color: #43A047; }
.card.c-b .oval span { color: #1E88E5; }
.card.c-w .oval { background: conic-gradient(#E53935 0 25%, #F9C80E 0 50%, #43A047 0 75%, #1E88E5 0); }
.card.c-w .oval span { color: var(--white); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.card.back { background: #1B1B1B; }
.card.back .oval { background: var(--yellow); }
.card.back .oval span { color: var(--ink); font-size: 15px; }
.card.back:not(:disabled) { box-shadow: 0 0 0 3px var(--ink), 0 8px 16px rgba(0,0,0,.3); animation: pulse 1.4s ease-in-out infinite; }
.color-pick { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(0,0,0,.35); }
.game-panel { position: relative; }
.color-pick-card { background: var(--white); border-radius: 22px; padding: 18px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.color-pick-card h4 { margin: 0 0 12px; font-size: 18px; font-weight: 900; }
.color-grid { display: grid; grid-template-columns: repeat(2, 72px); gap: 10px; }
.swatch { width: 72px; height: 72px; border: 0; border-radius: 18px; }

/* ---------- Trivia ---------- */
.trivia-meta, .qd-who, .fh-meta { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.question { font-size: clamp(19px, 2.6vw, 24px); font-weight: 900; margin: 8px 0 14px; line-height: 1.25; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 10px 12px;
  border: 0; border-radius: 16px;
  color: var(--white); font-weight: 900; font-size: 15px; text-align: left;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
  transition: opacity .2s, transform .1s;
}
.choice:active { transform: translateY(2px); }
.choice .letter { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.25); font-size: 13px; }
.ch-0 { background: #E53935; }
.ch-1 { background: #1E88E5; }
.ch-2 { background: #FB8C00; }
.ch-3 { background: #43A047; }
.choice.dim { opacity: .35; }
.choice.picked { box-shadow: 0 0 0 4px var(--ink); }
.choice.right { box-shadow: 0 0 0 4px var(--ink); }
.choice.right::after { content: '✓'; margin-left: auto; font-size: 20px; }
.choice.wrong { opacity: .6; }
.choice.wrong::after { content: '✗'; margin-left: auto; font-size: 20px; }
.trivia-foot { text-align: center; font-weight: 800; margin-top: 12px; color: var(--ink-soft); }
.trivia-foot .good { color: #1B8E3E; font-size: 17px; }
.trivia-foot .bad { color: #C62828; font-size: 17px; }

/* ---------- Quick Draw ---------- */
.quickdraw { display: flex; flex-direction: column; gap: 8px; }
.qd-word { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.qd-word .mask { letter-spacing: 2px; font-weight: 900; font-size: 22px; }
.qd-board { display: flex; justify-content: center; }
.qd-canvas {
  width: 100%; max-width: 560px; aspect-ratio: 4 / 3;
  background: var(--white); border-radius: 18px;
  box-shadow: 0 4px 0 rgba(0,0,0,.1);
}
.qd-canvas.can-draw { touch-action: none; cursor: crosshair; box-shadow: 0 0 0 3px var(--ink); }
.qd-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.qd-tools .inks { display: flex; gap: 6px; flex-wrap: wrap; }
.ink { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); }
.ink.on { box-shadow: 0 0 0 3px var(--ink); }
.qd-guess { display: flex; gap: 8px; }
.qd-guess input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 16px; font-weight: 800;
  padding: 11px 16px; border: 0; border-radius: 999px;
  background: var(--white); color: var(--ink); outline: none;
}
.qd-guess input:focus { box-shadow: 0 0 0 3px var(--ink); }
.qd-feed { display: flex; flex-direction: column; gap: 3px; font-size: 14px; font-weight: 700; }
.qd-feed .ok { color: #1B8E3E; }
.qd-feed .sys { color: var(--ink); font-weight: 900; }

/* ---------- Forehead ---------- */
.forehead { display: flex; flex-direction: column; gap: 10px; }
.fh-card {
  background: var(--white); border-radius: 22px;
  padding: 18px 16px; text-align: center;
  font-weight: 800; color: var(--ink-soft);
  box-shadow: 0 6px 0 rgba(0,0,0,.08);
}
.fh-card .row { margin-top: 14px; }
.fh-word { font-size: clamp(30px, 6vw, 44px); font-weight: 900; color: var(--ink); line-height: 1.1; margin-bottom: 6px; text-transform: capitalize; }
.fh-big { font-size: 56px; line-height: 1.1; }
.fh-sub { font-size: 14px; }
.fh-got { margin-top: 10px; font-weight: 900; color: var(--ink); }
.fh-yes { background: #43A047; color: var(--white); }
.fh-skip { background: rgba(0,0,0,.08); }
.fh-card.secret { background: var(--ink); color: rgba(255,255,255,.8); }
.fh-card.secret .fh-got { color: var(--yellow); }
.fh-recent { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.fh-recent span { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.55); }
.fh-recent .ok { color: #1B8E3E; }
.fh-recent .no { color: #9E9E9E; text-decoration: line-through; }

@media (max-width: 760px) {
  .picker { place-items: end stretch; padding: 0; }
  .picker-card { width: 100%; max-height: 85vh; border-radius: 26px 26px 0 0; padding-bottom: calc(var(--sab) + 16px); animation: sheet-up .3s cubic-bezier(.2,.9,.3,1); }
  .card { width: 56px; height: 84px; }
  .card .oval { width: 40px; height: 64px; }
  .card .oval span { font-size: 19px; }
  .choice { min-height: 56px; font-size: 14px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
