/* ----- design tokens ---------------------------------------------------- */
:root {
  --bg-canvas: #1c1c1c;
  --bg-elev-1: #1f1f1f;       /* topbar, toolbar */
  --bg-elev-2: #232323;       /* chat sidebar, modals */
  --bg-tile: #1a1a1a;         /* tile background behind video */
  --bg-tile-empty: #2a2a2a;   /* placeholder tile */
  --bg-hover: #3a3a3a;
  --bg-pressed: #4a4a4a;

  --border-subtle: #2a2a2a;
  --border-divider: #303030;

  --text-primary: #ffffff;
  --text-secondary: #d0d0d0;
  --text-muted: #9c9c9c;
  --text-faint: #6b6b6b;

  --accent-blue: #2d8cff;       /* per brief */
  --accent-blue-hover: #1f7ce6;
  --accent-yellow: #ffe26d;     /* speaking ring */
  --accent-red: #e02828;        /* end call, mute slash, recording */
  --accent-green: #22c55e;      /* encryption */

  --radius-tile: 6px;
  --radius-pill: 4px;
  --radius-control: 6px;
  --radius-modal: 10px;

  --font-stack: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --topbar-h: 36px;
  --toolbar-h: 72px;
  --chat-w: 340px;

  --tile-pad: 6px;

  --shadow-modal: 0 24px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-pop: 0 6px 16px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font-family: inherit; color: inherit; }

/* ----- app shell -------------------------------------------------------- */
.app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--toolbar-h);
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "topbar  topbar"
    "stage   chat"
    "toolbar toolbar";
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.topbar  { grid-area: topbar; }
.stage   { grid-area: stage; position: relative; min-width: 0; min-height: 0; }
.chat    { grid-area: chat; }
.toolbar { grid-area: toolbar; }

/* ----- topbar ----------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  user-select: none;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-encryption {
  display: inline-flex; align-items: center;
  width: 22px; height: 22px;
  border-radius: 4px;
  color: var(--accent-green);
  cursor: default;
}

.topbar-recording {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-secondary);
}
.topbar-recording .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(224, 40, 40, 0.18);
  animation: rec-pulse 1.6s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.topbar-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 13px;
}
.topbar-title-meta {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.topbar-clock {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

.view-toggle {
  display: inline-flex;
  background: #2a2a2a;
  padding: 2px;
  border-radius: 6px;
  font-size: 12px;
}
.view-toggle button {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}
.view-toggle button[aria-pressed="true"] {
  background: #4a4a4a;
  color: var(--text-primary);
}

.topbar-icon-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: 4px;
  display: inline-grid; place-items: center;
  cursor: pointer;
}
.topbar-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ----- stage / grid ----------------------------------------------------- */
.stage {
  background: var(--bg-canvas);
  padding: 12px;
  overflow: hidden;
}

.grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 8px;
  /* JS sets --tile-w / --tile-h in pixels so tiles stay 16:9 and the grid
     centers cleanly inside the stage. Fallback to 1fr if JS hasn't run yet. */
  grid-template-columns: repeat(var(--grid-cols, 4), var(--tile-w, 1fr));
  grid-auto-rows: var(--tile-h, 1fr);
  align-content: center;
  justify-content: center;
}

/* speaker view: speaker takes ~75% canvas, others form a 2-col strip on the right */
.app[data-view="speaker"] .grid {
  grid-template-columns: 3fr 1fr;
  grid-template-rows: 1fr;
  gap: 10px;
  /* Override the gallery JS-set vars so the cells follow fr units, not pixels. */
  --tile-w: auto;
  --tile-h: auto;
  --grid-cols: 2;
}
.app[data-view="speaker"] .tile.speaker {
  grid-row: 1;
  grid-column: 1;
  /* Fill the entire 3fr cell, ignore the 16:9 safety net. */
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}
.app[data-view="speaker"] .grid .strip {
  grid-row: 1;
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  overflow-y: auto;
  align-content: start;
  min-height: 0;
}
.app[data-view="speaker"] .grid .strip .tile {
  /* strip tiles stay 16:9 so they look right next to the giant speaker */
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
}

/* ----- video tile ------------------------------------------------------- */
.tile {
  position: relative;
  background: var(--bg-tile);
  border-radius: var(--radius-tile);
  overflow: hidden;
  /* size comes from grid-template (var(--tile-w/h)); aspect-ratio kept
     as a safety net for the very first frame before JS recomputes. */
  aspect-ratio: 16 / 9;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 120ms ease;
}
.tile.speaking {
  outline-color: var(--accent-yellow);
}

.tile video,
.tile .tile-fallback {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--bg-tile);
}

/* mirror the user's webcam feed like Zoom does */
.tile.speaker video { transform: scaleX(-1); }

.tile-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  color: var(--text-secondary);
  text-align: center;
  padding: 12px;
}

/* attendee with camera off — flat gray with centered initials */
.tile-camera-off {
  position: absolute; inset: 0;
  display: grid;
  place-items: center;
  background: #2a2a2a;
}
.tile-camera-off .avatar {
  width: 28%;
  aspect-ratio: 1;
  max-width: 96px;
  min-width: 48px;
  border-radius: 50%;
  background: #4a4a4a;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 3.4vw, 38px);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.tile-fallback .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #4a4a4a;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.tile-fallback button {
  background: var(--accent-blue);
  color: white;
  border: 0;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}
.tile-fallback button:hover { background: var(--accent-blue-hover); }
.tile-fallback .fallback-msg { font-size: 12px; color: var(--text-muted); max-width: 180px; }

/* name + mic pill — bottom-left of tile */
.tile-meta {
  position: absolute;
  left: 8px; bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  padding: 4px 8px 4px 6px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: calc(100% - 16px);
  pointer-events: none;
}
.tile-meta .mic {
  width: 14px; height: 14px;
  display: inline-block;
  flex-shrink: 0;
}
.tile-meta .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* host badge for the speaker tile */
.tile-host-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  pointer-events: none;
}

/* per-tile reaction popup (top-left of an attendee's tile) */
.tile-reaction {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  animation: tile-reaction-pop 1800ms ease-out forwards;
  z-index: 2;
}
@keyframes tile-reaction-pop {
  0%   { transform: scale(0.4) translateY(8px); opacity: 0; }
  18%  { transform: scale(1.15) translateY(0);  opacity: 1; }
  60%  { transform: scale(1)     translateY(0);  opacity: 1; }
  100% { transform: scale(0.95)  translateY(-6px); opacity: 0; }
}

/* ----- floating reactions layer (Zoom-live stream) ---------------------- */
.reactions-layer {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.float-reaction {
  position: absolute;
  font-size: 30px;
  line-height: 1;
  /* Two parallel animations: transform glides smoothly from start to end
     with one ease-out curve (no segment boundaries → no perceived stop).
     Opacity fades in then out independently on a linear ramp. */
  animation:
    float-rise var(--anim-duration, 2800ms) cubic-bezier(0.0, 0.0, 0.4, 1) forwards,
    float-fade var(--anim-duration, 2800ms) linear forwards;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
  will-change: transform, opacity;
  transform-origin: center;
}
@keyframes float-rise {
  0%   { transform: translate3d(0, 0, 0) scale(0.75) rotate(var(--rot-start, 0deg)); }
  100% { transform: translate3d(var(--drift, 0px), var(--rise, -260px), 0) scale(var(--end-scale, 0.85)) rotate(var(--rot-end, 0deg)); }
}
@keyframes float-fade {
  /* Snappy fade-in, snappy fade-out — visible window is brief; emoji
     never lingers. Motion continues underneath the opacity changes. */
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  32%  { opacity: 0; }
  100% { opacity: 0; }
}

/* ----- bottom toolbar --------------------------------------------------- */
.toolbar {
  background: var(--bg-elev-1);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
}

.toolbar-group {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.tb-btn {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  min-width: 64px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
  margin: 8px 2px;
}
.tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tb-btn:active { background: var(--bg-pressed); }
.tb-btn[aria-pressed="true"] { color: var(--text-primary); }

.tb-btn .icon-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.tb-btn .icon-wrap svg { width: 22px; height: 22px; }
.tb-btn .caret {
  width: 10px; height: 10px;
  color: var(--text-muted);
  margin-left: 1px;
}
.tb-btn .label {
  white-space: nowrap;
}

/* end button — far right, red */
.tb-btn.tb-end {
  background: var(--accent-red);
  color: white;
  margin: 14px 0 14px 12px;
  padding: 0 18px;
  min-width: auto;
  border-radius: var(--radius-control);
  flex-direction: row;
  font-size: 13px;
  font-weight: 600;
}
.tb-btn.tb-end:hover { background: #c81f1f; color: white; }

/* mute-on (audio playing) = the icon is no longer red-slashed */
.tb-btn.tb-mute[data-mute="unmuted"] .label::after {
  content: "";
}

/* "muted slash" element baked into mic icon when applicable (handled in SVG) */

/* ----- chat sidebar ----------------------------------------------------- */
.chat {
  width: var(--chat-w);
  background: var(--bg-elev-2);
  border-left: 1px solid var(--border-divider);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  transform: translateX(0);
  transition: transform 220ms ease, width 220ms ease;
}
.chat[data-open="false"] {
  width: 0;
  border-left: 0;
  overflow: hidden;
}

.chat-header {
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-divider);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.chat-header button {
  background: transparent; border: 0;
  color: var(--text-muted);
  width: 24px; height: 24px;
  border-radius: 4px;
  display: inline-grid; place-items: center;
  cursor: pointer;
}
.chat-header button:hover { background: var(--bg-hover); color: var(--text-primary); }

.chat-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #3a3a3a transparent;
}
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 3px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: chat-in 240ms ease-out;
}
@keyframes chat-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg .meta {
  font-size: 11.5px;
  color: var(--text-muted);
}
.chat-msg .meta .from {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 4px;
}
.chat-msg .meta .to {
  color: var(--text-muted);
  font-weight: 400;
}
.chat-msg .body {
  font-size: 13.5px;
  color: var(--text-secondary);
  word-break: break-word;
}

.chat-input {
  flex: 0 0 auto;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-divider);
}
.chat-input .field {
  background: #2c2c2c;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-faint);
  font-size: 13px;
  cursor: not-allowed;
}

/* ----- modal (share) ---------------------------------------------------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
  z-index: 100;
  animation: scrim-in 160ms ease-out;
}
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(480px, calc(100vw - 32px));
  background: var(--bg-elev-2);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modal-in 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-divider);
  font-size: 15px; font-weight: 600;
}
.modal-header button {
  background: transparent; border: 0; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 4px;
  cursor: pointer; display: inline-grid; place-items: center;
}
.modal-header button:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-body label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.modal-body input[type="text"] {
  width: 100%;
  background: #2c2c2c;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.modal-body input[type="text"]:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.18);
}
.modal-preview {
  font-size: 13px; color: var(--text-secondary);
  background: #2c2c2c;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #303030;
}
.modal-preview strong { color: var(--text-primary); font-weight: 600; }

.modal-link-row {
  display: flex;
  gap: 8px;
}
.modal-link-row input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
.modal-link-row button.primary {
  background: var(--accent-blue);
  color: white;
  border: 0;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease;
}
.modal-link-row button.primary:hover { background: var(--accent-blue-hover); }
.modal-link-row button.primary[data-state="copied"] { background: #1f9d55; }

/* ----- end-meeting overlay --------------------------------------------- */
#end-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms ease;
}
#end-overlay[data-visible="true"] {
  opacity: 1;
  pointer-events: auto;
}

.end-card {
  width: min(520px, calc(100vw - 32px));
  text-align: center;
  padding: 36px 32px 32px;
  color: var(--text-primary);
  animation: end-card-in 360ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes end-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.end-eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.end-card h1 {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.end-card p {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.end-primary {
  background: var(--accent-blue);
  color: white;
  border: 0;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-width: 220px;
  transition: background 120ms ease, transform 120ms ease;
}
.end-primary:hover { background: var(--accent-blue-hover); }
.end-primary:active { transform: translateY(1px); }
.end-secondary {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 120ms ease;
}
.end-secondary:hover { color: var(--text-primary); }

/* ----- lobby (join screen) ---------------------------------------------- */
#lobby {
  position: fixed; inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 16px;
  background: var(--bg-canvas);
  overflow-y: auto;
}
#lobby[data-visible="true"] { display: grid; }
.lobby-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  width: min(960px, 100%);
}
.lobby-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-modal);
  overflow: hidden;
  background: var(--bg-tile-empty);
  outline: 2px solid var(--accent-yellow);
  outline-offset: -2px;
}
.lobby-preview video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.lobby-preview-msg {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.lobby-form { display: grid; gap: 10px; }
.lobby-eyebrow {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lobby-form h1 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; }
.lobby-sub { margin: 0 0 12px; color: var(--text-secondary); }
.lobby-form label { font-size: 12px; color: var(--text-muted); }
.lobby-form input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-control);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
}
.lobby-form input:focus { outline: none; border-color: var(--accent-blue); }
.lobby-join {
  margin-top: 6px;
  background: var(--accent-blue);
  color: white;
  border: 0;
  border-radius: var(--radius-control);
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.lobby-join:hover { background: var(--accent-blue-hover); }
.lobby-join:disabled { background: var(--bg-hover); color: var(--text-faint); cursor: default; }
@media (max-width: 720px) {
  .lobby-card { grid-template-columns: 1fr; gap: 20px; }
}

/* gentle pulse on Unmute All until someone finds the punchline */
.tb-btn.tb-unmute-all.nudge .icon-wrap { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); color: var(--accent-yellow); }
}
@media (prefers-reduced-motion: reduce) {
  .tb-btn.tb-unmute-all.nudge .icon-wrap { animation: none; color: var(--accent-yellow); }
}

/* ----- toast ------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--toolbar-h) + 16px);
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #3a3a3a;
  color: var(--text-primary);
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 150;
  box-shadow: var(--shadow-pop);
  animation: toast-in 180ms ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ----- responsive ------------------------------------------------------- */
@media (max-width: 900px) {
  .chat {
    position: fixed;
    right: 0;
    top: var(--topbar-h);
    bottom: var(--toolbar-h);
    width: 100%;
    max-width: 360px;
    border-left: 1px solid var(--border-divider);
    z-index: 50;
  }
  .chat[data-open="false"] {
    width: 100%;
    transform: translateX(100%);
  }
  .tb-btn .label { display: none; }
  .tb-btn { min-width: 48px; padding: 6px 8px; }
  .tb-btn.tb-end { padding: 0 14px; }
  .topbar-title-meta { display: none; }
}

@media (max-width: 600px) {
  :root { --toolbar-h: 64px; }
  .stage { padding: 6px; }
  .grid { gap: 4px; }
  .tile-meta { font-size: 11px; padding: 3px 6px; }
  .topbar-recording .label { display: none; }
  .view-toggle { display: none; }
}

/* ----- a11y ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}
