.recital-memo-preview {
  --recital-memo-ink: var(--ink);
  --recital-memo-muted: var(--ink-2);
  --recital-memo-panel: var(--surface-2);
  --recital-memo-border: var(--line);
  --recital-memo-accent: var(--advisory);
  --recital-memo-warning: var(--danger);
  color: var(--recital-memo-ink);
  background: var(--recital-memo-panel);
  border: 1px solid var(--recital-memo-border);
  border-radius: 14px;
  padding: clamp(16px, 3vw, 28px);
  max-width: 78ch;
  box-sizing: border-box;
}

.recital-memo-header {
  border-bottom: 1px solid var(--recital-memo-border);
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.recital-memo-eyebrow,
.recital-memo-status,
.recital-memo-save-note {
  color: var(--recital-memo-muted);
  font-size: .82rem;
  letter-spacing: .02em;
}

.recital-memo-eyebrow {
  font-weight: 700;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.recital-memo-title {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.2;
  margin: 0;
}

.recital-memo-boundary {
  color: var(--recital-memo-muted);
  margin: 8px 0 10px;
}

.recital-memo-status {
  font-weight: 600;
  margin: 0;
}

.recital-memo-fields {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--recital-memo-border);
  color: var(--recital-memo-muted);
  font-size: .82rem;
}

.recital-memo-fields-summary {
  width: max-content;
  cursor: pointer;
  color: var(--recital-memo-accent);
  font-weight: 650;
}

.recital-memo-fields[open] .recital-memo-fields-summary { margin-bottom: 9px; }
.recital-memo-source-boundary { max-width: 66ch; margin: 0 0 9px; line-height: 1.5; }
.recital-memo-fields .recital-memo-line { margin-bottom: 5px; overflow-wrap: anywhere; }

.recital-memo-prose {
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.recital-memo-section-title {
  margin: 20px 0 7px;
  color: var(--recital-memo-ink);
  font: 600 .9rem/1.4 var(--font-sans);
  letter-spacing: .025em;
}

.recital-memo-section-title:first-child { margin-top: 0; }

.recital-memo-line { margin: 0 0 9px; }

.recital-memo-grounded-disclosure { margin: 0 0 14px; padding: 12px; border: 1px solid var(--recital-memo-border); border-radius: 10px; background: var(--surface); }
.recital-memo-grounded-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.recital-memo-grounded-label { font-size: .9rem; }
.recital-memo-grounded-source { color: var(--recital-memo-muted); font-size: .82rem; }
.recital-memo-grounded-preview { margin: 9px 0; }
.recital-memo-grounded-ellipsis { color: var(--recital-memo-muted); }
.recital-memo-grounded-summary { width: max-content; color: var(--recital-memo-accent); cursor: pointer; font-size: .86rem; font-weight: 650; }
.recital-memo-grounded-summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--recital-memo-accent) 35%, transparent); outline-offset: 2px; }
.recital-memo-grounded-full { margin: 9px 0 0; white-space: pre-wrap; }

.recital-memo-line.is-bullet { position: relative; padding-left: 16px; }

.recital-memo-line.is-bullet::before {
  position: absolute;
  left: 1px;
  color: var(--recital-memo-accent);
  content: "•";
}

.recital-memo-citation {
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 2px;
  color: var(--recital-memo-accent);
  cursor: pointer;
  font: inherit;
  padding: 0 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.recital-memo-citation:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--recital-memo-accent) 35%, transparent);
  outline-offset: 2px;
}

.recital-memo-invalid-citation {
  color: var(--recital-memo-warning);
  font-weight: 650;
  text-decoration: underline wavy;
  text-underline-offset: 3px;
}

.recital-memo-warning {
  font-size: .78em;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
}

.recital-memo-save-note {
  border-top: 1px solid var(--recital-memo-border);
  margin: 18px 0 0;
  padding-top: 12px;
}

[data-theme="light"] .recital-memo-preview { color-scheme: light; }
[data-theme="dark"] .recital-memo-preview { color-scheme: dark; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .recital-memo-preview { color-scheme: light; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .recital-memo-preview { color-scheme: dark; }
}

@media (max-width: 640px) {
  .recital-memo-preview { border-radius: 10px; padding: 16px; }
  .recital-memo-prose { font-size: .97rem; line-height: 1.6; }
  .recital-memo-warning { display: inline-block; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .recital-memo-preview *,
  .recital-memo-preview *::before,
  .recital-memo-preview *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
