/* «اشرح لي» on the web: the same tokens as the apps (android design/Theme.kt, iOS VCDesign). */
:root {
  --canvas: #ffffff;
  --surface: #ffffff;
  --subtle: #f5f5f7;
  --line: #ececef;
  --ink: #0b0b0c;
  --on-ink: #ffffff;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --wave-idle: #cfcfd4;
  --ai: #5b3fd0;
  --ai-bg: #efebfe;
  --ai-start: #8b5cf6;
  --ai-end: #4f46e5;
  --ai-pink: #f0abfc;
  --ai-cyan: #67e8f9;
  --wash-violet: #ede7ff;
  --wash-sky: #e0f2fe;
  --amber-fg: #b45309;
  --amber-bg: #fef3c7;
  --sky-fg: #0369a1;
  --sky-bg: #e0f2fe;
  --rose-fg: #be123c;
  --rose-bg: #ffe4e6;
  --green-fg: #15803d;
  --green-bg: #dcfce7;
  --violet-fg: #5b3fd0;
  --violet-bg: #efebfe;
  --danger: #e5484d;
  --shadow: 0 1px 2px rgba(17, 12, 46, 0.04), 0 10px 30px rgba(17, 12, 46, 0.07);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
  --radius: 24px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #000000;
    --surface: #1c1c1e;
    --subtle: #2c2c2e;
    --line: #38383a;
    --ink: #f5f5f7;
    --on-ink: #0b0b0c;
    --ink-2: #98989f;
    --ink-3: #636366;
    --wave-idle: #3a3a3c;
    --ai: #b8a6ff;
    --ai-bg: #221a40;
    --wash-violet: #2a1f5c;
    --wash-sky: #0c2638;
    --amber-fg: #fcd34d;
    --amber-bg: #3a2a0a;
    --sky-fg: #7dd3fc;
    --sky-bg: #0b2a3a;
    --rose-fg: #fda4af;
    --rose-bg: #3a0f18;
    --green-fg: #4ade80;
    --green-bg: #0f2a1a;
    --violet-fg: #b8a6ff;
    --violet-bg: #221a40;
    --danger: #ff6369;
    --shadow: none;
    --shadow-soft: none;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The soft violet and sky light behind AI screens, fading into white. */
.wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90vmax 70vmax at 90% -8%, var(--wash-violet), transparent 62%),
    radial-gradient(70vmax 55vmax at 4% 10%, color-mix(in srgb, var(--wash-sky) 90%, transparent), transparent 58%);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 28px);
}

.screen { display: flex; flex-direction: column; gap: 14px; animation: rise 0.28s ease-out; }
.screen-center { min-height: calc(100dvh - 60px); align-items: center; justify-content: center; text-align: center; gap: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.badge { font-size: 12px; font-weight: 600; color: var(--violet-fg); background: var(--violet-bg); padding: 2px 9px; border-radius: 999px; }

/* Round icon button on white with a hairline: close, more, back. */
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  transition: transform 0.12s ease;
}
.icon-btn:active { transform: scale(0.94); }

/* Hero */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 8px 4px; }
.title { margin: 6px 0 0; font-size: 26px; line-height: 1.35; font-weight: 700; letter-spacing: -0.2px; }
.sub { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.7; max-width: 34ch; }

/* The AI's face: a glowing sphere of violet and indigo with pink and cyan light drifting inside. */
.orb { --size: 84px; position: relative; display: inline-block; width: var(--size); height: var(--size); flex: none; }
.orb::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.32), transparent 70%);
}
.orb .core {
  position: absolute; inset: 13%;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ai-start), var(--ai-end));
  animation: breathe 2.9s ease-in-out infinite;
  transform: scale(calc(1 + var(--level, 0) * 0.14));
}
.orb .blob { position: absolute; inset: -18%; animation: spin 7s linear infinite; }
.orb .blob::after { content: ''; position: absolute; width: 78%; height: 78%; border-radius: 50%; }
.orb .pink::after { top: 2%; left: 30%; background: radial-gradient(circle, rgba(240, 171, 252, 0.95), transparent 62%); }
.orb .cyan { animation-duration: 5.3s; animation-direction: reverse; }
.orb .cyan::after { top: 34%; left: 2%; background: radial-gradient(circle, rgba(103, 232, 249, 0.85), transparent 60%); }
.orb .shine { position: absolute; inset: 0; background: radial-gradient(circle at 33% 29%, rgba(255, 255, 255, 0.8), transparent 30%); }
.orb-tiny { --size: 30px; }
.orb-tiny::before { display: none; }
.orb-tiny .core { inset: 0; }
.orb-big { --size: 96px; }
.orb-huge { --size: 168px; }
.orb.is-active .blob { animation-duration: 3.2s; }
.orb.is-active .cyan { animation-duration: 2.4s; }
.orb.is-active::before { animation: glow 1.6s ease-in-out infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { scale: 1.035; } }
@keyframes glow { 50% { opacity: 0.55; transform: scale(1.06); } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.composer { padding: 14px 14px 10px; position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
.composer.is-drop { border-color: var(--ai-start); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ai-start) 18%, transparent); }
.composer textarea {
  width: 100%;
  min-height: 112px;
  max-height: 46vh;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 17px;
  line-height: 1.75;
  padding: 2px 4px;
}
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.count { margin-inline-start: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.drop-hint { display: none; margin: 6px 4px 0; font-size: 12.5px; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .drop-hint { display: block; } }

/* Chips and pills */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 999px;
  border: 0;
  background: var(--subtle);
  color: var(--ink);
  font-size: 14.5px; font-weight: 600;
}
.chip .icon { width: 17px; height: 17px; }
.chip-quiet { background: transparent; color: var(--ink-2); }

.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--on-ink);
  font-size: 16.5px; font-weight: 600;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.pill:active:not(:disabled) { transform: scale(0.98); }
.pill:disabled { opacity: 0.3; cursor: default; }
.pill-wide { width: 100%; }
.pill-big { height: 58px; font-size: 18px; }
.pill-light { background: var(--subtle); color: var(--ink); }

/* Option rows with pastel icon tiles */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.option:active { transform: scale(0.98); }
.option-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.option-text b { font-size: 15.5px; font-weight: 600; }
.option-text small { font-size: 12.5px; color: var(--ink-2); }
.option-compact { flex-direction: column; gap: 8px; padding: 14px 8px; text-align: center; justify-content: center; }
.option-compact b { font-size: 14.5px; font-weight: 600; }

.tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tile .icon { width: 21px; height: 21px; }
.tile-sky { color: var(--sky-fg); background: var(--sky-bg); }
.tile-violet { color: var(--violet-fg); background: var(--violet-bg); }
.tile-amber { color: var(--amber-fg); background: var(--amber-bg); }
.tile-green { color: var(--green-fg); background: var(--green-bg); }
.tile-rose { color: var(--rose-fg); background: var(--rose-bg); }

.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: start; }
.row-text { flex: 1; color: var(--ink-2); font-size: 15px; }
.row-text b { color: var(--ink); font-weight: 600; }
.row-action { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-2); font-size: 14px; }
.row-action .icon { width: 17px; height: 17px; }

/* Attachments */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attachment {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 10px;
  background: var(--subtle);
  border-radius: 14px;
  font-size: 13.5px;
  max-width: 100%;
}
.attachment img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; display: block; }
.attachment .name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment .remove { width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--ink-2); }
.attachment .remove .icon { width: 14px; height: 14px; }
.attachment.is-image { padding: 0; background: none; }
.attachment.is-image .remove { position: absolute; top: -6px; inset-inline-start: -6px; box-shadow: var(--shadow-soft); border: 1px solid var(--line); }

.cta { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); padding-top: 4px; z-index: 2; }

.error { margin: 0; color: var(--danger); font-size: 14.5px; }
.error-box { padding: 12px 14px; background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-radius: 16px; }
.footnote { margin: 4px 8px 0; text-align: center; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }

/* Access code */
.code-card { width: 100%; padding: 18px; display: flex; flex-direction: column; gap: 12px; text-align: start; margin-top: 10px; }
.field-label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; }
.field-label .icon { width: 17px; height: 17px; color: var(--ink-2); }
.input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--subtle);
  font-size: 17px;
  outline: none;
}
.input:focus { border-color: var(--ai-start); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ai-start) 16%, transparent); }

/* Working */
.step { margin: 18px 0 0; font-size: 21px; font-weight: 600; }

/* Result thread */
.thread { display: flex; flex-direction: column; gap: 12px; }
.answer { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.answer-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.answer-label .icon { width: 16px; height: 16px; }
.answer-text { font-size: 18.5px; line-height: 1.9; }
.answer-text p { margin: 0 0 0.6em; }
.answer-text p:last-child { margin-bottom: 0; }
.note { margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--subtle); color: var(--ink-2); font-size: 14px; }
.tag { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--amber-fg); background: var(--amber-bg); }

.section-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; }
.section-head .tile { width: 34px; height: 34px; border-radius: 10px; }
.section-head .tile .icon { width: 18px; height: 18px; }
.section-body { margin: 0; font-size: 17px; line-height: 1.85; }
.terms { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.terms dt { font-weight: 700; font-size: 16px; }
.terms dd { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.75; }
.plain-list { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 6px; font-size: 15.5px; line-height: 1.75; }
.plain-list small { display: block; color: var(--ink-2); }

.source { padding: 0; }
.source summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 15px; }
.source summary::-webkit-details-marker { display: none; }
.source summary .row-action { margin-inline-start: auto; }
.source[open] summary .row-action .icon { transform: rotate(-90deg); }
.source .source-text { margin: 0; padding: 0 16px 16px; white-space: pre-wrap; color: var(--ink-2); font-size: 15px; line-height: 1.8; }

.bubble {
  align-self: flex-start;
  max-width: 88%;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px;
  border-radius: 20px;
  border-start-start-radius: 6px;
  background: var(--ink); color: var(--on-ink);
  font-size: 16px; line-height: 1.6;
}
.bubble .icon { width: 16px; height: 16px; margin-top: 4px; opacity: 0.75; }

.pending { padding: 14px 16px; display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 15px; }
.pending-text { display: flex; flex-direction: column; line-height: 1.5; }
.pending-text small { font-size: 12.5px; color: var(--ink-3); }
.pending .orb { --size: 34px; }
.pending .orb::before { display: none; }
.pending .orb .core { inset: 0; }

.followups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }

/* Voice card: a play button and a wave whose played part turns violet */
.voice { display: flex; align-items: center; gap: 12px; }
.play-btn {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--ink); color: var(--on-ink);
  transition: transform 0.12s ease;
}
.play-btn:active { transform: scale(0.94); }
.play-btn .icon { width: 22px; height: 22px; }
.play-btn.is-loading .icon { opacity: 0.25; }
.play-btn.is-loading { background: linear-gradient(135deg, var(--ai-start), var(--ai-end)); animation: glow 1.2s ease-in-out infinite; }
.wave { position: relative; flex: 1; height: 38px; cursor: pointer; touch-action: none; }
.bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.bars i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--wave-idle); }
.bars.played { clip-path: inset(0 0 0 calc(100% - var(--progress, 0%))); }
.bars.played i { background: linear-gradient(180deg, var(--ai-start), var(--ai-end)); }
[dir='ltr'] .bars.played { clip-path: inset(0 calc(100% - var(--progress, 0%)) 0 0); }
.time { flex: none; min-width: 38px; text-align: center; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Sheets */
.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 22px);
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.sheet[open] { animation: sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (min-width: 560px) {
  .sheet { margin: auto; border-radius: 28px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 700; }

.language-list { display: flex; flex-direction: column; gap: 6px; }
.language-option {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: start;
}
.language-option[aria-checked='true'] { border-color: var(--ai-start); background: var(--ai-bg); }
.language-option .names { flex: 1; display: flex; flex-direction: column; line-height: 1.4; }
/* Names in other scripts keep their own direction but line up with the rest of the list. */
.language-option .native, .language-option .english { text-align: right; }
.language-option .native { font-weight: 600; font-size: 16px; }
.language-option .english { font-size: 12.5px; color: var(--ink-2); }
.language-option .no-voice { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--subtle); padding: 2px 8px; border-radius: 999px; }
.language-option .check { width: 22px; height: 22px; color: var(--ai); visibility: hidden; }
.language-option[aria-checked='true'] .check { visibility: visible; }

.setting { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.setting-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
/* Choices side by side in a gray track; the chosen one is a raised white pill. */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--subtle); }
.segmented button {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px; font-weight: 500;
}
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-soft); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 16px; font-size: 15.5px; font-weight: 500; }
.toggle { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--wave-idle); position: relative; cursor: pointer; transition: background 0.2s; flex: none; margin: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.toggle:checked { background: var(--ai-start); }
.toggle:checked::after { transform: translateX(-20px); }
[dir='ltr'] .toggle:checked::after { transform: translateX(20px); }

.share { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.share-inner { padding: 6px 14px; box-shadow: none; }
.share-row { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 15px; }
.share-row + .share-row { border-top: 1px solid var(--line); }
.share-row span { color: var(--ink-2); flex: 1; }
.share-row b { font-size: 17px; font-weight: 600; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

.link-danger { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--danger); font-size: 14px; font-weight: 500; }

/* Ask by voice: the microphone in the dock */
.mic-btn {
  width: 96px; height: 96px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--ai-start), var(--ai-end));
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35), 0 0 0 calc(var(--level, 0) * 26px) rgba(139, 92, 246, 0.18);
  transition: box-shadow 0.08s linear, transform 0.12s ease;
}
.mic-btn .icon { width: 38px; height: 38px; }
.mic-btn:active { transform: scale(0.96); }
.mic-btn.is-recording { background: var(--ink); color: var(--on-ink); }
.mic-label { margin: 0; color: var(--ink-2); font-size: 12.5px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.ask-form { display: flex; gap: 8px; align-items: center; }
.send-btn { width: 50px; height: 50px; flex: none; border: 0; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }

/* Voice first: the microphone on the home screen and the speaking orb on the result are the same sphere. */
.voice-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 8px 2px; }
.mic-orb, .stage-orb {
  position: relative;
  display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 50%;
  background: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.mic-orb:active, .stage-orb:active { transform: scale(0.97); }
.mic-orb > *, .stage-orb > * { grid-area: 1 / 1; }
.orb-hero { --size: 196px; }
.orb-stage { --size: 184px; }
.mic-orb .orb .core, .stage-orb .orb .core { transform: scale(calc(0.96 + var(--level, 0) * 0.13)); transition: transform 0.07s linear; }
/* Rings that grow with the voice, heard or spoken. */
.halo {
  width: 62%; height: 62%;
  border-radius: 50%;
  box-shadow:
    0 0 0 calc(var(--level, 0) * 30px) color-mix(in srgb, var(--ai-start) 16%, transparent),
    0 0 0 calc(var(--level, 0) * 58px) color-mix(in srgb, var(--ai-start) 8%, transparent);
  transition: box-shadow 0.08s linear;
}
.mic-orb:not(.is-recording) .halo { animation: invite 2.8s ease-out infinite; }
@keyframes invite {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ai-start) 26%, transparent); }
  70%, 100% { box-shadow: 0 0 0 34px transparent; }
}
.glyph { display: grid; place-items: center; color: #fff; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.glyph .icon { width: 46px; height: 46px; stroke-width: 2.2; filter: drop-shadow(0 2px 10px rgba(49, 26, 140, 0.45)); }
.is-recording .orb .blob, .is-speaking .orb .blob { animation-duration: 2.8s; }
.is-recording .orb .cyan, .is-speaking .orb .cyan { animation-duration: 2.1s; }
.is-speaking .glyph, .is-loading .glyph { opacity: 0; transform: scale(0.85); }
.is-loading .orb::before { animation: glow 1.2s ease-in-out infinite; }

.record-bar { display: inline-flex; align-items: center; gap: 10px; margin-top: 2px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1.2s ease-in-out infinite; }
.rec-time { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2em; }
@keyframes blink { 50% { opacity: 0.25; } }

.divider { display: flex; align-items: center; gap: 12px; margin: 2px 6px 10px; color: var(--ink-3); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.options-3 { grid-template-columns: repeat(3, 1fr); }

/* Result: the voice on stage */
.stage { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 0 4px 6px; }
.speaker { margin: 2px 0 0; min-height: 1.5em; font-size: 13.5px; font-weight: 600; color: var(--ai); }
.caption {
  margin: 0;
  max-width: 30ch;
  min-height: calc(1.65em * 3);
  font-size: 21px; line-height: 1.65; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.22s ease;
}
.caption.is-hint { color: var(--ink-2); font-size: 16.5px; font-weight: 500; }
.caption.is-new { animation: rise 0.25s ease-out; }
.stage.is-silent .stage-meta, .stage.is-silent .glyph { display: none; }
.stage-orb:disabled { cursor: default; }
.stage-meta { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 380px; margin-top: 4px; }
.icon-btn-small { width: 36px; height: 36px; }
.icon-btn-small .icon { width: 17px; height: 17px; }
.progress { position: relative; flex: 1; height: 6px; border-radius: 999px; background: var(--subtle); cursor: pointer; touch-action: none; }
.progress::before { content: ''; position: absolute; inset: -12px 0; }
.progress i { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--progress, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--ai-start), var(--ai-end)); }

/* The written explanation, folded to three lines under the voice. */
.answer-text.is-folded { max-height: calc(1.9em * 3); overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent); mask-image: linear-gradient(to bottom, #000 45%, transparent); }
.fold-btn { align-self: flex-start; }

/* The dock: ask by voice in the middle, the other follow-ups beside it. */
.dock {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 10px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: var(--shadow);
}
.dock-side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; border: 0; background: none; color: var(--ink); transition: transform 0.12s ease, opacity 0.15s ease; }
.dock-side b { font-size: 13.5px; font-weight: 600; }
.dock-side:active { transform: scale(0.95); }
.dock-side:disabled, .mic-btn:disabled { opacity: 0.4; cursor: default; }
.dock-center { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.dock .mic-btn { width: 70px; height: 70px; }
.dock .mic-btn .icon { width: 30px; height: 30px; }

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  max-width: 440px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 15px;
  text-align: center;
  z-index: 10;
  animation: rise 0.2s ease-out;
}

:focus-visible { outline: 3px solid color-mix(in srgb, var(--ai-start) 55%, transparent); outline-offset: 2px; }

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