/*********************************************
 * Selamlaş — Apple-HIG-clean, icon-based UI (owner rule 2026-11-17, see
 * docs/PRODUCT.md top override: "better than Bi Merhaba De... icon-based,
 * no text written on buttons/components, no flashy colours (black/white/
 * neutral greys, one quiet accent at most; the OKLCH aurora is removed),
 * one action per screen").
 *
 * Replaces the previous multi-hue OKLCH "aurora" glassmorphism theme
 * (3 background hues + 2 accent hues + gradient buttons everywhere) with
 * a strict near-monochrome palette: one ink/background pair per color
 * scheme, ONE quiet accent reserved for a few meaningful highlights
 * (focus rings, the "devam edelim" continue action, the online-status
 * dot) — never for ordinary buttons, which are plain ink/background
 * fills, same as iOS/macOS system buttons.
 *
 * This file is hand-maintained directly: the legacy gulp-sass toolchain
 * in gulpfile.js (node-sass 2.x) does not run on Node 24, so the
 * src/scss/*.scss sources are no longer the compiled input for this file.
 * They're left in place as reference for whoever restores a modern
 * sass/dart-sass build step later; until then, edit THIS file.
 *
 * Design tokens below are a local stub (packages/brand/tokens.json does
 * not exist yet — Agent C's package). Swap the :root block for the real
 * tokens once that package ships; nothing else here should need to change
 * if the same custom property names are reused.
 **********************************************/

/* ---------- tokens (stub — replace from packages/brand/tokens.json) ---------- */
:root {
  /* Dark scheme: near-black background, near-white ink — true greys in
     between, no hue anywhere except --slm-accent. */
  --slm-bg-1: oklch(16% 0 0);
  --slm-bg-2: oklch(22% 0 0);
  --slm-bg-3: oklch(28% 0 0);
  /* The one accent, literal #0071E3 everywhere, light or dark (Apple
     design rules, plans/gtm/APPLE-DESIGN-RULES-2026-11-17.md) — used for
     focus rings, the continue/"devam edelim" action, the online-status
     dot, AND (Stage 2a, 2026-11-17) the one labelled primary pill,
     "Başla" — never for any other ordinary button/fill. */
  --slm-accent: #0071E3;
  --slm-accent-2: #0071E3;
  --slm-accent-ink: #FFFFFF;
  --slm-danger: oklch(58% 0.14 25);

  --slm-ink: oklch(96% 0 0);
  --slm-ink-dim: oklch(80% 0 0 / 0.72);
  /* Darker than --slm-ink-dim, lighter than full --slm-ink -- "label
     colour" for an unselected-but-still-legible control (lead review
     2026-11-17, mode-segment icons). */
  --slm-label: oklch(96% 0 0 / 0.88);

  --slm-glass-bg: oklch(26% 0 0 / 0.46);
  --slm-glass-bg-strong: oklch(24% 0 0 / 0.68);
  --slm-glass-border: oklch(92% 0 0 / 0.14);
  --slm-glass-blur: 18px;
  /* "Received" bubble colour (Stage 2b, 2026-11-17 — owner spec: "grey
     #E9E9EB received / #0071E3 sent"). #0071E3 sent-bubble reuses
     --slm-accent/--slm-accent-ink directly (same literal colour either
     scheme); received needs its own scheme-aware pair since dark mode's
     real iMessage equivalent is a dark grey, not the light-mode #E9E9EB
     literal. */
  --slm-bubble-received-bg: #3A3A3C;
  --slm-bubble-received-ink: var(--slm-ink);
  --slm-field-bg: oklch(20% 0 0 / 0.4);

  /* Plain monochrome fill for primary actions/selected states — an ink
     background with a background-colored icon, i.e. the system-button
     look (black-on-white / white-on-black), not a colored gradient. */
  --slm-fill-bg: var(--slm-ink);
  --slm-fill-ink: var(--slm-bg-1);

  --slm-radius-sm: 10px;
  --slm-radius-md: 16px;
  --slm-radius-lg: 24px;

  --slm-space-1: 0.4rem;
  --slm-space-2: 0.8rem;
  --slm-space-3: 1.2rem;
  --slm-space-4: 2rem;

  /* -apple-system/system-ui first (Stage 2a, 2026-11-17 — owner feedback
     "SF Pro Display style"): most real traffic here is a phone browser
     or an in-app webview on iOS/Android, where the system font IS SF
     Pro/Roboto and reads as native; 'Open Sans' now only ever loads as
     the fallback for a desktop browser lacking both. */
  --slm-font: -apple-system, system-ui, 'Open Sans', sans-serif;
  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    --slm-bg-1: oklch(98% 0 0);
    --slm-bg-2: oklch(94% 0 0);
    --slm-bg-3: oklch(90% 0 0);
    /* --slm-accent/-2 intentionally NOT overridden here — one literal
       #0071E3 in both schemes, per the single-accent rule above. */

    --slm-ink: oklch(18% 0 0);
    --slm-ink-dim: oklch(32% 0 0 / 0.72);
    --slm-label: oklch(18% 0 0 / 0.88);
    --slm-bubble-received-bg: #E9E9EB;
    --slm-bubble-received-ink: #000000;
    --slm-glass-bg: oklch(100% 0 0 / 0.55);
    --slm-glass-bg-strong: oklch(100% 0 0 / 0.78);
    --slm-glass-border: oklch(18% 0 0 / 0.1);
    --slm-field-bg: oklch(100% 0 0 / 0.65);

    --slm-fill-bg: var(--slm-ink);
    --slm-fill-ink: var(--slm-bg-1);
  }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* The HTML `hidden` attribute must win over any class's own `display`
   value (.setup-panel/.chat/.room-chat etc. all set display:grid/flex),
   otherwise toggling `hidden` in JS silently does nothing and multiple
   panels render stacked on top of each other. */
[hidden] { display: none !important; }
html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}
/* Full-bleed app shell (Stage 2a, 2026-11-17 — owner feedback: "on
   mobile the app is a squished desktop card with dead space below").
   100dvh (not 100vh) so the real visible viewport is used on iOS
   Safari/in-app webviews, where the URL bar/home-indicator chrome
   otherwise leaves a gap at the bottom; the topbar/landing content/
   start-bar below are laid out as flex children of this column instead
   of floating cards over a decorative background, so there is never
   leftover empty space between them. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--slm-font);
  color: var(--slm-ink);
  background: var(--slm-bg-1);
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}
h1, h2, h3, p, ul { margin: 0; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Stage 2b (2026-11-17): while a chat is open, #chat-area is its own
   position:fixed overlay (see "chat area" below) that already visually
   covers .app-topbar — display:none here just removes it from the a11y
   tree/tab order too, rather than leaving an invisible-but-reachable
   duplicate nav underneath. Locking body's own height to the REAL
   visible viewport (chat-box.js#bindKeyboardAvoidance sets --slm-vvh from
   window.visualViewport) is what keeps the composer pinned above the iOS
   keyboard instead of the keyboard covering it — only while chatting, so
   the landing screen's own natural flow/scroll (already reviewed) is
   untouched. */
body.chat-open { height: var(--slm-vvh, 100dvh); min-height: 0; overflow: hidden; }
body.chat-open .app-topbar { display: none; }

/* Visually-hidden-but-accessible text — used on icon-only controls where
   the icon alone is the visible affordance (owner rule 2026-11-17: no
   text written on buttons/components) but the label still needs to exist
   for screen readers and for computing the button's accessible name. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- layout shell ---------- */
/* Mobile-first; on desktop the SAME phone-width layout just centers
   (owner rule 2026-11-17) instead of spreading into a wide desktop
   layout — this is a chat app, not a marketing page. */
.container {
  width: min(480px, calc(100% - 2.4rem));
  margin-inline: auto;
}
/* Flat neutral backdrop — no multi-hue radial gradients, no color drift
   animation (the "OKLCH aurora" the owner's rule explicitly removes). A
   single, very subtle vignette keeps the glass panels readable without
   adding any color. Element kept (not deleted) so nothing else in the DOM
   needs to change; it is simply inert now. */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--slm-bg-2) 0%, transparent 60%),
    var(--slm-bg-1);
}

/* glass-panel: the one reusable glassmorphism primitive */
.glass-panel {
  background: var(--slm-glass-bg);
  border: 1px solid var(--slm-glass-border);
  border-radius: var(--slm-radius-md);
  backdrop-filter: blur(var(--slm-glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--slm-glass-blur)) saturate(1.3);
  box-shadow: 0 8px 30px -10px oklch(10% 0 0 / 0.45);
}

/* ---------- header (full-bleed app topbar, Stage 2a 2026-11-17) ----------
   Owner feedback: "floating header card with heavy shadow + 2-icon
   toolbar = template look". Replaces the old sticky glass-panel card
   (box-shadow, backdrop-blur, rounded corners floating over the aurora
   background) with a flat bar painted in the page's own background
   color — same surface as the content below it, not a card on top of
   it — plus a real native-style large title instead of a small
   logotype. */
.app-topbar {
  padding-top: max(var(--slm-space-2), env(safe-area-inset-top));
  flex: none;
}
.app-topbar-row {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
}
.brand-mark { border-radius: 8px; flex: none; }
/* Large title, top-left — the one real "Selamlaş" wordmark on screen,
   sized and weighted like an iOS large-title nav bar. */
.app-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--slm-ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--slm-space-1);
  margin-inline-start: auto;
}
.online-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slm-ink-dim);
  white-space: nowrap;
  padding-inline-end: var(--slm-space-1);
}
/* Single icon-only globe button that cycles tr<->en (owner rule
   2026-11-17: no text written on components). Reuses .icon-btn's look. */
.lang-switch-btn { font-size: 1rem; }

/* Section tabs (1:1 / Odalar): a quiet underline strip under the large
   title, not a second floating card — icon-only, the accessible name
   carries the real label. */
.section-tabs {
  display: flex;
  gap: var(--slm-space-3);
  margin-top: var(--slm-space-2);
  border-bottom: 1px solid var(--slm-glass-border);
}
.section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--slm-ink-dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.section-tab.is-active {
  color: var(--slm-ink);
  border-bottom-color: var(--slm-ink);
}
.section-tab:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--slm-accent);
  outline-offset: 2px;
}

/* ---------- buttons ---------- */
/* Plain system-button fill: ink-on-background border, no color — the
   "quiet" default control everywhere in the app. */
.btn {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--slm-radius-sm);
  cursor: pointer;
  font-weight: 700;
  color: var(--slm-ink);
  background: var(--slm-glass-bg-strong);
  border: 1px solid var(--slm-glass-border);
  transition: transform 0.08s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
/* Primary action = solid monochrome fill (black-on-white / white-on-
   black depending on scheme), the one visually "loudest" control allowed
   — still zero color, matching the owner's "no flashy colours" rule. */
.btn-primary {
  background: var(--slm-fill-bg);
  color: var(--slm-fill-ink);
  border: none;
}
#control.is-danger { background: var(--slm-danger); color: white; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--slm-ink-dim);
  font-size: 1.1rem;
  cursor: pointer;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border-radius: var(--slm-radius-sm);
}
.icon-btn:hover { color: var(--slm-ink); background: var(--slm-glass-bg-strong); }
.icon-btn-outline { border: 1px solid var(--slm-glass-border); }

/* Icon sizing inside any button that only carries a .icon svg (no visible
   text) — one consistent glyph size everywhere instead of relying on
   each button's own font-size. Design-review fix 2026-11-17: dropped the
   old `<i class="fa ...">`-targeting rules, nothing in the DOM uses that
   tag anymore. */
.btn .icon, .icon-btn .icon, .reaction-chip .icon, .safety-btn .icon {
  width: 1rem;
  height: 1rem;
}

/* ---------- gate / continue / report dialogs ---------- */
dialog.glass-panel {
  color: var(--slm-ink);
  max-width: min(420px, calc(100vw - 2rem));
  padding: var(--slm-space-4);
  border-radius: var(--slm-radius-lg);
}
dialog.glass-panel::backdrop {
  background: oklch(10% 0 0 / 0.55);
  backdrop-filter: blur(6px);
}
dialog.glass-panel h2 { font-size: 1.25rem; margin-bottom: var(--slm-space-2); }
.gate-rules { padding-left: 1.1rem; display: grid; gap: var(--slm-space-1); margin: var(--slm-space-2) 0 var(--slm-space-3); color: var(--slm-ink-dim); }
.gate-dialog .field { margin-bottom: var(--slm-space-2); }
.field-hint { font-size: 0.72rem; color: var(--slm-ink-dim); font-weight: 400; }
.gate-dob-error { font-size: 0.8rem; color: var(--slm-danger); margin-bottom: var(--slm-space-2); }
.gate-actions { display: flex; justify-content: flex-end; gap: var(--slm-space-2); margin-top: var(--slm-space-3); }
/* Returning device: only the bot check runs, so the dialog shows nothing
   but that (and stays empty-looking unless Cloudflare asks for a tap). */
.gate-dialog.is-verify-only h2,
.gate-dialog.is-verify-only .gate-rules,
.gate-dialog.is-verify-only .field,
.gate-dialog.is-verify-only #gate-accept-btn { display: none; }
.gate-verify { display: flex; align-items: center; justify-content: center; gap: var(--slm-space-2); }
.gate-verify-spinner { color: var(--slm-ink-dim); }
.gate-verify-spinner[hidden] { display: none; }
.gate-dialog:not(.is-verify-only) .gate-verify-spinner { display: none; }
.continue-status { font-weight: 700; color: var(--slm-accent); margin: var(--slm-space-2) 0; }
.continue-note { font-size: 0.8rem; color: var(--slm-ink-dim); margin-top: var(--slm-space-1); }

/* "Looks under 18" is its own explicit, separate choice from general
   abuse (owner rule 2026-11-17: this report reason is a hard, instant
   pause — see services/realtime/chat/handler.js#onReport). Short labels
   stay visible here deliberately: this is a decision dialog whose
   content IS the choice, not ambient chat chrome, and "under 18" isn't
   reliably representable by an icon alone. */
.report-reasons { display: grid; gap: var(--slm-space-2); margin: var(--slm-space-3) 0; }
.report-reason-btn {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
  min-height: 44px;
  padding: 0.7rem 0.9rem;
  border-radius: var(--slm-radius-sm);
  border: 1px solid var(--slm-glass-border);
  background: var(--slm-glass-bg);
  color: var(--slm-ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.report-reason-btn:hover { background: var(--slm-glass-bg-strong); }
.report-reason-btn .icon { width: 1.05rem; height: 1.05rem; flex: none; color: var(--slm-danger); }

/* ---------- main / setup panel ---------- */
/* Scrollable middle section between the fixed-height topbar and the
   pinned start-bar (Stage 2a, 2026-11-17) — fills all remaining space
   instead of leaving dead space below a small centered card. */
/* Design-review fix 2026-11-18 (round-3): `display:flex` added here so
   .view below becomes a genuine flex ITEM (not a percentage-sized block
   box). A flex item's resolved main size is treated as definite for its
   own children's flex-grow math (CSS Flexbox #definite-sizes); a plain
   `min-height: 100%` block never was, which is why .landing-hero further
   down measured its content's own intrinsic/max-height-capped size
   instead of the real leftover space and overflowed the shortest
   viewport by ~75px before this was caught live and fixed. */
.main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-block: var(--slm-space-3) var(--slm-space-3);
}
.view[hidden] { display: none; }
/* flex:1 1 auto + min-height:0 (not min-height:100%, see .main's comment
   above) -- the one visible .view claims .main's whole resolved height
   via real flex-grow. If its own content ever needs more than that (the
   Rooms grid on a very short viewport, say), min-height:0 lets it
   flex-shrink below that content's natural size without clipping
   anything -- the content simply overflows the shrunk box and .main's
   own overflow-y:auto still scrolls to it, same as it always did; only
   the *mechanism* for the no-leftover-space case changed, not the
   overflow/scroll guarantee for the too-much-content case. */
.view { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
/* Real bug caught live (2026-11-17, headless-browser check): a flex
   item's default min-width is `auto`, which let #rooms-grid's
   auto-fit/minmax() grid refuse to shrink below its own max-content
   width and overflow the 480px shell (777px wide inside a 352px
   container, measured). Every .view's direct child needs min-width: 0
   to actually respect the column it's in. */
.view > * { min-width: 0; }

/* Landing content (replaces the old centered "setup-panel" glass card):
   left-aligned, fills the column, no card/border/shadow of its own —
   same flat surface as the page. Mode picker + Başla live in #start-bar,
   pinned below. */
/* Design-review fix 2026-11-17: centering the whole block (previous
   attempt) just split the dead space into two empty grey bands, one
   above the title and one below the list, sandwiching the content --
   still read as empty/fake. Natural top-down flow, hugging the topbar
   like a normal short settings screen, removes the leading band; any
   leftover space collapses into a single trailing gap right above the
   pinned start-bar instead of framing the content on both sides. */
/* Design-review fix 2026-11-18 (round-3): that trailing gap itself was
   never actually closed -- it just moved from "two bands" to "one band",
   and measured 10.8%-36.6% of the viewport depending on device height
   (worst on tall phones + desktop, where the content below the title is
   genuinely short: one interests field, one always-visible invite row,
   the legal line -- daily-topic/streak stay [hidden] until there's real
   data). `flex: 1 1 auto` here lets .landing claim all of .view's height
   (previously it only took its own content height), so .landing-hero
   below has real free space to grow into instead of nothing. */
.landing {
  display: flex;
  flex: 1 1 auto;
  /* Flex items default to min-height:auto (their own min-content size) as
     the automatic minimum, which silently overrides flex-shrink and is
     what let .landing render at its full ~461px content height instead
     of clamping to .view's real 347px before this was caught live. */
  min-height: 0;
  flex-direction: column;
  gap: var(--slm-space-3);
  padding-block: var(--slm-space-3);
}
/* The one flex child that's allowed to grow: it claims exactly however
   much space is left between the tagline and .landing-stack -- never
   more, never less, so it can neither overflow .main nor leave a flat
   empty band -- and renders the brand mark (same S-curve path as
   /img/icon.svg) as a quiet neutral watermark at a capped size, the same
   "soft icon, not raw blank grey" grammar iOS apps use for an empty
   state (e.g. Messages' no-conversation-selected placeholder). Purely
   decorative: aria-hidden, no semantic content, drops out of the a11y
   tree entirely. */
.landing-hero {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-hero-mark {
  width: auto;
  height: 100%;
  max-width: 128px;
  max-height: 128px;
  color: var(--slm-ink-dim);
  opacity: 0.22;
}
/* Large-title style (lead review 2026-11-17: "set the tagline in the
   black large-title style, or drop it") -- same weight/color grammar as
   .app-title in the topbar, not a dim grey caption. */
.landing-tagline {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--slm-ink);
  margin: 0;
}
.landing-stack {
  display: grid;
  gap: var(--slm-space-3);
}

.field {
  display: grid;
  gap: 0.35rem;
  text-align: left;
  font-size: 0.85rem;
  color: var(--slm-ink-dim);
}
.field input {
  padding: 0.6rem 0.8rem;
  border-radius: var(--slm-radius-sm);
  border: 1px solid var(--slm-glass-border);
  background: var(--slm-field-bg);
  color: var(--slm-ink);
  font-size: 0.95rem;
}
.field input:focus { border-color: var(--slm-accent-2); }

/* Design-review fix 2026-11-18 (violation #1), scoped to #setup-panel
   only — the gate dialog's own DOB .field (a real, clearly-labelled
   legal/safety form control) keeps the grid layout above untouched.
   The landing interests field was a stacked label-above-bare-input —
   the exact "form-like layout (label + input + boxed rows)" the owner
   called out, the first thing a visitor sees. The visible label moves
   to .sr-only (still the real accessible name) and the field becomes
   one rounded icon-leading pill, same grammar as every other app
   surface here (a search/filter field, not an HTML form row); the
   placeholder text is the only thing visibly shown. */
#setup-panel .field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding-inline: 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--slm-glass-border);
  background: var(--slm-field-bg);
}
#setup-panel .field-icon { flex: none; width: 1.1rem; height: 1.1rem; color: var(--slm-ink-dim); }
#setup-panel .field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--slm-ink);
  font-size: 0.95rem;
  padding: 0;
}
#setup-panel .field input:focus { outline: none; border-color: transparent; }
#setup-panel .field:has(input:focus) { border-color: var(--slm-accent-2); }

/* #control ("Başla"/"Sıradaki"/confirm) is icon-only (owner rule
   2026-11-17) — it ships all 3 glyphs as inline SVGs and shows exactly
   one, keyed on [data-current] (set by chat-box.js#setControlState()), so
   no JS ever needs to touch its visible content (only the aria-label/
   title). Design-review fix 2026-11-17: replaces the old FontAwesome
   ::before content-swap (dropped the whole font). */
#control {
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 999px;
}
#control .icon { display: none; width: 1.05rem; height: 1.05rem; }
#control[data-current="start"] .control-icon-start,
#control[data-current="next"] .control-icon-next,
#control[data-current="really"] .control-icon-really { display: inline-block; }
.legal-notice {
  font-size: 0.75rem;
  color: var(--slm-ink-dim);
  text-align: center;
  max-width: 44ch;
  margin-inline: auto;
}

/* Self-hosted inline-SVG icon utility (Stage 2a, 2026-11-17 — replaces
   FontAwesome across the shell/landing/sheets with self-hosted Material
   Symbols Rounded-style glyphs, inlined directly in the markup). Sized/
   colored exactly like the old <i class="fa ..."> glyphs it replaces so
   every existing .btn/.icon-btn/.mode-chip/.loop-icon rule above still
   applies unchanged. Design-review fix 2026-11-17: the FontAwesome
   stylesheet and every remaining <i class="fa ..."> (gate dialogs, share
   dialog, Rooms tiles, room-chat, #control) are now gone too — one
   consistent icon set everywhere, nothing left mixing the two. */
.icon {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
}

/* ---------- pinned bottom start-bar (Stage 2a, 2026-11-17) ----------
   Owner-specified layout: an iOS-style segmented mode picker directly
   above the one labelled primary pill in the whole app, both pinned at
   the bottom of the screen in thumb reach, safe-area aware. */
.start-bar {
  flex: none;
  display: grid;
  gap: var(--slm-space-2);
  width: min(480px, calc(100% - 2.4rem));
  margin-inline: auto;
  padding: var(--slm-space-2) 0 max(var(--slm-space-2), env(safe-area-inset-bottom));
  border-top: 1px solid var(--slm-glass-border);
  /* Design-review fix 2026-11-17 — real bug caught live on phone-width
     viewports (headless-browser screenshots, every mobile size, never
     desktop): on first paint the compositor occasionally bled a faint
     copy of the topbar's own brand row into this bar's raster tile
     ("brand header bleeding into the Başla pill"). isolation:isolate +
     contain:paint force this bar onto its own clean paint surface so
     nothing from elsewhere in the page can ever be sampled into it. */
  isolation: isolate;
  contain: paint;
}
.start-bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slm-ink-dim);
  text-align: center;
}

/* Segmented control (text/voice/video) — one continuous pill-shaped
   track, same visual grammar as UISegmentedControl/.segmented-control,
   not 3 separate floating circular chips. Icon-only; the real label is
   the accessible name (.sr-only removed, data-i18n-aria-label carries
   it directly on the button now). */
.mode-segment {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--slm-glass-bg);
  border: 1px solid var(--slm-glass-border);
  border-radius: 999px;
}
.mode-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Design-review fix 2026-11-18 (violation #2): measured live at
     41.59px, under the 44px tap-target minimum. */
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  /* Darker/label-colour by default (lead review 2026-11-17: "icons are
     tiny and grey... make them darker, label colour") -- --slm-label
     reads as a real label colour in both color schemes, not the much
     lighter --slm-ink-dim caption tone. */
  color: var(--slm-label);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.mode-chip .icon { width: 22px; height: 22px; }
.mode-chip.is-active {
  /* Clearly filled selected segment (lead review 2026-11-17), same
     grammar as UISegmentedControl's selected-segment surface: a real
     background fill + a quiet lift, not just a darker icon. */
  background: var(--slm-bg-1);
  color: var(--slm-ink);
  box-shadow: 0 1px 4px oklch(10% 0 0 / 0.18);
}

/* The one owner-allowed labelled primary pill in the whole app —
   accent-filled (the single #0071E3 accent), 52px tall, full width.
   Design-review fix 2026-11-17: carries its real "Başla" label again
   (the one deliberate exception to icon-only) alongside the play glyph —
   every other control in the app stays icon-only. */
.start-pill {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--slm-space-1);
  border: none;
  border-radius: 999px;
  background: var(--slm-accent);
  color: var(--slm-accent-ink);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.start-pill-icon { width: 1.3rem; height: 1.3rem; }
.start-pill-label { font-size: 1.05rem; font-weight: 700; }
.start-pill:hover { filter: brightness(1.08); }
.start-pill:active { transform: scale(0.98); }
/* Smaller variant for inside a sheet's own action row (nickname/iab
   dialogs) instead of the full-width bottom-bar size -- those two sheets
   stay icon-only (their accessible name carries "Başla"/"confirm"), so
   .start-pill-label is never used there; hide it just in case a future
   sheet reuses this class with a label. */
.start-pill-sheet { width: auto; height: auto; padding: 0.6rem 1.4rem; }
.start-pill-sheet .start-pill-label { display: none; }

/* Real bottom sheets (owner spec: "iOS-style bottom sheets for
   nickname/interests/report"), not a centered modal — anchored to the
   bottom edge, full width, rounded top corners only, safe-area aware.
   Stage 2a covered nickname/in-app-browser; Stage 2b (2026-11-17) adds
   the chat "..." menu and its report reason sub-sheet, now that both are
   reachable from the chat screen — gate/continue/share stay centered
   modals, out of this stage's scope. */
#nickname-dialog, #iab-dialog, #chat-menu-dialog, #report-dialog {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  width: 100%;
  max-width: none;
  max-height: 85dvh;
  border-radius: var(--slm-radius-lg) var(--slm-radius-lg) 0 0;
  padding-bottom: max(var(--slm-space-4), env(safe-area-inset-bottom));
  animation: slm-sheet-in 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
  #nickname-dialog, #iab-dialog, #chat-menu-dialog, #report-dialog { animation: none; }
}
@keyframes slm-sheet-in {
  from { transform: translateY(16px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- chat "..." menu sheet + its report reason sub-sheet ---------- */
.chat-menu-dialog h2 { font-size: 1.05rem; }
.chat-menu-rows { display: grid; gap: 2px; margin-top: var(--slm-space-3); border-radius: var(--slm-radius-md); overflow: hidden; }
.chat-menu-row {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0.9rem;
  border: none;
  background: var(--slm-glass-bg);
  color: var(--slm-ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.chat-menu-row:hover { background: var(--slm-glass-bg-strong); }
.chat-menu-row .icon { width: 1.2rem; height: 1.2rem; flex: none; }
.chat-menu-row.is-danger { color: var(--slm-danger); }
.chat-menu-row.is-danger .icon { color: var(--slm-danger); }
/* .report-reasons/.report-reason-btn are already styled above (shared
   with the pre-existing gate-dialog family); this sub-sheet reuses them
   unchanged. */

/* ---------- nickname sheet ---------- */
.nickname-dialog { text-align: left; }
.nickname-hint {
  font-size: 0.85rem;
  color: var(--slm-ink-dim);
  margin-top: 0.3rem;
}
.nickname-field-row {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
  margin-top: var(--slm-space-3);
}
.nickname-field-row input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  border-radius: var(--slm-radius-sm);
  border: 1px solid var(--slm-glass-border);
  background: var(--slm-field-bg);
  color: var(--slm-ink);
  font-size: 1rem;
  font-weight: 600;
}
.nickname-field-row input:focus { border-color: var(--slm-accent-2); }

/* ---------- in-app-browser hint sheet ---------- */
.iab-dialog { text-align: center; }
.iab-icon {
  color: var(--slm-ink-dim);
  display: flex;
  justify-content: center;
  margin-bottom: var(--slm-space-2);
}
.iab-icon .icon { width: 2rem; height: 2rem; }
.iab-dialog p { color: var(--slm-ink-dim); margin-top: var(--slm-space-1); font-size: 0.9rem; }

/* ---------- chat area (Stage 2b, 2026-11-17: iMessage + FaceTime) ----------
   #chat-area is its own full-bleed overlay (position:fixed, covers the
   whole viewport including the app's own topbar/start-bar underneath —
   no need to hide those separately) instead of a card sharing the page.
   Mobile-first; on desktop the content column still caps at 480px and
   centers, same convention as .container elsewhere, so this never turns
   into a wide desktop video-call layout. */
.chat {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--slm-bg-1);
  /* Push-in entrance (owner spec: "native transitions, push/slide
     250-300ms, iOS easing") — re-triggers every time hidden -> visible
     flips this element's display, since that's a fresh paint. */
  animation: slm-chat-push-in 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
  .chat { animation: none; }
}
@keyframes slm-chat-push-in {
  from { transform: translateX(3%); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

/* ---- nav bar: partner identity, skip, "..." ---- */
.chat-navbar {
  flex: none;
  padding-top: max(var(--slm-space-2), env(safe-area-inset-top));
  border-bottom: 1px solid var(--slm-glass-border);
}
.chat-navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--slm-space-2);
  padding-block: var(--slm-space-2);
}
.chat-partner {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
  min-width: 0;
  /* Long-press target (owner spec: report/block via "..." OR long-press)
     — padding keeps the hit area comfortable without changing the
     visible layout. */
  padding: 0.3rem 0.4rem 0.3rem 0;
  margin: -0.3rem 0 -0.3rem -0.4rem;
  border-radius: var(--slm-radius-sm);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.chat-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--slm-glass-bg-strong);
  color: var(--slm-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}
.chat-partner-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--slm-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-navbar-actions { display: flex; align-items: center; gap: var(--slm-space-1); flex: none; }
/* >=44px tap targets (owner spec) for the two nav-bar controls — scoped
   here rather than resizing .icon-btn/.icon-btn-primary globally. */
.chat-navbar-actions .icon-btn,
.chat-navbar-actions #control {
  width: 44px;
  height: 44px;
}

.chat-body { flex: 1; min-height: 0; position: relative; }

/* ---- text mode (default): iMessage, full-bleed between nav bar and composer ---- */
.chat.text-only .video { display: none; }
.chat.text-only .chat-body { display: flex; flex-direction: column; }
.chat.text-only .text {
  flex: 1;
  min-height: 0;
  width: min(480px, calc(100% - 2.4rem));
  margin-inline: auto;
}

.text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conversation-box {
  flex: 1;
  overflow-y: auto;
  padding: var(--slm-space-3) var(--slm-space-2);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.conversation-box p { line-height: 1.4; }
.syslog { color: var(--slm-ink-dim); text-align: center; font-size: 0.85rem; margin-block: 0.3rem; }
.syslog.error { color: var(--slm-danger); }

/* ---- iMessage bubbles: colour, tails, grouping, timestamps ----
   chat-box.js#appendBubble is the single source of truth for the markup:
   a centered ".bubble-timestamp" caption starts every new group (same
   sender, within BUBBLE_GROUP_WINDOW_MS of the previous bubble -- a real
   time check, not just DOM adjacency, so this stays JS-driven rather
   than a pure :has() trick), and every bubble after the first in a run
   carries ".is-grouped". No per-message name label in 1:1 (identity
   lives in the nav bar now, same as real iMessage) -- appendBubble sets
   plain textContent, no .name span at all here; rooms
   (#room-conversation-box, many-to-many) still build their own
   .userlog>.name and are untouched. */
.userlog {
  position: relative;
  max-width: 78%;
  padding: 0.5rem 0.85rem;
  border-radius: 18px;
  font-size: 0.95rem;
}
.userlog.me {
  align-self: flex-end;
  background: var(--slm-accent);
  color: var(--slm-accent-ink);
  border-bottom-right-radius: 4px;
}
.userlog.stranger {
  align-self: flex-start;
  background: var(--slm-bubble-received-bg);
  color: var(--slm-bubble-received-ink);
  border-bottom-left-radius: 4px;
}
/* A continuation bubble (.is-grouped) sits closer to the one above and
   merges its top corner; the bubble it continues from (detected via
   :has() — the one and only part of grouping CSS can infer on its own)
   merges its bottom corner and loses its tail. */
.userlog.is-grouped { margin-top: 2px; }
.userlog.me.is-grouped { border-top-right-radius: 6px; }
.userlog.stranger.is-grouped { border-top-left-radius: 6px; }
.userlog.me:has(+ .userlog.me.is-grouped) { border-bottom-right-radius: 6px; }
.userlog.stranger:has(+ .userlog.stranger.is-grouped) { border-bottom-left-radius: 6px; }
/* Tail — every bubble gets one, except one immediately followed by a
   continuation of itself. */
.userlog.me::after, .userlog.stranger::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 9px;
  height: 11px;
}
.userlog.me::after { right: -5px; background: var(--slm-accent); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.userlog.stranger::after { left: -5px; background: var(--slm-bubble-received-bg); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.userlog.me:has(+ .userlog.me.is-grouped)::after,
.userlog.stranger:has(+ .userlog.stranger.is-grouped)::after { display: none; }
/* Small grey timestamp divider (owner spec) — centered, once per new
   group, same place real iMessage shows one. */
.bubble-timestamp {
  align-self: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--slm-ink-dim);
  margin-block: 0.35rem 0.1rem;
}

.reaction-log {
  align-self: center;
  font-size: 0.8rem;
  color: var(--slm-accent-2);
  font-weight: 700;
}

.photo-bubble {
  align-self: flex-start;
  display: grid;
  gap: 0.3rem;
  max-width: 220px;
}
.photo-bubble.me { align-self: flex-end; }
.photo-bubble img {
  border-radius: var(--slm-radius-sm);
  max-height: 220px;
  object-fit: cover;
}
.photo-bubble img.photo-blurred { filter: blur(22px) brightness(0.8); }
.photo-reveal {
  font-size: 0.75rem;
  background: var(--slm-glass-bg-strong);
  border: 1px solid var(--slm-glass-border);
  color: var(--slm-ink);
  border-radius: var(--slm-radius-sm);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}

/* interaction bar (reactions only now — report/block moved to the nav
   bar's "..." sheet, see .chat-menu-* below) */
.interaction-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--slm-space-1);
  padding: var(--slm-space-1) var(--slm-space-2);
}
.reaction-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* Icon-only reaction/continue chips — circular, same family as .icon-btn. */
.reaction-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Design-review fix 2026-11-18 (violation #3): measured live at
     33.6x33.6px, ~24% under the 44px tap-target minimum. */
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--slm-glass-border);
  background: transparent;
  color: var(--slm-ink-dim);
  cursor: pointer;
}
.reaction-chip .icon { width: 1rem; height: 1rem; }
.reaction-chip:hover { background: var(--slm-glass-bg-strong); color: var(--slm-ink); }
/* "Devam edelim" is the one place the single quiet accent is allowed to
   show up on an ordinary control — it's a positive, rare, end-of-chat
   action worth making visually distinct from the 3 plain reactions. */
.continue-chip { border-color: var(--slm-accent); color: var(--slm-accent); }

/* ---- composer: rounded pill + round icon-only send, pinned above the
   keyboard via visualViewport (chat-box.js#bindKeyboardAvoidance sets
   --slm-vvh on <html>; body.chat-open locks its own height to it so the
   flex column — and this composer, its last child — compresses to stay
   above the real visible viewport instead of the iOS keyboard covering
   it). ---- */
.write-box {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--slm-space-1);
  padding: var(--slm-space-2);
  padding-bottom: max(var(--slm-space-2), env(safe-area-inset-bottom));
}
.write-box textarea {
  flex: 1;
  resize: none;
  height: 40px;
  max-height: 120px;
  border: none;
  outline: none;
  background: var(--slm-glass-bg);
  color: var(--slm-ink);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
}
.write-box textarea::placeholder { color: var(--slm-ink-dim); }
.write-box:has(textarea:focus) textarea { box-shadow: inset 0 0 0 1.5px var(--slm-accent-2); }
.write-box .icon-btn-primary {
  flex: none;
  /* Design-review fix 2026-11-18 (violation #4): measured live at
     40x40px, under the 44px tap-target minimum. */
  width: 44px;
  height: 44px;
  border-radius: 999px;
}

/* #control ("Sıradaki"/"Başla") only makes sense for the 1:1 view — hide
   it while the Rooms tab is active instead of leaving a confusing control
   for a session the user isn't looking at. */
body:has(#view-rooms.is-active) #control { display: none; }

/* ---- video mode: FaceTime (partner full-screen, own video a PiP
   corner, bottom translucent controls bar, text docked as a sheet) ---- */
.chat:not(.text-only) .chat-body { overflow: hidden; }
.chat:not(.text-only) .video {
  position: absolute;
  inset: 0;
  width: min(480px, 100%);
  margin-inline: auto;
}
.video {
  position: relative; /* containing block for .stranger/.me/.facetime-controls below */
  display: grid;
  gap: var(--slm-space-2);
}
.video .stranger, .video .me {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--slm-radius-md);
  overflow: hidden;
  background: var(--slm-bg-3);
}
.chat:not(.text-only) .video .stranger {
  position: absolute;
  inset: 0;
  border-radius: 0;
  aspect-ratio: auto;
}
.chat:not(.text-only) .video .me {
  position: absolute;
  top: var(--slm-space-2);
  right: var(--slm-space-2);
  width: 92px;
  aspect-ratio: 3 / 4;
  border: 2px solid oklch(100% 0 0 / 0.5);
  box-shadow: 0 4px 16px oklch(10% 0 0 / 0.4);
  z-index: 4;
}
/* P0 fix 2026-11-18: the <video> must be positioned. .avatar-placeholder is
   position:absolute, and positioned boxes always paint ABOVE non-positioned
   ones whatever the DOM order, so a playing camera stayed hidden under the
   grey "S" placeholder on both tiles. z-index 1 keeps it under the controls
   bar, retry button and badges (z-index 4-5). */
.video video, .video audio {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease;
}
/* when a track really fails, show the placeholder/error state, not a black frame */
.me.media-error video, .stranger.media-error video { visibility: hidden; }
.stranger.loading .load-canvas { z-index: 2; }
/* Camera-off toggle (chat-client.js#toggleLocalVideo) — a disabled video
   track still paints a black frame, not a transparent one, so the <video>
   itself needs hiding to let the calm avatar-placeholder underneath show
   through instead of a black box. */
.me.cam-off video { display: none; }
/* Calm neutral placeholder (owner feedback 2026-11-17): camera loading/
   off/denied -- a fixed light grey regardless of the app's own dark/light
   theme (same spirit as a default avatar chip), icon-only by default,
   showing the real nickname's initial once known (Stage 2b,
   chat-box.js#setPartnerNickname/#setOwnAvatarInitial). Sits earlier in
   the DOM than any <video>/<audio> this tile ever gets, so a real stream
   simply paints over it (object-fit: cover, above) -- no class toggling
   needed on either side. */
.avatar-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--slm-space-1);
  background: #E5E5EA;
}
/* Found live (headless QA, 2026-11-17): on the full-screen FaceTime
   "stranger" tile, centering the placeholder in the WHOLE box put the
   avatar-initial uncomfortably close to the translucent controls bar
   near the bottom — padding the centering box by the reserved bottom
   chrome height keeps the avatar centered in the actually-visible video
   area instead, same as how a real FaceTime placeholder sits. Scoped to
   the full-screen stranger tile only — the small PiP "me" tile has no
   such reserved area and stays centered in its own small box.
   Design-review fix 2026-11-17: was padding by the FULL collapsed-chat-
   drawer height (up to 320px) even though the drawer is closed most of
   the time, leaving roughly the bottom half of the screen as dead grey
   space below the 3 control icons — now only clears the always-visible
   controls bar itself. */
.chat:not(.text-only) .video .stranger .avatar-placeholder {
  padding-bottom: var(--slm-facetime-controls-clear);
}
.avatar-placeholder .icon { width: 1.9rem; height: 1.9rem; color: #8E8E93; }
.avatar-placeholder .avatar-initial {
  font-size: 1.6rem;
  font-weight: 700;
  color: #8E8E93;
}
.avatar-placeholder:has(.avatar-initial:not(:empty)) .icon { display: none; }
/* Media-health fallback (owner P0, 2026-11-18, plans/selamlas.md): a real
   getUserMedia()/WebRTC track can resolve without ever actually decoding a
   frame (OS-level camera contention, a blocked autoplay, the partner's own
   network trouble) -- chat-client.js's watchMediaHealth() toggles this
   class instead of leaving the plain avatar-initial/person icon sitting
   there forever with no explanation. Both icon-error and the default
   person icon/initial are mutually exclusive via this one class. */
.avatar-placeholder .icon-error { display: none; width: 1.9rem; height: 1.9rem; color: #8E8E93; }
.avatar-placeholder .media-error-text {
  display: none;
  margin: 0;
  max-width: 85%;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: center;
  color: #8E8E93;
}
.me.media-error .avatar-placeholder .icon,
.me.media-error .avatar-placeholder .avatar-initial,
.stranger.media-error .avatar-placeholder .icon,
.stranger.media-error .avatar-placeholder .avatar-initial {
  display: none;
}
.me.media-error .avatar-placeholder .icon-error,
.stranger.media-error .avatar-placeholder .icon-error {
  display: block;
}
.stranger.media-error .avatar-placeholder .media-error-text { display: block; }
.own-media-retry-btn {
  position: absolute;
  bottom: var(--slm-space-2);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: oklch(100% 0 0 / 0.85);
}
.me.media-error .own-media-retry-btn { display: inline-flex; }
.load-canvas {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--slm-accent);
}
.stranger.loading .load-canvas { display: flex; }
/* Plain CSS spinner (Stage 2b icon drop — this screen no longer loads
   FontAwesome at all). */
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid oklch(100% 0 0 / 0.3);
  border-top-color: currentColor;
  animation: slm-spin 0.8s linear infinite;
}
/* Small variant — inline next to text (gate dialog's "verifying" spinner,
   design-review fix 2026-11-17, replaces the old FontAwesome fa-spinner). */
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
@keyframes slm-spin { to { transform: rotate(360deg); } }

/* No-flashing guard (owner rule 2026-11-17, see safety-guard.js): every
   incoming video call blurs for a fixed opening window, then stays
   auto-blurred live for as long as our own on-device classifier keeps
   flagging that stream as nudity. Pure local CSS — never touches what
   the partner actually sends. */
.stranger.nsfw-blur-timed video, .stranger.nsfw-blur-live video {
  filter: blur(28px) brightness(0.75);
}
.stranger.nsfw-blur-timed::after, .stranger.nsfw-blur-live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: oklch(10% 0 0 / 0.25);
}
.mic-only-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  text-align: center;
  color: var(--slm-ink);
  background: oklch(15% 0 0 / 0.6);
  border-radius: var(--slm-radius-sm);
  padding: 0.3rem;
}
.chat:not(.text-only) .mic-only-badge { bottom: calc(var(--slm-facetime-controls-clear) + var(--slm-space-2)); }

/* Bottom translucent controls bar (owner spec: FaceTime mode) — mic/
   camera toggle + the text-panel drawer toggle.
   Design-review fix 2026-11-17: two real bugs here.
   1) Dead space — this used to sit at `bottom: var(--slm-facetime-text-h)`
      (up to 320px above the real bottom edge) ALWAYS, even though the
      chat drawer it was reserving room for is collapsed 95% of the time —
      leaving the whole lower half of the screen empty grey canvas below
      the icons. Now pinned near the actual bottom edge, safe-area aware,
      same as a real FaceTime call.
   2) "Floating bare circles, not a bar" — each button used to carry its
      own individual blur/background with nothing visually joining them.
      Now wrapped in one real pill-shaped translucent bar container (this
      rule), with the buttons themselves transparent on top of it.
   --slm-facetime-controls-clear is the total vertical space this bar
   (+ its safe-area padding) occupies, reused by the avatar placeholder/
   mic-only badge above so nothing else needs to reserve the old 320px. */
:root {
  --slm-facetime-text-h: min(42dvh, 320px);
  --slm-facetime-controls-clear: calc(76px + max(var(--slm-space-3), env(safe-area-inset-bottom)));
}
.facetime-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(var(--slm-space-3), env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--slm-space-3);
  width: fit-content;
  max-width: calc(100% - 2.4rem);
  margin-inline: auto;
  padding: var(--slm-space-2) var(--slm-space-3);
  border-radius: 999px;
  background: oklch(14% 0 0 / 0.42);
  border: 1px solid oklch(100% 0 0 / 0.14);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.facetime-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
}
.facetime-btn .icon { width: 1.3rem; height: 1.3rem; }
/* Each mic/camera toggle ships both states as two stacked SVGs — CSS
   shows exactly one, keyed off the button's own [data-muted]/[data-off]
   attribute (chat-box.js#bindFaceTimeControls), never a class on <body>
   so each tile's own on/off state is independent of the other. */
.facetime-icon-off { display: none; }
.facetime-btn[data-muted="true"] .facetime-icon-on,
.facetime-btn[data-off="true"] .facetime-icon-on { display: none; }
.facetime-btn[data-muted="true"] .facetime-icon-off,
.facetime-btn[data-off="true"] .facetime-icon-off { display: block; }
.facetime-btn[data-muted="true"], .facetime-btn[data-off="true"] { background: oklch(50% 0.18 25 / 0.75); }
#video-chat-toggle-btn[aria-expanded="true"] { background: var(--slm-accent); }

/* Text panel docked as a translucent sheet over the lower part of the
   video (owner spec: controls bar + the rest stays a real, working chat
   underneath — nothing removed, just not the resting view during a
   call). Collapsed by default (0 height, content still in the DOM so
   nothing needs re-rendering when it opens); #video-chat-toggle-btn
   above toggles .is-open.
   Design-review fix 2026-11-17: this used to sit flush at `bottom: 0`,
   directly underneath the controls bar with zero gap — the opening
   system message (top of this panel's content, same edge the controls
   bar's bottom edge touched) rendered right up against the mic/camera/
   chat icons, "clipped"/illegible the instant the drawer opened. Now
   anchored ABOVE the controls bar (bottom offset = the bar's own
   reserved height) with explicit clearance, so the two can never
   overlap regardless of viewport/safe-area rounding. */
.chat:not(.text-only) .text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--slm-facetime-controls-clear);
  z-index: 2;
  width: min(480px, 100%);
  margin-inline: auto;
  height: 0;
  border-radius: var(--slm-radius-lg) var(--slm-radius-lg) 0 0;
  background: var(--slm-glass-bg-strong);
  backdrop-filter: blur(var(--slm-glass-blur)) saturate(1.3);
  transition: height 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
.chat:not(.text-only) .text.is-open { height: var(--slm-facetime-text-h); }
@media (prefers-reduced-motion: reduce) {
  .chat:not(.text-only) .text { transition: none; }
}

/* ---------- rooms ---------- */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--slm-space-3);
  max-width: 900px;
  /* Real bug caught live (2026-11-17, Stage 2a, headless-browser check):
     now that .view is a flex column (for the full-bleed shell), an
     `auto` cross-axis margin on a flex item opts it OUT of the default
     stretch alignment and back to its own content size -- for this
     auto-fit grid that meant sizing to as many 180px+ columns as would
     fit unconstrained (777px measured in a 352px-wide shell) instead of
     the real available width. Explicit width:100% restores the stretch;
     max-width + margin-inline:auto still centers it on a wide screen. */
  width: 100%;
  margin: var(--slm-space-4) auto 0;
}
/* iOS-Home-Screen-style tile: one icon, one short name underneath — icon
   first, never an instructional verb on the control. Design-review fix
   2026-11-17: dropped .glass-panel (its box-shadow + heavy blur read as
   "a shadowed white card on a grey background", a milder recurrence of
   the floating-card look) — flat fill + hairline border only, same
   grammar as .loop-row/.loop-list. */
.room-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--slm-space-1);
  padding: var(--slm-space-3);
  cursor: pointer;
  color: var(--slm-ink);
  text-align: center;
  background: var(--slm-glass-bg);
  border: 1px solid var(--slm-glass-border);
  border-radius: var(--slm-radius-md);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.room-card:hover { background: var(--slm-glass-bg-strong); }
.room-icon { width: 1.6rem; height: 1.6rem; color: var(--slm-ink-dim); }
.room-name { font-weight: 700; font-size: 0.95rem; }
.room-badge {
  font-size: 0.72rem;
  color: var(--slm-ink-dim);
  border: 1px solid var(--slm-glass-border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.room-chat {
  max-width: 700px;
  /* width:100% — same flex-item auto-margin-vs-stretch fix as
     .rooms-grid above; this is .view's other direct child. */
  width: 100%;
  margin: var(--slm-space-3) auto 0;
  display: flex;
  flex-direction: column;
  min-height: 55vh;
  max-height: 70vh;
  overflow: hidden;
}
.room-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--slm-space-2) var(--slm-space-3);
  border-bottom: 1px solid var(--slm-glass-border);
}
.room-chat-title { font-weight: 700; }
#room-conversation-box {
  flex: 1;
  overflow-y: auto;
  padding: var(--slm-space-3);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#room-conversation-box .userlog .name { color: var(--slm-accent-2); }
#room-message-input {
  flex: 1;
  resize: none;
  height: 44px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--slm-ink);
  font-family: inherit;
  padding: 0.5rem;
}
#room-chat .write-box {
  border-top: 1px solid var(--slm-glass-border);
  padding: var(--slm-space-2);
}

/* ---------- growth loops: daily topic, streak, share card ---------- */
/* One row = one quiet icon + plain content text + (optionally) one
   icon-only action. Neutral only: no accent, no fill, so Başla stays the
   single loud control on the start screen. */
.loop-row {
  display: flex;
  align-items: center;
  gap: var(--slm-space-2);
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--slm-glass-border);
  border-radius: var(--slm-radius-md);
}
.loop-row[hidden] { display: none; }

/* iOS-style inset-grouped list (lead review 2026-11-17: "make the daily
   topic and the invite light iOS inset-grouped list rows, no heavy
   borders"). One rounded, quietly-filled container; each .loop-row inside
   loses its own border/background and gets a hairline separator instead,
   same grammar as a Settings.app grouped table. Scoped to #loop-list so
   the standalone .loop-row used inside .conversation-box (today's-topic
   chat bubble) keeps its own existing card look untouched. */
.loop-list {
  border-radius: var(--slm-radius-md);
  overflow: hidden;
  border: 1px solid var(--slm-glass-border);
  background: var(--slm-glass-bg);
}
.loop-list .loop-row {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--slm-glass-border);
}
.loop-list .loop-row:last-child { border-bottom: none; }
.loop-icon { color: var(--slm-ink-dim); width: 1.4rem; text-align: center; flex: none; }
.loop-text { flex: 1; font-size: 0.95rem; font-weight: 600; line-height: 1.35; color: var(--slm-ink); }
.loop-row .icon-btn { flex: none; font-size: 0.95rem; }
/* The same row inside a chat: today's topic as a tap-to-send first
   message, and the once-per-session streak share offer after a chat. */
.conversation-box .loop-row { align-self: center; width: min(100%, 30rem); margin-block: 0.3rem; }
.conversation-box .loop-text { font-size: 0.9rem; }

/* A page opened from an invite link: the friend already picked how to
   chat, so only the arrival line and Başla are left. */
/* A page opened from an invite link (Stage 2a 2026-11-17: moved from a
   .setup-panel.is-invited scope to body.is-invited — the mode
   picker/label now live in #start-bar, a sibling of #setup-panel, not a
   descendant of it): the friend already picked how to chat, so only the
   arrival line and Başla are left. */
body.is-invited #setup-panel .field,
body.is-invited #daily-topic,
body.is-invited #streak-line,
body.is-invited #invite-row,
body.is-invited .start-bar-label,
body.is-invited .mode-segment { display: none; }
.invite-link-row .loop-text { font-weight: 500; font-size: 0.8rem; overflow-wrap: anywhere; }

.share-dialog { width: min(360px, calc(100vw - 2rem)); padding: var(--slm-space-3); }
.share-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--slm-radius-md);
  border: 1px solid var(--slm-glass-border);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  translate: -50% 12px;
  background: var(--slm-glass-bg-strong);
  border: 1px solid var(--slm-glass-border);
  backdrop-filter: blur(var(--slm-glass-blur));
  color: var(--slm-ink);
  padding: 0.6rem 1.1rem;
  border-radius: var(--slm-radius-sm);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s ease, translate 0.2s ease;
  z-index: 60;
}
.toast.is-visible { opacity: 1; translate: -50% 0; }

/* ---------- view transitions ---------- */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 0.22s;
}

/* ---------- small screens ---------- */
/* The shell is mobile-first by default now (Stage 2a, 2026-11-17) — the
   .container/.start-bar max-width is already 480px everywhere, so there
   is no separate "shrink the desktop layout" pass to do here. The one
   real narrow-screen fix left: on a genuinely small phone the online
   count would otherwise crowd the lang/control icons in the topbar. */
@media (max-width: 360px) {
  .online-count { display: none; }
}
