/* Shell chrome + shared components. */

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  height: calc(var(--topbar-h) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-left: var(--gutter);
  padding-right: var(--s-2);
  background: transparent;
  transition: opacity var(--fade-ms) var(--ease), transform var(--fade-ms) var(--ease),
              background-color var(--fade-ms) var(--ease), box-shadow var(--fade-ms) var(--ease);
}
.topbar.scrolled {
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}
.topbar.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-heading);
  font-weight: 800;
  flex: 1;
}
.topbar .brand img { width: 32px; height: 32px; border-radius: var(--r-sm); }
.icon-btn {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--ink);
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
.icon-btn:active {
  background: color-mix(in srgb, var(--electric) 14%, var(--surface));
  transform: scale(.97);
}
.icon-btn svg { width: 26px; height: 26px; }

/* inline icon wrapper — keeps Icons.get() SVGs aligned in buttons/rows */
.ic { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ic svg { display: block; }

/* ---------- tab panes + screens ---------- */
#tabs { position: fixed; inset: 0; z-index: 10; }
.tab-pane { position: absolute; inset: 0; transition: opacity var(--fade-ms) var(--ease); }
.tab-pane.inactive { visibility: hidden; opacity: 0; pointer-events: none; }

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ground);
  transition: transform var(--push-ms) var(--ease);
}
.screen.root { padding-top: calc(var(--topbar-h) + var(--safe-top)); }
.screen.offright { transform: translateX(100%); }
.screen.under { transform: translateX(-28%); }
.screen.dragging { transition: none; }
.screen::after { /* dim layer used while a screen sits under a pushed one */
  content: "";
  position: fixed;
  inset: 0;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--push-ms) var(--ease);
}
.screen.under::after { opacity: .12; }

/* ---------- ambient wash (wired from js/shell.js) ---------- */
.screen.root::before {
  content: "";
  position: fixed;
  left: 0; right: 0; top: 0;
  bottom: calc(var(--dock-h) + var(--safe-bottom));
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 60% at 50% 100%,
    color-mix(in srgb, var(--wash-color, transparent) calc(var(--wash-opacity) * 100%), transparent) 0%,
    transparent 70%);
  opacity: 0;
  transition: opacity var(--wash-ms) var(--ease);
}
.screen.root.wash-on::before { opacity: 1; }
.screen.root.academy::before { content: none; }
.screen.root .screen-body { position: relative; z-index: 0; }

.screen-body { padding: 0 var(--gutter) var(--dock-clear); }
.screen.has-fab .screen-body { padding-bottom: calc(var(--dock-clear) + var(--s-8) + var(--s-8)); }

/* compact header on pushed screens */
.screen-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--safe-top) var(--s-2) 0 var(--s-1);
  height: calc(var(--topbar-h) + var(--safe-top));
  background: var(--ground);
}
.screen-header .back-btn { color: var(--brand-deep); }
.screen-header h1 {
  font-size: var(--t-title);
  line-height: var(--lh-title);
  font-weight: 800;
  letter-spacing: -0.01em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* root screen title block */
.screen-title { padding: var(--s-3) 0 var(--s-4); }
.screen-title p { margin-top: var(--s-1); }
/* Home header with the learner's avatar — tapping it opens My progress */
.home-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.home-head-txt { flex: 1; min-width: 0; }
.home-avatar {
  flex: none; background: none; border: 0; padding: 0;
  cursor: pointer; border-radius: var(--r-pill);
}
.home-avatar .avatar { box-shadow: 0 0 0 2px var(--sky); }
.home-avatar:active { opacity: .7; }

/* ---------- dock ---------- */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--dock-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--line), var(--e-raised);
  display: flex;
  align-items: stretch;
}
.dock-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  transition: color var(--fade-ms) var(--ease), transform 120ms var(--ease);
}
.dock-item:active { transform: scale(.97); }
.dock-item .ico {
  width: 52px; height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  transition: background-color var(--fade-ms) var(--ease);
}
.dock-item .ico svg { width: 24px; height: 24px; transition: transform var(--fade-ms) var(--ease); }
.dock-item span { font-size: var(--t-caption); line-height: var(--lh-caption); font-weight: 700; transition: color var(--fade-ms) var(--ease); }
.dock-item.active { color: var(--brand); }
.dock-item.active .ico { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.dock-item.active .ico svg { transform: scale(1.08); }
.dock-fab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--brand-deep);
}
.dock-fab .fab {
  margin-top: calc(-1 * var(--s-5));
  width: 56px; height: 56px;
  border-radius: var(--r-pill);
  background:
    linear-gradient(rgba(4, 16, 56, .25), rgba(4, 16, 56, .25)),
    var(--grad-brand);
  color: var(--surface);
  display: grid;
  place-items: center;
  box-shadow: var(--e-raised);
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
.dock-fab .fab:active { background: var(--brand-deep); transform: scale(.97); }
.dock-fab .fab svg { width: 26px; height: 26px; }
.dock-fab span { font-size: var(--t-caption); line-height: var(--lh-caption); font-weight: 800; }

/* ---------- lists ---------- */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.row {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  text-align: left;
  border-radius: 0;
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
.row + .row { border-top: 1px solid var(--line); }
.row:active {
  background: color-mix(in srgb, var(--electric) 10%, var(--surface));
  transform: scale(.97);
}
.row .avatar {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--brand-deep);
  display: grid;
  place-items: center;
  font-size: var(--t-sub);
  font-weight: 800;
}
/* svg icons inside a row avatar keep the established 22px idiom (else an
   attribute-less svg balloons to the full 40px box) */
.row .avatar svg { width: 22px; height: 22px; }
.row .row-main { flex: 1; min-width: 0; }
.row .row-title { font-size: var(--t-body); line-height: var(--lh-body); font-weight: 700; }
.row .row-sub {
  font-size: var(--t-sub);
  line-height: var(--lh-sub);
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row .row-meta { flex: none; font-size: var(--t-caption); color: var(--muted); display: flex; align-items: center; gap: var(--s-2); }
.row .chevron { color: var(--muted); flex: none; }
.row .chevron svg { width: 18px; height: 18px; }

.section-label {
  font-size: var(--t-sub);
  font-weight: 800;
  color: var(--muted);
  margin: var(--s-5) 0 var(--s-2);
}

/* ---------- segmented control ---------- */
.seg {
  display: flex;
  background: var(--tint);
  border-radius: var(--r-pill);
  padding: var(--s-1);
  margin-bottom: var(--s-4);
}
.seg button {
  flex: 1;
  min-height: 44px;
  border-radius: var(--r-pill);
  font-size: var(--t-sub);
  font-weight: 700;
  color: var(--muted);
  transition: transform 120ms var(--ease), color var(--fade-ms) var(--ease);
}
.seg button:active { transform: scale(.97); }
.seg button.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--e-raised);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-6);
  border-radius: var(--r-pill);
  font-size: var(--t-body);
  font-weight: 800;
  background:
    linear-gradient(rgba(4, 16, 56, .25), rgba(4, 16, 56, .25)),
    var(--grad-brand);
  color: var(--surface);
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
.btn:active { background: var(--brand-deep); transform: scale(.97); }
.btn.secondary { background: var(--tint); color: var(--brand-deep); }
.btn.secondary:active {
  background: color-mix(in srgb, var(--electric) 16%, var(--surface));
  transform: scale(.97);
}
.btn.block { display: flex; width: 100%; }

/* icon-only decline buttons (mentor request rows) — keep a 44px tap width */
.row .btn.secondary[aria-label="Decline"] { min-width: 44px; }

/* ---------- cards & chips ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
}
.card.accent { background: var(--brand); border-color: var(--brand); color: var(--surface); }
.card.accent .t-sub { color: var(--surface); /* QA: --tint on --brand is 4.49:1 — below the 4.5 floor; --surface is 5.12 */ }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--brand-deep);
  font-size: var(--t-caption);
  font-weight: 700;
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
button.chip:active, a.chip:active {
  background: color-mix(in srgb, var(--electric) 16%, var(--surface));
  transform: scale(.97);
}
.chip.gold { background: color-mix(in srgb, var(--gold) 18%, var(--surface)); color: var(--ink); }

.phase-chip {
  display: inline-block;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  border: 1px dashed var(--lumen);
  color: var(--brand);
  font-size: var(--t-caption);
  font-weight: 700;
  margin-bottom: var(--s-3);
}

/* ---------- bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-wrap .scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 16, 56, .45);
  opacity: 0;
  transition: opacity var(--push-ms) var(--ease);
}
.sheet-wrap.open .scrim { opacity: 1; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 86%;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--e-sheet);
  padding: var(--s-3) var(--gutter) calc(var(--safe-bottom) + var(--s-6));
  transform: translateY(100%);
  transition: transform var(--push-ms) var(--ease);
}
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet .grabber {
  width: 36px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--line);
  margin: 0 auto var(--s-3);
}
.sheet-head {
  display: flex;
  align-items: center;
  margin-bottom: var(--s-3);
}
.sheet-head h2 { font-size: var(--t-title); line-height: var(--lh-title); font-weight: 800; flex: 1; }

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--dock-h) + var(--safe-bottom) + var(--s-4));
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--surface);
  font-size: var(--t-sub);
  font-weight: 600;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  box-shadow: var(--e-raised);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 250ms var(--ease), transform 250ms var(--ease);
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- phase 2 additions ---------- */
.avatar-img { object-fit: cover; border-radius: var(--r-pill); flex: none; }

.badge {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--s-2);
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--surface);
  font-size: var(--t-caption);
  font-weight: 800;
  display: grid;
  place-items: center;
}

.fab-float {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--dock-h) + var(--safe-bottom) + var(--s-4));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  background:
    linear-gradient(rgba(4, 16, 56, .25), rgba(4, 16, 56, .25)),
    var(--grad-brand);
  color: var(--surface);
  font-size: var(--t-body);
  font-weight: 800;
  box-shadow: var(--e-raised);
  transition: transform 120ms var(--ease), background-color 120ms var(--ease);
}
.fab-float:active { background: var(--brand-deep); transform: scale(.97); }

.banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--tint);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3) var(--s-2) var(--s-4);
  margin-bottom: var(--s-4);
}
.banner p { flex: 1; font-size: var(--t-sub); line-height: var(--lh-sub); font-weight: 600; color: var(--brand-deep); }
.banner .btn { min-height: 44px; padding: 0 var(--s-4); font-size: var(--t-sub); }

/* urgent prompt — a setup step that blocks progress. Danger-tinted with a
   slow color breathe; the reduced-motion mirror pins the static tint. */
.banner.urgent,
.row.urgent {
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  animation: urgent-breathe 2.6s ease-in-out infinite;
}
.banner.urgent p { color: var(--danger); }
.row.urgent .row-title { color: var(--danger); }
.row.urgent .avatar { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
@keyframes urgent-breathe {
  0%, 100% { background-color: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
  50% { background-color: color-mix(in srgb, var(--danger) 15%, var(--surface)); }
}

/* forms */
.field { display: block; margin-bottom: var(--s-4); }
.field > span {
  display: block;
  font-size: var(--t-sub);
  font-weight: 700;
  color: var(--muted);
  margin-bottom: var(--s-1);
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--t-body);
}
.field textarea { min-height: 88px; resize: vertical; }

.tag-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tag-chips .chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); min-height: 44px; }
.tag-chips .chip.on { border-color: var(--brand); background: var(--tint); color: var(--brand-deep); }

.switch {
  flex: none;
  width: 52px;
  height: 44px; /* QA: 44px tap-target floor — the visible track stays 32px via
     transparent borders + padding-box clip; the knob positions against the
     padding box, so it is unaffected */
  min-width: 52px;
  min-height: 44px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-radius: var(--r-pill);
  background-color: var(--line); /* longhand: the shorthand would reset background-clip */
  background-clip: padding-box;
  position: relative;
  transition: background-color var(--fade-ms) var(--ease);
}
.switch span {
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--e-raised);
  transition: transform var(--fade-ms) var(--ease);
}
.switch.on { background-color: var(--brand); }
.switch.on span { transform: translateX(20px); }

/* chat */
.composer {
  position: sticky;
  bottom: calc(var(--dock-h) + var(--safe-bottom));
  display: flex;
  gap: var(--s-2);
  padding: var(--s-3) 0;
  background: var(--ground);
  box-shadow: 0 -1px 0 var(--line);
}
.composer input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--t-body);
}
.composer .btn { padding: 0 var(--s-5); }

/* chat screen layout — the composer pins above the dock and only the message
   list scrolls; a short thread no longer leaves the composer at the top */
.screen.chat { display: flex; flex-direction: column; overflow: hidden; }
.screen.chat .screen-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding-bottom: 0;
}
.screen.chat .msgs {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  align-items: flex-start;
  padding: var(--s-2) 0;
}
.screen.chat .composer {
  position: static;
  margin-bottom: calc(var(--dock-h) + var(--safe-bottom));
}

.bubble .ticks { font-size: var(--t-caption); color: var(--tint); margin-inline-start: var(--s-2); }
.bubble.question { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.bubble .q-tag {
  display: inline-block;
  font-size: var(--t-caption);
  font-weight: 800;
  color: var(--ink);
  background: color-mix(in srgb, var(--gold) 25%, var(--surface));
  border-radius: var(--r-pill);
  padding: 0 var(--s-2);
  margin-bottom: var(--s-1);
}
/* user-marked question tag — solid gold to read stronger than the auto .q-tag */
.bubble .mq-tag {
  display: block;
  width: fit-content;
  font-size: var(--t-caption);
  font-weight: 800;
  color: var(--ink);
  background: var(--gold);
  border-radius: var(--r-pill);
  padding: 0 var(--s-2);
  margin-bottom: var(--s-1);
}
/* a question the da'ee answered — green state on both sides of the chat */
.bubble .mq-tag.answered { background: var(--success); color: var(--surface); }
/* an open question row on the da'ee funnel — the whole row answers it */
.row.q-open { cursor: pointer; }
.bubble .flag-tag {
  display: block;
  width: fit-content;
  font-size: var(--t-caption);
  font-weight: 800;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-radius: var(--r-pill);
  padding: 0 var(--s-2);
  margin-bottom: var(--s-1);
}
/* da'ee private note attached under the message text */
.bubble .note-line {
  display: block;
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: var(--s-1);
}
/* starred marker inside the bubble's <time> */
.bubble .star-i { color: var(--gold); margin-inline-start: var(--s-1); }
.bubble.sys {
  max-width: 100%;
  background: none;
  border: 0;
  text-align: center;
  font-size: var(--t-caption);
  color: var(--muted);
  padding: var(--s-1) 0;
}
.typing span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--muted);
  margin-right: 3px;
  animation: typing 1s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* live indicator — gold means "happening now", per token rules */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--t-caption);
  font-weight: 800;
  color: var(--ink);
}
.live-dot::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: var(--r-pill);
  background: var(--gold);
}

/* ---------- vibrancy pass: shared micro-interaction primitives ---------- */

/* loading skeleton — brand-tinted shimmer, loops while content loads.
   Reduced motion: the global kill-switch drops the animation, leaving a
   static tinted block (background below), so no extra gating is needed. */
.skeleton {
  border-radius: var(--r-sm);
  background: var(--tint);
  animation: shimmer 1400ms var(--ease) infinite;
}
.skeleton.line { min-height: var(--s-4); margin-bottom: var(--s-2); }
.skeleton.block { min-height: calc(var(--s-8) * 3); }
@keyframes shimmer {
  0%, 100% { background-color: var(--tint); }
  50% { background-color: color-mix(in srgb, var(--lumen) 12%, var(--tint)); }
}

/* lesson/step completion — gold radial pulse, once per event, 450ms.
   Add .pulse-gold to the completed element (needs position: relative). */
.pulse-gold { position: relative; }
.pulse-gold::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glow);
  opacity: 0;
  pointer-events: none;
  animation: gold-pulse 450ms var(--ease) 1;
}
@keyframes gold-pulse {
  0% { opacity: .55; transform: scale(.6); }
  100% { opacity: 0; transform: scale(1.35); }
}

/* check draw — pair with an inline SVG stroke path; --check-len is the
   path length (default 32 covers a 24px icon check). Once, 300ms. */
.check-draw {
  stroke-dasharray: var(--check-len, 32);
  stroke-dashoffset: var(--check-len, 32);
  animation: check-draw 300ms var(--ease) forwards;
}
@keyframes check-draw {
  to { stroke-dashoffset: 0; }
}
/* Bismillah send flourish — floating word spawned next to the send button,
   removed on animationend (modeled on the course quiz's blessRise).
   JS positions it via inline top/left; the translateX(-50%) lives here.
   NOTE: this block must stay ABOVE the prefers-reduced-motion mirror below,
   or the equal-specificity mirror loses on source order. */
.bismillah-fx {
  position: fixed;
  z-index: 80; /* above sheets (.sheet-wrap is 60) */
  pointer-events: none;
  font-weight: 700;
  color: var(--brand-deep);
  white-space: nowrap;
  animation: bismillah-rise 1.05s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes bismillah-rise {
  0% { transform: translate(-50%, 0) scale(.8); opacity: 0; }
  18% { transform: translate(-50%, -12px) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -56px) scale(1); opacity: 0; }
}

/* send button tap pop */
.composer .btn.send-pop { animation: send-pop 250ms var(--ease) 1; }
@keyframes send-pop {
  0% { transform: scale(.9); }
  55% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* action-sheet reaction strip — emoji row at the top of the message menu */
.rxn-strip {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.rxn-strip button {
  min-width: 44px;
  min-height: 44px;
  font-size: 22px; /* emoji glyph, not text — exempt from the type scale */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  transition: transform var(--fade-ms) var(--ease), background-color var(--fade-ms) var(--ease), border-color var(--fade-ms) var(--ease);
}
.rxn-strip button.on { background: var(--tint); border-color: var(--brand); }
.rxn-strip button:active { transform: scale(.92); }

/* static fallback: reduced motion must show the drawn check, not an empty one */
@media (prefers-reduced-motion: reduce) {
  .check-draw { stroke-dashoffset: 0; }
  /* message-action mirrors (base rules live just above, in this file) */
  .rxn-strip button { transition: none; }
  .bismillah-fx, .composer .btn.send-pop { animation: none; }
  /* static end-state: without the rise animation the floating word stays hidden */
  .bismillah-fx { opacity: 0; }
}

/* streak / mood check-in — chip glow with --glow, once, 300ms */
.chip-glow { animation: chip-glow 300ms var(--ease) 1; }
@keyframes chip-glow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 60%, transparent); }
  100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--glow) 0%, transparent); }
}

/* celebration burst (course complete, pairing) — expanding gold glow
   behind the celebrated element, once, 800ms. Add .celebrate-burst to a
   wrapper (needs position: relative). Kept deliberately soft: a gentle
   glow, never a flash. */
.celebrate-burst { position: relative; }
.celebrate-burst::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--s-4));
  border-radius: var(--r-lg);
  background: var(--grad-gold);
  opacity: 0;
  pointer-events: none;
  animation: celebrate-burst 800ms var(--ease) 1;
}
@keyframes celebrate-burst {
  0% { opacity: .38; transform: scale(.7); }
  60% { opacity: .16; }
  100% { opacity: 0; transform: scale(1.35); }
}

/* full-screen celebration overlay — learner.js appends .celebrate-burst
   directly to <body> with a .halo and eight .p confetti particles (pairing
   success), so the overlay styles key off the body-child selector and leave
   the da'ee usage (.d-celebrate .celebrate-burst, screens.css) on the base
   glow above. The base ::before flash is suppressed on the overlay —
   full-viewport gold at high opacity read as a startling flash; the soft
   halo + particles carry the moment on their own. */
body > .celebrate-burst {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  pointer-events: none;
}
body > .celebrate-burst::before { content: none; }
body > .celebrate-burst .halo {
  width: 96px;
  height: 96px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--glow) 28%, transparent);
  box-shadow: 0 0 36px 12px color-mix(in srgb, var(--glow) 30%, transparent);
  animation: celebrate-halo 800ms var(--ease) forwards;
}
@keyframes celebrate-halo {
  0% { transform: scale(.5); opacity: 0; }
  35% { opacity: .7; }
  100% { transform: scale(1.35); opacity: 0; }
}
body > .celebrate-burst .p {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(var(--a, 0deg));
  animation: celebrate-confetti 800ms var(--ease) forwards;
}
@keyframes celebrate-confetti {
  0% { opacity: .9; transform: translate(-50%, -50%) rotate(var(--a, 0deg)) translateY(0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a, 0deg)) translateY(-64px) scale(.5); }
}
body > .celebrate-burst .p:nth-of-type(2) { --a: 45deg; background: var(--lumen); }
body > .celebrate-burst .p:nth-of-type(3) { --a: 90deg; background: var(--glow); }
body > .celebrate-burst .p:nth-of-type(4) { --a: 135deg; background: var(--sky); }
body > .celebrate-burst .p:nth-of-type(5) { --a: 180deg; background: var(--gold); }
body > .celebrate-burst .p:nth-of-type(6) { --a: 225deg; background: var(--lumen); }
body > .celebrate-burst .p:nth-of-type(7) { --a: 270deg; background: var(--glow); }
body > .celebrate-burst .p:nth-of-type(8) { --a: 315deg; background: var(--sky); }
body > .celebrate-burst .p:nth-of-type(9) { --a: 360deg; background: var(--gold); }

/* message send — new outgoing bubble slides + fades in, 200ms.
   shared.js adds .sent to the freshly appended own bubble only (never on a
   full-thread re-render, or history would re-animate). */
.bubble.sent { animation: bubble-in 200ms var(--ease) 1; }
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
/* receipt tick — color shifts to --sky (own-content accent) when read */
.bubble .ticks { transition: color 200ms var(--ease); }
.bubble .ticks.read { color: var(--sky); }

/* ---------- da'ee calendar (d-calendar screen) ----------
   Intentionally transition/animation-free, so no prefers-reduced-motion
   overrides are needed for these selectors. */
.cal-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-2) 0 var(--s-3);
}
.cal-head h2 {
  flex: 1;
  text-align: center;
  font-size: var(--t-heading);
  line-height: var(--lh-heading);
  font-weight: 800;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-2);
  margin-bottom: var(--s-4);
}
.cal-dow {
  text-align: center;
  font-size: var(--t-caption);
  line-height: var(--lh-caption);
  font-weight: 700;
  color: var(--muted);
  padding: var(--s-1) 0;
}
.cal-day {
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--r-sm);
  font-size: var(--t-sub);
  font-weight: 600;
  color: var(--ink);
}
.cal-day.pad { background: none; }
.cal-day[data-day]:active { background: var(--tint); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); font-weight: 800; }
.cal-day.sel { background: var(--brand); color: var(--surface); box-shadow: none; }
.cal-day.sel:active { background: var(--brand-deep); }
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  visibility: hidden;
}
.cal-dot.on { visibility: visible; background: var(--brand); }
.cal-dot.pend { visibility: visible; background: var(--gold); }
.cal-day.sel .cal-dot.on,
.cal-day.sel .cal-dot.pend { background: var(--surface); }

/* small phones: trim grid chrome so each .cal-day keeps ~40px+ of width */
@media (max-width: 360px) {
  .cal-grid { gap: 2px; padding: var(--s-1); }
  .cal-dow { padding: 2px 0; }
}
