/*
 * Try Bayan (getbayan.app/playground/): the Bayan app's Ask path on the web. Home ("How are you feeling today?", the
 * feelings, the composer), then a thread: the message on the right, the agent's tool calls as they run, and the answer
 * docs/HOW-BAYAN-ANSWERS.md describes (one message, in paragraphs, that quotes the ayahs as it talks, then the next
 * steps). An ayah's reference and a scholar's number open the source beside the chat, never in it.
 *
 * Loaded after css/site.css, which gives the page getbayan.app's nav, footer, waitlist sheet, base and tokens. This file
 * is loaded by this page only. It holds three things, in this order:
 *   1. the parts the playground took from the library's site.css and pages.css (buttons, glass, chips, code blocks, the
 *      eyebrow), scoped to the playground with :where(), so they keep the library's specificity and touch nothing else;
 *   2. where site.css's own class names meet the playground's (.answer, .bubble, .say, .how…), site.css is undone
 *      inside the playground, so its home-page animations never reach the conversation;
 *   3. the playground's own rules, as on the library.
 * Every colour is a token from tokens.css (palette.ts); sizes follow the app's type scale (T) and components.
 */

/* the app's Arabic face for Arabic prose (tafsir, titles, citations): its letters only. Uthmanic Hafs draws Arabic digits
   and the Arabic comma, semicolon and question mark as the Mushaf's ayah-end ornaments, so those fall through to the
   next font in --arabic (the library's rule, docs/DESIGN-RULES.md) */
@font-face {
  font-family: "Bayan Arabic"; src: url("../fonts/UthmanicHafs.ttf") format("truetype"); font-display: swap;
  unicode-range: U+0600-060B, U+060D-061A, U+061C-061E, U+0620-065F, U+066E-06D3, U+06D5-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
.page-playground {
  /* the mushaf face for the Qur'an; the app's Arabic face for every other Arabic line, Latin inside it in the sans */
  --quran: "UthmanicHafs", "Geeza Pro", "Noto Naskh Arabic", serif;
  --arabic: "Bayan Arabic", "Neue Montreal", "Geeza Pro", "Noto Naskh Arabic", sans-serif;
}

/* ================================================================== 1. from the library: the parts the playground uses */
/* the page under the nav (pages.css .page main), and the type the playground's parts inherit (the library's body) */
.page-playground > main.pg { padding-top: 72px; }
:where(.pg, .pg-source) { font-weight: 500; font-size: 20px; line-height: 25px; text-rendering: optimizeLegibility; }
:where(.pg, .pg-source) :where(svg, canvas) { display: block; }
.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; }
:where(.pg, .pg-source) .ar { font-family: var(--arabic); direction: rtl; unicode-bidi: isolate; font-weight: 400; }

/* buttons: solid fills only, never outlined */
:where(.pg, .pg-source) .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 28px; border-radius: 28px; background: var(--ink); color: var(--black);
  font-weight: 500; font-size: 19px; line-height: 24px; white-space: nowrap;
  transition: transform 0.18s var(--ease), background-color 0.3s var(--ease), opacity 0.2s;
}
:where(.pg, .pg-source) .btn:active { transform: scale(0.97); }
:where(.pg, .pg-source) .btn.gray { background: var(--panel2); color: var(--ink); }
:where(.pg, .pg-source) .btn.gray:hover { background: var(--raised); }
:where(.pg, .pg-source) .btn:not(.gray):hover { opacity: 0.9; }
:where(.pg, .pg-source) .btn.sm { height: 44px; padding: 0 20px; font-size: 17px; }

/* glass: a round icon button (the source panel's close) */
:where(.pg, .pg-source) .glass {
  width: 44px; height: 44px; border-radius: 22px; display: inline-grid; place-items: center;
  background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  color: var(--ink); transition: transform 0.18s var(--ease);
}
:where(.pg, .pg-source) .glass:active { transform: scale(0.94); }
:where(.pg, .pg-source) .glass svg { width: 20px; height: 20px; }

/* chips: the next steps under an answer */
:where(.pg, .pg-source) .chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px;
  background: var(--panel2); color: var(--ink); font-weight: 500; font-size: 17px; white-space: nowrap;
}

/* the eyebrow over How it works */
:where(.pg, .pg-source) .eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--mute); font-size: 17px; line-height: 22px; font-weight: 500; }
:where(.pg, .pg-source) .eyebrow .mark { width: 14px; height: 14px; color: var(--ink); }

/* code: what a call sent and what came back, in the type system's own face (no monospace anywhere) */
:where(.pg, .pg-source) .code {
  margin: 0; padding: 18px; overflow: auto; font-family: var(--sans); font-weight: 400; font-size: 15px; line-height: 24px;
  color: var(--soft); white-space: pre; font-variant-numeric: tabular-nums; tab-size: 2; scrollbar-width: none;
}
:where(.pg, .pg-source) .code::-webkit-scrollbar { display: none; }
:where(.pg, .pg-source) .code .p, :where(.pg, .pg-source) .tok-p { color: var(--web-syn-property); }
:where(.pg, .pg-source) .code .k, :where(.pg, .pg-source) .tok-k { color: var(--web-syn-keyword); }
:where(.pg, .pg-source) .code .s, :where(.pg, .pg-source) .tok-s { color: var(--web-syn-string); }
:where(.pg, .pg-source) .code .n, :where(.pg, .pg-source) .tok-n { color: var(--web-syn-number); }
:where(.pg, .pg-source) .code .c, :where(.pg, .pg-source) .tok-c { color: var(--web-syn-comment); }
:where(.pg, .pg-source) .code .f, :where(.pg, .pg-source) .tok-f { color: var(--web-syn-function); }
:where(.pg, .pg-source) .tok-x { color: var(--web-syn-punct); }
:where(.pg, .pg-source) .code bdi.esc { font-family: var(--sans); }
/* numbered lines: each line its own block; the number sits in the margin; a wrapped line keeps its indent */
:where(.pg, .pg-source) .code.lined { counter-reset: line; white-space: normal; }
:where(.pg, .pg-source) .code.lined .line { display: block; position: relative; padding-left: calc(2.6em + var(--i, 0) * 0.3em); white-space: pre-wrap; overflow-wrap: anywhere; }
:where(.pg, .pg-source) .code.lined .line::before { counter-increment: line; content: counter(line); position: absolute; left: 0; width: 1.8em; text-align: right; color: var(--web-syn-comment); font-variant-numeric: tabular-nums; user-select: none; -webkit-user-select: none; }
:where(.pg, .pg-source) .code .ar { font-family: var(--arabic); font-size: 16px; }
:where(.pg, .pg-source) .codeblock { position: relative; margin: 20px 0 0; border-radius: 20px; background: var(--fill); overflow: hidden; }
:where(.pg, .pg-source) .codeblock figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 48px; padding: 0 8px 0 18px; font-size: 14px; font-weight: 500; color: var(--mute); }
:where(.pg, .pg-source) .codeblock .copy { position: static; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--panel2); color: var(--soft); font-size: 13px; font-weight: 500; }
:where(.pg, .pg-source) .codeblock .copy:hover { background: var(--raised); color: var(--ink); }
:where(.pg, .pg-source) .codeblock pre { margin: 0; padding: 4px 18px 18px; font-size: 15px; line-height: 24px; color: var(--soft); }
:where(.pg, .pg-source) .codeblock pre::-webkit-scrollbar { display: none; }
/* a long response opens collapsed, its end fading out, with a button to show it all */
:where(.pg, .pg-source) .codeblock.collapsed pre { max-height: 440px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
:where(.pg, .pg-source) .code-more { display: flex; justify-content: center; padding: 0 0 16px; }
:where(.pg, .pg-source) .code-more button { height: 36px; padding: 0 16px; border-radius: 18px; background: var(--panel2); color: var(--soft); font-size: 14px; font-weight: 500; }
:where(.pg, .pg-source) .code-more button:hover { background: var(--raised); color: var(--ink); }
:where(.pg, .pg-source) .codeblock code { font: inherit; background: none; padding: 0; color: inherit; white-space: inherit; border-radius: 0; }
:where(.pg, .pg-source) .codeblock .ar { font-family: var(--arabic); font-size: 16px; color: inherit; }

/* ================================================================== 2. site.css, undone inside the playground */
/* site.css sets h1–h3 for its own pages (tight, balanced); the playground's headings set their own type */
:where(.pg, .pg-source) :is(h1, h2, h3) { letter-spacing: normal; text-wrap: wrap; }
/* the small buttons keep the library's spacing and icon size (site.css: 7px, a 17px icon set 2px high) */
:where(.pg, .pg-source) .btn.sm { gap: 10px; }
:where(.pg, .pg-source) .btn.sm svg { width: 18px; height: 18px; margin-top: 0; }
/* the home page's Ask panel plays its message, answer and source in (.bubble, .answer, .found, .ref); here they are
   the conversation itself, there from the start */
:where(.pg, .pg-source) .bubble { opacity: 1; translate: none; }
:where(.pg, .pg-source) .answer { width: auto; max-width: none; min-height: auto; margin-top: 0; opacity: 1; translate: none; filter: none; }
:where(.pg, .pg-source) .answer .ar { font-family: var(--arabic); font-size: inherit; line-height: inherit; text-align: inherit; margin-top: 0; }
:where(.pg, .pg-source) .found { display: block; align-items: normal; gap: normal; }
:where(.pg, .pg-source) .ref { font-size: inherit; line-height: inherit; margin-top: 0; }
/* the home page's statement, read word by word (.say): here, a paragraph of Bayan's message */
:where(.pg, .pg-source) .say { max-width: none; text-align: start; letter-spacing: normal; }

/* ================================================================== 3. the playground */

.page-playground { overflow-x: clip; --col: calc(760px + var(--g) * 2); } /* the conversation's column, centred */
/* the full screen, always, so the ask bar reaches the bottom (on the library, pages.css gave every page's main 70vh) */
.page-playground main.pg { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pg > section, .pg > .pg-dock { position: relative; width: 100%; max-width: var(--col); margin-left: auto; margin-right: auto; padding: 0 var(--g); }
.pg button { -webkit-tap-highlight-color: transparent; }

/* the photo behind the top of the page is the library home page's own: .hero-photo in site.css */

/* ---------- home ---------- */
.pg-home { padding-top: 184px !important; }
.pg-hero { margin: 0; font-weight: 500; font-size: clamp(34px, 6.2vw, 60px); line-height: 1.08; letter-spacing: -0.022em; color: var(--ink); }
.pg-feelings { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.feel {
  height: 44px; padding: 0 18px; border-radius: 22px; background: var(--fill); color: var(--ink);
  font-weight: 500; font-size: 18px; line-height: 22px; white-space: nowrap;
  transition: transform 0.16s var(--ease), background-color 0.2s, color 0.2s;
}
.feel:hover { background: var(--raised); }
/* light: the warm photo behind the page washes --fill out, so the pills lose their shape; one step deeper keeps them
   visible (the same goes for the follow-up chips) */
[data-theme="light"] .feel, [data-theme="light"] .pg-next .chip { background: var(--panel2); }
[data-theme="light"] .feel:hover, [data-theme="light"] .pg-next .chip:hover { background: var(--raised); }
.feel:active { transform: scale(0.96); transition-duration: 0.09s; }
/* the feeling the words being typed point to */
.feel.on { background: var(--ink); color: var(--black); }

/* ---------- the composer ---------- */
.pg-dock { margin-top: 44px; z-index: 20; }
.pg-field {
  display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 8px 0 20px; border-radius: 30px;
  background: var(--field); transition: box-shadow 0.2s;
}
/* focus is a fill (the field lifts a shade), never a ring */
.pg-field:focus-within { background: var(--raised); }
.pg-field .ai { flex: none; width: 22px; height: 22px; color: var(--ink); }
.pg-field input {
  flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: none; color: var(--ink);
  font: 500 20px/25px var(--sans); caret-color: var(--ink);
}
.pg-field input::placeholder { color: var(--mute); opacity: 1; }
.pg-field .send {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 22px;
  background: var(--ink); color: var(--black); transition: transform 0.16s var(--ease), opacity 0.2s, background-color 0.2s;
}
.pg-field .send svg { width: 20px; height: 20px; }
.pg-field .send:disabled { background: rgba(var(--ink-rgb), 0.12); color: var(--ink); opacity: 0.5; cursor: default; }
.pg-field .send:not(:disabled):active { transform: scale(0.9); }
.pg-field .send:focus-visible { outline-offset: 2px; border-radius: 22px; }
.pg-fine { margin: 16px 0 0; padding: 0 20px; font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); text-wrap: pretty; }
.pg-fine a { color: var(--soft); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.pg-fine a:hover { color: var(--ink); }

/* suggestions as you type: "Ask “…”" first, solid, then the runs your words point to (the Ask overlay's cards) */
/* the suggestions: one solid card that floats under the box (above it in a conversation), so typing never moves the
   box and nothing behind it shows through. Rows, not bubbles: "Ask “…”" first and strongest, then up to three runs */
.pg-suggest {
  position: absolute; z-index: 30; left: var(--g); right: var(--g); top: 70px;
  display: grid; gap: 2px; padding: 8px; border-radius: 24px; background: var(--panel2);
  max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain;
}
.pg-suggest[hidden] { display: none; }
.sg {
  display: block; width: 100%; padding: 12px 14px; border-radius: 16px; background: none; color: var(--ink);
  font-weight: 500; font-size: 17px; line-height: 22px; text-align: left; overflow-wrap: anywhere;
  animation: pgRise 0.24s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
  transition: background-color 0.15s;
}
.sg:hover, .sg[aria-selected="true"] { background: rgba(var(--ink-rgb), 0.08); }
.sg.strong { font-weight: 500; }
.sg.strong::before { content: ""; display: inline-block; width: 16px; height: 16px; margin: 0 10px -2px 0; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat; }
.sg .k { display: block; margin-top: 2px; font-weight: 400; font-size: 14px; line-height: 19px; color: var(--mute); }
.sg.strong .k { color: inherit; opacity: 0.7; }

/* ---------- home, below the composer ---------- */
.pg-popular { padding-top: 104px !important; }
.pg-section { margin: 0 0 12px; font-weight: 500; font-size: 20px; line-height: 25px; color: var(--mute); }
.pg-rows { display: grid; }
.pg-row {
  display: block; width: 100%; min-height: 64px; padding: 18px 0; text-align: left; color: var(--ink);
  font-weight: 500; font-size: 20px; line-height: 25px; border-top: 2px solid rgba(var(--ink-rgb), 0.09); transition: color 0.15s;
}
.pg-row:first-child { border-top: 0; }
.pg-row:hover { color: var(--soft); }

/* ---------- how it works: three moves, each drawn with the playground's own parts ---------- */
.pg-how { padding-top: 128px !important; padding-bottom: 120px !important; scroll-margin-top: 40px; }
.pg-how-head { display: grid; gap: 18px; margin-bottom: 44px; }
.pg-how-title { margin: 0; font-weight: 500; font-size: clamp(32px, 4.6vw, 48px); line-height: 1.06; letter-spacing: -0.024em; text-wrap: balance; }
.pg-how-title .quiet { color: var(--mute); }
.pg-how-lead { margin: 0; max-width: 640px; font-weight: 400; font-size: 19px; line-height: 28px; color: var(--soft); text-wrap: pretty; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.how-card { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 30px; border-radius: 28px; background: var(--fill); }
.how-copy { display: grid; gap: 10px; align-content: start; }
.how-n { font-weight: 500; font-size: 15px; line-height: 20px; color: var(--mute); font-variant-numeric: tabular-nums; }
.how-copy h3 { margin: 6px 0 0; font-weight: 500; font-size: 26px; line-height: 31px; letter-spacing: -0.012em; color: var(--ink); }
.how-copy p { margin: 0; font-weight: 400; font-size: 17px; line-height: 25px; color: var(--soft); text-wrap: pretty; }
.how-viz { margin: 0; padding: 20px; border-radius: 22px; background: var(--black); min-width: 0; }
.how-ask { display: grid; gap: 22px; }
.how-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.how-chips span { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 19px; background: var(--fill); color: var(--ink); font-weight: 500; font-size: 16px; }
.how-chips .on { background: var(--ink); color: var(--black); }
.how-bubble { justify-self: end; margin: 0; max-width: 90%; padding: 11px 16px; border-radius: 20px; background: var(--field); color: var(--ink); font-weight: 500; font-size: 17px; line-height: 22px; }
.how-calls { list-style: none; display: grid; gap: 14px; }
.how-calls li { display: flex; align-items: flex-start; gap: 11px; }
.how-calls svg { flex: none; width: 19px; height: 19px; margin-top: 1px; color: var(--ink); }
.how-calls span { display: grid; gap: 2px; min-width: 0; }
.how-calls b { font-weight: 500; font-size: 15px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.how-calls b bdi { font-family: var(--arabic); font-weight: 400; font-size: 16px; }
.how-calls i { font-style: normal; font-weight: 400; font-size: 13px; line-height: 18px; color: var(--mute); font-variant-numeric: tabular-nums; }
/* the answer's sample: one paragraph of a message, set as the answer sets it, a step smaller */
.how-answer { display: grid; align-content: center; }
.say.how-say { font-size: 17px; line-height: 27px; }
.how-say .aref, .how-say .cite { pointer-events: none; }
.how-note { display: flex; align-items: flex-start; gap: 12px; margin: 24px 0 0; padding: 0 30px; font-weight: 400; font-size: 15px; line-height: 22px; color: var(--mute); text-wrap: pretty; }
.how-note[hidden] { display: none; }
.how-note svg { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--ink); }
.how-note strong { font-weight: 500; color: var(--soft); }
.how-note a { color: var(--soft); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.how-note a:hover { color: var(--ink); }

/* ---------- the thread ---------- */
[data-view="thread"] .pg-home, [data-view="thread"] .pg-popular, [data-view="thread"] .pg-how, [data-view="thread"] .footer { display: none; }

.pg-thread { padding-top: 96px !important; flex: 1; }
.pg-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.pg-new svg { width: 18px; height: 18px; }
.pg-turns { display: grid; gap: 44px; padding-bottom: 28px; }

/* in a thread the composer docks at the bottom over a fade, the app's Dock */
[data-view="thread"] .pg-dock {
  /* pinned to the bottom whatever the thread's length, as in the app (and any chat): margin-top: auto pushes it to the
     foot of the full-height page when the thread is short; sticky keeps it there once the thread is longer */
  position: sticky; bottom: 0; margin-top: auto;
  padding-top: 32px; padding-bottom: max(env(safe-area-inset-bottom), 16px);
  background: linear-gradient(180deg, rgba(var(--ground-rgb), 0) 0, rgba(var(--ground-rgb), 0.95) 30px, var(--black) 54px);
}
[data-view="thread"] .pg-field { height: 56px; border-radius: 28px; padding-left: 20px; padding-right: 6px; }
[data-view="thread"] .pg-field .send { width: 40px; height: 40px; border-radius: 20px; }
[data-view="thread"] .pg-field .send svg { width: 18px; height: 18px; }
[data-view="thread"] .pg-suggest { top: auto; bottom: calc(100% - 20px); }
[data-view="thread"] .pg-fine { padding: 0; }
[data-view="thread"] .pg-fine { margin-top: 10px; font-size: 13px; line-height: 17px; text-align: center; }

.turn { display: grid; gap: 18px; min-width: 0; scroll-margin-top: 92px; }
.turn:focus { outline: none; } /* focused only so the keyboard and a screen reader carry on from the new turn */
.me { display: flex; justify-content: flex-end; }
.bubble {
  max-width: 80%; margin: 0; padding: 13px 18px; border-radius: 22px; background: var(--field); color: var(--ink);
  font-weight: 500; font-size: 20px; line-height: 25px; overflow-wrap: anywhere;
}
.turn-note { margin: -8px 4px 0 auto; max-width: 80%; font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); text-align: right; overflow-wrap: anywhere; text-wrap: pretty; }
.bayan { display: grid; gap: 24px; min-width: 0; }

/* ---------- the agent's work: one card, open while it runs, folded when the answer comes ---------- */
.work { min-width: 0; border-radius: 26px; background: var(--fill); }
.work-head {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 18px 12px 14px;
  border-radius: 26px; text-align: left;
}
.work-head:focus-visible { outline-offset: -2px; border-radius: 26px; }
.work-ind { flex: none; display: grid; place-items: center; width: 36px; height: 36px; }
.work-ind canvas { width: 36px; height: 36px; }
.work-ind svg { width: 26px; height: 26px; color: var(--ink); }
/* room for the line and the muted line under it from the start, so the card keeps its height when its summary comes in
   after the answer has begun (a call answering late, Read around): nothing below it moves */
.work-text { flex: 1; display: grid; gap: 2px; align-content: center; min-width: 0; min-height: 45px; }
.work-line { font-weight: 500; font-size: 18px; line-height: 23px; color: var(--ink); overflow-wrap: anywhere; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-sub { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); font-variant-numeric: tabular-nums; text-wrap: pretty; }
.work-head .chev { flex: none; width: 18px; height: 18px; color: var(--mute); transition: transform 0.25s var(--ease); }
.work-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.work-head[aria-disabled="true"] { cursor: default; }
.work-head[aria-disabled="true"] .chev { visibility: hidden; }
.work .retry { margin: 0 18px 16px 64px; }

.pg-steps { list-style: none; margin: 0; padding: 0 10px 12px 12px; display: grid; }
.pg-steps[hidden] { display: none; }
.pg-step { position: relative; }
/* the line that joins one call to the next */
.pg-step + .pg-step::before { content: ""; position: absolute; left: 19px; top: -22px; height: 26px; width: 2px; border-radius: 1px; background: rgba(var(--ink-rgb), 0.12); }
.step-head { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 8px 8px 8px 8px; border-radius: 16px; text-align: left; transition: background-color 0.15s; }
.step-head:hover { background: rgba(var(--ink-rgb), 0.04); }
.step-head:focus-visible { outline-offset: -2px; border-radius: 16px; }
.step-dot { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 0; }
.step-dot svg { width: 22px; height: 22px; color: var(--ink); }
.pg-step[data-state="empty"] .step-dot svg { color: var(--mute); }
/* running: the app's status dot, pulsing (opacity .35 + .65 × |sin|, about 2.4 s a cycle) */
.step-dot i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); animation: pgPulse 1.2s ease-in-out infinite alternate; }
@keyframes pgPulse { from { opacity: 0.35; } to { opacity: 1; } }
.step-text { flex: 1; display: grid; gap: 2px; min-width: 0; padding-top: 1px; }
.step-title { font-weight: 500; font-size: 17px; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; }
.step-title bdi { font-family: var(--arabic); font-weight: 400; font-size: 18px; }
.step-sub { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pg-step[data-state="err"] .step-sub { color: var(--soft); }
.step-head .chev { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--mute); transition: transform 0.25s var(--ease); }
.step-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.pg-step[data-state="run"] .step-head .chev { visibility: hidden; }

.step-body { display: grid; gap: 14px; padding: 6px 8px 16px 44px; min-width: 0; }
.step-body[hidden] { display: none; }
.call { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; line-height: 20px; color: var(--soft); font-variant-numeric: tabular-nums; }
.call .verb, .call .code-status { height: 24px; padding: 0 9px; border-radius: 12px; background: var(--panel2); color: var(--ink); font-size: 13px; line-height: 24px; font-weight: 500; }
.call .path { overflow-wrap: anywhere; min-width: 0; }
.call .ms { color: var(--mute); }
.work .codeblock { margin: 0; background: var(--black); border-radius: 18px; }
.work .codeblock figcaption { height: 40px; padding-left: 16px; font-size: 13px; }
.work .codeblock pre { padding: 2px 16px 14px; font-size: 14px; line-height: 22px; }
.work .codeblock pre:focus-visible { outline-offset: -2px; border-radius: 0 0 18px 18px; }
.pg .btn:disabled, .act:disabled { opacity: 0.5; cursor: default; }
.work .code-more { padding-bottom: 12px; }
.facts { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-weight: 400; font-size: 15px; line-height: 21px; color: var(--soft); }
.facts .prov { color: var(--mute); }
.terms-label { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.term { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--panel2); color: var(--ink); font-size: 14px; }
.term .ar { font-size: 17px; }
.term .kind { color: var(--mute); }
.spans { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.spans .term { font-variant-numeric: tabular-nums; }

/* what a call returned: one row a passage, its citation as the library sends it */
.hits { display: grid; border-radius: 18px; background: var(--black); padding: 6px; }
.hit { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 13px; text-align: left; font-size: 14px; line-height: 20px; color: var(--soft); font-variant-numeric: tabular-nums; }
.hit:hover { background: rgba(var(--ink-rgb), 0.05); }
.hit .ref { color: var(--mute); }
.hit .cite-ar { min-width: 0; font-family: var(--arabic); font-size: 16px; line-height: 24px; color: var(--ink); direction: rtl; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit .hit-score { color: var(--mute); }
.hit.chosen .ref { color: var(--ink); }
/* opened: the whole citation, wrapped, above the passage */
.hit[aria-expanded="true"] .cite-ar { white-space: normal; overflow: visible; text-overflow: clip; }
.hit-open { margin: 0 12px 10px; padding: 12px 14px; border-radius: 13px; background: var(--fill); }
.hit-open[hidden] { display: none; }
.hit-text { margin: 0; font-family: var(--arabic); font-size: 17px; line-height: 31px; color: var(--read); direction: rtl; text-align: right; white-space: pre-line; overflow-wrap: anywhere; }
.hit-credit { margin: 8px 0 0; font-weight: 400; font-size: 13px; line-height: 18px; color: var(--mute); }
.hits-none { padding: 12px; font-size: 15px; color: var(--mute); }

/* ---------- the answer (docs/ANSWERS.md, "Decisions so far"): one message from Bayan, in paragraphs, that talks with
   the person and quotes the ayahs as it goes. Bayan's words are Regular in the reading ink, all one size; the ayah's own
   words, inside the sentence, are white and Medium in their quotes (TEXT-FORMATTING rule 3), each followed by its
   reference, a small quiet button that opens the whole ayah beside the chat. An ayah shown whole (in the message, or
   every ayah in the fallback) is set in a little: the Mushaf's text, Saheeh International in quotes, one quiet line.
   No headings, rules or cards: space only ---------- */
/* one track that never grows past the column, whatever a line holds (minmax(0, 1fr), not auto) */
.answer { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.reply, .say { min-width: 0; margin: 0; font-weight: 400; font-size: 20px; line-height: 28px; color: var(--read); text-wrap: pretty; overflow-wrap: anywhere; }
.say + .say { margin-top: 16px; }
.found { margin: 6px 0 0; font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); text-wrap: pretty; }
.answer > .found:first-child { margin: 0 0 10px; } /* at the start of the message, above its first paragraph */
.item { min-width: 0; margin-top: 20px; }
.answer > .item:first-child { margin-top: 0; }
.item + .item { margin-top: 32px; }
.item + .say { margin-top: 20px; }
/* the ayah's words inside a sentence (only a quote the guard checked, playground.js atomHtml); the Mushaf's in its own
   face, right to left inside the line; an English quote left to right inside an Arabic paragraph */
.say .aq { color: var(--ink); font-weight: 500; }
.say .aq-ar { font-family: var(--quran); font-weight: 400; font-size: 23px; color: var(--ink); }
.say bdi.ar { font-size: 22px; }
.say .nw { white-space: nowrap; }
.say.rtl { font-family: var(--arabic); font-size: 21px; line-height: 36px; text-align: right; }
.say .ref { font-size: 15px; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* a button never starts a line: it keeps to the word before it (or the end of the quote it closes) and the stop after it */
.say .keep { white-space: nowrap; }
.say .keep .aq, .say .keep .aq-ar, .say .keep .kw { white-space: normal; }
.say .keep .aq-ar.whole { white-space: nowrap; }
.say .keep .cite:last-child { margin-right: 1px; }
/* a reference: the whole ayah, opened beside the chat. Small and quiet, in the reference's own grey, on a fill */
.aref {
  position: relative; display: inline-flex; align-items: center; justify-content: center; height: 22px; margin: 0 1px; padding: 0 7px;
  border-radius: 11px; vertical-align: 2px; background: var(--panel2); color: var(--mute); font-family: var(--sans); font-weight: 500; font-size: 14px; line-height: 22px;
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.aref::after { content: ""; position: absolute; inset: -11px -4px; } /* a finger's reach */
.aref:hover, .aref:focus-visible, .aref[aria-expanded="true"] { background: var(--raised); color: var(--ink); }
/* the quote: set in from Bayan's words by space alone (no rule, bar or fill) */
.quote { min-width: 0; margin: 0; padding: 0 22px; }
.ayah-ar { margin: 12px 0 0; font-family: var(--quran); font-weight: 400; font-size: 30px; line-height: 58px; color: var(--ink); direction: rtl; text-align: right; overflow-wrap: anywhere; }
.ayah-en { margin: 10px 0 0; font-weight: 500; font-size: 20px; line-height: 28px; color: var(--ink); text-wrap: pretty; overflow-wrap: anywhere; }
.ayah-en .n { color: var(--mute); font-variant-numeric: tabular-nums; margin-right: 6px; }
.quote .ayah-ar { margin: 0; font-size: 24px; line-height: 46px; }
.quote .ayah-en { margin-top: 6px; }
.quote .ayah-en .n { margin: 0 4px 0 2px; font-size: 15px; }
.credit { margin: 12px 0 0; font-weight: 400; font-size: 17px; line-height: 22px; color: var(--mute); overflow-wrap: anywhere; text-wrap: pretty; }
/* one quiet line under each quote: where it is, then the scholars whose passages are on it; a name opens the passage
   beside the chat. The names are a step brighter and Medium, so they read as buttons without an underline */
.quote-ref { margin: 10px 0 0; font-weight: 400; font-size: 15px; line-height: 22px; color: var(--mute); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-wrap: pretty; }
.credit-name {
  position: relative; padding: 0; color: var(--soft); font: inherit; font-weight: 500; text-align: inherit;
  text-decoration: underline 1px transparent; text-underline-offset: 4px; transition: color 0.15s, text-decoration-color 0.15s;
}
.credit-name::after { content: ""; position: absolute; inset: -11px -4px; } /* a finger's reach around a short name */
.credit-name:hover, .credit-name[aria-expanded="true"] { color: var(--ink); }
.credit-name:hover { text-decoration-color: currentColor; }
.credit-name:focus-visible { outline-offset: 3px; border-radius: 6px; }
.credit-name bdi.ar { font-size: 16px; }
/* a number in a line: the passage it reports, opened beside the chat */
.cite {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin: 0 2px; padding: 0 6px;
  border-radius: 11px; vertical-align: 2px; background: var(--panel2); color: var(--soft); font-family: var(--sans); font-weight: 500; font-size: 13px; line-height: 22px;
  font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.cite::after { content: ""; position: absolute; inset: -11px -5px; }
.cite:hover, .cite:focus-visible, .cite[aria-expanded="true"] { background: var(--raised); color: var(--ink); }
.cite + .cite { margin-left: 0; }
.aref + .cite { margin-left: 3px; }
.pg-next { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.pg-next .chip { transition: transform 0.16s var(--ease), background-color 0.2s; }
.pg-next .chip:hover { background: var(--raised); }
.pg-next .chip:active { transform: scale(0.96); }
.pg-next .chip:focus-visible { border-radius: 20px; }
.pg-next .chip:disabled { opacity: 0.5; cursor: default; }
.made { margin: 18px 0 0; font-weight: 400; font-size: 14px; line-height: 20px; color: var(--mute); text-wrap: pretty; }
.answer > .item + .made, .answer > .say + .made { margin-top: 28px; }
.answer-note { margin: 0; font-weight: 500; font-size: 20px; line-height: 26px; color: var(--soft); text-wrap: pretty; overflow-wrap: anywhere; }
.answer > .pg-feelings { margin-top: 20px; gap: 8px; }
.cut-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 22px; }
.cut-note .credit { margin: 0; }

/* ---------- the support card (§10, level 1): above the answer, the first time in a conversation, closable ---------- */
.support { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px 12px; padding: 16px 12px 20px 22px; border-radius: 26px; background: var(--fill); }
.support-line { margin: 9px 0 0; font-weight: 500; font-size: 19px; line-height: 25px; color: var(--ink); text-wrap: pretty; }
.support-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.support-acts .btn svg { width: 16px; height: 16px; }
.support-who { font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); }
/* a crisis line's own note ("Choose option 4."), under its button: in the support card on a line of its own */
.help-note { margin: 0; font-weight: 400; font-size: 14px; line-height: 20px; color: var(--mute); text-wrap: pretty; overflow-wrap: anywhere; }
.support-acts .help-note { flex-basis: 100%; margin-top: -4px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 20px; background: var(--panel2); color: var(--ink); transition: background-color 0.15s, transform 0.16s var(--ease); }
.icon-btn:hover { background: var(--raised); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:focus-visible { border-radius: 20px; }

/* ---------- crisis mode (§10, level 2): the conversation pauses and one calm card fills the chat. The card's fill,
   one warm accent, no red, no capitals, nothing moving but a fade ---------- */
.page-playground { --care: var(--web-care); } /* the warm accent (palette.ts, WEB.care) */
[data-crisis="on"] .pg-turns, [data-crisis="on"] .pg-bar, [data-crisis="on"] .pg-help, [data-crisis="on"] .pg-dock { display: none; }
.pg-crisis { display: grid; align-content: center; min-height: calc(100vh - 128px); min-height: calc(100dvh - 128px); padding: 8px 0 40px; }
.crisis-card { display: grid; justify-items: start; min-width: 0; padding: 40px; border-radius: var(--r-card); background: var(--fill); animation: pgFade 0.6s ease both; }
@keyframes pgFade { from { opacity: 0; } to { opacity: 1; } }
.crisis-mark { width: 30px; height: 30px; color: var(--care); }
.crisis-title { margin: 22px 0 0; font-weight: 500; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.12; letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.crisis-title:focus { outline: none; }
.crisis-lead { margin: 12px 0 0; font-weight: 400; font-size: 20px; line-height: 27px; color: var(--soft); text-wrap: pretty; }
.crisis-acts { display: grid; gap: 14px; width: 100%; margin-top: 32px; }
.crisis-act { display: grid; gap: 6px; min-width: 0; }
.crisis-act .btn { width: 100%; }
.crisis-act .btn svg { width: 18px; height: 18px; }
.crisis-local { margin: 0 0 4px; font-weight: 500; font-size: 24px; line-height: 30px; color: var(--ink); text-wrap: balance; }
/* phones: the number under its button, quiet; the button dials it */
.crisis-num { font-weight: 400; font-size: 16px; line-height: 21px; color: var(--mute); font-variant-numeric: tabular-nums; text-align: center; overflow-wrap: anywhere; }
.crisis-num small { font-size: inherit; }
.crisis-num small::before { content: " · "; }
.crisis-num.dup { display: none; }
.crisis-act .help-note { text-align: center; }
.crisis-safe { margin-top: 26px; padding: 10px 0; font-weight: 500; font-size: 18px; line-height: 24px; color: var(--soft); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 4px; }
.crisis-safe:hover { color: var(--ink); }
/* desktop, where a link can't dial: the numbers large enough to read across a room */
@media (min-width: 721px) {
  .crisis-card { padding: 48px 52px 44px; }
  .crisis-act { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: center; gap: 28px; }
  .crisis-num, .crisis-num.dup { display: block; text-align: left; font-weight: 500; font-size: clamp(44px, 5vw, 72px); line-height: 1; letter-spacing: -0.015em; color: var(--care); }
  .crisis-num small { display: block; margin-top: 8px; font-weight: 400; font-size: 16px; line-height: 21px; letter-spacing: 0; color: var(--mute); }
  .crisis-num small::before { content: none; }
  .crisis-num.small { font-weight: 500; font-size: 22px; line-height: 28px; letter-spacing: 0; color: var(--soft); }
  /* a line's note under its button, the number beside both */
  .crisis-act.with-note { align-items: start; }
  .crisis-act.with-note .crisis-num { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .crisis-act .help-note { grid-column: 1; grid-row: 2; margin-top: -18px; text-align: left; }
  .crisis-local { font-size: 26px; line-height: 32px; }
}
/* once crisis mode has shown, Get help stays at the top of the conversation */
.pg-help { position: sticky; top: 84px; z-index: 30; height: 0; display: flex; justify-content: flex-end; }
.pg-help .btn { background: var(--glass); color: var(--ink); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
.pg-help .btn:hover { opacity: 1; background: var(--panel2); }
/* and above the drawer and its backdrop, which stops short of it (playground.js, sourceMode) */
[data-drawer] .pg-help { z-index: 61; }

/* ---------- the source: one passage beside the chat (§5). A panel in the free space on the right of the column, at
   1640px and up, where the narrowest panel (360px) fits there with its 24px margins; below that, a drawer like the
   app's Sheet. The panel never covers the chat ---------- */
.pg-source { position: fixed; z-index: 60; }
.src-sheet { display: flex; flex-direction: column; min-height: 0; background: var(--panel); outline: none; }
.src-grab { display: none; }
.src-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px 6px var(--g); }
.src-title { flex: 1; min-width: 0; margin: 0; font-weight: 500; font-size: 19px; line-height: 24px; color: var(--soft); overflow-wrap: anywhere; }
.src-close { flex: none; background: var(--panel2); -webkit-backdrop-filter: none; backdrop-filter: none; }
.src-close:hover { background: var(--raised); }
.src-close:focus-visible { border-radius: 22px; }
.src-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--g) 28px; scrollbar-width: none; }
.src-scroll::-webkit-scrollbar { display: none; }
.src-ayah .ayah-ar { margin-top: 4px; font-size: 26px; line-height: 50px; }
.src-ayah .ayah-en { font-size: 18px; line-height: 26px; }
.src-ayah .credit { font-size: 15px; line-height: 20px; }
/* the scholars on an ayah opened from its reference: a name puts that scholar's passage in place of the one shown */
.src-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 22px; border-top: 2px solid rgba(var(--ink-rgb), 0.09); }
.src-pick + .src { margin-top: 18px; padding-top: 0; border-top: 0; }
.pick {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--panel2); color: var(--soft);
  font-weight: 500; font-size: 15px; line-height: 20px; white-space: nowrap; transition: background-color 0.15s, color 0.15s;
}
.pick:hover { background: var(--raised); color: var(--ink); }
.pick[aria-pressed="true"] { background: var(--ink); color: var(--black); cursor: default; }
.pick bdi.ar { font-size: 16px; }

@media (max-width: 1639.98px) {
  .pg-source { inset: 0; }
  .src-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity 0.26s ease; touch-action: none; }
  .src-sheet {
    position: absolute; left: 0; right: 0; bottom: 0; max-width: 760px; margin: 0 auto; max-height: 88vh; max-height: 88dvh;
    padding-bottom: max(env(safe-area-inset-bottom), 16px); border-radius: 32px 32px 0 0;
    transform: translateY(100%); transition: transform 0.34s cubic-bezier(0.33, 1, 0.68, 1);
  }
  .pg-source.on .src-backdrop { opacity: 1; }
  .pg-source.on .src-sheet { transform: none; }
  .pg-source.drag .src-sheet, .pg-source.drag .src-backdrop { transition: none; }
  .src-grab { display: grid; place-items: center; flex: none; height: 32px; touch-action: none; cursor: grab; }
  .src-grab span { width: 40px; height: 5px; border-radius: 3px; background: rgba(var(--ink-rgb), 0.3); }
  .src-head { touch-action: none; }
}
@media (min-width: 1640px) {
  /* The conversation stays centred, like every page of the site. The panel sits in the free space on its right, 24px
     from the column and from the screen's edge, at most 480px: opening or closing it moves nothing in the chat. */
  .pg-source { top: 88px; right: 24px; bottom: 24px; width: clamp(360px, calc((100% - var(--col)) / 2 - 48px), 480px); z-index: 40; }
  .src-backdrop { display: none; }
  .src-sheet { height: 100%; padding-top: 16px; border-radius: var(--r-card); opacity: 0; transition: opacity 0.22s ease; }
  .pg-source.on .src-sheet { opacity: 1; }
}

/* a scholar's passage, word for word: the book, the scholar, the text, the volume and page */
.src { display: grid; margin-top: 22px; padding-top: 22px; border-top: 2px solid rgba(var(--ink-rgb), 0.09); }
.src-ar { direction: rtl; text-align: right; font-family: var(--arabic); font-weight: 400; }
.src-who { margin: 0; font-weight: 500; font-size: 21px; line-height: 32px; color: var(--ink); }
.src-by { margin: 2px 0 0; font-family: var(--sans); font-weight: 400; font-size: 15px; line-height: 20px; color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }
.src-by bdi { font-family: var(--arabic); font-size: 16px; }
.src-text { position: relative; margin-top: 12px; font-size: 20px; line-height: 38px; color: var(--read); overflow-wrap: anywhere; }
.src-text p { margin: 0; }
.src-text p + p { margin-top: 12px; }
.src-text .q { color: var(--ink); }
.src-cite { margin: 14px 0 0; font-size: 16px; line-height: 28px; color: var(--mute); }
.around { margin-top: 14px; padding: 14px 16px; border-radius: 18px; background: var(--fill); }
.around-none { margin: 12px 0 0; }
.around .src-text { margin-top: 4px; font-size: 18px; line-height: 34px; color: var(--soft); }
.around .src-cite { margin-top: 8px; font-size: 15px; line-height: 24px; }
.around-label { direction: ltr; text-align: right; font-family: var(--sans); font-weight: 500; font-size: 14px; line-height: 18px; color: var(--mute); }
.src-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--panel2); color: var(--soft); font-weight: 500; font-size: 15px; line-height: 20px; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, transform 0.16s var(--ease);
}
.act:hover { background: var(--raised); color: var(--ink); }
.act:active { transform: scale(0.96); }
.act svg { width: 15px; height: 15px; }
.act[aria-busy="true"] { cursor: progress; } /* the label says "Reading…": the button keeps its full contrast */
.src-acts.offer { justify-content: flex-start; }
.src-sheet .around { background: var(--panel2); }
.src-sheet .act { background: var(--panel2); }
.src-sheet .act:hover { background: var(--raised); }

/* ---------- motion: blocks rise in (the app's StreamIn), still for reduced motion ---------- */
.rise { animation: pgRise 0.32s cubic-bezier(0.33, 1, 0.68, 1) both; animation-delay: var(--d, 0ms); }
/* a paragraph or an ayah comes into the answer: a fade, nothing moves */
.fade { animation: pgFade 0.45s ease both; animation-delay: var(--d, 0ms); }
@keyframes pgRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .rise, .fade, .sg, .crisis-card { animation: none; }
  .cite, .aref, .pick, .credit-name, .icon-btn, .src-sheet, .src-backdrop { transition: none; }
  .step-dot i { animation: none; opacity: 1; }
  .feel, .sg, .act, .pg-field .send, .pg-row, .pg .btn, .pg-next .chip, .step-head, .work-head .chev, .step-head .chev { transition: none; }
  .feel:active, .sg:active, .act:active, .pg-next .chip:active, .pg .btn:active, .pg-field .send:active, .icon-btn:active { transform: none; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .pg-home { padding-top: 128px !important; }
  .pg-hero { font-size: 34px; line-height: 39px; letter-spacing: -0.3px; }
  .pg-feelings { margin-top: 24px; gap: 8px; }
  .pg-dock { margin-top: 32px; }
  .pg-popular { padding-top: 72px !important; }
  .pg-how { padding-top: 96px !important; padding-bottom: 112px !important; }
  .how-card { grid-template-columns: 1fr; gap: 22px; padding: 22px; }
  .how-note { padding: 0 8px; }
  .pg-thread { padding-top: 88px !important; }
  .bubble { max-width: 86%; }
  .work-head { padding: 10px 14px 10px 10px; gap: 12px; }
  .pg-steps { padding: 0 4px 10px 6px; }
  .pg-step + .pg-step::before { left: 19px; }
  .step-body { padding-left: 8px; padding-right: 4px; }
  .hit { grid-template-columns: 60px 1fr; }
  .hit .hit-score { display: none; }
  .ayah-en { font-size: 19px; line-height: 27px; }
  .quote { padding: 0 16px; }
  .quote .ayah-ar { font-size: 22px; line-height: 42px; }
  .work .retry { margin-left: 18px; }
  .support { padding-left: 18px; }
  .crisis-card { padding: 30px 22px 26px; }
  .pg-crisis { padding-bottom: 24px; }
}

/* ---------- typing, as a chat does: words shown one at a time (playground.js typeIn) ---------- */
.typing .w:not(.on) { display: none; }
.typing .w.on { animation: w-in .28s ease both; }
@keyframes w-in { from { opacity: 0; } to { opacity: 1; } }
/* the newest turn can always sit at the top with the answer growing under it: at least the screen above the ask bar */
[data-view="thread"] .pg-turns > .turn:last-child { align-content: start; min-height: calc(100vh - var(--dock-h, 150px) - 92px); min-height: calc(100dvh - var(--dock-h, 150px) - 92px); }
