/* Shared stylesheet of the web manuals (web/<id>_manual.html). Defaults are the Deepwake look;
   each manual's own <style> overrides the custom properties (fonts, paper, ink, covers, bars). */
:root {
  --desk: #0c0806;
  --wood: #76461f;
  --wood-dark: #4a2a10;
  --gold: #d4a23a;
  --gold-bright: #f0c040;
  --blue: #3783fe;
  --ui-text: #ece4d4;
  --ui-dim: #a89c8a;
  --paper: #ecdfc0;
  --ink: #2b1a0e;
  --ink-soft: #5a4128;
  --rubric: #8e2b1d;
  --teal: #2f5f5e;
  --pw: 520px;
  --ph: 743px;
  --turn: 0.85s;
  /* fonts */
  --f-body: "IM Fell English", Georgia, serif;
  --f-sc: "IM Fell English SC", Georgia, serif;
  --f-head: "Cinzel", Georgia, serif;
  --f-deco: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --f-hand: "Caveat", "Segoe Print", cursive;
  /* the reading desk, and the bars above and below the book */
  --desk-img:
    radial-gradient(ellipse at 50% 40%, rgba(120, 70, 30, 0.35) 0%, rgba(0, 0, 0, 0) 65%),
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.015) 0 3px, rgba(0, 0, 0, 0.03) 3px 9px),
    linear-gradient(#1a100a, #0a0604);
  --bar-bg: linear-gradient(#5a3418, #3a200c);
  /* covers */
  --cover-bg:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='l'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.35' numOctaves='4' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 -.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23l)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 45% 35%, #2f4a3a 0%, #1a2a20 55%, #0e1610 100%);
  --cover-line: #c8962e;
  --cover-text: #e8c46a;
  --cover-soft: #d8b060;
  --gilt: linear-gradient(180deg, #fff1b8 0%, #e8b84a 40%, #a8741c 60%, #f0c860 100%);
  --ribbon: linear-gradient(#a8321e, #7a2010);
  --board: #3a1a12 radial-gradient(ellipse at 30% 30%, #5a2a1c, #2a120c 75%);
  --endpaper:
    radial-gradient(circle at 20% 30%, rgba(47, 95, 94, 0.55) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 60%, rgba(142, 43, 29, 0.45) 0 5%, transparent 6%),
    repeating-radial-gradient(circle at 30% 40%, #1f3c46 0 1.2cqw, #2f5f5e 1.2cqw 2cqw, #c8a050 2cqw 2.3cqw, #1a2e3a 2.3cqw 3.4cqw),
    #1f3c46;
  --orn: "\2766\00a0\2042\00a0\2767";
  --bullet: "\2766";
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--desk);
  background-image: var(--desk-img);
  color: var(--ui-text);
  font: 16px/1.4 var(--f-body);
  display: flex;
  flex-direction: column;
}
a { color: inherit; }

/* ---------- top and bottom bars (wood and gold, as on the landing page) ---------- */
.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bar-bg);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 2px 0 var(--wood-dark), 0 6px 18px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 5;
}
.bar.bottom { border-bottom: 0; border-top: 2px solid var(--gold); box-shadow: 0 -2px 0 var(--wood-dark), 0 -6px 18px rgba(0, 0, 0, 0.5); justify-content: center; }
.home { font: 600 0.85rem var(--f-head); letter-spacing: 0.06em; color: var(--gold-bright); text-decoration: none; white-space: nowrap; }
.home:hover { color: #fff; }
.bar-title { flex: 1; text-align: center; min-width: 0; }
.bar-title b { display: block; font: 800 1.05rem var(--f-head); color: var(--gold-bright); letter-spacing: 0.12em; }
.bar-title span { display: block; font-size: 0.78rem; color: var(--ui-dim); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
select, .nav {
  font: 600 0.85rem var(--f-head);
  color: var(--gold-bright);
  background: var(--wood);
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 3px 0 var(--wood-dark);
  cursor: pointer;
}
select { padding: 5px 6px; max-width: 220px; }
select option { background: #2a1a0c; color: var(--ui-text); }
.nav { min-width: 44px; height: 38px; padding: 0 12px; font-size: 1rem; }
.nav:hover:not(:disabled), select:hover { filter: brightness(1.15); }
.nav:disabled { opacity: 0.4; cursor: default; }
.nav:focus-visible, select:focus-visible, .home:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
#where { min-width: 150px; text-align: center; font: 600 0.9rem var(--f-head); color: var(--ui-text); letter-spacing: 0.04em; }
.hint { position: absolute; right: 16px; font-size: 0.78rem; color: var(--ui-dim); font-style: italic; }
@media (max-width: 760px) {
  .bar { padding: 6px 10px; gap: 8px; }
  .bar-title span, .hint { display: none; }
  .home .long { display: none; }
  select { max-width: 120px; }
  #where { min-width: 96px; font-size: 0.8rem; }
}

/* ---------- the stage and the book ---------- */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px 0;
}
/* The book stays flat (no preserve-3d) so the leaves stack by z-index; each leaf is its own 3D scene. */
.book {
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  perspective: calc(var(--pw) * 5);
  transition: transform var(--turn) ease;
}
.book.single { width: var(--pw); }
.book.closed-front { transform: translateX(calc(var(--pw) * -0.5)); }
.book.closed-back { transform: translateX(calc(var(--pw) * 0.5)); }

/* leather boards behind the pages, and the edges of the stacked pages */
.board {
  position: absolute;
  top: -8px; bottom: -8px;
  width: calc(50% + 8px);
  background: var(--board);
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7), inset 0 0 0 2px rgba(212, 162, 58, 0.35);
  transition: opacity 0.2s;
}
.board.left { left: -8px; border-radius: 6px 2px 2px 6px; }
.board.right { right: -8px; border-radius: 2px 6px 6px 2px; }
.book.closed-front .board.left, .book.closed-back .board.right { opacity: 0; transition-delay: calc(var(--turn) * 0.5); }
.stack {
  position: absolute;
  top: 3px; bottom: 3px;
  width: var(--sw, 6px);
  background: repeating-linear-gradient(90deg, #e2d2ae 0 1px, #b8a47c 1px 2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.stack.left { left: calc(var(--sw, 6px) * -1); border-radius: 3px 0 0 3px; }
.stack.right { right: calc(var(--sw, 6px) * -1); border-radius: 0 3px 3px 0; }
.book.single .board, .book.single .stack { display: none; }

.leaf {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--turn) cubic-bezier(0.35, 0.1, 0.25, 1);
}
.leaf.flipped { transform: rotateY(-180deg); }
.book.single .leaf { left: 0; width: 100%; transition: transform var(--turn) cubic-bezier(0.35, 0.1, 0.25, 1), visibility 0s linear 0s; }
.book.single .leaf.flipped { visibility: hidden; transition: transform var(--turn) cubic-bezier(0.35, 0.1, 0.25, 1), visibility 0s linear var(--turn); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  container-type: size;
  background: var(--paper);
}
.face.back { transform: rotateY(180deg); }
.face.front { border-radius: 0 3px 3px 0; }
.face.back { border-radius: 3px 0 0 3px; }
/* gutter shading by the spine */
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgba(70, 40, 10, 0.38), rgba(70, 40, 10, 0) 9%, rgba(70, 40, 10, 0) 95%, rgba(70, 40, 10, 0.12));
}
.face.back::after { background: linear-gradient(to left, rgba(70, 40, 10, 0.38), rgba(70, 40, 10, 0) 9%, rgba(70, 40, 10, 0) 95%, rgba(70, 40, 10, 0.12)); }
.book.single .face.front::after { background: linear-gradient(to right, rgba(70, 40, 10, 0.18), rgba(70, 40, 10, 0) 5%); }
.face.cover-face::after { background: linear-gradient(to right, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 6%); }
.face.back.cover-face::after { background: linear-gradient(to left, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 6%); }
/* a darkening sweep while a leaf turns */
.leaf.turning .face::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
  animation: sweep var(--turn) ease forwards;
}
@keyframes sweep { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }
/* page corner hint */
.face.front.live .curl {
  position: absolute; right: 0; bottom: 0; width: 0; height: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0) 50%, #d9c79e 50%, #f3e8cc 80%);
  box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.25);
  transition: width 0.2s, height 0.2s;
}
.face.front.live:hover .curl { width: 5cqw; height: 5cqw; }

@media (prefers-reduced-motion: reduce) {
  :root { --turn: 0.01s; }
  .leaf.turning .face::before { animation: none; }
}

/* ---------- the printed page ---------- */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 5.5cqw 8cqw 4.5cqw;
  color: var(--ink);
  font-size: 3cqw;
  line-height: 1.36;
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: #b09870 transparent;
  background:
    radial-gradient(circle at var(--fx, 80%) var(--fy, 20%), rgba(140, 90, 30, 0.13) 0, rgba(140, 90, 30, 0) 3.5cqw),
    radial-gradient(circle at var(--gx, 20%) var(--gy, 85%), rgba(140, 90, 30, 0.10) 0, rgba(140, 90, 30, 0) 2.5cqw),
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 58%, rgba(120, 80, 30, 0.30) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .1 0 0 0 .22 -.06'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .08 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
}
.book.single .page { font-size: max(15px, 3cqw); padding: max(18px, 5.5cqw) max(18px, 7cqw) max(14px, 4.5cqw); }
.runhead {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.9em;
  font: 0.7em var(--f-sc);
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.runhead::before, .runhead::after { content: ""; flex: 1; border-top: 1px solid rgba(43, 26, 14, 0.4); }
.folio {
  flex: none;
  margin-top: auto;
  padding-top: 0.6em;
  text-align: center;
  font: 0.8em var(--f-sc);
  color: var(--ink-soft);
  letter-spacing: 0.1em;
}
.folio::before { content: "\2014\00a0"; }
.folio::after { content: "\00a0\2014"; }
.body { flex: none; }

.page p { margin: 0 0 0.62em; text-align: justify; hyphens: auto; }
.page h2.chap {
  margin: 0.2em 0 0.15em;
  font: 800 1.5em/1.12 var(--f-head);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "dlig" 0;
}
.page h2.chap .num {
  display: block;
  font: 0.5em var(--f-sc);
  letter-spacing: 0.3em;
  color: var(--rubric);
  margin-bottom: 0.2em;
}
.orn {
  display: block;
  text-align: center;
  color: var(--rubric);
  font-size: 1em;
  letter-spacing: 0.5em;
  margin: 0.25em 0 0.8em;
}
.orn::before { content: var(--orn); }
.page h3 {
  margin: 0.85em 0 0.35em;
  font: 1.12em var(--f-sc);
  letter-spacing: 0.06em;
  color: var(--rubric);
  border-bottom: 1px solid rgba(142, 43, 29, 0.35);
}
.page h3:first-child { margin-top: 0; }
.sub { text-align: center; font-style: italic; color: var(--ink-soft); margin: -0.3em 0 0.8em !important; }
.dropcap::first-letter {
  float: left;
  font: 700 3.3em/0.82 var(--f-deco);
  color: var(--rubric);
  margin: 0.06em 0.08em 0 0;
  padding: 0.08em 0.1em 0.02em;
  border: 1px solid rgba(142, 43, 29, 0.45);
  background: rgba(212, 162, 58, 0.18);
}
.page ul, .page ol { margin: 0 0 0.62em; padding-left: 1.5em; }
.page li { margin-bottom: 0.25em; }
.page ul { list-style: none; }
.page ul li { position: relative; }
.page ul li::before { content: var(--bullet); position: absolute; left: -1.25em; color: var(--rubric); font-size: 0.85em; top: 0.08em; }
.page ol li::marker { color: var(--rubric); font-family: var(--f-head); font-weight: 600; }
kbd {
  display: inline-block;
  min-width: 1.35em;
  padding: 0 0.28em;
  font: 600 0.82em/1.3 var(--f-head);
  text-align: center;
  color: var(--ink);
  background: linear-gradient(#f6ecd4, #dccaa0);
  border: 1px solid #6a5034;
  border-bottom-width: 2px;
  border-radius: 3px;
  vertical-align: 0.06em;
}
.word { font: 0.92em var(--f-sc); letter-spacing: 0.06em; color: var(--rubric); }
blockquote.motto {
  margin: 0.5em 1.2em 0.8em;
  padding: 0.5em 0.8em;
  text-align: center;
  font-style: italic;
  font-size: 1.08em;
  border-top: 1px solid rgba(43, 26, 14, 0.5);
  border-bottom: 1px solid rgba(43, 26, 14, 0.5);
}
.page p.verse { margin: 0.4em 0 0.9em; text-align: center; font-style: italic; line-height: 1.45; }
.warning { margin: 0.6em 0; padding: 0.5em 0.8em; border-left: 3px solid var(--rubric); background: rgba(142, 43, 29, 0.07); }
.say { font-style: italic; }

/* sidebars, boxed in the old way */
.sidebar {
  position: relative;
  margin: 0.8em 0.2em;
  padding: 0.6em 0.9em 0.5em;
  background: rgba(120, 80, 30, 0.08);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  font-size: 0.94em;
}
.sidebar::before, .sidebar::after {
  content: "\2756";
  position: absolute;
  top: -0.78em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 0.3em;
  background: var(--paper);
  color: var(--rubric);
  font-size: 0.95em;
}
.sidebar::after { top: auto; bottom: -0.78em; }
.sidebar p:last-child { margin-bottom: 0; }
.sidebar b:first-child { font-family: var(--f-sc); color: var(--rubric); letter-spacing: 0.03em; }
.margin-note {
  margin: 0.8em 0.4em;
  padding: 0.4em 0.7em;
  font: 500 1.3em/1.18 var(--f-hand);
  color: #2a3a6a;
  transform: rotate(-1.2deg);
  border-left: 2px solid rgba(42, 58, 106, 0.4);
}
.margin-note .lead { display: block; font: italic 0.68em var(--f-body); color: var(--ink-soft); margin-bottom: 0.15em; }
.struck { text-decoration: line-through; text-decoration-color: rgba(160, 20, 10, 0.85); text-decoration-thickness: 2px; color: var(--ink-soft); }
.stamp {
  display: inline-block;
  font: 800 1.2em var(--f-head);
  color: rgba(160, 20, 10, 0.85);
  border: 3px double rgba(160, 20, 10, 0.75);
  padding: 0.05em 0.4em;
  transform: rotate(-6deg);
  letter-spacing: 0.1em;
}

/* tables */
table.t { width: 100%; border-collapse: collapse; margin: 0.4em 0 0.8em; font-size: 0.86em; line-height: 1.25; }
table.t th {
  font: 0.92em var(--f-sc);
  letter-spacing: 0.04em;
  color: var(--rubric);
  text-align: left;
  padding: 0.25em 0.4em;
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--ink);
}
table.t td { padding: 0.2em 0.4em; vertical-align: top; border-bottom: 1px dotted rgba(43, 26, 14, 0.35); }
table.t tr:last-child td { border-bottom: 3px double var(--ink); }
table.t tbody tr:nth-child(even) td { background: rgba(120, 80, 30, 0.06); }
table.t .c { text-align: center; }
table.t .r { text-align: right; }
table.t td.k { white-space: nowrap; width: 2.4em; }
table.t.compact { font-size: 0.8em; }
table.t.compact td { padding: 0.12em 0.35em; }

/* plates (illustrations) */
figure.plate { margin: 0.5em 0 0.8em; text-align: center; }
figure.plate .frame {
  display: block;
  position: relative;
  padding: 0.35em;
  background: #f6ecd4;
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--ink), 0.2em 0.3em 0.6em rgba(60, 35, 10, 0.25);
  margin: 0 0.3em;
}
figure.plate img { display: block; width: 100%; height: auto; }
figure.plate.short img { max-height: 12.5em; object-fit: contain; }
figure.plate.tiny img { max-height: 9.5em; object-fit: contain; }
figure.plate figcaption { margin-top: 0.7em; font-size: 0.86em; font-style: italic; line-height: 1.25; color: var(--ink-soft); }
figure.plate figcaption .pn { font: normal 0.95em var(--f-sc); color: var(--rubric); font-style: normal; letter-spacing: 0.06em; }
figure.plate.tall { flex: 1; display: flex; flex-direction: column; margin: 0; }
figure.plate.tall .frame { flex: 1; min-height: 0; }
figure.plate.tall .frame img { width: 100%; height: 100%; object-fit: contain; }
img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
/* screenshot "tipped in" with photo corners */
figure.shot .frame { background: #000; padding: 0; border: 0; box-shadow: 0.2em 0.3em 0.7em rgba(40, 20, 0, 0.4); }
figure.shot .frame::before, figure.shot .frame::after {
  content: ""; position: absolute; width: 1.6em; height: 1.6em; z-index: 2;
  background: linear-gradient(135deg, #3a2a1a 50%, transparent 50%);
}
figure.shot .frame::before { top: -0.3em; left: -0.3em; }
figure.shot .frame::after { bottom: -0.3em; right: -0.3em; transform: rotate(180deg); }
.callout {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 1.5em; height: 1.5em;
  border-radius: 50%;
  background: var(--rubric);
  color: #fff;
  border: 2px solid #f6ecd4;
  font: 700 0.8em/1.3em var(--f-head);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.legend { counter-reset: lg; list-style: none; padding: 0 !important; margin: 0.4em 0 0.6em; font-size: 0.9em; columns: 2; column-gap: 1.2em; }
.legend li { counter-increment: lg; padding-left: 1.6em; position: relative; break-inside: avoid; }
.legend li::before {
  content: counter(lg) !important;
  position: absolute; left: 0; top: 0.1em !important;
  width: 1.25em; height: 1.25em; border-radius: 50%;
  background: var(--rubric); color: #fff;
  font: 700 0.75em/1.25em var(--f-head) !important; text-align: center;
}

/* battle scene built from the game's own tiles and sprites */
.battle {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(5, 1fr);
  aspect-ratio: 9 / 5;
  background: #2a7a2a url("assets/assets/tiles/grass.png") 0 0 / calc(100% / 9) auto;
  image-rendering: pixelated;
}
.battle img { width: 100%; height: 100%; image-rendering: pixelated; }
.battle .hit { position: relative; }
.battle .hit img + img { position: absolute; inset: 0; }

/* calling plates */
.callings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6em 0.5em; margin: 0.5em 0 0.4em; }
.calling { text-align: center; }
.calling .cameo {
  display: block;
  margin: 0 auto;
  width: 3.6em; height: 3.6em;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fbf3dc, #d9c494);
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--gold);
  overflow: hidden;
}
.calling .cameo img { width: 100%; height: 100%; image-rendering: pixelated; }
.calling .banner {
  display: inline-block;
  margin-top: 0.35em;
  padding: 0 0.7em;
  font: 0.78em var(--f-sc);
  letter-spacing: 0.08em;
  background: #f6ecd4;
  border: 1px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 92% 50%, 100% 100%, 0 100%, 8% 50%);
}

/* bestiary entries, each with its sprite pinned beside it */
.beast { display: flex; gap: 0.6em; align-items: flex-start; margin-bottom: 0.48em; }
.beast .spec {
  flex: none;
  width: 2.6em; height: 2.6em;
  background: #f6ecd4;
  border: 1px solid var(--ink);
  box-shadow: 0.1em 0.15em 0 rgba(60, 35, 10, 0.25);
}
.beast .spec img { width: 100%; height: 100%; image-rendering: pixelated; }
.beast p { margin: 0 !important; text-align: left !important; }
.beast b { font-family: var(--f-sc); letter-spacing: 0.03em; }

/* contents */
.toc { list-style: none !important; padding: 0 !important; margin: 0.6em 0 0; }
.toc li { display: flex; align-items: baseline; gap: 0.35em; margin: 0 0 0.28em !important; }
.toc li::before { content: none !important; }
.toc .n { flex: none; width: 2.3em; color: var(--rubric); font: 0.9em var(--f-sc); }
.toc a { text-decoration: none; }
.toc a:hover { color: var(--rubric); text-decoration: underline; }
.toc .dots { flex: 1; border-bottom: 1px dotted rgba(43, 26, 14, 0.6); transform: translateY(-0.25em); }
.toc .pg { flex: none; min-width: 1.5em; text-align: right; font-variant-numeric: oldstyle-nums; }

/* quick reference card */
.card {
  position: relative;
  margin: 0.6em 0 0.4em;
  padding: 0.9em 0.9em 0.6em;
  background: #f8f0dc;
  border: 1px solid var(--ink);
  outline: 2px dashed rgba(43, 26, 14, 0.55);
  outline-offset: 0.45em;
}
.card .scissors { position: absolute; top: -1.25em; left: 1em; background: var(--paper); padding: 0 0.3em; font-size: 0.95em; color: var(--ink-soft); }
.card .orn-img { display: block; width: 92%; margin: 0 auto 0.3em; }
.card table.t { font-size: 0.8em; }
.card table.t td { border-bottom: 1px dotted rgba(43, 26, 14, 0.3); white-space: nowrap; }
.card p { font-size: 0.86em; margin-bottom: 0.3em !important; text-align: left !important; }

/* cover and back cover: leather and gold */
.page.cover {
  padding: 0;
  color: var(--cover-text);
  background: var(--cover-bg);
}
.cover-in {
  position: absolute;
  inset: 4.5cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6cqw 6cqw 5cqw;
  border: 0.6cqw solid var(--cover-line);
  outline: 0.25cqw solid var(--cover-line);
  outline-offset: -2.2cqw;
  box-shadow: inset 0 0 0 0.25cqw rgba(0, 0, 0, 0.5);
}
.corner { position: absolute; font-size: 5cqw; line-height: 1; color: var(--cover-line); text-shadow: 0 1px 0 #000; }
.corner.tl { top: 0.6cqw; left: 1cqw; } .corner.tr { top: 0.6cqw; right: 1cqw; }
.corner.bl { bottom: 0.6cqw; left: 1cqw; } .corner.br { bottom: 0.6cqw; right: 1cqw; }
.gilt {
  background: var(--gilt);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0.25cqw 0 rgba(0, 0, 0, 0.7));
}
.cover-kicker { font: 3cqw var(--f-sc); letter-spacing: 0.3em; color: var(--cover-soft); }
.cover-title { margin: 2cqw 0 0; font: 900 13cqw/1 var(--f-deco); letter-spacing: 0.02em; }
.cover-sub { margin-top: 1.2cqw; font: italic 4.2cqw var(--f-body); color: var(--cover-text); }
.cover-art {
  margin: 4.5cqw 0 0;
  width: 100%;
  padding: 1cqw;
  background: var(--cover-line);
  box-shadow: 0 1cqw 2.5cqw rgba(0, 0, 0, 0.6);
}
.cover-art img { display: block; width: 100%; }
.cover-foot { margin-top: auto; font: 700 4cqw var(--f-head); letter-spacing: 0.24em; }
.cover-foot span { display: block; margin-top: 0.8cqw; font: italic 2.8cqw var(--f-body); letter-spacing: 0.06em; color: var(--cover-soft); }
.ribbon {
  position: absolute;
  top: 7cqw; right: -7.5cqw;
  transform: rotate(40deg);
  width: 36cqw;
  padding: 0.6cqw 0;
  background: var(--ribbon);
  color: #f6e2b0;
  font: 600 2cqw var(--f-head);
  letter-spacing: 0.1em;
  text-align: center;
  box-shadow: 0 0.4cqw 1cqw rgba(0, 0, 0, 0.6);
  border-top: 1px solid #e8b84a;
  border-bottom: 1px solid #e8b84a;
}
.cover-mask { position: absolute; inset: 0; overflow: hidden; }
.back-art { width: 70%; margin: 4cqw auto 0; border: 0.6cqw solid var(--cover-line); box-shadow: 0 1cqw 2.5cqw rgba(0, 0, 0, 0.6); }
.back-art img { display: block; width: 100%; }
.page p.back-text { text-align: center; margin-top: 5cqw; font: italic 3.6cqw/1.35 var(--f-body); color: var(--cover-text); padding: 0 4cqw; }
.back-mark { margin-top: auto; font: 600 2.6cqw var(--f-head); letter-spacing: 0.14em; color: var(--cover-soft); }
.back-mark small { display: block; margin-top: 1cqw; font: italic 2.3cqw var(--f-body); letter-spacing: 0.02em; color: var(--cover-soft); }

/* endpaper: marbled paper and a bookplate */
.page.endpaper {
  background: var(--endpaper);
  align-items: center;
  justify-content: center;
}
.bookplate {
  width: 72%;
  padding: 4cqw 4cqw 3.5cqw;
  background: #f3e7c8;
  border: 0.4cqw solid var(--ink);
  outline: 0.2cqw solid var(--ink);
  outline-offset: -1.4cqw;
  text-align: center;
  box-shadow: 0 1cqw 2cqw rgba(0, 0, 0, 0.5);
}
.bookplate .ex { font: 700 5cqw var(--f-deco); color: var(--rubric); }
.bookplate .lamp { font-size: 9cqw; line-height: 1.1; color: var(--ink); }
.bookplate .who { font: 3.2cqw var(--f-sc); letter-spacing: 0.12em; }
.bookplate .line { margin-top: 4cqw; text-align: left; font: italic 2.6cqw var(--f-body); border-bottom: 1px solid var(--ink); padding-bottom: 0.4cqw; }
.bookplate .stamp { margin-top: 3cqw; font-size: 2.6cqw; }

/* title page */
.titlepage { text-align: center; justify-content: center; }
.titlepage .tp-title { font: 900 3.6em/1 var(--f-deco); color: var(--ink); margin-top: 1.5em; }
.titlepage .tp-sub { font: italic 1.4em var(--f-body); color: var(--rubric); margin-top: 0.4em; }
.titlepage .tp-being { margin: 2.4em 2em 0; font-style: italic; font-size: 1.1em; line-height: 1.5; text-align: center !important; }
.titlepage .tp-lamp { margin-top: 1.6em; font-size: 3em; color: var(--ink-soft); }
.titlepage .tp-imprint { margin-top: auto; font: 0.95em var(--f-sc); letter-spacing: 0.14em; color: var(--ink-soft); }

/* notes page */
.lines { flex: 1; margin-top: 0.8em; background: repeating-linear-gradient(to bottom, transparent 0 1.75em, rgba(47, 95, 94, 0.35) 1.75em calc(1.75em + 1px)); }
.blank-page { background: var(--paper); }

.closing { margin-top: 1.4em; text-align: center !important; font-style: italic; font-size: 1.08em; }
.credit { text-align: center !important; font-size: 0.9em; color: var(--ink-soft); }

/* source list: hidden until the script has bound the pages into the book */
#pages, #flow { display: none; }
noscript p { color: var(--ui-text); text-align: center; padding: 20px; }

/* ---------- auto-flowed manuals (book.js paginates them) ---------- */
.measure { position: absolute; left: -10000px; top: 0; width: 440px; height: 608px; visibility: hidden; } /* a 440x629 page less 3% for font rounding at other sizes */
.measure .face { position: relative; width: 100%; height: 100%; }
.lines.notes { flex: none; min-height: 12em; }
.page .afterword { text-align: center; }
.loading { color: var(--ui-dim); font-style: italic; }
figure.plate.flow-short img { max-height: 12.5em; object-fit: contain; }
figure.plate.flow-tiny img { max-height: 8.5em; object-fit: contain; }
figure.plate.flow-short .battle, figure.plate.flow-tiny .battle { max-height: 9em; margin: 0 auto; aspect-ratio: 9 / 5; width: auto; height: 9em; }
.specimens { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2em, 1fr)); gap: 0.6em 0.4em; padding: 0.6em 0.4em 0.2em; }
.specimens .sp { text-align: center; font-size: 0.78em; line-height: 1.15; font-style: italic; }
.specimens .sp img { display: block; width: 3.4em; height: 3.4em; margin: 0 auto 0.2em; image-rendering: pixelated; }
.page p.closing-line { text-align: center; font-style: italic; }

/* generated manuals: corner ornaments, official documents, plates without frames */
:root { --corner: "\2766"; --f-doc: var(--f-body); }
.corner:empty::before { content: var(--corner); }
.page .document {
  margin: 0.6em 0.1em 0.9em;
  padding: 0.7em 0.9em 0.3em;
  font-family: var(--f-doc);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid var(--ink);
  box-shadow: 0.2em 0.25em 0 rgba(60, 35, 10, 0.18);
}
.page .document p { text-align: left; margin-bottom: 0.5em; }
figure.plate.plain .callings { margin-top: 0.2em; }
.beast .spec.blank { visibility: hidden; }
.page h3.notes-head { text-align: center; border: 0; margin-top: 1.4em; }
.page .afterword p { text-align: center; }
.page .afterword .closing-line { font-size: 1.08em; margin: 1.2em 0; }
.cover-title { overflow-wrap: anywhere; }
