/* ============================================================
   COMPONENT BESTIARY — CUSTOM STYLES
   Works alongside Tailwind; only handles what Tailwind can't.
   ============================================================ */

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  min-height: 100%;
  background-color: #1a120b;
  background-image:
    radial-gradient(rgba(139, 69, 19, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
}

body {
  font-family: 'Newsreader', Georgia, serif;
  background-color: #1a120b;
  background-image: url('https://www.transparenttextures.com/patterns/dark-matter.png');
  min-height: 100vh;
}

/* ── Page transitions (manuscript feel) ──────────────────────── */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px) scale(0.992); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
body.page-transition {
  opacity: 0;
  animation: none;
}
body.page-transition.ready {
  animation: pageIn 480ms cubic-bezier(0.33, 0, 0.2, 1) forwards;
}
body.page-transition.fade-out {
  animation: none;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 280ms cubic-bezier(0.4, 0, 1, 1), transform 280ms cubic-bezier(0.4, 0, 1, 1);
}
@media (prefers-reduced-motion: reduce) {
  body.page-transition { animation: none; opacity: 1; transform: none; }
  body.page-transition.ready { animation: none; opacity: 1; }
  body.page-transition.fade-out { transition-duration: 0ms; }
}

/* Overlay shown during navigation — fills the gap so it doesn't feel broken */
.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1a120b;
  background-image: radial-gradient(rgba(139, 69, 19, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0;
  animation: overlayIn 120ms ease-out forwards;
}
.transition-overlay-graphic {
  display: flex;
  align-items: center;
  justify-content: center;
}
.transition-overlay-graphic svg {
  width: 4rem;
  height: 4rem;
  opacity: 0.5;
}
@keyframes overlayIn {
  to { opacity: 1; }
}
.transition-overlay.exiting {
  opacity: 0;
  animation: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 1, 1);
}
@media (prefers-reduced-motion: reduce) {
  .transition-overlay { animation: none; opacity: 1; }
  .transition-overlay.exiting { transition-duration: 0ms; }
}

/* ── Parchment container ────────────────────────────────────── */
.parchment {
  background-color: #d7c4a5;
  background-image:
    url('https://www.transparenttextures.com/patterns/parchment.png'),
    radial-gradient(circle at 8% 8%,  rgba(139,69,19,.09) 0%, transparent 50%),
    radial-gradient(circle at 92% 92%, rgba(0,0,0,.15)     0%, transparent 40%);
  border: 20px solid #3d2b1f;
  border-image: url('https://www.transparenttextures.com/patterns/dark-leather.png') 30 stretch;
  position: relative;
  overflow: hidden;
  filter: url('#rough-edge');
  clip-path: polygon(0px 4px, 8px 0px, calc(100% - 8px) 2px, 100% 4px, calc(100% - 2px) calc(100% - 4px), calc(100% - 6px) 100%, 6px calc(100% - 2px), 0px calc(100% - 4px));
}

.parchment-overlay {
  position: absolute;
  inset: 0;
  opacity: .18;
  pointer-events: none;
  background-image: url('https://www.transparenttextures.com/patterns/p6.png');
  z-index: 0;
}

/* ── Corner stains ──────────────────────────────────────────── */
.stain {
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(ellipse at center, rgba(101,67,33,.28) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* ── Navigation scraps ──────────────────────────────────────── */
.nav-scrap {
  display: inline-block;
  background-color: #e5d3b3;
  box-shadow: 2px 2px 5px rgba(0,0,0,.3);
  transform: rotate(-1deg);
  border: 1px solid rgba(0,0,0,.1);
  clip-path: polygon(2% 5%, 95% 0%, 100% 90%, 5% 100%);
  text-decoration: none;
  transition: filter .15s, transform .15s;
  padding: .5rem 1.6rem;
  font-family: 'MedievalSharp', serif;
  font-size: .8rem;
  color: #3e2723;
}
.nav-scrap:nth-child(even) {
  transform: rotate(1.5deg);
  clip-path: polygon(0% 10%, 98% 2%, 95% 95%, 5% 90%);
}
.nav-scrap:hover { filter: brightness(1.1); transform: rotate(0deg) translateY(-2px); }
.nav-scrap.active { background-color: #c9a96e; }

/* ── Typography scale (consistent across site) ───────────────── */
/* Font sizes: .65rem (xs) | .72rem (sm) | .8rem (md) | .88rem (base) | .9rem (lg) | 1rem (xl) */
/* Colors: sepia #3e2723 | accent #5d4037 | primary #8b4513 | ink #2b2b2b */

.page-title {
  font-family: 'MedievalSharp', serif;
  font-size: clamp(1.875rem, 4rem, 2.25rem);
  color: #3e2723;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.page-subtitle {
  font-family: 'Newsreader', serif;
  font-size: .875rem;
  font-style: italic;
  color: #5d4037;
  line-height: 1.5;
}
.volume-label {
  font-family: 'MedievalSharp', serif;
  font-size: .875rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #5d4037;
}
.index-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-family: 'MedievalSharp', serif;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b4513;
  text-decoration: none;
  opacity: .7;
  transition: opacity .15s;
}
.index-link:hover { opacity: 1; }
.index-link .material-symbols-outlined { font-size: .95rem; }

.anchor-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  border-radius: .25rem;
  text-decoration: none;
  color: #5d4037;
  font-family: 'MedievalSharp', serif;
  font-size: .72rem;
  letter-spacing: .06em;
  transition: background .12s, color .12s;
}
.anchor-link:hover { background: rgba(139,69,19,.08); color: #3e2723; }
.anchor-link .material-symbols-outlined { font-size: .95rem; color: #8b4513; }

.sidebar-card-title {
  font-family: 'MedievalSharp', serif;
  font-size: .9rem;
  font-weight: 600;
  color: #3e2723;
}
.sidebar-card-desc {
  font-family: 'Newsreader', serif;
  font-size: .72rem;
  font-style: italic;
  color: #5d4037;
}
.sidebar-card-meta {
  font-family: 'MedievalSharp', serif;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5d4037;
}

.threat-label {
  font-family: 'MedievalSharp', serif;
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b4513;
}

/* ── Typography ─────────────────────────────────────────────── */
.entry-name {
  font-family: 'MedievalSharp', serif;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  color: #3e2723;
  line-height: 1.05;
}
.entry-epithet {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: .9rem;
  color: #5d4037;
  margin-top: .2rem;
}
.sect-heading {
  font-family: 'MedievalSharp', serif;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: #3e2723;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid rgba(139,69,19,.3);
  margin-bottom: .9rem;
}
.sect-heading .material-symbols-outlined {
  font-size: 1.1rem;
  color: #8b4513;
  font-variation-settings: 'wght' 300;
}
/* Meta grid: Class, Rarity, CR on row 1; Habitat spans full width on row 2 to reduce wrap */
.entry-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 .5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(139,69,19,.2);
}
@media (min-width: 768px) {
  .entry-meta-grid {
    grid-template-columns: auto auto auto;
    gap: 0 1.5rem;
  }
  .entry-meta-grid .meta-row-habitat {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
}
.meta-row {
  font-size: .82rem;
  color: #5d4037;
  padding: .12rem 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.meta-label {
  font-family: 'MedievalSharp', serif;
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b4513;
  display: block;
  margin-right: 0;
}

/* ── Threat stars ───────────────────────────────────────────── */
.threat-stars .filled { color: #8b4513; }
.threat-stars .empty  { color: rgba(139,69,19,.22); }

/* ── Flavour quote ──────────────────────────────────────────── */
.flavour {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: .9rem;
  line-height: 1.8;
  color: #5d4037;
  border-left: 3px solid rgba(139,69,19,.4);
  padding: .5rem 1rem .5rem 1rem;
  margin: 0 0 2rem 0;
}

/* ── Illustration frame ─────────────────────────────────────── */
.illo-frame {
  background: rgba(255,255,255,.35);
  border: 1px solid rgba(139,69,19,.25);
  border-radius: .375rem;
  padding: .75rem .75rem .4rem;
}
.illo-caption {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: .68rem;
  color: #5d4037;
  line-height: 1.55;
  text-align: center;
  margin-top: .45rem;
  padding: 0 .2rem;
}

/* ── Illustration hover animations (subtle, discovery-style) ─── */
@media (hover: hover) {
  /* Base transitions so leave animates back smoothly */
  .illo-frame--modal .illo-eye--left,
  .illo-frame--modal .illo-eye--right { transition: transform 280ms ease-out; }
  .illo-frame--tooltip .illo-wing--left { transition: transform 400ms ease-out; transform-origin: 30px 72px; }
  .illo-frame--tooltip .illo-wing--right { transition: transform 400ms ease-out; transform-origin: 170px 72px; }
  .illo-frame--skeleton .illo-pulse { transition: transform 400ms ease-out; }
  .illo-frame--button .illo-eyes { transition: transform 220ms ease-out; transform-origin: 100px 44px; }
  .illo-frame--accordion .illo-eyes { transition: transform 350ms ease-out; transform-origin: 28px 33px; }
  .illo-frame--dropdown .illo-chevron { transition: transform 350ms ease-out; transform-origin: 152px 38px; }
  .illo-frame--dropdown .illo-eyes { transition: transform 300ms ease-out; }
  .illo-frame--data-table .illo-eye { transition: transform 400ms ease-out; transform-origin: 28px 30px; }
  .illo-frame--toast .illo-arm--left,
  .illo-frame--toast .illo-arm--right { transition: transform 400ms ease-out; }
  .illo-frame--carousel .illo-gear { transition: transform 500ms ease-out; transform-origin: 75px 55px; }
  .illo-frame--date-picker .illo-selected { transition: opacity 350ms ease-out; }
  .illo-frame--form .illo-limb--1.illo-limb--left { transition: transform 450ms ease-out; transform-origin: 35px 53px; }
  .illo-frame--form .illo-limb--1.illo-limb--right { transition: transform 450ms ease-out; transform-origin: 165px 53px; }
  .illo-frame--form .illo-limb--2.illo-limb--left { transition: transform 450ms ease-out; transform-origin: 35px 82px; }
  .illo-frame--form .illo-limb--2.illo-limb--right { transition: transform 450ms ease-out; transform-origin: 165px 82px; }
  .illo-frame--form .illo-limb--3.illo-limb--left { transition: transform 450ms ease-out; transform-origin: 35px 111px; }
  .illo-frame--form .illo-limb--3.illo-limb--right { transition: transform 450ms ease-out; transform-origin: 165px 111px; }
  .illo-frame--infinite-scroll .illo-spinner { transition: transform 500ms ease-out; transform-origin: 100px 195px; }
  .illo-frame--nav-bar .illo-foot--1 { transition: transform 300ms ease-out; transform-origin: 25px 58px; }
  .illo-frame--nav-bar .illo-foot--2 { transition: transform 300ms ease-out; transform-origin: 60px 58px; }
  .illo-frame--nav-bar .illo-foot--3 { transition: transform 300ms ease-out; transform-origin: 95px 58px; }
  .illo-frame--nav-bar .illo-foot--4 { transition: transform 300ms ease-out; transform-origin: 130px 58px; }
  .illo-frame--nav-bar .illo-foot--5 { transition: transform 300ms ease-out; transform-origin: 165px 58px; }

  /* Modal: eyes shift to follow */
  .illo-frame--modal:hover .illo-eye--left { transform: translate(-1.5px, 0); }
  .illo-frame--modal:hover .illo-eye--right { transform: translate(1.5px, 0); }
  /* Tooltip: wings flutter */
  .illo-frame--tooltip:hover .illo-wing--left { animation: wingFlutterLeft 600ms ease-in-out 2; transform-origin: 30px 72px; }
  .illo-frame--tooltip:hover .illo-wing--right { animation: wingFlutterRight 600ms ease-in-out 2; transform-origin: 170px 72px; }
  /* Skeleton Loader: pulse */
  .illo-frame--skeleton:hover .illo-pulse { animation: skeletonPulse 1.2s ease-in-out 2; transform-origin: 100px 120px; }
  /* Button: eyes widen slightly */
  .illo-frame--button:hover .illo-eyes { transform: scale(1.08); }
  /* Accordion: eye blinks */
  .illo-frame--accordion:hover .illo-eyes { animation: eyeBlink 400ms ease-in-out 2; transform-origin: 28px 33px; }
  /* Dropdown: chevron wiggles, eyes glance */
  .illo-frame--dropdown:hover .illo-chevron { animation: chevronWiggle 500ms ease-in-out 2; transform-origin: 152px 38px; }
  .illo-frame--dropdown:hover .illo-eyes { transform: translateY(-1px); }
  /* Data Table: eye shifts */
  .illo-frame--data-table:hover .illo-eye { animation: eyeShift 800ms ease-in-out 1; transform-origin: 28px 30px; }
  /* Toast: arms wave */
  .illo-frame--toast:hover .illo-arm--left { animation: armWaveLeft 700ms ease-in-out 2; transform-origin: 30px 80px; }
  .illo-frame--toast:hover .illo-arm--right { animation: armWaveRight 700ms ease-in-out 2; transform-origin: 170px 80px; }
  /* Carousel: gear rotates */
  .illo-frame--carousel:hover .illo-gear { animation: gearSpin 1.5s linear 1; transform-origin: 75px 55px; }
  /* Date Picker: selected date pulses */
  .illo-frame--date-picker:hover .illo-selected { animation: cellPulse 1s ease-in-out 2; }
  /* Form: limbs sway */
  .illo-frame--form:hover .illo-limb--1.illo-limb--left { animation: limbSwayLeft 1.2s ease-in-out 2; transform-origin: 35px 53px; }
  .illo-frame--form:hover .illo-limb--1.illo-limb--right { animation: limbSwayRight 1.2s ease-in-out 2; transform-origin: 165px 53px; }
  .illo-frame--form:hover .illo-limb--2.illo-limb--left { animation: limbSwayLeft 1.2s ease-in-out 2 100ms; transform-origin: 35px 82px; }
  .illo-frame--form:hover .illo-limb--2.illo-limb--right { animation: limbSwayRight 1.2s ease-in-out 2 100ms; transform-origin: 165px 82px; }
  .illo-frame--form:hover .illo-limb--3.illo-limb--left { animation: limbSwayLeft 1.2s ease-in-out 2 200ms; transform-origin: 35px 111px; }
  .illo-frame--form:hover .illo-limb--3.illo-limb--right { animation: limbSwayRight 1.2s ease-in-out 2 200ms; transform-origin: 165px 111px; }
  /* Infinite Scroll: spinner rotates */
  .illo-frame--infinite-scroll:hover .illo-spinner { animation: spinnerRotate 1.2s linear 2; transform-origin: 100px 195px; }
  /* Navigation Bar: feet wiggle */
  .illo-frame--nav-bar:hover .illo-foot--1 { animation: footWiggle 400ms ease-in-out 2; transform-origin: 25px 58px; }
  .illo-frame--nav-bar:hover .illo-foot--2 { animation: footWiggle 400ms ease-in-out 2 50ms; transform-origin: 60px 58px; }
  .illo-frame--nav-bar:hover .illo-foot--3 { animation: footWiggle 400ms ease-in-out 2 100ms; transform-origin: 95px 58px; }
  .illo-frame--nav-bar:hover .illo-foot--4 { animation: footWiggle 400ms ease-in-out 2 150ms; transform-origin: 130px 58px; }
  .illo-frame--nav-bar:hover .illo-foot--5 { animation: footWiggle 400ms ease-in-out 2 200ms; transform-origin: 165px 58px; }
}
@keyframes wingFlutterLeft {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}
@keyframes wingFlutterRight {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(8deg); }
}
@keyframes skeletonPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes eyeBlink {
  0%, 45%, 55%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(.15); }
}
@keyframes chevronWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}
@keyframes eyeShift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2px, -1px); }
}
@keyframes armWaveLeft {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-12deg); }
}
@keyframes armWaveRight {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(12deg); }
}
@keyframes gearSpin {
  to { transform: rotate(360deg); }
}
@keyframes cellPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
@keyframes limbSwayLeft {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(4deg); }
}
@keyframes limbSwayRight {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-4deg); }
}
@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}
@keyframes footWiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .illo-frame--modal .illo-eye--left,
  .illo-frame--modal .illo-eye--right,
  .illo-frame--tooltip .illo-wing--left,
  .illo-frame--tooltip .illo-wing--right,
  .illo-frame--skeleton .illo-pulse,
  .illo-frame--button .illo-eyes,
  .illo-frame--accordion .illo-eyes,
  .illo-frame--dropdown .illo-chevron,
  .illo-frame--dropdown .illo-eyes,
  .illo-frame--data-table .illo-eye,
  .illo-frame--toast .illo-arm--left,
  .illo-frame--toast .illo-arm--right,
  .illo-frame--carousel .illo-gear,
  .illo-frame--date-picker .illo-selected,
  .illo-frame--form .illo-limb--left,
  .illo-frame--form .illo-limb--right,
  .illo-frame--infinite-scroll .illo-spinner,
  .illo-frame--nav-bar .illo-foot { transition: none !important; }
  .illo-frame--modal:hover .illo-eye--left,
  .illo-frame--modal:hover .illo-eye--right,
  .illo-frame--tooltip:hover .illo-wing--left,
  .illo-frame--tooltip:hover .illo-wing--right,
  .illo-frame--skeleton:hover .illo-pulse,
  .illo-frame--button:hover .illo-eyes,
  .illo-frame--accordion:hover .illo-eyes,
  .illo-frame--dropdown:hover .illo-chevron,
  .illo-frame--dropdown:hover .illo-eyes,
  .illo-frame--data-table:hover .illo-eye,
  .illo-frame--toast:hover .illo-arm--left,
  .illo-frame--toast:hover .illo-arm--right,
  .illo-frame--carousel:hover .illo-gear,
  .illo-frame--date-picker:hover .illo-selected,
  .illo-frame--form:hover .illo-limb--left,
  .illo-frame--form:hover .illo-limb--right,
  .illo-frame--infinite-scroll:hover .illo-spinner,
  .illo-frame--nav-bar:hover .illo-foot { animation: none !important; transform: none !important; transition: none !important; }
}

/* ── Lore text ──────────────────────────────────────────────── */
.lore p {
  font-family: 'Newsreader', serif;
  font-size: 1rem;
  line-height: 1.85;
  color: #2b2b2b;
  margin-bottom: 1rem;
}
.lore p:last-child { margin-bottom: 0; }
.lore p:first-of-type::first-letter {
  font-family: 'MedievalSharp', serif;
  font-size: 3.5rem;
  line-height: .82;
  float: left;
  margin: .1rem .3rem -.05rem 0;
  color: #5d4037;
}

/* ── Stat block ─────────────────────────────────────────────── */
.stat-block {
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(139,69,19,.2);
  border-radius: .375rem;
  padding: .6rem 0;
}
.stat-cell {
  text-align: center;
  padding: .4rem .5rem;
  border-right: 1px solid rgba(139,69,19,.12);
}
.stat-cell:last-child { border-right: none; }
.stat-abbr {
  font-family: 'MedievalSharp', serif;
  font-size: .6rem;
  letter-spacing: .1em;
  color: #8b4513;
  display: block;
  margin-bottom: .1rem;
}
.stat-val {
  font-family: 'Newsreader', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #3e2723;
  display: block;
  line-height: 1.1;
}
.stat-mod {
  font-family: 'Newsreader', serif;
  font-size: .72rem;
  color: #5d4037;
  display: block;
}

/* ── Ability panels ─────────────────────────────────────────── */
.ability-panel {
  border-left: 4px solid rgba(139,69,19,.45);
  background: rgba(139,69,19,.05);
  border-radius: 0 .375rem .375rem 0;
  padding: .7rem 1rem;
  margin-bottom: .55rem;
}
.ability-name {
  font-family: 'MedievalSharp', serif;
  font-size: .8rem;
  letter-spacing: .06em;
  color: #3e2723;
  display: block;
  margin-bottom: .2rem;
}
.ability-body {
  font-family: 'Newsreader', serif;
  font-size: .88rem;
  color: #2b2b2b;
  line-height: 1.7;
}

/* ── Lists ──────────────────────────────────────────────────── */
.beast-list { list-style: none; padding: 0; }
.beast-list li {
  font-family: 'Newsreader', serif;
  font-size: .88rem;
  line-height: 1.65;
  color: #2b2b2b;
  padding: .3rem 0 .3rem 1rem;
  border-bottom: 1px solid rgba(139,69,19,.1);
  position: relative;
}
.beast-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: .5rem;
  color: rgba(139,69,19,.4);
  font-size: .5rem;
}
.beast-list li:last-child { border-bottom: none; }

/* ── Field notes ────────────────────────────────────────────── */
.field-notes {
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(139,69,19,.2);
  border-top: 3px solid rgba(139,69,19,.4);
  border-radius: .375rem;
  padding: .9rem 1.15rem;
}
.field-note {
  font-family: 'Newsreader', serif;
  font-size: .86rem;
  line-height: 1.72;
  color: #2b2b2b;
  margin-bottom: .55rem;
}
.field-note:last-child { margin-bottom: 0; }
.field-note strong {
  font-family: 'MedievalSharp', serif;
  font-size: .72rem;
  letter-spacing: .06em;
  color: #5d4037;
}

/* ── Badge pills ────────────────────────────────────────────── */
.badge {
  font-family: 'MedievalSharp', serif;
  font-size: .58rem;
  letter-spacing: .08em;
  padding: .18rem .55rem;
  border-radius: 9999px;
  display: inline-block;
  vertical-align: middle;
}
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-brown { background: rgba(139,69,19,.1); color: #5d4037; border: 1px solid rgba(139,69,19,.3); }

/* ── Index rows ─────────────────────────────────────────────── */
.index-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .6rem .75rem;
  border-radius: .375rem;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(139,69,19,.12);
  text-decoration: none;
  color: inherit;
  margin-bottom: .35rem;
  transition: background .15s, border-color .15s;
}
.index-row:hover { background: rgba(139,69,19,.07); border-color: rgba(139,69,19,.3); }
.index-num { font-family: 'MedievalSharp', serif; font-size: .65rem; color: #8b4513; min-width: 1.5rem; }
.index-entry-name { font-family: 'MedievalSharp', serif; font-size: .95rem; color: #3e2723; display: block; }
.index-entry-sub  { font-family: 'Newsreader', serif; font-style: italic; font-size: .72rem; color: #5d4037; display: block; }
.index-dots {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(139,69,19,.3) 0, rgba(139,69,19,.3) 2px, transparent 2px, transparent 6px);
  align-self: center;
}
.index-threat { font-size: .75rem; letter-spacing: .06em; flex-shrink: 0; }
.index-threat .filled { color: #8b4513; }
.index-threat .empty  { color: rgba(139,69,19,.22); }

/* ── Page footer ────────────────────────────────────────────── */
.page-foot {
  font-family: 'MedievalSharp', serif;
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(62,39,35,.45);
  text-align: center;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(139,69,19,.18);
}
.footer-credit {
  font-family: 'MedievalSharp', serif;
  font-size: .65rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(93,64,55,.6);
  text-align: center;
}
footer {
  padding-bottom: 2rem !important;
}

/* ── Code ───────────────────────────────────────────────────── */
code {
  font-family: 'Courier New', monospace;
  font-size: .8em;
  background: rgba(139,69,19,.1);
  border: 1px solid rgba(139,69,19,.2);
  border-radius: .2rem;
  padding: .1em .35em;
  color: #5d4037;
}

/* ── Roll button ────────────────────────────────────────────── */
.roll-btn {
  width: 100%;
  padding: .9rem 2rem;
  background: #8b0000;
  color: #d7c4a5;
  font-family: 'MedievalSharp', serif;
  font-size: .95rem;
  letter-spacing: .06em;
  border-radius: 9999px;
  border: 4px solid #5a0000;
  box-shadow: 0 4px 0 rgb(60,0,0);
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  cursor: pointer;
  transition: all .1s;
}
.roll-btn:hover { box-shadow: 0 2px 0 rgb(60,0,0); transform: translateY(2px); }
.roll-btn:active { box-shadow: none; transform: translateY(4px); }

/* ── Handwritten note ───────────────────────────────────────── */
.hand-note {
  font-family: 'Homemade Apple', cursive;
  font-size: .6rem;
  color: rgba(93,64,55,.55);
  transform: rotate(-1.5deg);
  display: inline-block;
}