:root {
  --nav-height: 64px;
  --ink: #0f172a;
  --muted: #5b6475;
  --border: #d8e0ec;
  --surface: #ffffff;
  --surface-muted: #f3f6fc;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --accent-warm: #f59e0b;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  --radius-lg: 16px;
  --radius-sm: 10px;
  --book-font-scale: 1;
}

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

html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Work Sans", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background: radial-gradient(120% 120% at 10% 20%, #e0f6ff 0, transparent 45%),
    radial-gradient(80% 80% at 80% 0%, #ffe8c8 0, transparent 40%),
    #f7f9fc;
}

body.editor-mode {
  overflow: hidden;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
  text-decoration: none;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 1050;
}
.navbar-glass {
  background: rgba(12, 18, 31, 0.92);
  border: 1px solid #0f1c33;
  border-radius: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}
.navbar .nav-link {
  color: #dfe8f5;
  font-weight: 500;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: #ffffff;
}
.navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  border: none;
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.25);
}
.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border: none;
}
.btn-outline-secondary,
.btn-outline-primary {
  border-color: var(--border);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}
.btn-outline-secondary:hover,
.btn-outline-primary:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: #eef7ff;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card .card-body {
  padding: 1.25rem 1.35rem;
}

.list-group-item {
  border-color: var(--border);
}

.book-settings-panel {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.form-control,
.form-select,
.form-check-input {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
}
.form-switch .form-check-input {
  width: 3rem;
  height: 1.6rem;
  border-radius: 999px;
  background-color: #e7eef8;
  background-image: var(--bs-form-switch-bg);
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
}
.form-switch .form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-position: right center;
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 0.15rem rgba(14, 165, 233, 0.25);
}

.landing-hero {
  background: linear-gradient(120deg, rgba(14, 165, 233, 0.12), rgba(245, 158, 11, 0.1)),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}
.landing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(40% 50% at 85% 20%, rgba(14, 165, 233, 0.18), transparent 60%);
  pointer-events: none;
}
.landing-hero h1 {
  color: var(--ink);
}
.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.25);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-strong);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}
.eyebrow {
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}
.hero-meta .meta-pill {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.2);
  color: var(--accent-strong);
}
.hero-preview {
  position: relative;
  z-index: 1;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  padding: 1.4rem;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
}
.mini-outline {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: #ffffff;
}
.mini-outline-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  margin-bottom: 0.5rem;
}
.mini-outline-row:last-child {
  margin-bottom: 0;
}
.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.82rem;
}
.badge-soft.alt {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}
.code-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}
.hero-ghost {
  border-color: rgba(14, 165, 233, 0.35);
  color: var(--accent-strong);
}

.feature-grid .feature-card {
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  height: 100%;
}
.feature-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-strong);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.home-footer {
  border-top: 1px solid var(--border);
  background: #f7f9fc;
  border-radius: 0;
  padding: 2.5rem 0 2.5rem;
  box-shadow: none;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  margin-bottom: 0;
}
.home-wrap {
  width: auto;
  margin: 0;
  background: transparent;
  padding-bottom: 0;
}
.home-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.stacked-list {
  display: grid;
  gap: 0.85rem;
}
.stacked-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  color: inherit;
  text-decoration: none;
}
.stacked-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-strong);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}
.stacked-card:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}
.stacked-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.stacked-card__top > div {
  min-width: 0; /* allow title truncation */
}
.stacked-card__title {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stacked-card__desc {
  color: var(--muted);
}
.stacked-card__meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
}
.status-success {
  border-color: rgba(14, 165, 233, 0.3);
  color: var(--accent-strong);
  background: rgba(14, 165, 233, 0.1);
}
.status-muted {
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--muted);
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
}
.meta-pill.subtle {
  background: #ffffff;
  color: var(--muted);
}
.book-meta .status-pill {
  border-width: 1px;
}
.book-meta {
  margin-top: -0.25rem;
}
.meta-pill-compact {
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  gap: 0.25rem;
}

.text-ink {
  color: var(--ink);
}

.editor-shell,
.viewer-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}

@media (max-width: 900px) {
  .editor-shell,
  .viewer-shell {
    grid-template-columns: 1fr;
  }

  .viewer-top {
    position: static;
    top: auto;
  }
}

.viewer-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.viewer-top {
  position: static;
  top: auto;
  z-index: 1040;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
  border-bottom: 1px solid var(--border);
  border-radius: 14px;
  padding-top: 0.25rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.viewer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
}
.viewer-title h1 {
  margin: 0;
  line-height: 1.2;
}
.viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-page {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

.editor-top {
  position: relative;
  z-index: 1040;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
  border-bottom: 1px solid var(--border);
  border-radius: 14px;
  padding-top: 0.2rem;
  padding-bottom: 0.3rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.editor-shell-wrapper {
  display: flex;
  min-height: 0;
  overflow: visible;
  height: calc(100vh - var(--nav-height) - 80px);
  max-height: calc(100vh - var(--nav-height) - 80px);
}

.editor-shell {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.editor-shell .outline {
  overflow-y: auto;
  height: 100%;
  min-height: 0;
}
.editor-shell .builder-main {
  height: 100%;
  min-height: 0;
}

.viewer-shell-wrapper {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: visible;
  height: calc(100vh - var(--nav-height) - 30px);
  max-height: calc(100vh - var(--nav-height) - 30px);
}

.viewer-shell {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.viewer-shell .builder-main {
  padding: 0.7rem 1rem 1rem;
}

.viewer-shell .outline {
  overflow-y: auto;
  height: 100%;
  min-height: 0;
}
.viewer-shell .builder-main {
  height: 100%;
  min-height: 0;
}

.viewer-header-row,
.editor-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0; /* allow inner flex items to truncate */
}

.viewer-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}
.viewer-title > .d-inline-flex {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
.viewer-title h1 {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
  min-width: 0;
}

.editor-labels {
  min-width: 0;
  flex: 1 1 auto;
}
.editor-actions {
  flex: 0 0 auto;
  white-space: nowrap;
}
.editor-actions .btn {
  flex: 0 0 auto;
}
.viewer-actions {
  flex: 0 0 auto;
  white-space: nowrap;
}
.editor-top .d-flex.align-items-center.gap-2 {
  min-width: 0;
}
#path-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  display: inline-block;
  max-width: 100%;
}

.outline {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: linear-gradient(180deg, #f9fbff 0%, #f4f7fc 100%);
  overflow-y: auto;
}

.outline-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.3rem 0.2rem;
  cursor: pointer;
  min-width: 0;
}

.outline-row.chapter-row,
.outline-row.section {
  width: 100%;
}

.outline-row.chapter-row.active {
  background: rgba(14, 165, 233, 0.16);
  border-radius: 6px;
}

.outline-row input,
.outline-row .form-control-sm {
  cursor: text;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.truncate-dots {
  position: relative;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding-right: 0.65rem;
}
.truncate-dots.is-truncated::after {
  content: "..";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-left: 0.25rem;
  padding-right: 0.05rem;
  background: var(--surface);
}

.outline-row.section {
  margin-left: 0.25rem;
}

.editor-shell .outline-row.section {
  cursor: grab;
}

.viewer-shell .outline-row.section {
  cursor: pointer;
}

.outline-row.section.active {
  background: rgba(14, 165, 233, 0.14);
  border-radius: 6px;
}
.outline-row.chapter-row {
  font-weight: 600;
}
.outline-row.section:hover,
.outline-row.chapter-row:hover {
  background: rgba(14, 165, 233, 0.08);
}

.outline-chapter.active > .outline-row {
  background: rgba(14, 165, 233, 0.16);
  border-radius: 8px;
}

.outline-row.section.dragging {
  opacity: 0.6;
}

.outline-row.section.drop-target-before {
  box-shadow: inset 0 2px 0 var(--accent-strong);
}

.outline-row.section.drop-target-after {
  box-shadow: inset 0 -2px 0 var(--accent-strong);
}

.outline-toggle {
  display: none;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.55rem;
  line-height: 1.2;
}
.outline-toggle-mobile {
  display: none;
  padding: 0.25rem 0.55rem;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .outline-toggle {
    display: inline-block;
  }
  .outline-toggle-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .viewer-shell .outline {
    display: none;
  }
  .viewer-shell .outline.collapsed {
    display: block;
    padding: 0.25rem;
    width: auto;
  }
  .editor-shell .outline {
    display: none;
  }
  .editor-shell .outline.collapsed {
    display: block;
    padding: 0.25rem;
    width: auto;
  }

  /* viewer: let outline shrink to its content on mobile */
  .viewer-shell {
    display: block;
    height: auto;
    min-height: 0;
  }
  .viewer-shell-wrapper {
    display: block;
    overflow: visible;
    height: auto;
  }
  .viewer-shell .outline {
    height: auto;
    max-height: none;
    overflow: visible;
    margin-bottom: 1rem;
  }
  .viewer-shell .builder-main {
    height: auto;
    max-height: none;
    overflow: visible;
    width: 100%;
  }

  /* editor: let outline shrink to its content on mobile */
  .editor-page {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .editor-shell-wrapper {
    overflow: hidden;
    height: auto;
    max-height: none;
  }
  .editor-shell {
    display: block;
    height: auto;
    min-height: 0;
  }
  .editor-shell .outline {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .editor-shell .outline.collapsed {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .editor-shell .builder-main {
    height: auto;
    max-height: none;
    overflow: hidden;
    max-width: 100%;
  }
  .block-list,
  .builder-main .card {
    max-width: 100%;
    overflow-x: hidden;
  }
  .block-list {
    width: 100%;
  }
  .block-list .card,
  .block-list .card-body,
  .block-list .preview,
  .block-list textarea,
  .block-list .code-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .block-list pre,
  .block-list code {
    white-space: pre-wrap;
    word-break: break-word;
  }

  /* allow natural page scrolling on mobile while editing */
  html,
  body {
    height: auto;
    min-height: 100%;
  }
  body.editor-mode {
    overflow: auto;
  }
}

.question-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f4f8ff;
}
.viewer-block.question-block {
  border: 0;
  background: transparent;
  padding: 0;
}
.question-prompt {
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.question-options button {
  min-width: 110px;
}
.question-feedback {
  min-height: 1.25rem;
}

.chapter-chat-messages {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f6f9ff;
  padding: 0.75rem;
  min-height: 220px;
  max-height: 55vh;
  overflow-y: auto;
}
.chat-bubble {
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.6rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  word-break: break-word;
}
.chat-bubble:last-child {
  margin-bottom: 0;
}
.chat-bubble p {
  margin-bottom: 0.35rem;
}
.chat-bubble p:last-child {
  margin-bottom: 0;
}
.chat-bubble-assistant {
  background: #ffffff;
  border: 1px solid var(--border);
  margin-right: auto;
  max-width: 90%;
}
.chat-bubble-typing {
  font-family: "Menlo", "SFMono-Regular", Consolas, monospace;
  opacity: 0.7;
}
.chat-bubble-user {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #ffffff;
  margin-left: auto;
  max-width: 86%;
}
#chapter-chat-status.bg-warning {
  color: #0f172a;
}

.question-image {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.question-image img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  background: #fff;
}

.add-block-bar {
  text-align: center;
  margin: 0 0 4px;
}

.add-block-bar .btn {
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}

.block-list .card {
  margin-bottom: 0.35rem;
}

.toggle-btn {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
}
.toggle-btn:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.outline-divider {
  border-bottom: 1px solid var(--border);
  margin: 0.25rem 0;
}

.builder-main {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.block-list .card pre {
  margin: 0;
}

.builder-main .block-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.builder-main input[type="number"]::-webkit-inner-spin-button,
.builder-main input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.builder-main input[type="number"] {
  -moz-appearance: textfield;
}

.practice-nav .dropdown-select {
  position: relative;
  min-width: 260px;
}
.practice-nav select {
  padding-right: 2.2rem;
}
.practice-nav .dropdown-select::after {
  content: "▾";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview {
  min-height: 60px;
  background: #f6f9ff;
}

.code-input {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* tame MathJax sizing */
mjx-container {
  font-size: 1em !important;
  overflow-x: visible;
  max-width: 100%;
}
mjx-container mjx-math {
  margin: 0;
}

/* font scaling limited to book areas */
.editor-shell,
.viewer-shell,
.outline,
.builder-main,
.block-list,
.viewer-block,
.preview,
.figure-block,
.figure-caption,
.figure-label {
  font-size: calc(1rem * var(--book-font-scale));
}

/* ensure markdown headings honor font scale too */
.viewer-block h1,
.preview h1,
.question-block h1 {
  font-size: calc(2rem * var(--book-font-scale));
}
.viewer-block h2,
.preview h2,
.question-block h2 {
  font-size: calc(1.75rem * var(--book-font-scale));
}
.viewer-block h3,
.preview h3,
.question-block h3 {
  font-size: calc(1.5rem * var(--book-font-scale));
}
.viewer-block h4,
.preview h4,
.question-block h4 {
  font-size: calc(1.25rem * var(--book-font-scale));
}
.viewer-block h5,
.preview h5,
.question-block h5 {
  font-size: calc(1.1rem * var(--book-font-scale));
}
.viewer-block h6,
.preview h6,
.question-block h6 {
  font-size: calc(1rem * var(--book-font-scale));
}

/* ensure form fields inherit scaled font */
.editor-shell input,
.editor-shell textarea {
  font-size: inherit;
}
.outline .form-control-sm {
  font-size: inherit;
}

/* Viewer blocks without card chrome */
.viewer-block {
  margin-bottom: 0.35rem;
}
.viewer-block-body {
  padding: 0.25rem 0;
}
.viewer-block pre {
  margin: 0;
  background: #f8f9fb;
  border-radius: 6px;
  padding: 0.5rem;
}

.figure-wrapper .viewer-block-body,
.preview.figure-preview {
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.85rem;
}
.figure-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  position: relative;
}
.figure-block img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  background: #ffffff;
}
.figure-caption-wrap {
  width: 100%;
  color: var(--muted);
  text-align: left;
  font-size: 0.97rem;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.figure-caption {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}
.figure-label {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.figure-caption em {
  color: var(--muted);
}
