:root {
  --sw-teal: #0d6e8a;
  --sw-teal-dark: #0a4f63;
  --sw-teal-soft: rgba(13, 110, 138, 0.12);
  --sw-cyan: #1a9bb8;
  --sw-gold: #c9a227;
  --sw-navy: #0d2d3d;

  --bpa-coral: #1a9bb8;
  --bpa-coral-hover: #0d6e8a;
  --bpa-coral-soft: rgba(26, 155, 184, 0.15);
  --bpa-teal: #0d6e8a;
  --bpa-teal-dark: #0a4f63;
  --bpa-teal-soft: rgba(13, 110, 138, 0.1);
  --bpa-green: #0d6e8a;
  --bpa-green-soft: rgba(13, 110, 138, 0.08);
  --bpa-slate: #2d4a56;
  --bpa-burgundy: #0d4f6e;

  --bg: #f4f9fb;
  --bg-soft: #eef6f9;
  --bg-muted: #e8f2f6;
  --surface: #ffffff;
  --surface-border: rgba(13, 78, 110, 0.1);
  --text: #1e3a47;
  --text-heading: #0d2d3d;
  --text-dim: #4a6b7a;
  --text-muted: #7a96a3;
  --rose: #0d6e8a;

  --font-display: "Vazirmatn", system-ui, sans-serif;
  --font-body: "Vazirmatn", system-ui, sans-serif;

  --radius-sm: 10px;
  --radius-panel: 16px;
  --radius-chip: 999px;
  --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.05);
  --shadow-panel: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-orb: 0 0 0 4px var(--bpa-coral-soft), 0 8px 28px rgba(232, 180, 176, 0.35);

  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

/* The hidden attribute must always win over component display rules
   (e.g. .controls{display:flex}), otherwise sections leak between phases. */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

a {
  color: var(--bpa-coral-hover);
  font-weight: 500;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg-soft);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel,
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-soft);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding:
    calc(0.75rem + var(--safe-top))
    calc(0.6rem + var(--safe-right))
    calc(0.6rem + var(--safe-bottom))
    calc(0.6rem + var(--safe-left));
}

.section-label {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.section-label--inline {
  margin-bottom: 0;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 0.25rem;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1 1 auto;
}

.app-header__logo-link {
  flex-shrink: 0;
  line-height: 0;
}

.app-header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sw-cyan), var(--sw-teal-dark));
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-soft);
}

.app-header__titles {
  min-width: 0;
}

.app-header__badge {
  display: none;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-heading);
  line-height: 1.25;
  white-space: nowrap;
}

.tagline {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-ghost,
.btn-text {
  min-height: var(--touch-min);
  padding: 0.5rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-ghost:hover,
.btn-text:hover {
  background: var(--bpa-coral-soft);
  border-color: var(--bpa-coral);
  color: var(--text-heading);
}

.btn-ghost:focus-visible,
.btn-text:focus-visible {
  outline: 2px solid var(--bpa-coral);
  outline-offset: 2px;
}

/* Book selector */
.book-selector {
  flex-shrink: 0;
  margin-bottom: 0.875rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-inline: calc(-0.25rem - var(--safe-left));
  padding-inline: calc(0.25rem + var(--safe-left));
}

.book-selector::-webkit-scrollbar {
  display: none;
}

.book-selector__track {
  display: flex;
  gap: 0.5rem;
  min-width: min-content;
  padding: 0.35rem;
  border-radius: var(--radius-panel);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--surface-border);
}

.book-chip {
  flex: 0 0 auto;
  min-height: var(--touch-min);
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.book-chip[aria-pressed="true"] {
  border-color: var(--surface-border);
  color: var(--text-heading);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.book-chip:focus-visible {
  outline: 2px solid var(--bpa-coral);
  outline-offset: 2px;
}

/* Transcript */
.transcript-panel {
  flex: 1 1 auto;
  min-height: 160px;
  margin-bottom: 0.875rem;
  overflow: hidden;
}

/* Chat/explanation view: lock to the viewport, only the transcript scrolls. */
body.chat-mode .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.chat-mode .suggested { display: none; }        /* free space for the answer */
body.chat-mode .transcript-panel { margin-bottom: 0.5rem; }

.transcript-panel__header {
  padding: 0.75rem 1rem 0;
  border-bottom: 1px solid var(--surface-border);
}

.transcript-panel__inner {
  height: calc(100% - 2.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
}

.transcript-panel__empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  max-width: 18rem;
  line-height: 1.5;
}

.turn {
  max-width: 88%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-panel);
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: fadeUp 0.35s ease;
}

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

.turn--user {
  align-self: flex-end;
  text-align: right;
  color: var(--text-heading);
  background: var(--bpa-coral-soft);
  border: 1px solid rgba(252, 236, 236, 0.9);
  border-bottom-right-radius: 4px;
}

.turn--assistant {
  align-self: stretch;
  max-width: 100%;      /* explanation uses the full width for comfortable reading */
  width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-right: 3px solid var(--bpa-teal);
  border-bottom-left-radius: 4px;
  box-shadow: none;
  font-size: 1.02rem;   /* larger for on-screen reading while it speaks */
  line-height: 1.85;
}

.turn__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-chip);
  background: var(--bpa-coral-soft);
  border: 1px solid rgba(232, 180, 176, 0.35);
  color: var(--text-dim);
  font-size: 0.6875rem;
  font-weight: 600;
}

/* Suggested */
.suggested {
  flex-shrink: 0;
  margin-bottom: 0.875rem;
}

.suggested__chips {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggested-chip {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.875rem 1rem;
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--bpa-coral-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: var(--shadow-soft);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.suggested-chip__label {
  font-weight: 600;
  color: var(--text-heading);
}

.suggested-chip__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.suggested-chip--choice {
  border-left-color: var(--bpa-coral);
}

.suggested-chip--choice:hover {
  background: var(--bpa-coral-soft);
  border-left-color: var(--bpa-coral-hover);
}

.suggested-chip:hover {
  background: rgba(252, 236, 236, 0.45);
  border-left-color: var(--bpa-coral);
}

.suggested-chip:active {
  transform: scale(0.99);
}

.suggested-chip:focus-visible {
  outline: 2px solid var(--bpa-coral);
  outline-offset: 2px;
}

/* Controls */
.controls-panel {
  padding: 0.75rem 1rem;
}

.controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.orb-wrap {
  position: relative;
  width: min(128px, 34vw);
  height: min(128px, 34vw);
  display: grid;
  place-items: center;
}

.contour-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.contour-rings .ring {
  fill: none;
  stroke: rgba(212, 181, 178, 0.45);
  stroke-width: 1;
  transform-origin: center;
  transition: stroke 0.25s;
}

.orb-wrap[data-state="listening"] .ring {
  stroke: var(--bpa-coral);
}

.orb-wrap[data-state="listening"] .ring-1 {
  transform: scale(var(--mic-level, 1));
}

.orb-wrap[data-state="listening"] .ring-2 {
  transform: scale(calc(var(--mic-level, 1) * 0.98));
}

.orb-wrap[data-state="speaking"] .ring-1 { animation: ripple 2.4s ease-out infinite; }
.orb-wrap[data-state="speaking"] .ring-2 { animation: ripple 2.4s ease-out 0.4s infinite; }
.orb-wrap[data-state="speaking"] .ring-3 { animation: ripple 2.4s ease-out 0.8s infinite; }

.orb-wrap[data-state="thinking"] .contour-rings {
  animation: slow-spin 14s linear infinite;
}

@keyframes ripple {
  0% { opacity: 0.8; transform: scale(1); stroke: var(--bpa-coral); }
  100% { opacity: 0; transform: scale(1.14); stroke: var(--bpa-coral-hover); }
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

.orb {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  min-width: 92px;
  min-height: 92px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--bpa-coral), var(--bpa-coral-hover));
  color: #fff;
  box-shadow: var(--shadow-orb);
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
}

.orb__glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 180, 176, 0.45) 0%, transparent 70%);
  pointer-events: none;
}

.orb:hover:not(:disabled) {
  transform: scale(1.03);
}

.orb:active:not(:disabled) {
  transform: scale(0.97);
}

.orb:focus-visible {
  outline: 2px solid var(--bpa-coral-hover);
  outline-offset: 4px;
}

.orb:disabled,
.orb-wrap[data-state="text-only"] .orb {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.4);
}

.orb-wrap[data-state="passive"] .orb {
  opacity: 0.7;
}

.orb-caption {
  margin: 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9375rem;
  font-weight: 500;
  max-width: 20rem;
  padding-inline: 0.5rem;
}

.controls__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.btn-secondary,
.btn-primary {
  min-height: var(--touch-min);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-chip);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.btn-secondary {
  flex: 1 1 calc(50% - 0.25rem);
  max-width: 100%;
  border: 1px solid var(--surface-border);
  background: var(--bg);
  color: var(--text-heading);
}

.btn-secondary:hover {
  background: var(--bpa-coral-soft);
  border-color: var(--bpa-coral);
}

.btn-secondary[aria-pressed="true"] {
  border-color: var(--bpa-coral);
  color: var(--text-heading);
  background: var(--bpa-coral-soft);
}

.btn-primary {
  border: 0;
  background: var(--bpa-coral);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 180, 176, 0.4);
}

.btn-primary:hover {
  background: var(--bpa-coral-hover);
  transform: translateY(-1px);
}

.btn-secondary:focus-visible,
.btn-primary:focus-visible {
  outline: 2px solid var(--bpa-coral-hover);
  outline-offset: 2px;
}

.text-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  align-items: stretch;
}

.text-row[hidden] {
  display: none !important;
}

.text-row__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--touch-min);
  padding: 0.625rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.text-row__input::placeholder {
  color: var(--text-muted);
}

.text-row__input:focus {
  outline: 2px solid var(--bpa-coral);
  outline-offset: 0;
  border-color: var(--bpa-coral);
}

.text-row__send {
  flex: 0 0 auto;
  white-space: nowrap;
}

.app-footer-note {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.app-footer-note a {
  color: var(--bpa-coral-hover);
}

/* About sheet */
.about-sheet {
  width: 100%;
  max-width: 720px;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.about-sheet::backdrop {
  background: rgba(52, 73, 94, 0.4);
  backdrop-filter: blur(4px);
}

.about-sheet__panel {
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  max-height: 90dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 600px) {
  .about-sheet {
    max-width: 28rem;
    margin: auto;
  }

  .about-sheet__panel {
    border-radius: var(--radius-panel);
  }
}

.about-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--surface-border);
}

.about-sheet__header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-heading);
}

.btn-icon {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border: 0;
  background: var(--bg-muted);
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.about-sheet__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem;
  color: var(--text-dim);
  font-size: 0.9375rem;
}

.about-sheet__body p {
  margin: 0 0 1rem;
}

.about-book {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--surface-border);
}

.about-book:last-of-type {
  border-bottom: 0;
}

.about-book h3 {
  margin: 0 0 0.375rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--bpa-coral-hover);
}

.about-book p {
  margin: 0;
  font-size: 0.875rem;
}

.error-banner {
  margin-bottom: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(148, 23, 81, 0.08);
  border: 1px solid rgba(148, 23, 81, 0.25);
  color: var(--text-heading);
  font-size: 0.875rem;
}

.app-shell--locked {
  pointer-events: none;
  user-select: none;
  filter: blur(2px) saturate(0.85);
}

.consent-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1000;
  padding:
    0.75rem
    calc(0.75rem + var(--safe-right))
    calc(0.75rem + var(--safe-bottom))
    calc(0.75rem + var(--safe-left));
}

.consent-banner[hidden] {
  display: none !important;
}

.consent-banner--active::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(52, 73, 94, 0.35);
  pointer-events: none;
}

.consent-banner__panel {
  pointer-events: auto;
}

.consent-banner__panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem;
}

.consent-banner__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-heading);
}

.consent-banner__summary {
  margin: 0 0 0.875rem;
  color: var(--text-dim);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.consent-banner__details {
  display: none;
  margin-bottom: 0.875rem;
  max-height: 30dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.consent-banner__details--open {
  display: block;
}

.consent-banner__details section {
  margin-bottom: 0.875rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--surface-border);
}

.consent-banner__details section:last-child {
  border-bottom: 0;
}

.consent-banner__details h3 {
  margin: 0 0 0.25rem;
  color: var(--bpa-coral-hover);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.consent-banner__details p {
  margin: 0;
}

.consent-banner__toggle {
  margin-bottom: 0.875rem;
  padding-left: 0;
  border: 0;
  background: transparent;
}

.consent-banner__actions {
  display: flex;
  gap: 0.5rem;
}

.consent-banner__accept {
  flex: 1 1 auto;
  min-height: var(--touch-min);
}

.turnstile-host {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.captcha-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--surface-border);
}

.captcha-section--invisible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.captcha-section--invisible .captcha-section__label {
  display: none;
}

.captcha-section[hidden] {
  display: none !important;
}

.captcha-section--invisible #turnstile-widget {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.captcha-section__label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.captcha-section__error {
  margin: 0;
  color: var(--rose);
  font-size: 0.875rem;
  text-align: center;
}

.consent-banner__policy-link {
  display: inline-block;
  margin-bottom: 0.875rem;
  margin-left: 0.5rem;
  padding-left: 0;
  border: 0;
  background: transparent;
  color: var(--bpa-coral-hover);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.consent-banner__policy-link:hover {
  color: var(--bpa-slate);
}

/* Privacy policy page */
.privacy-page {
  background: var(--bg-soft);
}

.privacy-shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right))
    calc(2rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
}

.privacy-shell__header {
  margin-bottom: 1.25rem;
}

.privacy-shell__back {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--bpa-coral-hover);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.privacy-shell__back:hover {
  color: var(--bpa-slate);
}

.privacy-shell__header h1 {
  margin: 0 0 0.35rem;
  color: var(--text-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

.privacy-shell__lead {
  margin: 0 0 0.25rem;
  color: var(--text-dim);
  font-size: 1rem;
}

.privacy-shell__updated {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.privacy-content {
  padding: 1.25rem 1.35rem;
}

.privacy-content section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--surface-border);
}

.privacy-content section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.privacy-content h2 {
  margin: 0 0 0.75rem;
  color: var(--text-heading);
  font-size: 1.125rem;
  font-weight: 700;
}

.privacy-content h3 {
  margin: 1rem 0 0.5rem;
  color: var(--text-heading);
  font-size: 1rem;
  font-weight: 600;
}

.privacy-content p,
.privacy-content li {
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.privacy-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.privacy-content a {
  color: var(--bpa-coral-hover);
  font-weight: 500;
}

.privacy-content a:hover {
  color: var(--bpa-slate);
}

.privacy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.privacy-table th,
.privacy-table td {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--surface-border);
  text-align: left;
  vertical-align: top;
}

.privacy-table th {
  background: var(--bg-muted);
  color: var(--text-heading);
  font-weight: 600;
}

.privacy-addendum-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.privacy-shell__footer {
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.privacy-shell__footer a {
  color: var(--bpa-coral-hover);
  font-weight: 600;
  text-decoration: none;
}

.privacy-shell__footer a:hover {
  text-decoration: underline;
}

.controls--blocked .orb,
.controls--blocked .suggested-chip,
.controls--blocked .book-chip,
.controls--blocked .text-row__input,
.controls--blocked .text-row__send {
  opacity: 0.45;
}

@media (min-width: 900px) {
  .app-shell {
    padding-top: calc(1.5rem + var(--safe-top));
  }

  .controls-panel {
    padding: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .turn { animation: none; }

  .orb-wrap[data-state="speaking"] .ring,
  .orb-wrap[data-state="thinking"] .contour-rings {
    animation: none;
  }

  .orb-wrap[data-state="speaking"] .ring,
  .orb-wrap[data-state="listening"] .ring {
    stroke: var(--bpa-coral);
  }

  .btn-primary:hover,
  .suggested-chip:active {
    transform: none;
  }
}

/* ── Guided Discovery interview ─────────────────────────────────────────── */
.interview {
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: interview-in 0.25s ease;
}
@keyframes interview-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.interview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.interview__progress {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bpa-coral-hover);
}
.interview__skip {
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.interview__skip:hover { color: var(--text); }
.interview__question {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-heading);
  margin: 0;
}
.interview__help {
  font-size: 13px;
  color: var(--text-dim);
  margin: -4px 0 2px;
}
.interview__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.interview__chips--wrap { gap: 8px; }
.interview-chip {
  min-height: var(--touch-min);
  padding: 9px 15px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-chip);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.interview-chip:hover {
  background: var(--bpa-coral-soft);
  border-color: var(--bpa-coral);
}
.interview-chip:active { transform: scale(0.97); }
.interview-chip[aria-pressed="true"] {
  background: var(--bpa-coral-soft);
  border-color: var(--bpa-coral);
  color: var(--bpa-burgundy);
  font-weight: 600;
}
.interview-chip:focus-visible {
  outline: 2px solid var(--bpa-coral);
  outline-offset: 2px;
}
.interview-chip--other { border-style: dashed; }
.interview__more {
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--bpa-coral-hover);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}
.interview__more:hover { text-decoration: underline; }
.interview__other { display: flex; flex-direction: column; gap: 8px; }
.interview__other-input,
.interview__free-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  resize: vertical;
}
.interview__other-input:focus,
.interview__free-input:focus {
  outline: none;
  border-color: var(--bpa-coral);
  box-shadow: 0 0 0 3px var(--bpa-coral-soft);
}
.interview__free { display: flex; flex-direction: column; gap: 10px; }
.interview__continue {
  align-self: flex-end;
  min-height: var(--touch-min);
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-chip);
  background: linear-gradient(145deg, var(--bpa-coral), var(--bpa-coral-hover));
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.interview__continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.interview__continue:not(:disabled):hover { filter: brightness(1.03); }
@media (prefers-reduced-motion: reduce) {
  .interview { animation: none; }
  .interview-chip { transition: none; }
}

/* ── Welcome card (shown on open; guide waits for the user to choose) ────── */
.welcome {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  padding: 8px 4px 6px;
  animation: interview-in 0.25s ease;
}
.welcome__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
}
.welcome__body {
  margin: 0 auto;
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}
.welcome__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.welcome-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-chip);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.welcome-btn:active { transform: scale(0.98); }
.welcome-btn:focus-visible { outline: 2px solid var(--bpa-coral); outline-offset: 2px; }
.welcome-btn__icon { font-size: 20px; line-height: 1; }
.welcome-btn--voice {
  background: linear-gradient(145deg, var(--bpa-coral), var(--bpa-coral-hover));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-orb);
}
.welcome-btn--voice:hover { filter: brightness(1.04); }
.welcome-btn--text,
.welcome-btn--search {
  background: var(--surface);
  color: var(--text);
}
.welcome-btn--text:hover,
.welcome-btn--search:hover {
  background: var(--bpa-coral-soft);
  border-color: var(--bpa-coral);
}
@media (prefers-reduced-motion: reduce) {
  .welcome { animation: none; }
  .welcome-btn { transition: none; }
}

/* ── Profile capture (name/email, opt-in, after several uses) ────────────── */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.profile-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-dim);
  cursor: pointer;
}
.profile-consent input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--bpa-coral);
  flex: none;
}
.profile-error {
  margin: 0;
  font-size: 13px;
  color: var(--rose);
}
.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ── Settings sheet ─────────────────────────────────────────────────────── */
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-icon-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-icon-round:hover { background: var(--bg-muted); color: var(--sw-teal-dark); }
.btn-icon-round:active { transform: scale(0.94); }
.btn-pill {
  height: 38px;
  padding: 0 0.9rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-pill:hover { background: var(--bg-muted); color: var(--sw-teal-dark); }
.btn-pill:active { transform: scale(0.96); }
.btn-settings {
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
}
.settings-group { margin-bottom: 18px; }
.settings-group:last-child { margin-bottom: 0; }
.settings-group__label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Sinaweb overrides ──────────────────────────────────────────────────── */
html[dir="rtl"] .app-shell {
  text-align: right;
}

.app-bg {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(26, 155, 184, 0.18), transparent),
    var(--bg-soft);
}

.app-header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sw-teal), var(--sw-cyan));
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0;
  box-shadow: 0 4px 14px rgba(13, 110, 138, 0.3);
}

.kb-badge {
  display: none;
}

/* ── Top search ─────────────────────────────────────────────────────────── */
.kb-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.kb-search:focus-within { border-color: var(--sw-cyan); box-shadow: 0 0 0 3px var(--sw-teal-soft); }
.kb-search__icon { flex-shrink: 0; opacity: 0.6; font-size: 0.95rem; }
.kb-search__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.8rem 0;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-heading);
  outline: none;
}
.kb-search__results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.app-ai-note {
  margin: 1.25rem 0 0.25rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Category quick-filter ──────────────────────────────────────────────── */
.category-filter { margin-bottom: 1.25rem; }
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-chip {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-height: var(--touch-min);
}
.category-chip__count {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.6;
  margin-inline-start: 0.3rem;
}
.category-chip[aria-pressed="true"] {
  background: var(--sw-teal);
  border-color: var(--sw-teal);
  color: #fff;
}
.category-chip[aria-pressed="true"] .category-chip__count { opacity: 0.85; }
.category-questions {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.category-loading {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.faq-item {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow: hidden;
  transition: border-color 0.15s;
}
.faq-item--open { border-color: var(--sw-cyan); background: var(--surface); }
.faq-item__q {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-heading);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.55;
  text-align: start;
  cursor: pointer;
}
.faq-item__qtext { flex: 1; }
.faq-item__chevron {
  flex-shrink: 0;
  color: var(--sw-teal);
  transition: transform 0.2s;
  font-size: 0.85rem;
}
.faq-item--open .faq-item__chevron { transform: rotate(180deg); }
.faq-item__q:hover { background: var(--bg-muted); }
.faq-item__a {
  padding: 0 1rem 1rem;
  animation: faqReveal 0.2s ease;
}
.faq-item__atext {
  margin: 0 0 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--surface-border);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.85;
  white-space: pre-wrap;
}
.faq-item__ask {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--sw-teal);
  border-radius: 999px;
  background: transparent;
  color: var(--sw-teal-dark);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.faq-item__ask:hover { background: var(--sw-teal-soft); }
@keyframes faqReveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.section-label--divider {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-border);
}

.role-selector,
.book-selector {
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0.75rem 0 0.25rem;
  border-top: 1px dashed var(--surface-border);
  margin-top: 0.5rem;
}
.quick-reply {
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--sw-teal);
  border-radius: 999px;
  background: var(--sw-teal-soft);
  color: var(--sw-teal-dark);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: var(--touch-min);
}
.quick-reply:hover { background: var(--sw-teal); color: #fff; }
.quick-reply:active { transform: scale(0.96); }

.journal-input {
  display: flex;
  gap: 8px;
  margin-top: 0.6rem;
}
.journal-input__field {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-heading);
  outline: none;
}
.journal-input__field:focus { border-color: var(--sw-cyan); box-shadow: 0 0 0 3px var(--sw-teal-soft); }
.journal-input__send {
  flex-shrink: 0;
  padding: 0 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--sw-teal);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.journal-input__send:active { transform: scale(0.97); }

.role-selector__track,
.book-selector__track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* In chat, keep role chips to a single scrollable row so the conversation gets
   the vertical space. Also shrink the orb and tighten the role section. */
body.chat-mode .role-selector__track {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
body.chat-mode .role-selector__track::-webkit-scrollbar { display: none; }
body.chat-mode .role-selector { margin-bottom: 0.35rem; }
body.chat-mode .role-selector .section-label { margin-bottom: 0.35rem; }
/* Remove the large decorative orb in chat — give that space to the explanation.
   The type/mute buttons below still control everything; a slim caption shows status. */
body.chat-mode .orb-wrap { display: none; }
body.chat-mode .controls { gap: 0.4rem; }
body.chat-mode .controls-panel {
  padding: 0.5rem 0.6rem;
  background: transparent;
  border: none;
  box-shadow: none;
}
body.chat-mode .orb-caption { margin: 0 0 0.4rem; font-size: 0.85rem; }
/* Simple modern controls: no Type button / text input in chat — search is for typing. */
body.chat-mode #btn-type,
body.chat-mode .text-row { display: none !important; }
body.chat-mode .controls__row { justify-content: center; }
body.chat-mode #btn-mute {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  min-width: 56px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

/* Per-answer action icons (read-aloud, 👍, 👎) — Claude-style, subtle. */
.turn__actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--surface-border);
}
.turn__action {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.turn__action:hover { opacity: 1; background: var(--bg-muted); }
.turn__action:active { transform: scale(0.9); }
.turn__action--on { opacity: 1; background: var(--sw-teal-soft); }

.role-chip,
.book-chip {
  flex-shrink: 0;
}

.workflow-strip {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
}

.workflow-strip__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workflow-chip {
  padding: 8px 14px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--surface-border);
  background: var(--bg-muted);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.workflow-chip:hover {
  background: var(--sw-teal-soft);
  border-color: var(--sw-teal);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 1rem;
}

.about-stat {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  text-align: center;
}

.about-stat__num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sw-teal-dark);
}

.about-stat__label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.section-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8125rem;
}

.onboarding {
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 520px) {
  .workflow-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.workflow-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 12px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  min-height: 120px;
}

.workflow-card:hover,
.workflow-card:focus-visible {
  border-color: var(--sw-teal);
  box-shadow: 0 4px 20px rgba(13, 110, 138, 0.12);
  transform: translateY(-1px);
}

.workflow-card[aria-pressed="true"] {
  border-color: var(--sw-teal);
  background: var(--sw-teal-soft);
}

.workflow-card__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.workflow-card__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.35;
}

.workflow-card__meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: auto;
}

.workflow-detail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-border);
}

.workflow-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.75rem;
}

.workflow-detail__title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-heading);
}

.workflow-detail__overview {
  margin: 0 0 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
  line-height: 1.6;
}

.workflow-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
  padding-left: 4px;
}

.workflow-detail--anim { animation: wfReveal 0.28s ease; }
@keyframes wfReveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.workflow-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 0.9rem;
  line-height: 1.65;
}

.workflow-step__num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sw-teal);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workflow-step__body strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-heading);
}

.workflow-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 4px 10px;
}

.transcript-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0.5rem;
}

.captcha-gate {
  padding: 1.25rem 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.captcha-gate__title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--text-heading);
}

.captcha-gate__hint {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.captcha-gate__widget {
  display: flex;
  justify-content: center;
  min-height: 72px;
}

.captcha-gate__loading,
.captcha-gate__error {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
}

.captcha-gate__error {
  color: #b42318;
}

/* ——— Certificate exam ——— */
.exam-invite {
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.08), rgba(13, 110, 138, 0.06));
}

.exam-invite__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text-heading);
}

.exam-invite__text {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.65;
}

.exam-invite__meta {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.exam-invite__btn {
  width: 100%;
}

.exam-panel {
  margin-bottom: 1rem;
}

.exam-panel__header {
  margin-bottom: 0.75rem;
}

.exam-panel__title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-heading);
}

.exam-panel__subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.exam-panel__description {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text);
}

.exam-panel__rules {
  margin: 0 0 1.25rem;
  padding-right: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.exam-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.exam-register-form {
  display: grid;
  gap: 0.85rem;
}

.exam-field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-heading);
}

.exam-field__input {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
}

.exam-quiz__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: 0.8125rem;
}

.exam-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 800;
  font-size: 1rem;
  color: var(--sw-teal-dark);
  font-variant-numeric: tabular-nums;
}
.exam-timer::before { content: "⏱"; font-size: 0.95rem; }

.exam-progress {
  color: var(--text-dim);
}

.exam-questions {
  display: grid;
  gap: 1rem;
  min-height: 12rem;
  padding-left: 0.15rem;
}

.exam-quiz__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 1rem 0 0.5rem;
}

.exam-quiz__nav .btn-secondary {
  flex: 0 0 auto;
  width: auto;
  min-width: 104px;
  padding: 0.65rem 1rem;
}

.exam-q-counter {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.exam-btn-replay {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem 0.55rem;
}

.exam-question {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.exam-question__text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.7;
  margin-bottom: 0.85rem;
}

.exam-question__options {
  display: grid;
  gap: 0.55rem;
}

.exam-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.6;
  transition: background 0.15s, border-color 0.15s;
}

.exam-option:hover {
  background: var(--bg-muted);
  border-color: var(--sw-cyan);
}

.exam-option:has(input:checked) {
  background: var(--sw-teal-soft);
  border-color: var(--sw-teal);
}

.exam-option input {
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--sw-teal);
}

.exam-result__badge {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.exam-result__badge--pass {
  color: #0d6e4a;
}

.exam-result__badge--fail {
  color: #b42318;
}

.exam-result__score,
.exam-result__message,
.exam-result__note {
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  line-height: 1.65;
}

.exam-error {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
  font-size: 0.8125rem;
}
