/* Forem Meet web — shared styles (dark theme matching the app branding). */
:root {
  --bg: #1d1b1c;
  --surface: #2a2727;
  --surface-2: #353131;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --brand: #f0552a;
  --danger: #ea4335;
  --green: #34a853;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2 { font-weight: 600; }

/* ---------------- shared bits ---------------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; }
.brand-name { font-size: 18px; font-weight: 600; }
.brand.small .brand-logo { width: 28px; height: 28px; }
.brand.small { justify-content: center; margin-bottom: 18px; }

.text-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid #4a4747;
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
.text-input:focus { border-color: var(--brand); }
.field-label { display: block; color: var(--muted); font-size: 13px; margin: 14px 0 6px; text-align: left; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid #4a4747; font-weight: 500; }
.btn-outline:hover { background: var(--surface); }
.btn.wide { width: 100%; margin-top: 18px; }
.form-error { color: #ff8a80; font-size: 13px; margin: 10px 0 0; }
.muted { color: var(--muted); }

/* ---------------- landing page ---------------- */
html { scroll-behavior: smooth; }
.home { min-height: 100%; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(29, 27, 28, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.site-header .brand { text-decoration: none; color: var(--text); }
.site-nav { display: flex; gap: 22px; flex: 1; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  transition: color .15s;
}
.site-nav a:hover { color: var(--text); }
.btn-sm { padding: 9px 18px; font-size: 14px; }
.btn-lg { padding: 15px 32px; font-size: 16px; }

.hero-split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 88px;
}
.eyebrow {
  display: inline-block;
  color: var(--brand);
  background: rgba(240, 85, 42, .12);
  border: 1px solid rgba(240, 85, 42, .3);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  padding: 5px 14px;
  margin: 0 0 18px;
}
.hero-copy h1 {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.08;
  margin: 0 0 18px;
  letter-spacing: -.02em;
}
.grad {
  background: linear-gradient(90deg, var(--brand), #ff9d6c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { color: var(--muted); font-size: 17px; line-height: 1.6; margin: 0 0 22px; max-width: 46ch; }
.trust-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trust-points li { color: var(--text); font-size: 15px; padding-left: 28px; position: relative; }
.trust-points li::before {
  content: '';
  position: absolute; left: 0; top: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: rgba(52, 168, 83, .18);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2334a853'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 11px; background-position: center; background-repeat: no-repeat;
}

.home-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  padding: 28px;
  text-align: left;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.card-title { font-size: 19px; margin: 0 0 6px; }
.home-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.09); }
.join-row { display: flex; gap: 10px; }
.join-row .code-input { flex: 1; }
.card-note { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.card-note code, .step code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: .92em;
}

/* sections */
.section { padding: 72px 0; }
.section-alt { background: #232021; }
.section-title { font-size: clamp(26px, 3.2vw, 34px); text-align: center; margin: 0 0 12px; letter-spacing: -.01em; }
.section-title.left { text-align: left; }
.section-sub { color: var(--muted); text-align: center; font-size: 16px; max-width: 60ch; margin: 0 auto 44px; line-height: 1.6; }
.section-sub.left { text-align: left; margin-left: 0; }
.center { text-align: center; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 26px 24px;
  transition: transform .18s, border-color .18s;
}
.feature-card:hover { transform: translateY(-3px); border-color: rgba(240,85,42,.4); }
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(240, 85, 42, .13);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.feature-icon svg { width: 22px; height: 22px; fill: var(--brand); }
.feature-card h3 { font-size: 16.5px; margin: 0 0 8px; }
.feature-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 48px; }
.step { text-align: center; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: 17px;
  margin-bottom: 14px;
}
.step h3 { font-size: 17px; margin: 0 0 8px; }
.step p { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0; }

.apps-section { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.store-badges { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.store-badges img { height: 48px; width: auto; display: block; }
.apps-art { display: flex; justify-content: center; }
.apps-art img {
  width: 190px; height: 190px;
  border-radius: 44px;
  box-shadow: 0 24px 80px rgba(240, 85, 42, .25);
}

.faq-section { max-width: 760px; }
.faq-section details {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-section summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 600; font-size: 15px;
  list-style: none;
  position: relative;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after {
  content: '+';
  position: absolute; right: 20px; top: 50%;
  transform: translateY(-50%);
  color: var(--brand); font-size: 20px; font-weight: 400;
}
.faq-section details[open] summary::after { content: '–'; }
.faq-section details p { color: var(--muted); font-size: 14.5px; line-height: 1.65; margin: 0; padding: 0 20px 18px; }

.cta-band {
  background: linear-gradient(135deg, rgba(240,85,42,.16), rgba(240,85,42,.04));
  border-top: 1px solid rgba(240,85,42,.2);
  border-bottom: 1px solid rgba(240,85,42,.2);
}
.cta-band .section-sub { margin-bottom: 28px; }

.site-footer { padding: 44px 0 28px; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 28px; flex-wrap: wrap;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.footer-brand p { margin: 4px 0 0; font-size: 13.5px; }
.footer-brand a { color: var(--muted); }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.footer-copy { text-align: center; color: var(--muted); font-size: 12.5px; margin: 22px 0 0; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .nav-inner { justify-content: space-between; }
  .hero-split { grid-template-columns: 1fr; gap: 40px; padding-top: 48px; padding-bottom: 56px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; gap: 36px; }
  .apps-section { grid-template-columns: 1fr; }
  .apps-art { order: -1; }
  .apps-art img { width: 130px; height: 130px; border-radius: 30px; }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
  .section { padding: 52px 0; }
  .container { padding: 0 16px; }
  .nav-inner { height: 56px; gap: 12px; }
  .brand-name { font-size: 16px; }
  .btn-sm { padding: 8px 14px; font-size: 13px; }
  .hero-split { padding-top: 32px; padding-bottom: 44px; gap: 28px; }
  .hero-sub { font-size: 15.5px; }
  .home-card { padding: 20px 18px; }
  .join-row { flex-direction: column; }
  .join-row .btn { width: 100%; }
  .store-badges img { height: 42px; }
  .footer-inner { flex-direction: column; }
  .cta-band .btn-lg { width: 100%; }
}

/* Prejoin & overlays on phones */
@media (max-width: 480px) {
  .overlay { padding: 16px; }
  .prejoin-card { max-width: none; }
  .prejoin-title { font-size: 21px; }
  .ended-actions { flex-direction: column; }
  .ended-actions .btn { width: 100%; }
}

/* ---------------- overlays (prejoin / lobby / ended) ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }
.prejoin-card { width: 100%; max-width: 420px; text-align: left; }
.prejoin-card.center { text-align: center; }
.prejoin-title { font-size: 24px; margin: 0 0 6px; text-align: center; }
.prejoin-code { color: var(--muted); text-align: center; margin: 0 0 18px; }
.preview-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--surface);
}
.prejoin-toggles { display: flex; justify-content: center; gap: 14px; margin: 14px 0 4px; }
.mic-meter {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 2px;
}
#micLevel { height: 100%; width: 0; background: var(--green); transition: width .08s linear; }
.prejoin-devices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.prejoin-devices select { font-size: 13px; padding: 9px 10px; }
.back-link { display: block; text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; text-decoration: none; }
.ended-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 18px;
  border: 4px solid var(--surface-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- meeting stage ---------------- */
.stage { position: fixed; inset: 0; display: flex; flex-direction: column; }
.stage[hidden] { display: none; }

.stage-notices {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 35;
}
.notice {
  display: inline-flex; align-items: center; gap: 8px;
  background: #4a3a12;
  border: 1px solid #6d5518;
  color: #ffd77a;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.notice[hidden] { display: none; }
.notice-btn { background: var(--brand); border-color: var(--brand); color: #fff; cursor: pointer; }
.notice-btn:hover { filter: brightness(1.08); }
.notice .icon { width: 17px; height: 17px; }

.grid {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}
.grid.n2 { grid-template-columns: repeat(2, 1fr); }
.grid.n3, .grid.n4 { grid-template-columns: repeat(2, 1fr); }
.grid.n5, .grid.n6 { grid-template-columns: repeat(3, 1fr); }
.grid.n7, .grid.n8, .grid.n9 { grid-template-columns: repeat(3, 1fr); }
.grid.featured-layout { grid-template-columns: 1fr; }

.filmstrip {
  display: flex; gap: 8px;
  padding: 0 12px 8px;
  overflow-x: auto;
  min-height: 110px;
}
.filmstrip .tile { width: 170px; flex: 0 0 auto; }

.tile {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.grid .tile { aspect-ratio: auto; }
.tile.speaking { border-color: var(--brand); }
.tile.pinned { border-color: var(--text); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, 6vw, 52px);
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4a3630, #2a2727);
}
.tile .avatar img { width: 30%; max-width: 96px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.name-tag {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,.55);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  max-width: calc(100% - 16px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.tile-badges span {
  background: rgba(0,0,0,.55);
  border-radius: 6px;
  padding: 4px 6px;
  color: #fff;
}
.tile-badges .icon { width: 14px; height: 14px; }
.tile-badges .hand-badge { color: #fdd663; }
.tile-badges .net-badge { color: #fbbc04; }
.hand-mini .icon { width: 16px; height: 16px; fill: #fdd663; }

.overflow-tile {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: var(--surface-2);
}
.overflow-num { font-size: clamp(22px, 4vw, 38px); font-weight: 600; color: var(--muted); }

/* ---------------- bottom bar ---------------- */
.bottom-bar {
  display: flex; align-items: center;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 12px;
  background: rgba(0,0,0,.35);
}
.bar-left, .bar-right { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar-right { justify-content: flex-end; }
.bar-center { display: flex; gap: 10px; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-code { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon { width: 22px; height: 22px; fill: currentColor; display: block; }
.icon-btn .icon { width: 20px; height: 20px; }
.btn .icon { width: 20px; height: 20px; }

.ctl {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  transition: background .15s;
}
.ctl:hover { background: #454040; }
/* Mic/cam toggles: red with the "off" icon variant when disabled. */
.ctl.toggle .icon-off { display: none; }
.ctl.toggle:not(.on) .icon-on { display: none; }
.ctl.toggle:not(.on) .icon-off { display: block; }
.ctl.toggle:not(.on) { background: var(--danger); }
.ctl.toggle:not(.on):hover { filter: brightness(1.1); }
.ctl.active { background: var(--brand); }
.ctl.danger { background: var(--danger); width: 60px; border-radius: 999px; }
.ctl.danger:hover { filter: brightness(1.1); }

.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .count {
  position: absolute; top: 0; right: -2px;
  font-size: 11px; color: var(--muted);
}
.badge {
  position: absolute; top: 0; right: -2px;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
}
.icon-btn.attention::after {
  content: '';
  position: absolute; top: 3px; right: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulseDot 1.2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: .6; }
}

.reactions-anchor { position: relative; }
.react-tray {
  position: absolute; bottom: 58px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 8px 10px;
  display: flex; gap: 4px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.react-tray[hidden] { display: none; }
.react-tray button { font-size: 22px; padding: 4px; border-radius: 8px; }
.react-tray button:hover { background: #4a4545; transform: scale(1.15); }

/* ---------------- floating reactions ---------------- */
.reaction-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.floating-reaction {
  position: absolute; bottom: 90px;
  display: flex; flex-direction: column; align-items: center;
  animation: floatUp 3s ease-out forwards;
}
.floating-reaction .emoji { font-size: 38px; }
.floating-reaction .who {
  font-size: 11px; color: #fff;
  background: rgba(0,0,0,.5);
  border-radius: 6px; padding: 1px 6px; margin-top: 2px;
}
@keyframes floatUp {
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(-45vh); opacity: 0; }
}

/* ---------------- side panels ---------------- */
.panel {
  position: absolute; top: 12px; right: 12px; bottom: 80px;
  width: min(340px, calc(100vw - 24px));
  background: var(--surface);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  z-index: 30;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
}
.panel[hidden] { display: none; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
}
.panel-head h2 { margin: 0; font-size: 16px; }

.chat-log { flex: 1; overflow-y: auto; padding: 8px 16px; }
.chat-entry { margin-bottom: 12px; }
.chat-head { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chat-entry.local .chat-head { color: var(--brand); }
.chat-body { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.chat-body a { color: var(--brand); word-break: break-all; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; }
.chat-form .send { color: var(--brand); }

.people-list, #knockList { overflow-y: auto; padding: 4px 12px; }
.people-list { flex: 1; }
.knock-head { font-size: 12px; color: var(--brand); font-weight: 600; padding: 6px 4px; }
.person {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid #3a3636;
}
.person-name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  border: 1px solid #4a4747;
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 11px;
  color: var(--text);
}
.chip:hover { background: var(--surface-2); }
.chip.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.danger { color: #ff8a80; border-color: #6a3a36; }
.host-tools { padding: 10px 12px 14px; }

.settings-body { padding: 4px 16px 16px; overflow-y: auto; }
.settings-body select { margin-bottom: 4px; }
.settings-body select:disabled { opacity: .5; }
.settings-hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

/* ---------------- toasts ---------------- */
.toasts {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 60;
}
.toast {
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.toast-act {
  font-weight: 600; font-size: 13px;
  color: var(--brand);
  padding: 4px 8px; border-radius: 6px;
}
.toast-act:hover { background: rgba(240,85,42,.12); }
.toast-act.primary { background: var(--brand); color: #fff; padding: 5px 12px; border-radius: 999px; }

/* ---------------- responsive: meeting ---------------- */
/* Tablets */
@media (max-width: 900px) {
  .grid.n5, .grid.n6, .grid.n7, .grid.n8, .grid.n9 { grid-template-columns: repeat(2, 1fr); }
  .bar-code { display: none; }
}

/* Phones */
@media (max-width: 640px) {
  .bar-left { display: none; }
  .bar-center { gap: 6px; }
  .bar-right { gap: 4px; flex: 0 0 auto; }
  .ctl { width: 44px; height: 44px; }
  .grid { gap: 8px; padding: 8px; }
  /* Portrait phone: single column reads best; pairs side by side in 2-up. */
  .grid.n3, .grid.n4 { grid-template-columns: 1fr; }
  .grid.n5, .grid.n6, .grid.n7, .grid.n8, .grid.n9 { grid-template-columns: repeat(2, 1fr); }
  .filmstrip .tile { width: 132px; }
  .name-tag { font-size: 11px; padding: 2px 6px; }

  /* Panels become bottom sheets. */
  .panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: min(62dvh, 480px);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 92vw; }
  .toast { flex-wrap: wrap; }
  .react-tray { padding: 6px 8px; }
  .react-tray button { font-size: 20px; }
}

/* Small phones — keep every control on one row */
@media (max-width: 420px) {
  .bottom-bar { padding-left: 8px; padding-right: 8px; gap: 6px; }
  .bar-center { gap: 4px; }
  .ctl { width: 40px; height: 40px; }
  .ctl .icon { width: 19px; height: 19px; }
  .ctl.danger { width: 50px; }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn .icon { width: 18px; height: 18px; }
}

/* Short viewports (landscape phones): let overlays scroll from the top. */
@media (max-height: 700px) {
  .overlay { align-items: flex-start; padding-top: 24px; }
  .preview-wrap { max-height: 38vh; }
  .preview-wrap video { max-height: 38vh; }
}
