:root {
  --bg: #07080d;
  --bg-2: #0c0e16;
  --elev: #12151f;
  --elev-2: #181c29;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f5fb;
  --muted: #9aa3bb;
  --faint: #6d768e;
  --accent: #7aa7ff;
  --accent-2: #8b7dff;
  --accent-3: #5eead4;
  --danger: #ff5a6f;
  --danger-2: #c42b40;
  --ok: #3ee0a4;
  --warn: #ffc14a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-orbs::before,
.bg-orbs::after,
.bg-orbs span {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}
.bg-orbs::before {
  width: 520px; height: 520px;
  background: #3b5bdb;
  top: -180px; left: -120px;
  animation: drift 18s ease-in-out infinite;
}
.bg-orbs::after {
  width: 460px; height: 460px;
  background: #6d28d9;
  right: -140px; top: 20%;
  animation: drift 22s ease-in-out infinite reverse;
}
.bg-orbs span {
  width: 380px; height: 380px;
  background: #0f766e;
  bottom: -160px; left: 30%;
  animation: drift 26s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 28px); }
}

.topnav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 7vw;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 18px;
  text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px;
}
.nav-links {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--text); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-user { color: var(--muted); font-size: 14px; font-weight: 650; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-tabs button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
}
.auth-tabs button.on { background: var(--elev-2); color: var(--text); }
.account-page {
  position: relative;
  z-index: 1;
  padding: 12px 7vw 64px;
}
.account-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.account-head h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 42px;
  margin: 0 0 6px;
}
.account-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-card {
  margin-bottom: 14px;
  padding: 18px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.profile-card h2 { margin: 0 0 8px; font-size: 18px; }
.profile-card .lede { margin: 0 0 12px; font-size: 14px; }
.form-error { min-height: 1.2em; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.meeting-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 16px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.meeting-row-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.meeting-row h2 { margin: 0 0 4px; font-size: 18px; }
.meeting-row p { margin: 0; color: var(--muted); font-size: 13px; }
.meeting-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meeting-notes {
  margin-top: 14px;
  max-height: 320px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.meeting-notes p { margin: 0 0 8px; }
.note-line {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text);
}
.note-line time { color: var(--faint); font-size: 12px; padding-top: 2px; }
.note-line b { font-weight: 700; }
.note-kind {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  padding: 28px 7vw 72px;
  min-height: calc(100vh - 88px);
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 5.4vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 18px 0 16px;
}
.hero h1 em {
  font-style: italic;
  background: linear-gradient(120deg, #93c5fd, #c4b5fd 45%, #5eead4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 540px;
  margin: 0 0 28px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 650;
  font-size: 14px;
  color: var(--text);
  background: var(--elev-2);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn-primary {
  background: linear-gradient(180deg, #8fb4ff, #6b8cff);
  color: #08101f;
  border: 0;
  box-shadow: 0 10px 30px rgba(110, 168, 255, 0.28);
}
.btn-primary:hover { background: linear-gradient(180deg, #a3c2ff, #7b99ff); }
.btn-danger {
  background: var(--danger);
  color: white;
  border: 0;
}
.btn-ghost { background: transparent; }
.btn-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  background: #2b3040;
  border: 0;
  color: white;
}
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon.off {
  background: var(--danger);
}
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-icon.danger {
  width: 58px; height: 58px;
  background: var(--danger-2);
}
.btn-end {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--danger-2);
  color: white;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.btn-icon.active {
  background: #3b4258;
  box-shadow: 0 0 0 2px var(--accent);
}

.join-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: min(100%, 340px);
}
.join-box input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 14px;
  padding: 8px 0;
  outline: none;
  letter-spacing: 0.04em;
}
.join-box input::placeholder { color: var(--faint); }

.mock {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.mock-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px 12px;
  color: var(--muted);
  font-size: 12px;
}
.dots { display: flex; gap: 6px; }
.dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff5f57; display: block;
}
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.mock-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  min-height: 340px;
}
.tile-demo {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #1a2030;
  min-height: 160px;
  display: grid;
  place-items: center;
}
.tile-demo.tall { grid-row: span 2; min-height: 330px; }
.avatar-lg {
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 28px;
  color: white;
}
.tile-label {
  position: absolute;
  left: 10px; bottom: 10px;
  background: rgba(0,0,0,0.45);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
}
.mock-bar {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pill {
  width: 42px; height: 42px; border-radius: 50%;
  background: #2a3144;
}
.pill.red { background: var(--danger-2); width: 48px; }

.section {
  position: relative;
  z-index: 1;
  padding: 24px 7vw 88px;
}
.section h2 {
  font-family: var(--display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
}
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.icon-bubble {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(122, 167, 255, 0.12);
  color: var(--accent);
  margin-bottom: 14px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.step-n {
  font-family: var(--display);
  font-size: 42px;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.site-footer {
  position: relative;
  z-index: 1;
  padding: 18px 7vw 32px;
  color: var(--faint);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(10px);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: min(440px, 100%);
  background: var(--elev);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 8px; font-size: 22px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.hidden { display: none !important; }

/* Meeting */
.meeting-page { height: 100%; overflow: hidden; }
.lobby, .room {
  position: relative;
  z-index: 1;
  height: 100%;
}
.lobby {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  padding: 28px 6vw;
  align-items: center;
}
.preview-card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.preview-video-wrap {
  position: relative;
  aspect-ratio: 16/10;
  background: #10131c;
}
.preview-video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #10131c;
}
.preview-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.preview-avatar span {
  width: 120px; height: 120px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 40px; font-weight: 700;
}
.preview-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--elev-2);
}
.meter {
  position: absolute;
  left: 16px; bottom: 16px;
  display: flex; gap: 3px; align-items: flex-end; height: 22px;
}
.meter i {
  width: 4px; background: var(--ok); border-radius: 2px;
  opacity: 0.25;
}
.meter i.on { opacity: 1; }

.lobby-panel h1 {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
.lobby-panel .sub { color: var(--muted); margin: 0 0 22px; }
.ready-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hint { color: var(--faint); font-size: 13px; margin-top: 12px; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; }

.room {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100%;
  height: 100dvh;
  background: #0a0c12;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,12,18,0.86);
  backdrop-filter: blur(12px);
}
.top-left, .top-right { display: flex; align-items: center; gap: 12px; }
.meeting-title { font-weight: 650; font-size: 14px; }
.chip {
  font-size: 12px;
  color: var(--muted);
  background: var(--elev-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--elev-2); color: var(--text); }
.icon-btn.has-badge { position: relative; }
.badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #08101f;
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
  padding: 0 4px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  height: 100%;
  min-height: 0;
}
.workspace.with-panel { grid-template-columns: 1fr 360px; }
.stage {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 8px 8px calc(96px + env(safe-area-inset-bottom, 0px));
  align-content: stretch;
  justify-content: stretch;
  justify-items: stretch;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-auto-rows: minmax(0, 1fr);
}
.stage.count-1 { grid-template-columns: minmax(0, 1fr); }
.stage.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage.count-3, .stage.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage.count-5, .stage.count-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage.count-7, .stage.count-8, .stage.count-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage.count-10, .stage.count-11, .stage.count-12 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stage.spotlight {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
}
.stage.spotlight .tile.featured { min-height: 0; }
.filmstrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
}
.filmstrip .tile { width: 180px; height: 112px; flex: 0 0 auto; }

.tile {
  position: relative;
  background: #151924;
  border-radius: 16px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 0 1px var(--line);
}
.tile.speaking { box-shadow: inset 0 0 0 2px var(--ok); }
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0e1118;
}
.tile[data-id="self"]:not(.screen) video,
#previewVideo { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; background: #05070c; transform: none; }
.mic-dot svg { width: 12px; height: 12px; display: block; }
.tile .avatar-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #243049, #12151d 70%);
}
.tile .avatar-fallback b {
  width: 86px; height: 86px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px; color: white;
}
.tile .meta {
  position: absolute;
  left: 10px; bottom: 10px;
  display: flex; gap: 6px; align-items: center;
  background: rgba(0,0,0,0.48);
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
  max-width: calc(100% - 20px);
}
.tile .meta .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mic-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: #2a3142;
}
.mic-dot.muted { background: var(--danger); }
.hand-flag {
  position: absolute; top: 10px; right: 10px;
  font-size: 22px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.4));
}
.host-tag {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  background: rgba(139,125,255,.9); color: #120c24;
  padding: 3px 7px; border-radius: 6px;
}
.empty-room {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  text-align: center;
  color: var(--muted);
  padding: 16px 18px;
  background: rgba(16, 19, 27, 0.88);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: min(420px, 92%);
  backdrop-filter: blur(10px);
}
.empty-room h2 {
  color: var(--text);
  font-family: var(--display);
  font-weight: 500;
  margin: 0 0 6px;
  font-size: 22px;
}
.empty-room p { margin: 0 0 12px; font-size: 13px; }

.sidepanel {
  border-left: 1px solid var(--line);
  background: #10131b;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.side-head h3 { margin: 0; font-size: 15px; }
.tabs { display: flex; gap: 6px; }
.tabs button {
  background: transparent; border: 0; color: var(--muted);
  padding: 6px 10px; border-radius: 8px; font-weight: 650; font-size: 13px;
}
.tabs button.on { background: var(--elev-2); color: var(--text); }
.people-list, .chat-log {
  flex: 1; overflow: auto; padding: 10px 12px;
}
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px;
}
.person:hover { background: rgba(255,255,255,0.03); }
.person .av {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 13px;
}
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 13px; }
.person .who span { color: var(--faint); font-size: 11px; }
.person-actions { display: flex; gap: 4px; }
.chat-item { margin-bottom: 12px; }
.chat-item .who { font-size: 12px; color: var(--accent); font-weight: 700; }
.chat-item .when { color: var(--faint); font-weight: 500; margin-left: 6px; }
.chat-item .body { font-size: 14px; line-height: 1.45; margin-top: 3px; word-break: break-word; }
.chat-form {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1; background: var(--elev-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 10px 12px;
}

.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(7, 8, 13, 0.92) 36%);
  pointer-events: none;
}
.tb-center {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(24, 28, 40, 0.94);
  border: 1px solid var(--line-strong);
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tb-left, .tb-right { pointer-events: auto; }
.tb-left, .tb-right { display: flex; gap: 8px; align-items: center; }
.tb-right { justify-content: flex-end; }
.tb-left { color: var(--muted); font-size: 13px; }

.reactions-pop {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: var(--elev);
  border: 1px solid var(--line-strong);
  padding: 8px;
  border-radius: 999px;
  z-index: 8;
}
.reactions-pop button {
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--elev-2); font-size: 20px;
}
.fly {
  position: absolute;
  bottom: 110px;
  left: 50%;
  font-size: 28px;
  animation: fly 1.6s ease-out forwards;
  pointer-events: none;
  z-index: 9;
}
@keyframes fly {
  0% { transform: translate(-50%, 0) scale(.7); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), -140px) scale(1.2); opacity: 0; }
}

.unmute-fab {
  position: fixed;
  left: 50%;
  bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  background: #ffc14a;
  color: #1a1403;
  box-shadow: var(--shadow);
}
.captions {
  position: fixed;
  left: 50%;
  bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(720px, 90%);
  background: rgba(0,0,0,0.62);
  padding: 8px 14px;
  border-radius: 12px;
  text-align: center;
  z-index: 7;
  font-size: 16px;
}
.captions b { color: var(--accent); margin-right: 8px; }

.menu {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--elev);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 6px;
  min-width: 220px;
  z-index: 10;
  box-shadow: var(--shadow);
}
.menu button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.menu button:hover { background: var(--elev-2); }

#toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--elev);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  min-width: 240px;
  opacity: 0;
  transform: translateY(-8px);
  transition: .25s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { border-color: rgba(255,90,111,.4); }

.ended {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}
.ended h1 { font-family: var(--display); font-weight: 500; font-size: 42px; margin-bottom: 8px; }

.kbd {
  font-size: 11px;
  border: 1px solid var(--line-strong);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero, .lobby { grid-template-columns: 1fr; padding: 20px; }
  .nav-links { display: none; }
  .features, .steps { grid-template-columns: 1fr; }
  .workspace.with-panel { grid-template-columns: 1fr; }
  .sidepanel {
    position: absolute; inset: 56px 0 110px auto;
    width: min(100%, 360px);
    border-left: 1px solid var(--line);
    z-index: 6;
  }
  .hero h1 { font-size: 40px; }
  .toolbar { grid-template-columns: 1fr; justify-items: center; }
  .tb-left, .tb-right { display: none; }
  .tb-center {
    width: calc(100% - 16px);
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 22px;
  }
  .tb-center .btn-icon { flex: 0 0 auto; width: 46px; height: 46px; }
  .btn-end { height: 46px; padding: 0 12px; font-size: 12px; }
  .stage,
  .stage.count-1,
  .stage.count-2,
  .stage.count-3,
  .stage.count-4,
  .stage.count-5,
  .stage.count-6,
  .stage.count-7,
  .stage.count-8,
  .stage.count-9,
  .stage.count-10,
  .stage.count-11,
  .stage.count-12 {
    grid-template-columns: minmax(0, 1fr);
  }
  .lobby { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
