/* ═══════════════════════════════════════════════════════════════════
   Shared Mobile Live-Session Styles  (scoped under `.slm`)
   Loaded alongside /css/session.css in both apps. Visible only at
   (max-width: 768px) — above that, the desktop #screen-live takes over.
   Keep ALL selectors prefixed with `.slm ` so nothing leaks to desktop.
   ═══════════════════════════════════════════════════════════════════ */

/* Visibility rules:
   - Desktop widths (>768px): always hide mobile, desktop #screen-live handles itself.
   - Mobile widths (<=768px): show mobile ONLY when desktop #screen-live is the
     active screen (navigateTo toggles `.active` on screens). Keep mobile hidden
     on all other screens so it doesn't overlay landing/studio/auth.
   The `!important` on `display: flex` is required to beat activateScreen()'s
   inline `style.display = 'none'` (set on every .screen element during nav). */
#screen-live-mobile { display: none !important; }
@media (max-width: 768px) {
  #screen-live.active { display: none !important; }
  body:has(#screen-live.active) #screen-live-mobile { display: flex !important; flex-direction: column; }
}

.slm {
  --slm-bg: #ffffff;
  --slm-surface: #fafafa;
  --slm-ink: #0f0f0e;
  --slm-ink-2: #1e1e1c;
  --slm-ink-soft: #52525b;
  --slm-ink-faint: #a1a1aa;
  --slm-line: #e4e4e7;
  --slm-line-soft: rgba(15, 15, 14, 0.05);
  --slm-terra: #d97757;

  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--slm-bg);
  color: var(--slm-ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Google Material body medium: 14px floor for readable body copy; bump to
     16px on this root so nested components can step down to 14px and still
     meet Material minimums. */
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Horizontal scroll lock — the whole live-session screen scrolls only on
     the Y axis, matching native mobile app behavior in a browser. Children
     are clipped to the viewport width; the chat feed is the one vertical
     scroller. touch-action: pan-y on .slm-main prevents horizontal gestures
     from being hijacked by iOS back-swipe / elastic overscroll. */
  overflow: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  max-width: 100vw;
}
.slm *, .slm *::before, .slm *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
}

/* ── HEADER ──────────────────────────────────
   Two mutually-exclusive states. `.slm-hdr-full` = default expanded header.
   `.slm-hdr-mini` = a small floating wave pill, pinned top-center. When
   `.slm-hdr.collapsed` is set:
     - .slm-hdr-full is hidden
     - .slm-hdr is pulled out of the flex flow (position:absolute) so the
       chat feed expands to full screen and answers scroll UNDER the pill
     - .slm-hdr-mini becomes visible as the floating control
   The chevron between mic and ⋮ toggles; the pill itself also toggles. */
.slm-hdr {
  padding: calc(env(safe-area-inset-top, 0) + 10px) 14px 6px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border-bottom: 1px solid var(--slm-line);
  flex-shrink: 0;
  z-index: 50;
}
.slm-hdr-mini { display: none; }

/* Collapsed: header detaches from flex flow so .slm-main takes the full
   screen and AI answers scroll under the floating mini pill.
   Explicitly unset the blur + border from the base .slm-hdr so nothing
   visible remains behind the pill contents. */
.slm-hdr.collapsed {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  pointer-events: none;  /* children opt back in */
}
.slm-hdr.collapsed .slm-hdr-full { display: none; }
/* BUG-D FIX (2026-05): Wrap the listening waves + timer + mic into a single
 * rounded pill card matching the desktop topbar treatment so the elements
 * no longer "float" without a unifying background. Frosted glass surface
 * with subtle shadow + 1px hairline border. */
.slm-hdr.collapsed .slm-hdr-mini {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  border: 1px solid rgba(14, 13, 12, 0.06);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(14, 13, 12, 0.08), 0 1px 2px rgba(14, 13, 12, 0.04);
  color: var(--slm-ink-2);
}
/* Tap zone 1: waves + timer — expands the header */
.slm-hdr-mini-expand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.15s, transform 0.15s;
}
.slm-hdr-mini-expand:hover  { background: rgba(14,13,12,0.04); }
.slm-hdr-mini-expand:active { transform: scale(0.97); }
.slm-wave-mini { height: 12px; }
.slm-wave-mini i:nth-child(1) { height: 5px; }
.slm-wave-mini i:nth-child(2) { height: 9px; }
.slm-wave-mini i:nth-child(3) { height: 7px; }
.slm-wave-mini i:nth-child(4) { height: 4px; }
.slm-tc-mini {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--slm-ink-2);
}
.slm-hdr-mini-chev {
  width: 12px;
  height: 12px;
  color: var(--slm-ink-soft);
  opacity: 0.7;
  margin-left: -2px;
}
/* Tap zone 2: mic — toggles mic, does NOT expand */
.slm-mic-mini {
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--slm-ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.slm-mic-mini:hover  { background: rgba(14,13,12,0.06); color: var(--slm-ink-2); }
.slm-mic-mini:active { transform: scale(0.92); }
.slm-mic-mini svg    { width: 16px; height: 16px; }
.slm-mic-mini.on     { color: var(--slm-terra); }

/* Expand/collapse chevron (between mic and ⋮ in the full header) */
.slm-hdr-collapse {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--slm-ink-soft);
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}
.slm-hdr-collapse:hover  { color: var(--slm-ink-2); background: var(--slm-surface); }
.slm-hdr-collapse:active { transform: scale(0.9); }
.slm-hdr-collapse svg    { width: 14px; height: 14px; }
.slm-hdr-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slm-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  background: var(--slm-ink);
  color: var(--slm-bg);
  flex-shrink: 0;
  position: relative;
}
/* Avatar is naked — no pulse dot. Live state is communicated by the
   voice-wave indicator next to the "Listening" label. */
.slm-info { flex: 1; min-width: 0; }
.slm-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--slm-ink);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slm-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--slm-ink-soft);
  font-weight: 500;
  margin-top: 2px;
}
.slm-status .slm-sep { color: var(--slm-line); margin: 0 4px; }
.slm-status .slm-tc {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--slm-ink-2);
  font-variant-numeric: tabular-nums;
}

/* 4-bar voice-activity indicator — sits in the status row, replacing the
   static listening dot. Same heights / stagger delays as desktop's
   .ticker-waves so mobile keeps visual parity with web/desktop.
   Freezes to 0.3 opacity when `.muted` class is toggled from JS. */
.slm-wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
  color: var(--slm-terra);
  flex-shrink: 0;
  margin-right: 2px;
}
.slm-wave i {
  display: inline-block;
  width: 2px;
  background: currentColor;
  border-radius: 99px;
  animation: slmTickerWave 900ms ease-in-out infinite alternate;
}
.slm-wave i:nth-child(1) { animation-delay: 0s;    height: 6px;  }
.slm-wave i:nth-child(2) { animation-delay: 0.12s; height: 11px; }
.slm-wave i:nth-child(3) { animation-delay: 0.24s; height: 8px;  }
.slm-wave i:nth-child(4) { animation-delay: 0.36s; height: 5px;  }
@keyframes slmTickerWave {
  from { transform: scaleY(0.55); opacity: 0.65; }
  to   { transform: scaleY(1);    opacity: 1;   }
}
.slm-wave.muted i { animation-play-state: paused; opacity: 0.3; }

/* Mic + more: naked icons (no oval background, no border). Just the glyph.
   State is communicated by color: muted = neutral ink-soft, on = terra. */
.slm-mic, .slm-more-btn {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--slm-ink-soft);
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.15s, transform 0.15s;
}
.slm-mic svg, .slm-more-btn svg { width: 20px; height: 20px; }
.slm-mic.on { color: var(--slm-terra); }
.slm-mic-slash { transition: opacity 0.15s; }
.slm-mic.on .slm-mic-slash { opacity: 0; }
.slm-mic:not(.on) .slm-mic-slash { opacity: 1; }
.slm-mic:active, .slm-more-btn:active { transform: scale(0.9); }
.slm-more-btn { color: var(--slm-ink-2); }

/* ── LISTENING CARD (diarized speaker strands) ── */
.slm-tr {
  padding: 10px 12px;
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--slm-line);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--slm-ink-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slm-tr-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.slm-tr-line:hover { background: var(--slm-line-soft); }
.slm-tr-line:active { transform: scale(0.99); }
.slm-tr-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.slm-tr-dot.a { background: #7d8ea3; }
.slm-tr-dot.b { background: var(--slm-terra); }
.slm-tr-text {
  flex: 1;
  min-width: 0;
  overflow-x: scroll;
  scroll-behavior: smooth;
  scrollbar-width: none;
  white-space: nowrap;
  font-style: italic;
}
.slm-tr-text::-webkit-scrollbar { height: 0; display: none; }
.slm-tr-line.active .slm-tr-text { color: var(--slm-ink); font-style: normal; }
.slm-tr-line:not(.active) .slm-tr-text { opacity: 0.5; }

.slm-tr-tag {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slm-ink-faint);
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--slm-line);
  background: var(--slm-bg);
  transition: 0.2s;
}
.slm-tr.tagged .slm-tr-line .slm-tr-tag { opacity: 1; border-color: transparent; padding: 0; background: transparent; }
.slm-tr.tagged .slm-tr-line.mine .slm-tr-tag { color: var(--slm-terra); font-weight: 600; }
/* After tagging, the OTHER row is the interviewer — make its live text
   bold + full-opacity so the candidate can read it at a glance during
   the interview, even when their own row is dimmed. Overrides the generic
   `:not(.active)` opacity rule above by selector specificity. */
.slm-tr.tagged .slm-tr-line:not(.mine) .slm-tr-text {
  font-weight: 700;
  opacity: 1;
  font-style: normal;
  color: var(--slm-ink);
}
.slm-tr:not(.tagged) .slm-tr-tag {
  opacity: 1;
  animation: slmPulseBorder 1.8s ease-in-out infinite;
}
.slm-tr:not(.tagged) .slm-tr-line .slm-tr-tag::before { content: 'THIS IS ME'; }
.slm-tr.tagged .slm-tr-line.mine .slm-tr-tag::before { content: 'ME'; }
.slm-tr.tagged .slm-tr-line:not(.mine) .slm-tr-tag::before { content: 'INTERVIEWER'; }
@keyframes slmPulseBorder {
  0%, 100% { border-color: var(--slm-line); }
  50%      { border-color: var(--slm-terra); }
}

/* Pre-tag pulse hint (terra, animated). Visible until a speaker is tagged. */
.slm-tag-hint {
  font-size: 11px;
  text-align: center;
  margin-top: 6px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--slm-terra);
  animation: slmFadePulse 2.4s ease-in-out infinite;
}
.slm-tr.tagged ~ .slm-tag-hint { display: none; }
@keyframes slmFadePulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* Post-tag permanent hint (small, muted, no fade). Replaces the pop toast so
   users always have a persistent cue that they can re-tag the other row.
   Shown inline below the transcript card only after a speaker is tagged. */
.slm-tag-toast {
  display: none;
  margin: 6px 4px 0;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--slm-ink-faint);
}
.slm-tag-toast svg { width: 11px; height: 11px; flex-shrink: 0; color: var(--slm-terra); }
.slm-tag-toast strong { font-weight: 600; color: var(--slm-ink-soft); }
.slm-toast-dismiss { display: none; }
.slm-tr.tagged ~ .slm-tag-toast { display: inline-flex; }

/* ── CHAT FEED ───────────────────────────── */
.slm-main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 12px;
  scrollbar-width: none;
  position: relative;  /* anchors the absolutely-positioned empty state + scroll pill */
}
.slm-main::-webkit-scrollbar { width: 0; display: none; }

/* ↓ Latest pill — floats at bottom of feed, shown when user scrolls up
   while answers are streaming. Tapping snaps to the newest answer. */
.slm-scroll-latest {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--slm-ink);
  color: var(--slm-bg);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(14,13,12,0.18), 0 1px 4px rgba(14,13,12,0.08);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.slm-scroll-latest svg { width: 13px; height: 13px; flex-shrink: 0; }
.slm-scroll-latest:active { transform: translateX(-50%) scale(0.96); }
.slm-scroll-latest[hidden] { display: none; }

/* Empty state is absolutely centered in the answers pane — stays dead-center
   while we're waiting for the first Q&A, regardless of header collapse state.
   The feed-mirror in screen-live-mobile.js hides this via inline style as
   soon as the first .answer-item lands in the desktop feed. */
.slm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  color: var(--slm-ink-faint);
  pointer-events: none;
}
.slm-empty p {
  font-size: 14px;
  color: var(--slm-ink-2);
  margin-bottom: 4px;
}
.slm-empty span { font-size: 11.5px; }

/* Q + A pair grouping — terra left rule */
.slm-pair {
  position: relative;
  padding: 10px 4px 14px 18px;
  margin-bottom: 18px;
  border-left: 2px solid var(--slm-terra);
}
.slm-q {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--slm-ink-2);
  margin-bottom: 12px;
  font-weight: 400;
  background: #f4f4f5;
  padding: 10px 14px;
  border-radius: 14px;
  border-top-left-radius: 4px;
}
.slm-q::before {
  content: 'Q ';
  display: inline-block;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--slm-terra);
  margin-right: 8px;
  vertical-align: 2px;
}
.slm-q strong { font-weight: 600; color: var(--slm-ink); }
.slm-a {
  position: relative;
  padding: 2px 0 0;
  background: transparent;
  color: var(--slm-ink);
  font-size: 15.5px;
  line-height: 1.65;
  font-weight: 400;
}
.slm-a::before {
  content: 'A ';
  display: inline-block;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--slm-terra);
  margin-right: 8px;
  vertical-align: 2px;
}
.slm-a strong { font-weight: 600; color: var(--slm-ink); }
.slm-a em { font-style: italic; color: var(--slm-ink-2); }
.slm-a .slm-typing {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--slm-terra);
  margin-right: 4px;
  opacity: 0.5;
  animation: slmDot 1.3s ease-in-out infinite;
  vertical-align: 3px;
}
.slm-a .slm-typing:nth-child(2) { animation-delay: 160ms; }
.slm-a .slm-typing:nth-child(3) { animation-delay: 320ms; }
@keyframes slmDot {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40%           { opacity: 1; transform: scale(1); }
}
.slm-meta {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slm-ink-faint);
  margin-top: 6px;
}

/* ── BOTTOM COMPOSE — fully rounded, premium feel ──
   Pill primary + circular secondaries. Matches the rounded language of the
   listening card (12px) and the circular header controls (mic / more).
   Mode swap is driven by data-mode on .slm-compose. */
.slm-compose {
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0) + 12px);
  background: var(--slm-bg);
  border-top: 1px solid var(--slm-line);
  flex-shrink: 0;
}
.slm-compose[data-mode="default"] .slm-compose-chat    { display: none; }
.slm-compose[data-mode="chat"]    .slm-compose-default { display: none; }

.slm-compose-default,
.slm-compose-chat {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Primary: Answer Now — pill, subtle lift */
.slm-answer {
  flex: 1;
  height: 52px;
  padding: 0 24px;
  background: var(--slm-ink);
  color: var(--slm-bg);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(14, 13, 12, 0.08), 0 4px 14px rgba(14, 13, 12, 0.10);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.slm-answer:hover  { background: var(--slm-ink-2); box-shadow: 0 2px 4px rgba(14,13,12,.1), 0 6px 18px rgba(14,13,12,.14); }
.slm-answer:active { transform: scale(0.985); }
.slm-answer-ico    { width: 15px; height: 15px; }

/* Pulsing terra ring around Answer Now until the user has tapped it at
   least once. The bridge JS adds .slm-needs-attention on first mobile
   session, removes on first tap, and persists the "tapped before" state
   in localStorage so the pulse never shows for this user again. */
.slm-answer.slm-needs-attention {
  animation: slmAnswerPulse 2s ease-in-out infinite;
}
@keyframes slmAnswerPulse {
  0%, 100% {
    box-shadow: 0 1px 2px rgba(14,13,12,.08), 0 4px 14px rgba(14,13,12,.10),
                0 0 0 0 rgba(217, 119, 87, 0);
  }
  50% {
    box-shadow: 0 1px 2px rgba(14,13,12,.08), 0 4px 14px rgba(14,13,12,.10),
                0 0 0 10px rgba(217, 119, 87, 0.18);
  }
}

/* Coach-mark: small tooltip floating above Answer Now on first mobile
   session. The downward arrow points at the button. Hidden by [hidden];
   the bridge JS removes the attribute on first session start (only when
   localStorage flag is unset) and re-adds it on first tap or after 12s. */
.slm-coach {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 24px;
  right: 24px;
  background: var(--slm-ink);
  color: var(--slm-bg);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  padding: 9px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(14, 13, 12, 0.18), 0 2px 6px rgba(14, 13, 12, 0.10);
  text-align: center;
  animation: slmCoachIn 0.32s ease-out;
  z-index: 10;
}
.slm-coach[hidden] { display: none; }
.slm-coach-arrow {
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--slm-ink);
}
@keyframes slmCoachIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* The compose row needs a positioning context so the coach-mark anchors above it. */
.slm-compose { position: relative; }

/* Persistent reminder line under the Answer Now / chat-toggle row.
   Always present, every session — no localStorage gate, no first-time
   logic. The coach-mark above is bonus emphasis for first-time users,
   but this is the one that EVERY candidate (cached or not, new or
   returning) sees on every session. Made deliberately prominent
   (full ink, semi-bold, larger) so it can't be missed at a glance.
   Hidden in chat-compose mode to keep the keyboard layout tight. */
.slm-compose-hint {
  margin-top: 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--slm-ink);
  line-height: 1.35;
}
.slm-compose-hint strong { color: var(--slm-terra); }
.slm-compose[data-mode="chat"] .slm-compose-hint { display: none; }

/* v1.0.410 — Secondary: chat toggle. Was a white circle with a 1px line
 *   border. User feedback: the circle background was unnecessary visual
 *   noise; the Gemini-gradient sparkle icon is strong enough on its own
 *   without a wrapper. Removed the bg + border, kept the 52×52 tap
 *   target so iOS / Android still hit the WCAG 44×44 minimum. */
.slm-chat-toggle {
  width: 52px; height: 52px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--slm-ink-2);
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s;
}
.slm-chat-toggle:hover  { background: transparent; }
.slm-chat-toggle:active { transform: scale(0.92); }
/* v1.0.409 — bumped 36→46px so the chat-sparkle glyph fills the white
 *   circle button (88% fill, up from 69%). User feedback: 36px left too
 *   much empty space in the 52px circle; needed the icon to actually
 *   read as the button's content, not floating inside a void. translateY
 *   bumped 2.5→3px to keep the optical centre matched at the new size.
 * The chat-glyph is the VS Code chat-sparkle.svg (verbatim from
 * microsoft/vscode-codicons). Both bubble and sparkles painted with the
 * Gemini gradient via inline url(#slm-chat-grad). */
.slm-chat-toggle svg    { width: 46px; height: 46px; }
.slm-chat-toggle .slm-chat-glyph {
  width: 46px !important;
  height: 46px !important;
  transform: translateY(3px);
  display: block;
}
@keyframes slm-twinkle {
  0%, 100% { opacity: 1;   transform: scale(1);    }
  50%      { opacity: 0.7; transform: scale(0.9);  }
}
.slm-chat-glyph .slm-twinkle   { animation: slm-twinkle 1.8s ease-in-out infinite; transform-origin: center; }
.slm-chat-glyph .slm-twinkle-2 { animation-delay: 0.5s; }

/* Chat-mode cancel — circle, same weight as toggle */
.slm-chat-cancel {
  width: 44px; height: 44px;
  flex-shrink: 0;
  background: var(--slm-bg);
  border: 1px solid var(--slm-line);
  border-radius: 50%;
  color: var(--slm-ink-soft);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.slm-chat-cancel:hover  { background: var(--slm-surface); color: var(--slm-ink-2); }
.slm-chat-cancel:active { transform: scale(0.94); }
.slm-chat-cancel svg    { width: 14px; height: 14px; }

/* v1.0.413 — Chat input pill with GLASS interior + MUTED Gemini border.
 *   Three things per user feedback:
 *     1) auto-grow vertically (input → textarea, min 52 → max 104px,
 *        then scroll). Border-radius drops from 999px (pill) to 22px
 *        (rounded rectangle) so the bottom edge stays clean when the
 *        textarea grows beyond one line.
 *     2) glass interior: rgba(255,255,255,0.55) + backdrop-filter blur
 *        gives a frosted look that picks up the page colour behind.
 *     3) muted Gemini: gradient stops dropped from full saturation
 *        to ~55% alpha so the border ring reads as colour-coded
 *        without shouting. */
@property --gem-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes gemini-rotate-mobile {
  to { --gem-angle: 360deg; }
}
.slm-chat-input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;             /* send button anchors at bottom when textarea grows */
  min-height: 52px;
  max-height: 104px;
  padding: 6px 6px 6px 22px;
  /* v1.0.414 — GLASS Gemini border + opaque white inner.
     INNER: rgba(255,255,255,0.95) — near-opaque white so the conic
     gradient under it is fully masked. NO colour fill inside the pill.
     BORDER: thin (1px) + low-opacity gradient (~32%) so the Gemini
     ring reads as a soft glass-coloured line. Same treatment as desktop. */
  background:
    linear-gradient(rgba(255,255,255,0.95), rgba(255,255,255,0.95)) padding-box,
    conic-gradient(from var(--gem-angle),
      rgba(66, 133, 244, 0.32),
      rgba(147, 51, 234, 0.32),
      rgba(236, 72, 153, 0.32),
      rgba(245, 158, 11, 0.32),
      rgba(66, 133, 244, 0.32)) border-box;
  border: 1px solid transparent;
  border-radius: 22px;
  animation: gemini-rotate-mobile 5s linear infinite;
  transition: filter 0.15s;
  min-width: 0;
}
.slm-chat-input-wrap:focus-within {
  /* Focus state — slightly brighter gradient stops but still glass-like
     (low 50% alpha, not the old 75%). Inner stays fully opaque white. */
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    conic-gradient(from var(--gem-angle),
      rgba(66, 133, 244, 0.50),
      rgba(147, 51, 234, 0.50),
      rgba(236, 72, 153, 0.50),
      rgba(245, 158, 11, 0.50),
      rgba(66, 133, 244, 0.50)) border-box;
  filter: drop-shadow(0 0 6px rgba(147,51,234,0.15));
}
.slm-chat-input-wrap textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--slm-ink);
  min-width: 0;
  min-height: 40px;
  max-height: 88px;                  /* matches outer 104px - 2*pad */
  padding: 6px 0;
  resize: none;
  overflow-y: auto;
}
.slm-chat-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--slm-ink);
  min-width: 0;
  padding: 0;
}
.slm-chat-input-wrap input::placeholder { color: var(--slm-ink-faint); }

/* v1.0.410 — Chat send (mobile). Was solid black ink. Now: full Gemini
 *   gradient with a soft purple/pink glow halo — matches the desktop
 *   send button so the whole composer reads as one Gemini-themed AI
 *   affordance. */
.slm-chat-send {
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #4285f4 0%, #9333ea 35%, #ec4899 65%, #f59e0b 100%);
  border: none;
  border-radius: 50%;
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(147,51,234,0.35), 0 0 10px rgba(147,51,234,0.28);
  transition: box-shadow 0.15s, transform 0.15s;
}
.slm-chat-send:hover  {
  box-shadow: 0 0 0 1px rgba(236,72,153,0.55), 0 0 14px rgba(236,72,153,0.42);
}
.slm-chat-send:active { transform: scale(0.92); }
.slm-chat-send svg    { width: 15px; height: 15px; }

/* ── ⋮ SHEET ────────────────────────────── */
.slm-sheet-bd {
  position: fixed; inset: 0;
  background: rgba(14, 13, 12, 0.35);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms;
}
.slm-sheet-bd.open { opacity: 1; pointer-events: auto; }
.slm-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 120;
  background: var(--slm-bg);
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0) + 22px);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border-top: 1px solid var(--slm-line);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(.2,.8,.2,1);
}
.slm-sheet.open { transform: translateY(0); }
.slm-sheet-handle {
  width: 40px; height: 4px;
  background: var(--slm-line);
  border-radius: 2px;
  margin: 2px auto 14px;
}
.slm-sheet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 2px;
  border-bottom: 1px solid var(--slm-line);
  font-size: 14.5px;
}
.slm-sheet-row:last-of-type { border-bottom: none; }
.slm-sheet-label { color: var(--slm-ink); font-weight: 500; }
.slm-sheet-sub {
  display: block;
  font-size: 11.5px;
  color: var(--slm-ink-faint);
  font-weight: 400;
  margin-top: 2px;
}
.slm-sheet-hint { font-size: 12.5px; color: var(--slm-ink-soft); }

/* Tappable sheet rows show a chevron rotation hint when expanded. The hint
   span keeps its existing `›` glyph — we just animate its rotation so the
   user sees a "drawer opening" affordance. */
.slm-sheet-row-tap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.slm-sheet-row-tap:active { background: var(--slm-line-soft); }
.slm-sheet-row-tap.expanded .slm-sheet-hint {
  color: var(--slm-terra);
}

/* Inline model picker — sits as a sibling row below the Model row. Hidden
   by [hidden]; when shown, fills with options sourced from the desktop
   #model-switcher-menu (single source of truth for plan-gated models). */
.slm-model-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--slm-line);
  animation: slmFadeIn 0.18s ease-out;
}
.slm-model-list[hidden] { display: none; }
@keyframes slmFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slm-model-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  background: transparent;
  border: 0;
  text-align: left;
  font-family: inherit;
  color: var(--slm-ink);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  width: 100%;
}
.slm-model-opt:active { background: var(--slm-line-soft); }
.slm-model-opt .slm-model-check {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--slm-terra);
  opacity: 0;
  transition: opacity 0.15s;
}
.slm-model-opt .slm-model-check svg { width: 100%; height: 100%; }
.slm-model-opt.active .slm-model-check { opacity: 1; }
.slm-model-opt.active .slm-model-name { font-weight: 600; color: var(--slm-terra); }
.slm-model-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.slm-model-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}
.slm-model-sub {
  font-size: 11.5px;
  color: var(--slm-ink-faint);
  margin-top: 2px;
  line-height: 1.3;
}
.slm-model-empty {
  font-size: 12.5px;
  color: var(--slm-ink-faint);
  padding: 10px 4px;
  text-align: center;
}
.slm-toggle {
  width: 42px; height: 24px;
  background: var(--slm-line);
  border-radius: 999px;
  position: relative;
  transition: 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}
.slm-toggle.on { background: var(--slm-ink); }
.slm-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.slm-toggle.on::after { transform: translateX(18px); }

.slm-size-group { display: inline-flex; gap: 6px; }
.slm-size-btn {
  width: 38px; height: 32px;
  background: transparent;
  border: 1px solid var(--slm-line);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--slm-ink);
  cursor: pointer;
}
.slm-size-btn:active { background: var(--slm-line-soft); }

.slm-sheet-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--slm-line);
  border-radius: 12px;
  font-family: inherit;
  font-weight: 500;
  font-size: 14.5px;
  color: var(--slm-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.slm-sheet-btn svg { width: 14px; height: 14px; }
.slm-sheet-danger { color: var(--slm-terra); border-color: rgba(217, 119, 87, 0.3); }

/* ── END-SESSION MODAL ─────────────────────── */
.slm-end-bd {
  position: fixed; inset: 0;
  background: rgba(14, 13, 12, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}
.slm-end-bd.open { display: flex; }
.slm-end-modal {
  width: 100%;
  max-width: 360px;
  background: var(--slm-bg);
  border: 1px solid var(--slm-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
  animation: slmModalIn 260ms cubic-bezier(.2,.8,.2,1);
}
@keyframes slmModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.slm-end-head {
  padding: 18px 20px 2px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--slm-ink);
}
.slm-end-desc {
  padding: 2px 20px 14px;
  font-size: 13px;
  color: var(--slm-ink-soft);
  line-height: 1.5;
}
.slm-end-opts { padding: 0 14px 6px; }
.slm-end-opt {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--slm-line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: 0.15s;
}
.slm-end-opt:active { transform: scale(0.98); }
.slm-end-opt.now:hover { border-color: var(--slm-terra); background: rgba(217, 119, 87, 0.05); }
.slm-end-ico {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.slm-end-ico svg { width: 16px; height: 16px; }
.slm-end-ico.now { background: rgba(217, 119, 87, 0.14); color: var(--slm-terra); }
.slm-end-ico.close { background: var(--slm-line-soft); color: var(--slm-ink); }
.slm-end-txt { flex: 1; min-width: 0; }
.slm-end-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--slm-ink);
  letter-spacing: -0.005em;
  margin-bottom: 2px;
}
.slm-end-sub {
  font-size: 12px;
  color: var(--slm-ink-soft);
  line-height: 1.4;
}
.slm-end-foot { padding: 4px 14px 16px; text-align: center; }
.slm-end-cancel {
  background: transparent;
  border: none;
  color: var(--slm-ink-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
}

/* ── Text-size cascade on the feed ────────── */
.slm.text-size-sm .slm-q, .slm.text-size-sm .slm-a { font-size: 13.5px; }
.slm.text-size-lg .slm-q, .slm.text-size-lg .slm-a { font-size: 17px; }

/* ── BUG-B FIX (2026-05): Code blocks on mobile ─────────────
 * Desktop renders fenced ``` blocks as <pre class="ans-code-block"><code>
 * inside the answer body, plus an .ans-inline-code-section sibling for the
 * data.code field. Mobile clones both into the .slm-pair via the JS feed
 * mirror. Style them as premium black blocks with horizontal touch-scroll,
 * matching the desktop look. The hljs.* classes come from highlight.js
 * (atom-one-dark theme is loaded once, lazily, by screen-live-mobile.js). */
.slm-pair pre.ans-code-block,
.slm-pair pre.ans-inline-code-block,
.slm-pair .ans-inline-code-section pre {
  display: block;
  margin: 10px 0;
  padding: 12px 14px;
  background: #0a0a0a;
  color: #f4f4f5;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  /* keep block from being squeezed by .slm-pair's padding-left rule */
  box-sizing: border-box;
}
.slm-pair pre.ans-code-block code,
.slm-pair pre.ans-inline-code-block code,
.slm-pair .ans-inline-code-section pre code {
  display: block;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  white-space: pre;
}
/* Inline code-section header (lang badge + copy button row above the pre) */
.slm-pair .ans-inline-code-section {
  margin: 10px 0;
  max-width: 100%;
}
.slm-pair .ans-inline-code-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: #9ca3af;
}
.slm-pair .ans-inline-code-section pre.ans-inline-code-block {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}
.slm-pair .ans-code-copy,
.slm-pair .ans-code-ide-link {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #f4f4f5;
  font-family: inherit;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
}
.slm-pair .ans-code-copy:active { transform: scale(0.96); }
.slm-pair .ans-code-lang-label,
.slm-pair .ans-code-lang {
  text-transform: lowercase;
  color: #9ca3af;
  flex: 1;
}

/* Inline code (`backticks`) inside answer text — render as monospace pill */
.slm-a code,
.slm-a :not(pre) > code {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.92em;
  background: rgba(14, 13, 12, 0.06);
  color: var(--slm-ink);
  padding: 1px 5px;
  border-radius: 4px;
}
.slm-a pre code { background: transparent; padding: 0; }

/* ── BUG-21: full-width code block + steps card on mobile ─────────────
 * The mobile mirror clones the desktop .ans-inline-code-section AND the
 * new .ans-code-steps card. On a phone we want both to span the full
 * width of the .slm-pair (no padding-left squeeze, no inner viewport
 * clip), and the steps card always sits BELOW the code block. */
.slm-pair > .ans-inline-code-section {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 0;
  box-sizing: border-box;
}
.slm-pair > .ans-inline-code-section pre {
  /* Touch scroll for long lines + premium black bg matches desktop look */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background: #000000;
  border: 1px solid #1a1a1a;
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: #ffffff;
  padding: 12px 14px;
  margin: 0;
  white-space: pre;
  box-sizing: border-box;
}
.slm-pair > .ans-inline-code-section pre code {
  display: block;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  white-space: pre;
}
.slm-pair > .ans-inline-code-section .ans-inline-code-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
}
.slm-pair > .ans-inline-code-section .ans-inline-code-copy {
  margin-left: auto;
  color: var(--slm-terra, #d97757);
  text-decoration: none;
  cursor: pointer;
  /* Larger tap target on touch devices */
  padding: 4px 8px;
  border-radius: 4px;
}
.slm-pair > .ans-inline-code-section .ans-code-ide-link {
  color: var(--slm-terra, #d97757);
  text-decoration: none;
}
.slm-pair > .ans-inline-code-section .ans-code-lang-label {
  color: #9ca3af;
  text-transform: lowercase;
}

/* "How to run this — Programiz" steps card. Always renders BELOW the
 * code block — order is enforced by JS insertion (steps after code in
 * the desktop card, mirror preserves the order in _buildPair). */
.slm-pair > .ans-code-steps {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 10px 12px;
  box-sizing: border-box;
  background: rgba(232, 131, 74, 0.08);
  border: 1px solid rgba(232, 131, 74, 0.22);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--slm-ink-2);
}
.slm-pair > .ans-code-steps .ans-code-steps-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.slm-pair > .ans-code-steps .ans-code-steps-title {
  color: #c25a2c;
  font-weight: 600;
}
.slm-pair > .ans-code-steps .ans-code-steps-link {
  display: inline-block;
  margin-bottom: 6px;
  color: #c25a2c;
  text-decoration: underline;
  font-size: 12px;
  /* Larger tap target on touch devices */
  padding: 4px 0;
}
.slm-pair > .ans-code-steps .ans-code-steps-ol {
  margin: 6px 0 0;
  padding-left: 20px;
}
.slm-pair > .ans-code-steps .ans-code-steps-ol li {
  margin: 3px 0;
}
