.cf-mindmap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.6rem;
  align-items: stretch;
  margin-top: 1rem;
}

.cf-mindmap-stage {
  position: relative;
  min-height: 480px;
  padding: 1rem;
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(96, 51, 21, 0.25);
  background: rgba(255, 252, 237, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  overflow: hidden;
}

.cf-mindmap-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.cf-mindmap-svg {
  width: 100%;
  height: 100%;
}

.cf-mindmap-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.75), rgba(248, 238, 212, 0.9));
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: rgba(75, 48, 22, 0.78);
}

.cf-mindmap-node-detail {
  padding: 1.2rem;
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(96, 51, 21, 0.2);
  background: rgba(255, 252, 237, 0.88);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cf-mindmap-inspector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--cf-radius-sm);
  border: 1px solid rgba(96, 51, 21, 0.15);
  background: rgba(255, 255, 255, 0.6);
}

.cf-mindmap-inspector__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.cf-mindmap-inspector__header h5 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.cf-mindmap-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.cf-mindmap-controls details {
  border-radius: var(--cf-radius-sm);
  border: 1px solid rgba(96, 51, 21, 0.18);
  background: rgba(255, 255, 255, 0.5);
  padding: 0.75rem 0.9rem;
}

.cf-mindmap-controls summary {
  cursor: pointer;
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: rgba(75, 48, 22, 0.83);
  margin-bottom: 0.65rem;
}

.cf-mindmap-controls summary::marker {
  color: rgba(96, 51, 21, 0.65);
}

.cf-form--stacked {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cf-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.cf-form-feedback {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(156, 37, 30, 0.78);
  font-style: italic;
}

.cf-button--tiny {
  padding: 0.15rem 0.65rem;
  font-size: 0.7rem;
  line-height: 1.4;
}

.cf-mindmap-node-detail pre {
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--cf-radius-sm);
  background: rgba(32, 18, 10, 0.06);
  font-size: 0.8rem;
  overflow-x: auto;
}

.cf-mindmap-node {
  fill: rgba(203, 164, 107, 0.22);
  stroke: rgba(96, 51, 21, 0.62);
  stroke-width: 2;
  transition: transform 120ms ease, fill 120ms ease;
}

.cf-mindmap-node[data-type="Ort"] {
  fill: rgba(120, 180, 210, 0.24);
}

.cf-mindmap-node[data-type="Charakter"] {
  fill: rgba(207, 129, 118, 0.26);
}

.cf-mindmap-node[data-type="Frage"] {
  fill: rgba(178, 161, 88, 0.24);
}

.cf-mindmap-node.is-selected {
  stroke-width: 3;
  fill: rgba(203, 164, 107, 0.48);
}

.cf-mindmap-node.is-hovered,
.cf-mindmap-node:hover {
  transform: scale(1.06);
  fill: rgba(203, 164, 107, 0.38);
}

.cf-mindmap-node-label {
  font-size: 0.78rem;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  fill: rgba(41, 24, 13, 0.95);
  font-family: "ScalySans", sans-serif;
}

.cf-mindmap-edge {
  stroke: rgba(96, 51, 21, 0.3);
  stroke-width: 2;
}

.cf-mindmap-edge-label {
  font-size: 0.7rem;
  fill: rgba(64, 35, 18, 0.66);
  text-anchor: middle;
  pointer-events: none;
}

.cf-mindmap-edge.is-selected {
  stroke-width: 3;
  stroke: rgba(120, 56, 23, 0.85);
}

.cf-mindmap-edge-label.is-selected {
  font-weight: 600;
  fill: rgba(120, 56, 23, 0.85);
}

.cf-mini-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

.cf-mini-card.is-selected {
  border-color: rgba(120, 56, 23, 0.55);
  box-shadow: 0 0 0 2px rgba(120, 56, 23, 0.18);
}

.cf-table-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.cf-table tr.is-selected {
  background: rgba(238, 217, 186, 0.32);
}

@media (max-width: 960px) {
  .cf-mindmap-layout {
    grid-template-columns: 1fr;
  }

  .cf-mindmap-node-detail {
    order: -1;
  }
}

/* CodexForge PHB-inspired theme */

/* Typography */
@font-face {
  font-family: "BookSanity";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Bookinsanity/Bookinsanity.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BookSanity";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Bookinsanity/Bookinsanity%20Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "BookSanity";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Bookinsanity/Bookinsanity%20Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "BookSanity";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Bookinsanity/Bookinsanity%20Bold%20Italic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "ScalySans";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Scaly%20Sans/Scaly%20Sans.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ScalySans";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Scaly%20Sans/Scaly%20Sans%20Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ScalySans";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Scaly%20Sans/Scaly%20Sans%20Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "ScalySansSmallCaps";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Scaly%20Sans%20Caps/Scaly%20Sans%20Caps.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ScalySansSmallCaps";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Scaly%20Sans%20Caps/Scaly%20Sans%20Caps%20Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MrJeeves";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Mr%20Eaves/Mr%20Eaves%20Small%20Caps.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Solbera";
  src: url("https://raw.githubusercontent.com/jonathonf/solbera-dnd-fonts/master/Solbera%20Imitation/Solbera%20Imitation.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --cf-bg-deep: #16100c;
  --cf-bg-dark: #1e1510;
  --cf-parchment: #f2e4c1;
  --cf-parchment-alt: #ead8ae;
  --cf-ink: #2b1b13;
  --cf-muted: #6f553a;
  --cf-accent: #5d180d;
  --cf-accent-soft: #8d3522;
  --cf-gold: #cfa969;
  --cf-emerald: #3b8561;
  --cf-shadow: rgba(20, 8, 2, 0.35);
  --cf-radius-lg: 22px;
  --cf-radius-md: 16px;
  --cf-radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body.cf-body {
  margin: 0;
  min-height: 100vh;
  font-family: "BookSanity", "Georgia", serif;
  color: var(--cf-ink);
  background:
    url("../img/library-background.png");
  background-size: cover, 100% 100%, 100% 100%, cover;
  background-position: center;
  background-attachment: fixed;
}

.cf-page {
  max-width: 1180px;
  margin: 2.5rem auto 3.5rem;
  background-color: rgba(242, 228, 193, 0.5);
  /*background-image: url("https://raw.githubusercontent.com/Daxiongmao87/foundry-vtt-5e-phb-journal-styling/main/images/5e-phb-background-imitation.png");*/
  background-size: cover;
  border: 1px solid rgba(102, 71, 41, 0.45);
  border-radius: var(--cf-radius-lg);
  box-shadow: 0 28px 40px rgba(11, 6, 2, 0.6);
  overflow: hidden;
  backdrop-filter: blur(3px);
}

.cf-header {
  background: linear-gradient(135deg, rgba(202, 167, 109, 0.85), rgba(236, 210, 150, 0.82));
  border-bottom: 2px solid rgba(93, 24, 13, 0.35);
  box-shadow: inset 0 -20px 35px rgba(141, 70, 34, 0.12);
}

.cf-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.8rem 2.8rem;
}

.cf-logo {
  font-family: "MrJeeves", "BookSanity", serif;
  font-size: 2.4rem;
  letter-spacing: 0.04em;
  color: var(--cf-accent);
  text-decoration: none;
  text-shadow: 0 2px 4px rgba(255, 245, 230, 0.65);
}

.cf-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.cf-nav a {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid transparent;
  color: rgba(54, 32, 18, 0.8);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.cf-nav a:hover,
.cf-nav a:focus {
  color: var(--cf-accent);
  border-color: var(--cf-accent);
}

.cf-main {
  padding: 3rem clamp(1.8rem, 3vw + 1rem, 3.5rem) 4rem;
}

.cf-section {
  margin-bottom: 3rem;
}

.cf-section-header {
  margin-bottom: 1.6rem;
}

.cf-section-header--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.cf-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cf-section-header h1,
.cf-section-header h2,
.cf-section-header h3 {
  margin: 0 0 0.8rem;
}

h1, h2, h3, h4 {
  font-family: "MrJeeves", "BookSanity", serif;
  font-weight: 400;
  color: var(--cf-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 1.8rem + 1.5vw, 3.1rem);
}

h2 {
  font-size: clamp(1.8rem, 1.5rem + 1vw, 2.5rem);
}

h3 {
  font-size: clamp(1.4rem, 1.2rem + 0.6vw, 1.9rem);
}

p {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(37, 23, 15, 0.94);
}

.cf-section-header h1 + p::first-letter,
.cf-section-header h2 + p::first-letter {
  float: left;
  font-family: "Solbera", "BookSanity", serif;
  font-size: 4.8rem;
  line-height: 0.72;
  padding-right: 0.2rem;
  color: rgba(37, 23, 15, 0.88);
}

.cf-lead {
  font-size: 1.08rem;
  font-weight: 500;
  color: rgba(37, 23, 15, 0.88);
}

.cf-muted {
  color: var(--cf-muted);
  font-size: 0.9rem;
}

.cf-form {
  display: flex;
  /*flex-wrap: wrap; */
  gap: 0.85rem 1.1rem;
  padding: 1.15rem 1.35rem;
  background: rgba(255, 250, 235, 0.82);
  border-radius: var(--cf-radius-lg);
  backdrop-filter: blur(2px);
}

.cf-form--stack {
  flex-direction: column;
  gap: 0.95rem;
}

.cf-field {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cf-field--tight {
  flex: 0 0 160px;
}

.cf-label {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(64, 42, 27, 0.7);
}

.cf-input,
.cf-select,
.cf-textarea {
  font: inherit;
  color: var(--cf-ink);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(137, 92, 45, 0.4);
  border-radius: var(--cf-radius-sm);
  padding: 0.55rem 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cf-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.cf-input:focus,
.cf-select:focus,
.cf-textarea:focus {
  outline: none;
  border-color: var(--cf-accent);
  box-shadow: 0 0 0 3px rgba(93, 24, 13, 0.18);
}

.cf-form-actions {
  display: flex;
  align-items: flex-end;
  margin-left: auto;
}

.cf-button {
  align-self: flex-end;
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.82rem;
  padding: 0.75rem 1.9rem;
  border-radius: 999px;
  border: 1px solid rgba(93, 24, 13, 0.6);
  color: #fff5e6;
  background: linear-gradient(135deg, rgba(141, 53, 34, 0.95), rgba(93, 24, 13, 0.95));
  box-shadow: 0 12px 18px rgba(93, 24, 13, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cf-button:hover,
.cf-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 24px rgba(93, 24, 13, 0.28);
}

.cf-button--secondary {
  background: linear-gradient(135deg, rgba(59, 133, 97, 0.95), rgba(33, 94, 67, 0.92));
  border-color: rgba(33, 94, 67, 0.6);
}

.cf-button--ghost {
  color: var(--cf-accent);
  background: rgba(255, 252, 237, 0.7);
  border: 1px solid rgba(141, 92, 45, 0.35);
  box-shadow: 0 10px 18px rgba(54, 32, 18, 0.12);
}

.cf-button--ghost:hover,
.cf-button--ghost:focus {
  background: rgba(255, 248, 224, 0.9);
  box-shadow: 0 14px 22px rgba(54, 32, 18, 0.16);
}

.cf-subtext {
  font-size: 0.78rem;
  color: rgba(64, 42, 27, 0.65);
}

.cf-stack > * + * {
  margin-top: 1.4rem;
}

.cf-card-grid {
  display: grid;
  gap: 1.8rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.cf-card {
  position: relative;
  background: rgba(255, 252, 237, 0.92);
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(143, 98, 42, 0.35);
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow: 0 22px 28px rgba(33, 20, 11, 0.18);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cf-card::before {
  content: "";
  position: absolute;
  inset: 12px 12px calc(100% - 12px) 12px;
  border-radius: var(--cf-radius-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.cf-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 32px rgba(33, 20, 11, 0.2);
}

.cf-card-title {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: var(--cf-accent);
}

.cf-code {
  font-family: "BookSanity", "Courier New", monospace;
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
  background: rgba(207, 169, 105, 0.25);
  border: 1px solid rgba(141, 92, 45, 0.25);
  color: var(--cf-ink);
}

.cf-cover {
  margin: -1.2rem -1.2rem 1.2rem;
  border-radius: calc(var(--cf-radius-md) - 6px) calc(var(--cf-radius-md) - 6px) var(--cf-radius-sm) var(--cf-radius-sm);
  overflow: hidden;
  border: 1px solid rgba(141, 92, 45, 0.25);
  box-shadow: 0 16px 24px rgba(24, 14, 8, 0.2);
}

.cf-cover img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

.cf-meta-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  color: rgba(37, 23, 15, 0.85);
}

.cf-meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(141, 92, 45, 0.25);
}

.cf-meta-list li:last-child {
  border-bottom: none;
}

.cf-meta-term {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: rgba(64, 42, 27, 0.7);
}

.cf-card-actions {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cf-link {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--cf-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cf-link:hover,
.cf-link:focus {
  color: var(--cf-accent-soft);
}

.cf-grid--stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.cf-stat-card {
  position: relative;
  padding: 1.8rem;
  border-radius: var(--cf-radius-md);
  background: linear-gradient(135deg, rgba(255, 252, 237, 0.95), rgba(234, 219, 180, 0.9));
  border: 1px solid rgba(143, 98, 42, 0.35);
  box-shadow: 0 18px 28px rgba(30, 18, 10, 0.18);
}

.cf-stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.45);
  opacity: 0.6;
  pointer-events: none;
}

.cf-stat-label {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: rgba(64, 42, 27, 0.75);
}

.cf-stat-value {
  margin: 0.7rem 0 0;
  font-size: 2.6rem;
  font-family: "MrJeeves", "BookSanity", serif;
  color: var(--cf-accent);
}

.cf-subsection {
  margin-top: 2.6rem;
}

.cf-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.cf-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  border: 1px solid rgba(93, 24, 13, 0.35);
  background: rgba(255, 252, 237, 0.6);
  color: rgba(54, 32, 18, 0.78);
}

.cf-pill-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0.6rem 0 0;
}

.cf-note {
  padding: 1.2rem 1.4rem;
  border: 1px dashed rgba(93, 24, 13, 0.35);
  border-radius: var(--cf-radius-md);
  background: rgba(255, 250, 235, 0.9);
  font-size: 0.94rem;
  color: rgba(54, 32, 18, 0.82);
}

.cf-search-results {
  margin-top: 1.4rem;
}

.cf-search-results article {
  background: rgba(255, 252, 237, 0.92);
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(143, 98, 42, 0.28);
  padding: 1.4rem;
  box-shadow: 0 14px 22px rgba(30, 18, 10, 0.15);
}

.cf-search-results article + article {
  margin-top: 1rem;
}

.cf-search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: rgba(64, 42, 27, 0.7);
}

.cf-search-snippet {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

blockquote {
  margin: 1.6rem 0;
  padding: 1.2rem 1.4rem;
  background: rgba(224, 229, 193, 0.8);
  border: 10px solid transparent;
  border-image: url("https://raw.githubusercontent.com/Daxiongmao87/foundry-vtt-5e-phb-journal-styling/main/images/note-wrap-imitation.png") 40;
  border-radius: var(--cf-radius-md);
  box-shadow: 0 8px 16px rgba(35, 21, 12, 0.15);
  font-family: "ScalySans", sans-serif;
}

blockquote p {
  margin: 0;
}

blockquote p + p {
  margin-top: 0.6rem;
}

.cf-chat-panel {
  margin-top: 2rem;
  display: grid;
  gap: 1.8rem;
  background: rgba(255, 252, 237, 0.86);
  border: 1px solid rgba(143, 98, 42, 0.32);
  border-radius: var(--cf-radius-lg);
  padding: 2rem;
  box-shadow: 0 28px 36px rgba(33, 20, 11, 0.18);
}

.cf-chat-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cf-chat-title {
  font-family: "MrJeeves", "BookSanity", serif;
  font-size: 1.75rem;
  color: var(--cf-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cf-chat-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cf-form-illustrated,
.cf-form-callout {
  display: grid;
  gap: 1.45rem;
  align-items: start;
}


.cf-form-callout {
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  padding: 1.6rem 1.8rem;
  border-radius: var(--cf-radius-xl);
  border: 1px solid rgba(143, 98, 42, 0.35);
  background: linear-gradient(180deg, rgba(254, 248, 233, 0.92) 0%, rgba(248, 234, 206, 0.9) 100%);
  box-shadow: 0 32px 42px rgba(33, 20, 11, 0.22);
  position: relative;
  overflow: hidden;
}

.cf-form-callout::after {
  content: "";
  position: absolute;
  inset: 10px 14px;
  border-radius: calc(var(--cf-radius-xl) - 10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.cf-illustration {
  position: relative;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.cf-illustration::after {
  content: "";
  position: absolute;
  bottom: 2.4rem;
  right: -1rem;
  width: 2.4rem;
  height: 2.4rem;
  background: linear-gradient(180deg, rgba(255, 250, 238, 0.92) 0%, rgba(247, 234, 208, 0.9) 100%);
  border: 1px solid rgba(143, 98, 42, 0.35);
  border-left: none;
  border-bottom: none;
  transform: rotate(45deg);
  z-index: 0;
  box-shadow: 12px 12px 24px rgba(33, 20, 11, 0.18);
}

.cf-illustration-img {
  display: block;
  width: 90%;
  max-width: 220px;
  filter: drop-shadow(0 18px 26px rgba(93, 24, 13, 0.28));
  position: relative;
  z-index: 1;
  transition: opacity 0.2s ease;
}

.cf-illustration-img--loading {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.cf-illustration[data-state="loading"] .cf-illustration-img--idle,
.cf-illustration.is-loading .cf-illustration-img--idle {
  opacity: 0;
}

.cf-illustration[data-state="loading"] .cf-illustration-img--loading,
.cf-illustration.is-loading .cf-illustration-img--loading {
  opacity: 1;
}

.cf-speech-bubble {
  display: inline-block;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(180deg, rgba(255, 252, 239, 0.96) 0%, rgba(248, 236, 213, 0.9) 100%);
  border: 1px solid rgba(143, 98, 42, 0.35);
  border-radius: var(--cf-radius-lg);
  box-shadow: 0 14px 20px rgba(33, 20, 11, 0.14);
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cf-accent);
  position: relative;
  z-index: 1;
}

.cf-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -0.65rem;
  left: 2.4rem;
  width: 1rem;
  height: 1rem;
  background: inherit;
  border: inherit;
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
  box-shadow: 10px 10px 18px rgba(33, 20, 11, 0.14);
}

.cf-illustration-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.cf-form-panel {
  display: grid;
  gap: 1.2rem;
  background: rgba(255, 252, 239, 0.9);
  border-radius: calc(var(--cf-radius-xl) - 6px);
  padding: 2rem 2.4rem 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  position: relative;
}

.cf-form-panel__intro {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.cf-form-panel__eyebrow {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(64, 42, 27, 0.75);
  font-size: 0.85rem;
}

.cf-form-panel__hint {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(64, 42, 27, 0.6);
}

.cf-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.cf-form-grid__question {
  grid-column: 1 / -1;
}

.cf-form-grid__mode {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.cf-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(93, 24, 13, 0.65) 50%),
    linear-gradient(135deg, rgba(93, 24, 13, 0.65) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.cf-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  color: rgba(64, 42, 27, 0.65);
}

.cf-toggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.cf-toggle-track {
  position: relative;
  width: 3.6rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(93, 24, 13, 0.28);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.cf-toggle-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.14rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: rgba(255, 252, 237, 0.95);
  box-shadow: 0 2px 4px rgba(33, 20, 11, 0.25);
  transform: translateY(-50%);
  transition: transform 0.22s ease;
}

.cf-toggle-label {
  opacity: 0.55;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.cf-toggle-label--off {
  color: rgba(93, 24, 13, 0.75);
}

.cf-toggle-label--on {
  color: rgba(35, 98, 71, 0.75);
}

.cf-toggle input:checked ~ .cf-toggle-track {
  background: rgba(35, 98, 71, 0.45);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.cf-toggle input:checked ~ .cf-toggle-track::after {
  transform: translate(1.9rem, -50%);
}

.cf-toggle input:checked ~ .cf-toggle-label--off {
  opacity: 0.35;
}

.cf-toggle input:checked ~ .cf-toggle-label--on {
  opacity: 1;
  color: rgba(18, 60, 40, 0.95);
}

.cf-toggle:focus-within .cf-toggle-track {
  box-shadow: 0 0 0 2px rgba(35, 98, 71, 0.35);
}

.cf-label-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cf-help {
  position: relative;
  display: inline-block;
}

.cf-help summary {
  list-style: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(93, 24, 13, 0.28);
  color: rgba(64, 42, 27, 0.92);
  font-size: 0.85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.cf-help summary::-webkit-details-marker {
  display: none;
}

.cf-help[open] summary {
  background: rgba(35, 98, 71, 0.45);
  color: rgba(26, 44, 33, 0.95);
  box-shadow: 0 0 0 1px rgba(35, 98, 71, 0.35);
}

.cf-help-content {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  min-width: 220px;
  max-width: 280px;
  padding: 0.75rem 0.9rem;
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(143, 98, 42, 0.32);
  background: rgba(255, 252, 237, 0.96);
  box-shadow: 0 18px 26px rgba(33, 20, 11, 0.2);
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(64, 42, 27, 0.85);
  z-index: 40;
}

.cf-help:not([open]) .cf-help-content {
  display: none;
}

.cf-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 0.55rem;
}

@media (min-width: 1024px) {
  .cf-form-illustrated,
  .cf-form-callout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .cf-form-illustrated,
  .cf-form-callout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cf-form-callout {
    padding: 1.4rem 1.2rem 1.8rem;
  }

  .cf-form-panel {
    padding: 1.6rem 1.4rem 2.2rem;
  }

  .cf-illustration::after {
    right: unset;
    left: 2.6rem;
    bottom: -1.1rem;
  }

  .cf-speech-bubble::after {
    left: 1.8rem;
  }

  .cf-illustration {
    padding: 0.6rem 0.8rem;
  }

  .cf-illustration-img {
    max-width: 200px;
  }

  .cf-illustration figcaption {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
  }
}

.cf-chat-stream {
  max-height: min(60vh, 640px);
  overflow-y: auto;
  padding-right: 0.6rem;
}

.cf-chat-stream > ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 0;
  margin: 0;
}

.cf-chat-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cf-chat-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.cf-form-illustrated .cf-chat-form,
.cf-form-illustrated .cf-form {
  gap: 1rem;
}

.cf-chat-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: rgba(59, 133, 97, 0.85);
  font-size: 0.85rem;
}

.cf-spinner {
  width: 1.4rem;
  height: 1.4rem;
}

.cf-spinner-trail {
  opacity: 0.35;
}

.cf-spinner-head {
  stroke: var(--cf-emerald);
  animation: cf-spin 1s linear infinite;
}

@keyframes cf-spin {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

.cf-chat-entry {
  position: relative;
  max-width: 640px;
  padding: 1.1rem 1.3rem;
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(93, 24, 13, 0.25);
  background: rgba(255, 252, 237, 0.92);
  color: rgba(37, 23, 15, 0.95);
  box-shadow: 0 16px 24px rgba(33, 20, 11, 0.12);
}

.cf-chat-entry--user {
  margin-left: auto;
  background: rgba(207, 169, 105, 0.2);
  border-color: rgba(207, 169, 105, 0.45);
  box-shadow: 0 12px 20px rgba(93, 24, 13, 0.16);
}

.cf-chat-entry--assistant {
  border-color: rgba(30, 24, 18, 0.28);
  background: rgba(30, 24, 18, 0.92);
  color: rgba(249, 244, 234, 0.95);
  box-shadow: 0 18px 28px rgba(18, 12, 6, 0.22);
}

.cf-chat-entry--assistant .cf-chat-entry-header {
  color: rgba(255, 235, 205, 0.85);
}

.cf-chat-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: rgba(93, 24, 13, 0.65);
}

.cf-chat-entry-body {
  margin-top: 0.8rem;
  font-size: 0.98rem;
  line-height: 1.6;
}

.cf-chat-entry-body .prose {
  font-size: inherit;
  line-height: inherit;
}

.cf-chat-entry-meta {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(93, 24, 13, 0.25);
  font-size: 0.78rem;
  color: rgba(37, 23, 15, 0.75);
}

.cf-chat-source-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.cf-chat-source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--cf-radius-sm);
  border: 1px solid rgba(93, 24, 13, 0.28);
  background: rgba(255, 252, 237, 0.12);
  color: rgba(105, 71, 2, 0.9);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.cf-chat-source-link:hover {
  border-color: rgba(207, 169, 105, 0.6);
  color: rgba(255, 248, 224, 0.95);
}

.cf-ask-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.cf-ask-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
}

.cf-ask-card-header h4 {
  font-size: 1.2rem;
  color: var(--cf-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cf-ask-card-followup {
  display: none;
}

.cf-ask-card-body {
  font-size: 0.95rem;
  color: rgba(37, 23, 15, 0.9);
}

.cf-ask-card-footer {
  border-top: 1px dashed rgba(141, 92, 45, 0.32);
  padding-top: 1rem;
}

.cf-ask-card-sources {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cf-search-card {
  border-radius: var(--cf-radius-md);
  border: 1px solid rgba(143, 98, 42, 0.32);
  background: rgba(255, 252, 237, 0.92);
  padding: 1.3rem;
  box-shadow: 0 18px 24px rgba(33, 20, 11, 0.16);
}

.cf-search-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: rgba(37, 23, 15, 0.8);
}

.cf-search-card p {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  color: rgba(37, 23, 15, 0.88);
  line-height: 1.5;
}

.cf-search-card footer {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: rgba(64, 42, 27, 0.65);
}

.cf-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid rgba(143, 98, 42, 0.32);
  border-radius: var(--cf-radius-md);
  background: rgba(255, 252, 237, 0.95);
  box-shadow: 0 20px 28px rgba(33, 20, 11, 0.16);
}

.cf-table thead {
  background: rgba(207, 169, 105, 0.2);
  font-family: "ScalySansSmallCaps", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.cf-table th,
.cf-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(143, 98, 42, 0.25);
}

.cf-table tbody tr:nth-child(odd) {
  background: rgba(234, 219, 180, 0.35);
}

.cf-table tbody tr:last-child td {
  border-bottom: none;
}

.cf-reader-grid {
  display: grid;
  gap: 2.6rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
  .cf-reader-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.cf-reader-hero {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.cf-reader-title {
  font-size: clamp(2.1rem, 1.6rem + 1.6vw, 3.1rem);
  color: var(--cf-accent);
}

.cf-reader-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: rgba(37, 23, 15, 0.75);
}

.cf-reader-nav,
.cf-reader-article,
.cf-reader-card {
  border: 1px solid rgba(143, 98, 42, 0.32);
  border-radius: var(--cf-radius-lg);
  background: rgba(255, 252, 237, 0.9);
  box-shadow: 0 26px 32px rgba(33, 20, 11, 0.18);
  padding: 1.8rem;
}

.cf-reader-nav-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.9rem;
  align-items: center;
}

.cf-reader-nav-controls form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cf-reader-nav-controls input {
  width: 5.5rem;
  border-radius: var(--cf-radius-sm);
  border: 1px solid rgba(141, 92, 45, 0.35);
  background: rgba(255, 252, 237, 0.75);
  padding: 0.35rem 0.6rem;
}

.cf-reader-nav-controls button {
  font-size: 0.78rem;
  padding: 0.45rem 0.95rem;
}

.cf-reader-nav-pages,
.cf-reader-chunk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.cf-reader-article header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: rgba(64, 42, 27, 0.75);
}

.cf-reader-article-content {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  color: rgba(37, 23, 15, 0.95);
}

.cf-reader-article-content h3 {
  color: var(--cf-accent);
  font-size: 1.35rem;
}

.cf-reader-article-content ul {
  list-style: disc;
  padding-left: 1.3rem;
  line-height: 1.6;
}

.cf-reader-article-footer {
  margin-top: 1.6rem;
  border-top: 1px dashed rgba(141, 92, 45, 0.32);
  padding-top: 1.2rem;
  font-size: 0.85rem;
  color: rgba(37, 23, 15, 0.78);
}

.cf-reader-aside {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.cf-reader-card h3 {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  color: rgba(64, 42, 27, 0.7);
}

.cf-reader-details dl,
.cf-reader-details div {
  font-size: 0.85rem;
  color: rgba(37, 23, 15, 0.82);
}

.cf-reader-details dt {
  font-family: "ScalySansSmallCaps", "ScalySans", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(64, 42, 27, 0.65);
}

.cf-reader-details dd {
  margin: 0;
}

.cf-reader-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.8rem;
}

@media (max-width: 960px) {
  .cf-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .cf-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 1rem;
  }

  .cf-main {
    padding: 2.2rem 1.4rem 3rem;
  }

  .cf-form {
    padding: 1.3rem 1.2rem;
  }
}

@media (max-width: 640px) {
  .cf-page {
    margin: 1.4rem auto 2rem;
  }

  .cf-section-header h1 + p::first-letter,
  .cf-section-header h2 + p::first-letter {
    float: none;
    font-size: inherit;
    padding: 0;
  }

  .cf-card {
    padding: 1.2rem;
  }

  .cf-stat-card {
    padding: 1.4rem;
  }

  .cf-nav {
    flex-wrap: wrap;
  }
}
