@font-face {
  font-family: "Mobily Text";
  src: url("/web/mobily/fonts/Mobily_Text_v7-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Mobily Text";
  src: url("/web/mobily/fonts/Mobily_Text_v7-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Mobily Headline";
  src: url("/web/mobily/fonts/Mobily_Headline_v7-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #000050;
  --ink-62: rgba(0, 0, 80, 0.62);
  --ink-50: rgba(0, 0, 80, 0.5);
  --ink-15: rgba(0, 0, 80, 0.15);
  --action: #1061ff;
  --action-tint: rgba(16, 97, 255, 0.08);
  --action-line: rgba(16, 97, 255, 0.35);
  --action-line-soft: rgba(16, 97, 255, 0.28);
  --scooter: #30b7c4;

  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --radius-4: 4px;
  --radius-12: 12px;
  --radius-14: 14px;
  --radius-24: 24px;
  --radius-full: 999px;

  --font-text: "Mobily Text", "SF Arabic", "Geeza Pro", system-ui, sans-serif;
  --font-head: "Mobily Headline", "Mobily Text", "SF Arabic", system-ui, sans-serif;

  --page-bg: #eef3f8;
  --page-ink: #0b1630;
  --page-muted: #5b6785;
  --page-panel: #ffffff;
  --page-line: #dbe3ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--page-bg);
  color: var(--page-ink);
  font-family: var(--font-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* ---------- Phone ---------- */
.phone-slot { flex-shrink: 0; }

.phone {
  position: relative;
  width: 390px;
  height: 885px;
  overflow: hidden;
  background: #fff;
  border-radius: 44px;
  box-shadow: 0 30px 80px rgba(0, 0, 80, 0.18), 0 0 0 10px #0b1630, 0 0 0 11px #2a3550;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top left;
  color: var(--ink);
}

.bg-mobily {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(198.8deg, #fff 13.04%, #fff 32.17%, #f2feff 43.48%, #e6fcfe 56.52%, #cdfafe 69.57%, #abf7fd 82.61%, #7ff1fc 100%);
}

/* Wave */
.wave {
  position: absolute;
  left: 0;
  width: 390px;
  height: 885px;
  overflow: hidden;
  pointer-events: none;
  transition: top 600ms cubic-bezier(.2, .7, .2, 1);
}
.wave .aurora {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -2.31%;
  right: -2.31%;
  opacity: 0;
  transform-origin: 50% 47.46%; /* wave centre line: y = 420 of 885 */
  will-change: transform, opacity;
}
.wave .aurora img { display: block; width: 100%; height: 100%; max-width: none; }
.wave .wave-lines { position: absolute; inset: 0; overflow: hidden; }

/* Status bar */
.statusbar {
  position: relative;
  width: 100%;
  height: 43px;
  flex-shrink: 0;
}
.statusbar .time {
  position: absolute;
  left: 16.64px;
  top: 13px;
  font-family: "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.statusbar img { position: absolute; right: 16.64px; top: 16px; }

/* Co-brand */
.cobrand {
  position: absolute;
  left: 20px;
  top: 88px;
  width: 350px;
  height: 34px;
}
.cobrand .mobily { position: absolute; left: 0; top: 0; width: 88.533px; height: 34px; }
.cobrand .at { position: absolute; right: 0; top: 3px; width: 110px; height: 28px; }

/* Stage */
.stage {
  position: relative;
  width: 100%;
  height: 688px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-20);
  padding-bottom: 44px;
}
.stage.enter > * { animation: rise 420ms cubic-bezier(.2, .7, .2, 1) both; }
.stage.enter > *:nth-child(2) { animation-delay: 80ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Glass surfaces */
.identity {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-full);
  box-shadow: 0 6px 18px rgba(16, 97, 255, 0.12);
  padding: 10px 20px 12px;
  font-size: 14px;
  line-height: 21px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.bubble, .card {
  width: 345px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 32px rgba(16, 97, 255, 0.14);
  overflow: hidden;
  text-align: right;
}
.bubble {
  border-radius: var(--radius-12);
  padding: var(--space-12) var(--space-16);
  font-size: 14px;
  line-height: 21px;
}
.card {
  border-radius: var(--radius-24);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-12);
}
.card.tight { gap: var(--space-8); }
.card.center { align-items: center; text-align: center; }

.t-head { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 22px; }
.t-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; line-height: 32px; }
.t-body { font-size: 14px; line-height: 21px; }
.t-label { font-weight: 700; font-size: 14px; line-height: 20px; }
.t-cap { font-size: 12px; line-height: 16px; color: var(--ink-62); }
.t-cap-50 { font-size: 12px; line-height: 16px; color: var(--ink-50); }

.divider { height: 1px; background: var(--ink-15); width: 100%; }

/* Therapist header */
.person {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  height: 72px;
}
.person.exercise { height: 89px; }
.person .info { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); }
.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.08);
  object-fit: cover;
  flex-shrink: 0;
}

/* Chips */
.chips { display: flex; gap: var(--space-8); }
.chip {
  background: #fff;
  border: 1px solid var(--action-line-soft);
  border-radius: var(--radius-full);
  box-shadow: 0 1px 3px rgba(0, 0, 80, 0.08);
  padding: 10px 16px;
  font-size: 14px;
  line-height: 21px;
  white-space: nowrap;
  transition: background 150ms, border-color 150ms, box-shadow 150ms, transform 120ms;
}
.chip:hover { border-color: var(--action-line); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] {
  background: var(--action-tint);
  border-color: var(--action-line);
  box-shadow: none;
}
.chip.sm {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  background: var(--action-tint);
  border-color: var(--action-line);
  box-shadow: none;
  cursor: default;
}

/* Primary button */
.btn {
  height: 48px;
  width: 100%;
  border-radius: var(--radius-14);
  background: var(--action);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  transition: filter 150ms, transform 120ms, opacity 150ms;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

/* Steps */
.steps { display: flex; flex-direction: column; gap: var(--space-8); }
.step { display: flex; align-items: center; gap: var(--space-12); }
.step p { flex: 1; font-size: 14px; line-height: 21px; }
.badge {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--action-tint);
  border: 1px solid var(--action-line);
  display: grid;
  place-items: center;
  color: var(--action);
  font-weight: 700;
  font-size: 12px;
  line-height: 16px;
  transition: background 200ms, color 200ms, transform 200ms;
}
.step.active .badge { background: var(--action); color: #fff; transform: scale(1.1); }
.step.active p { font-weight: 700; }

/* Success */
.check-circle, .icon-circle {
  border-radius: var(--radius-full);
  background: var(--action-tint);
  border: 1px solid var(--action-line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.check-circle { width: 48px; height: 48px; animation: pop 500ms cubic-bezier(.3, 1.6, .5, 1) both 150ms; }
.icon-circle { width: 44px; height: 44px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

.details { width: 100%; display: flex; flex-direction: column; gap: var(--space-8); }
.row { display: flex; align-items: center; justify-content: space-between; white-space: nowrap; min-height: 21px; }
.row.tall { height: 29px; }
.row .v { font-size: 14px; line-height: 21px; }

.reminder {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: 8px var(--space-12);
  border-radius: var(--radius-12);
  background: var(--action-tint);
  border: 1px solid var(--action-line);
}

/* Content item */
.item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  height: 74px;
  padding: var(--space-12);
  border-radius: var(--radius-12);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--action-line-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 80, 0.08);
}
.item .info { flex: 1; display: flex; flex-direction: column; gap: var(--space-4); }
.thumb { width: 48px; height: 48px; border-radius: var(--radius-4); object-fit: cover; flex-shrink: 0; }

.spread { display: flex; align-items: center; justify-content: space-between; }

/* Moods */
.moods { display: flex; justify-content: space-between; align-items: flex-start; }
.mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  border-radius: 14px;
  padding: 0;
  transition: transform 160ms;
}
.mood .face { position: relative; width: 48px; height: 48px; transition: transform 200ms, filter 200ms; }
.mood .face img { position: absolute; inset: 0; width: 100%; height: 100%; }
.mood .face.great img { inset: -11.25% -17.5% -23.75% -17.5%; width: auto; height: auto; }
.mood[data-key="good"] .face { filter: drop-shadow(0 3px 4.2px rgba(153, 204, 102, .35)); }
.mood[data-key="okay"] .face { filter: drop-shadow(0 3px 4.2px rgba(229, 191, 89, .35)); }
.mood[data-key="low"] .face { filter: drop-shadow(0 3px 4.2px rgba(255, 178, 102, .35)); }
.mood[data-key="bad"] .face { filter: drop-shadow(0 3px 4.2px rgba(255, 140, 115, .35)); }
.mood:hover .face { transform: scale(1.06); }
.mood[aria-pressed="true"] .face { transform: scale(1.14); }
.mood[aria-pressed="true"] .t-cap { color: var(--ink); font-weight: 700; }

.mood-summary { display: flex; align-items: center; gap: 8px; }
.mood-summary .face-sm { width: 34px; height: 34px; filter: drop-shadow(0 2.1px 3px rgba(229, 191, 89, .35)); }

/* Transcript */
.turn { display: flex; flex-direction: column; gap: var(--space-2); }
.turn.tall { height: 72px; }
.turn .who { font-size: 12px; line-height: 16px; }
.turn .who.salam { color: var(--action); }
.turn .who.you { color: var(--ink-50); }
.turn p:last-child { font-size: 14px; line-height: 21px; }
.dots { display: flex; justify-content: flex-end; gap: 4px; direction: ltr; }
.dots img { width: 5px; height: 5px; animation: blink 1.2s ease-in-out infinite; }
.dots img:nth-child(2) { animation-delay: .2s; }
.dots img:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Controls */
.controls {
  position: relative;
  display: flex;
  gap: 40px;
  height: 120px;
  align-items: center;
  flex-shrink: 0;
}
.ctrl {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(16, 97, 255, 0.12);
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  position: relative;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms, box-shadow 160ms;
}
.ctrl.sm { width: 60px; height: 60px; }
.ctrl.lg { width: 110px; height: 110px; }
.ctrl .icon { position: relative; overflow: hidden; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22)); }
.ctrl .icon img { position: absolute; left: 1px; top: 1px; }
.ctrl .icon.end { width: 26px; height: 26px; }
.ctrl .icon.speaker { width: 28px; height: 28px; }
.ctrl .icon.mic { width: 52px; height: 52px; }
.ctrl .icon.mic img { left: 8px; top: 8px; }
.ctrl .alt { display: none; }

/* Pressed (end call + speaker): Figma "Pressed" state */
.ctrl.sm:active {
  background: linear-gradient(rgba(16, 97, 255, 0.12), rgba(16, 97, 255, 0.12)), rgba(255, 255, 255, 0.6);
}

/* End call · tapped → end session */
#end-call.confirm,
#end-call.confirm:active {
  background: #ff5a3c;
  box-shadow: 0 6px 18px rgba(255, 90, 60, 0.3);
}
#end-call.confirm .base { display: none; }
#end-call.confirm .alt { display: block; }

/* Speaker · muted */
#speaker[aria-pressed="true"],
#speaker[aria-pressed="true"]:active { background: #000050; }
#speaker[aria-pressed="true"] .base { display: none; }
#speaker[aria-pressed="true"] .alt { display: block; }
#speaker .mute-line {
  position: absolute;
  left: 18px;
  top: 19px;
  width: 21.213px;
  height: 21.213px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#speaker[aria-pressed="true"] .mute-line { display: flex; }
#speaker .mute-line > span { position: relative; width: 30px; height: 0; transform: rotate(45deg); flex: none; }
#speaker .mute-line img { position: absolute; left: 0; right: 0; top: -2px; bottom: 0; width: 30px; height: 2px; }

/* Push to talk · held / listening */
.ctrl.mic { touch-action: none; }
.ctrl.mic[aria-pressed="true"] {
  background: #1061ff;
  box-shadow: 0 0 28px rgba(75, 245, 255, 0.45);
}
.ctrl.mic[aria-pressed="true"] .base { display: none; }
.ctrl.mic[aria-pressed="true"] .alt { display: block; }
.ctrl.mic .ring { position: absolute; pointer-events: none; display: none; }
.ctrl.mic .ring.inner { left: -13px; top: -13px; width: 134px; height: 134px; }
.ctrl.mic .ring.outer { left: -22px; top: -22px; width: 152px; height: 152px; }
.ctrl.mic[aria-pressed="true"] .ring { display: block; }

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  top: 140px;
  transform: translate(-50%, -10px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  white-space: nowrap;
  z-index: 5;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ═══════════ Salam additions (live call on top of the Mobily design) ═══════════ */

/* Phone-sized screens: the phone fills the screen, no frame (app.js fit() adds .bare) */
body.bare { padding: 0; background: #fff; align-items: flex-start; }
body.bare .phone { border-radius: 0; box-shadow: none; }

/* Smooth updates (cards.js morphs the card in place and animates its height): no scrolling in the
   bubble or the cards. Only the full article (CONTENT=1) can be taller than the screen: it scrolls. */
.bubble { flex-shrink: 0; }
.card.reader { max-height: 470px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.chips { flex-wrap: wrap; }
.chip:disabled { opacity: .38; text-decoration: line-through; cursor: default; box-shadow: none; }
.btn { flex-shrink: 0; }
.mood, .chip, .btn { -webkit-tap-highlight-color: transparent; }

/* Content: several suggestions are tappable rows */
button.item { width: 100%; font: inherit; color: inherit; text-align: right; cursor: pointer; transition: border-color 150ms, transform 120ms; }
button.item:hover { border-color: var(--action-line); }
button.item:active { transform: scale(.985); }

/* Article reader: the library's markdown (## heading, - list, links, **bold**) */
.reader .body { display: flex; flex-direction: column; gap: var(--space-8); font-size: 14px; line-height: 23px; }
.reader .body h4 { font-family: var(--font-head); font-size: 15px; line-height: 22px; margin-top: var(--space-4); }
.reader .body ul { padding-inline-start: 18px; display: flex; flex-direction: column; gap: var(--space-4); }
.reader .body a { color: var(--action); text-decoration: none; }
.reader .body .src, .reader .body .src ~ * { font-size: 12px; line-height: 18px; color: var(--ink-50); }

/* Emotion detection: while the user holds the mic, its glow takes the voice tone */
body[data-tone="angry"]   .ctrl.mic[aria-pressed="true"] { box-shadow: 0 0 30px rgba(255, 90, 60, .55); }
body[data-tone="sad"]     .ctrl.mic[aria-pressed="true"] { box-shadow: 0 0 30px rgba(110, 120, 255, .55); }
body[data-tone="fearful"] .ctrl.mic[aria-pressed="true"] { box-shadow: 0 0 30px rgba(170, 110, 255, .55); }
body[data-tone="happy"]   .ctrl.mic[aria-pressed="true"] { box-shadow: 0 0 30px rgba(255, 190, 60, .6); }

/* Toast: errors stay longer and may wrap */
.toast { max-width: 340px; white-space: normal; text-align: center; }

/* Live transcript (always on while no task card is open): newest lines at the bottom, no scrolling;
   when the lines no longer fit, the oldest are clipped at the top behind a soft fade. */
.card.transcript { max-height: 360px; overflow: hidden; justify-content: flex-end; flex-shrink: 0; }
.card.transcript.clipped {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
}
.card.transcript .turn { flex-shrink: 0; }
