/* ============================================================
   Bystander — chat-simulatie
   Eigen visuele taal (géén WhatsApp-kopie):
   - Donker slate-teal header
   - Warm papier achtergrond
   - Salie-groen voor uitgaande bubbels
   - Wit voor inkomende bubbels
   ============================================================ */

:root {
  --header-bg: #1f2d33;
  --header-fg: #f5f1ea;
  --bg-chat: #ece8df;
  --bg-app: #d8d3c7;
  --bubble-in: #ffffff;
  --bubble-out: #cfe1c9;
  --bubble-sys: #fff6d6;
  --text: #1a2126;
  --text-muted: #6a7079;
  --accent: #2f6b58;
  --danger: #b8423a;
  --avatar-1: #c97a4b;  /* Daan */
  --avatar-2: #4a7faa;  /* Yusuf */
  --avatar-3: #a85a8a;  /* Lisa */
  --avatar-4: #7a8c4e;  /* Sam */
  --avatar-me: #4f5d65; /* speler */
  --shadow-card: 0 1px 0 rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  overscroll-behavior: none;
}

/* ===== App shell — mobile-first, centred on desktop ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg-chat);
  position: relative;
  overflow: hidden;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--header-bg);
  color: var(--header-fg);
  flex: 0 0 auto;
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
}
.header-sub {
  font-size: 12px;
  opacity: .7;
  margin-top: 2px;
}
.header-avatars {
  display: flex;
  margin-left: auto;
}
.header-avatars .avatar {
  width: 28px; height: 28px;
  font-size: 11px;
  margin-left: -8px;
  border: 2px solid var(--header-bg);
}
.header-sound {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--header-fg);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: grid; place-items: center;
  margin-left: 8px;
}
.header-sound:active { transform: scale(.95); }

/* ===== Avatars ===== */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 auto;
  letter-spacing: .3px;
}
.avatar-daan  { background: var(--avatar-1); }
.avatar-yusuf { background: var(--avatar-2); }
.avatar-lisa  { background: var(--avatar-3); }
.avatar-sam   { background: var(--avatar-4); }
.avatar-me    { background: var(--avatar-me); }

/* ===== Chat feed ===== */
.feed {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.4), transparent 40%),
    var(--bg-chat);
  -webkit-overflow-scrolling: touch;
}

.day-divider {
  align-self: center;
  background: rgba(255,255,255,.7);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 10px;
  margin: 6px 0 10px;
  box-shadow: var(--shadow-card);
}

/* Row groups one or more bubbles by author */
.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 6px;
  max-width: 100%;
}
.row.me { justify-content: flex-end; }
.row .avatar { width: 28px; height: 28px; font-size: 11px; opacity: 0; }
.row.show-avatar .avatar { opacity: 1; }
.row.me .avatar { display: none; }

/* Stack of bubbles per row */
.bubbles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 78%;
}

/* Bubble */
.bubble {
  background: var(--bubble-in);
  padding: 7px 11px 6px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  position: relative;
  animation: pop .18s ease-out;
  font-size: 14.5px;
}
.bubble.me { background: var(--bubble-out); }
.bubble .name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--accent);
}
.bubble.me .name { display: none; }
.bubble .time {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: 8px;
  float: right;
  margin-top: 4px;
  position: relative;
  top: 2px;
}

/* Tail on first bubble of a group */
.row .bubbles .bubble:first-child:not(.no-tail) {
  border-top-left-radius: 4px;
}
.row.me .bubbles .bubble:first-child:not(.no-tail) {
  border-top-left-radius: 10px;
  border-top-right-radius: 4px;
}

/* System message — for 112 calls etc */
.row.sys {
  justify-content: center;
  margin: 8px 0;
}
.row.sys .bubbles { max-width: 90%; }
.bubble.sys {
  background: var(--bubble-sys);
  text-align: center;
  font-size: 13px;
  color: #4a3b15;
  border: 1px solid #f0e3a8;
  font-style: italic;
}

/* Typing indicator */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}
.typing span {
  width: 6px; height: 6px;
  background: #9aa1a8;
  border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Composer ===== */
.composer {
  flex: 0 0 auto;
  border-top: 1px solid rgba(0,0,0,.06);
  background: #f3efe6;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.intent-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.intent-btn {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 18px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background .12s, transform .08s;
}
.intent-btn:hover { background: #fafaf6; }
.intent-btn:active { transform: scale(.97); background: #efece4; }
.intent-btn.alarm {
  background: #fff;
  border-color: rgba(184,66,58,.3);
  color: var(--danger);
  font-weight: 600;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.input-row textarea {
  flex: 1;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  line-height: 1.3;
  color: var(--text);
  min-height: 40px;
}
.input-row textarea:focus { outline: none; border-color: var(--accent); }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex: 0 0 auto;
  display: grid; place-items: center;
  transition: transform .08s, background .12s;
}
.send-btn:hover { background: #25543f; }
.send-btn:active { transform: scale(.92); }
.send-btn:disabled { background: #b6c2bd; cursor: default; }

/* ===== Start screen ===== */
.start-screen, .end-screen, .news-popup {
  position: absolute;
  inset: 0;
  background: var(--bg-chat);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  overflow-y: auto;
}
.start-screen h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 60px 0 6px;
  letter-spacing: -.3px;
}
.start-screen .lead {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 36px;
  max-width: 320px;
  line-height: 1.5;
}
.start-screen .preview {
  margin: 12px 0 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}
.start-screen .preview-avatars { display: flex; }
.start-screen .preview-avatars .avatar {
  margin-left: -10px;
  border: 2px solid #fff;
  width: 36px; height: 36px;
  font-size: 13px;
}
.start-screen .preview-avatars .avatar:first-child { margin-left: 0; }
.start-screen .preview-text {
  font-size: 13px;
  color: var(--text-muted);
}
.start-screen .preview-text strong {
  color: var(--text);
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.field label {
  font-size: 13px;
  color: var(--text-muted);
}
.field input {
  background: #fff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,.06);
}
.toggle-label { font-size: 14px; }
.toggle-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.switch {
  position: relative;
  width: 44px; height: 26px;
  background: #cdd2d6;
  border-radius: 13px;
  cursor: pointer;
  transition: background .15s;
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.primary-btn {
  margin-top: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.primary-btn:hover { background: #25543f; }
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { background: #b6c2bd; cursor: default; }

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}
.secondary-btn:hover { background: rgba(0,0,0,.04); }

/* ===== End screen ===== */
.end-screen h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -.2px;
}
.end-screen .end-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--text-muted);
  margin: 32px 0 4px;
  font-weight: 600;
}
.end-screen .end-block {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  margin-top: 10px;
  box-shadow: var(--shadow-card);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.end-screen .end-block p { margin: 0 0 10px; }
.end-screen .end-block p:last-child { margin-bottom: 0; }
.end-screen .timeline-row {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.end-screen .timeline-row:last-child { border-bottom: none; }
.end-screen .timeline-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 52px;
  font-weight: 500;
}
.end-screen .timeline-text {
  flex: 1;
  font-size: 14px;
}
.end-screen .lesson-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.end-screen .lesson-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: 14.5px;
}
.end-screen .lesson-list li:last-child { border-bottom: none; }

/* ===== News popup (outcome C) ===== */
.news-popup {
  background: rgba(20,25,30,.85);
  padding: 28px 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .35s ease-out;
}
.news-card {
  background: #fafaf7;
  border-radius: 4px;
  max-width: 380px;
  width: 100%;
  padding: 26px 22px;
  font-family: Georgia, "Times New Roman", serif;
  border-top: 4px solid #1a1a1a;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.news-card .masthead {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.2px;
  margin-bottom: 4px;
  color: #1a1a1a;
}
.news-card .news-meta {
  font-family: -apple-system, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #777;
  margin-bottom: 18px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 14px;
}
.news-card .news-headline {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  color: #1a1a1a;
}
.news-card .news-body {
  font-size: 14px;
  line-height: 1.55;
  color: #333;
}
.news-card .news-close {
  margin-top: 22px;
  font-family: -apple-system, sans-serif;
  font-size: 13px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mark of the player's name in chat */
.you-tag { color: var(--avatar-me); font-weight: 600; }

/* Scrollbar */
.feed::-webkit-scrollbar { width: 4px; }
.feed::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }

/* ============================================================
   v2 additions — language picker, fase-knoppen fade,
   system-status bubble, header-status, ghost-typing styling.
   ============================================================ */

/* ===== Language picker (uitrolmenu) ===== */
.lang-picker {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  user-select: none;
}
.lang-current {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.1);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px 7px 9px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background .12s, border-color .12s;
}
.lang-current:hover { border-color: var(--accent); }
.lang-flag { font-size: 15px; line-height: 1; }
.lang-caret {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 2px;
  transition: transform .15s;
}
.lang-picker.open .lang-caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  list-style: none;
  margin: 0;
  padding: 4px;
  z-index: 6;
  animation: fadeIn .15s ease-out;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
}
.lang-option:hover { background: #f3efe6; }
.lang-option.active {
  background: rgba(47,107,88,.08);
  color: var(--accent);
  font-weight: 600;
}

/* ===== Intent-row fade swap (fase-overgang) ===== */
.intent-row {
  transition: opacity .18s ease, transform .18s ease;
}
.intent-row.fade-swap {
  opacity: 0;
  transform: translateY(4px);
}
.intent-btn {
  transition: background .12s, transform .08s, opacity .25s ease;
}

/* ===== System messages — status variant (klein, grijs) ===== */
.row.sys-status {
  margin: 6px 0 4px;
}
.row.sys-status .bubbles { max-width: 95%; }
.bubble.sys-status-bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
  text-align: center;
  padding: 3px 8px;
  letter-spacing: .2px;
}

/* ===== Header status — Daan online/offline ===== */
.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.header-sub {
  font-size: 12px;
  opacity: .7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-sub .status-dim {
  opacity: .85;
  font-style: italic;
}

/* ===== Ghost typing — geen visuele aanpassing nodig; default typing-row volstaat ===== */



/* ============================================================
   v3 additions — multi-screen flow, overlays, breath, etc.
   ============================================================ */

/* App becomes the host for all screens; only one shown at a time */
.app { position: relative; }

.screen[hidden] { display: none !important; }

/* Generic screen container — fills the app, scrollable */
.screen {
  position: absolute;
  inset: 0;
  background: var(--bg-app);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.screen.chat-screen { z-index: 0; padding: 0; background: var(--bg-chat); }

.screen-inner {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.screen-inner.narrow { max-width: 360px; padding-top: 56px; }
.screen-inner.centered { align-items: stretch; text-align: left; }

/* ===== Language dropdown on start ===== */
.lang-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -16px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.lang-select {
  background: #fff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

/* ===== Start screen content ===== */
.start-screen h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.4px;
  margin: 20px 0 6px;
}
.start-screen .lead {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 28px;
}
.preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  margin: 0 0 24px;
}
.preview-avatars { display: flex; }
.preview-avatars .avatar {
  margin-left: -10px;
  border: 2px solid #fff;
  width: 36px; height: 36px;
  font-size: 13px;
}
.preview-avatars .avatar:first-child { margin-left: 0; }
.preview-text { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.preview-text strong { color: var(--text); font-size: 14.5px; font-weight: 600; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 13px;
  color: var(--text-muted);
}
.field input {
  background: #fff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  margin: 0 0 24px;
  border: 1px solid rgba(0,0,0,.06);
}
.toggle-label { font-size: 14px; }
.toggle-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.switch {
  position: relative;
  width: 44px; height: 26px;
  background: #cdd2d6;
  border-radius: 13px;
  cursor: pointer;
  transition: background .15s;
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

/* ===== Buttons ===== */
.primary-btn {
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, transform .08s;
  width: 100%;
}
.primary-btn:hover { background: #25543f; }
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { background: #b6c2bd; cursor: default; }

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
}
.secondary-btn:hover { background: rgba(0,0,0,.04); }

.text-link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 14px;
  padding: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: center;
}
.text-link-btn:hover { color: var(--text); }

/* ===== Opt-in / opt-out / check / breath / resources / facilitators ===== */
.optin-screen h2, .optout-screen h2, .check-screen h2,
.breath-screen h2, .resources-screen h2, .facilitators-screen h2,
.end-screen h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.2px;
  margin: 0 0 14px;
}
.optin-screen p, .optout-screen p, .check-screen p,
.resources-screen p, .facilitators-screen p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 14px;
}
.muted-p { color: var(--text-muted); }
.small { font-size: 13px; }

/* Opt-out simple layout */
.optout-screen .screen-inner { justify-content: center; }

/* Resources cards */
.res-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  margin: 8px 0;
}
.res-card-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.res-card-num {
  display: inline-block;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  margin: 2px 0;
}
.res-card-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Facilitators */
.facilitators-screen h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--text);
}
.fac-list { margin: 0 0 4px; padding-left: 20px; }
.fac-list li { font-size: 14px; line-height: 1.55; margin-bottom: 6px; color: var(--text); }

/* ===== Breathing exercise ===== */
.breath-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 0;
  min-height: 280px;
}
.breath-orb {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .85;
  transform: scale(.5);
  transition: transform 4s ease-in-out, opacity 4s ease-in-out;
}
.breath-orb.expanded { transform: scale(1); opacity: 1; }
.breath-orb.exhale   { transition: transform 6s ease-in-out, opacity 6s ease-in-out; transform: scale(.5); opacity: .6; }
.breath-label {
  font-size: 22px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: .5px;
}
.breath-counter {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ===== Pause / generic overlays ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,20,25,.65);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .25s ease-out;
}
.overlay[hidden] { display: none !important; }
.overlay-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 22px 18px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.overlay-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}
.overlay-card .muted-p { margin: 0 0 16px; font-size: 14px; }

/* ===== Chat header stop button ===== */
.header { gap: 10px; }
.header-text { display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; }
.header-avatars { margin-left: 8px; }
.header-stop {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--header-fg);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.header-stop:hover { background: rgba(255,255,255,.14); }
.header-stop:active { transform: scale(.95); }

/* Send button svg fix */
.send-btn svg { display: block; }

/* ===== Chat screen overrides — make it fill app properly ===== */
.chat-screen {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.chat-screen .feed { flex: 1 1 auto; min-height: 0; }
.chat-screen .composer { flex: 0 0 auto; }

/* Sys-status (offline/last-seen) — small grey */
.row.sys-status .bubble.sys-status-bubble,
.bubble.sys-status-bubble {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-style: italic;
  padding: 4px 8px !important;
  box-shadow: none !important;
}

/* ===== End screen tweaks ===== */
.end-screen .end-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin: 22px 0 4px;
  font-weight: 600;
}
.end-screen .end-block {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 6px;
  box-shadow: var(--shadow-card);
  font-size: 14.5px;
  line-height: 1.55;
}
.end-screen .end-block p { margin: 0 0 10px; }
.end-screen .end-block p:last-child { margin-bottom: 0; }
.end-screen .timeline-row {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.end-screen .timeline-row:last-child { border-bottom: none; }
.end-screen .timeline-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 52px;
  font-weight: 500;
}
.end-screen .timeline-text { flex: 1; font-size: 14px; }
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: 14.5px;
}
.lesson-list li:last-child { border-bottom: none; }

/* ===== Intent buttons — fade between phases ===== */
.intent-row { transition: opacity .25s ease; }
.intent-row.fading { opacity: 0; }
.intent-btn.alarm {
  background: #fff;
  border-color: rgba(184,66,58,.3);
  color: var(--danger);
  font-weight: 600;
}
.intent-btn.urgent {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}
.intent-btn.urgent:hover { background: #9d3933; }

/* ===== News popup — already styled below, keep ===== */
.overlay.news-popup { background: rgba(20,25,30,.85); }

/* keyframes */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }


/* ============================================================
   RTL support (Arabic, etc.)
   ============================================================ */
[dir="rtl"] body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Geeza Pro", "Arabic UI Text", sans-serif; }

/* Header — avatars stack from the other side */
[dir="rtl"] .header-avatars { margin-left: 0; margin-right: auto; }
[dir="rtl"] .header-avatars .avatar { margin-left: 0; margin-right: -8px; }
[dir="rtl"] .header-avatars .avatar:first-child { margin-right: 0; }

/* Preview avatars */
[dir="rtl"] .preview-avatars .avatar { margin-left: 0; margin-right: -10px; }
[dir="rtl"] .preview-avatars .avatar:first-child { margin-right: 0; }

/* Time stamp inside bubbles — flip the float */
[dir="rtl"] .bubble .time { float: left; margin-left: 0; margin-right: 8px; }

/* Language row — keep dropdown visually on the start side */
[dir="rtl"] .lang-row { justify-content: flex-start; }

/* Composer send button & textarea — let flexbox flip naturally,
   no override needed because we use gap-based flex. */

/* Numeric phone numbers — keep LTR for readability */
[dir="rtl"] .res-card-num { direction: ltr; text-align: right; }

/* Lesson list bullets — flip indent */
[dir="rtl"] .fac-list { padding-left: 0; padding-right: 20px; }

/* End screen timeline — flip min-width side */
[dir="rtl"] .end-screen .timeline-time { text-align: left; }
