/* The Magic Journey — Official Strategy Guide. Offline, no web fonts. */
:root {
  --paper: #f3e7cb;
  --paper-deep: #e8d5ab;
  --ink: #3b2a1a;
  --ink-soft: #6a5038;
  --teal: #2f5d5a;
  --teal-soft: #4f8a86;
  --amber: #b5772b;
  --amber-soft: #e2b86a;
  --rust: #8c3b2a;
  --display: "Cormorant", "Cormorant Garamond", "EB Garamond", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: "EB Garamond", "Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html { background: #5a4632; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  max-width: 900px;
  margin: 28px auto;
  padding: 64px 74px 56px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 250, 235, 0.65), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(176, 132, 70, 0.20), transparent 60%),
    radial-gradient(ellipse at 50% 50%, var(--paper) 55%, var(--paper-deep) 100%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 0 80px rgba(120, 80, 30, 0.22);
  border-radius: 2px;
}

.page::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(106, 80, 56, 0.35);
  pointer-events: none;
}

.folio {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

/* --- headings ------------------------------------------------------------- */

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; color: var(--ink); line-height: 1.15; }

h1.chapter-title {
  text-align: center;
  font-size: 46px;
  margin: 6px 0 4px;
  letter-spacing: 0.04em;
}

.chapter-kicker {
  text-align: center;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 14px;
  color: var(--teal);
  margin-top: 0;
}

.ornament { display: block; margin: 6px auto 14px; width: 320px; max-width: 80%; height: 26px; }
.ornament path, .ornament circle { stroke: var(--amber); fill: none; stroke-width: 1.3; }
.ornament .dot { fill: var(--amber); stroke: none; }

h2 {
  font-size: 30px;
  margin: 34px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(181, 119, 43, 0.6);
}

h2 .area-key { font-size: 15px; font-family: var(--body); font-weight: 400; color: var(--ink-soft); letter-spacing: 0.05em; margin-left: 8px; }

h3 { font-size: 22px; margin: 24px 0 6px; color: var(--teal); }

h4 { font-size: 18px; margin: 16px 0 4px; }

.dropcap::first-letter {
  float: left;
  font-family: var(--display);
  font-size: 3.6em;
  line-height: 0.85;
  padding: 4px 8px 0 0;
  color: var(--rust);
}

.intro { font-style: italic; color: var(--ink-soft); }

p { margin: 0 0 10px; }

a { color: var(--teal); text-decoration: none; border-bottom: 1px dotted rgba(47, 93, 90, 0.5); }
a:hover { color: var(--rust); }

code, .tag { font-family: "Iosevka", "DejaVu Sans Mono", monospace; font-size: 0.82em; color: var(--ink-soft); }

/* --- cover ------------------------------------------------------------------ */

.cover {
  text-align: center;
  padding-top: 40px;
  min-height: 1180px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(226, 184, 106, 0.40), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(47, 93, 90, 0.32), transparent 70%),
    radial-gradient(ellipse at 50% 50%, var(--paper) 50%, var(--paper-deep) 100%);
}

.cover .publisher { font-family: var(--display); letter-spacing: 0.4em; text-transform: uppercase; font-size: 14px; color: var(--ink-soft); }
.cover .official { font-family: var(--display); letter-spacing: 0.32em; text-transform: uppercase; font-size: 18px; color: var(--teal); margin-top: 26px; }
.cover h1 { font-size: 78px; margin: 4px 0 0; letter-spacing: 0.03em; color: var(--ink); font-weight: 500; }
.cover .subtitle { font-family: var(--display); font-size: 30px; font-style: italic; color: var(--rust); margin: 0 0 6px; }
.cover-art { width: 520px; max-width: 100%; margin: 18px auto 10px; display: block; }
.cover .contents-line { font-family: var(--display); font-size: 17px; letter-spacing: 0.12em; color: var(--ink-soft); }
.spoiler-band {
  margin: 30px auto 0;
  max-width: 560px;
  border: 2px solid var(--rust);
  outline: 1px solid var(--rust);
  outline-offset: 3px;
  padding: 10px 18px;
  color: var(--rust);
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.06em;
}
.spoiler-band strong { display: block; letter-spacing: 0.35em; text-transform: uppercase; font-size: 15px; }

/* --- table of contents ------------------------------------------------------- */

ol.toc { list-style: none; padding: 0; margin: 20px 0 0; counter-reset: toc; }
ol.toc > li { display: flex; align-items: baseline; font-family: var(--display); font-size: 21px; margin: 8px 0; }
ol.toc > li .num { color: var(--amber); width: 52px; flex: none; font-weight: 600; }
ol.toc > li a { border: none; color: var(--ink); }
ol.toc > li .dots { flex: 1; border-bottom: 2px dotted rgba(106, 80, 56, 0.45); margin: 0 8px; transform: translateY(-5px); }
ol.toc > li .sub { display: block; font-family: var(--body); font-size: 14px; color: var(--ink-soft); }
ol.toc li .label { flex: none; max-width: 70%; }

/* --- callouts ------------------------------------------------------------------ */

.callout {
  position: relative;
  margin: 16px 0;
  padding: 12px 16px 10px 62px;
  border-radius: 3px;
  break-inside: avoid;
}
.callout .icon { position: absolute; left: 14px; top: 12px; width: 36px; height: 36px; }
.callout .title { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 2px; }
.callout p { margin: 0 0 6px; }
.callout.tip { background: rgba(79, 138, 134, 0.14); border: 1px solid rgba(47, 93, 90, 0.55); border-left: 5px solid var(--teal); }
.callout.tip .title { color: var(--teal); }
.callout.secret { background: rgba(226, 184, 106, 0.22); border: 1px solid rgba(181, 119, 43, 0.6); border-left: 5px solid var(--amber); }
.callout.secret .title { color: #8a5a1c; }
.callout.warn { background: rgba(140, 59, 42, 0.10); border: 1px solid rgba(140, 59, 42, 0.55); border-left: 5px solid var(--rust); }
.callout.warn .title { color: var(--rust); }
.callout.note { background: rgba(106, 80, 56, 0.08); border: 1px solid rgba(106, 80, 56, 0.4); border-left: 5px solid var(--ink-soft); }
.callout.note .title { color: var(--ink-soft); }
.icon .ink { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill { fill: currentColor; }
.callout.tip .icon { color: var(--teal); }
.callout.secret .icon { color: var(--amber); }
.callout.warn .icon { color: var(--rust); }
.callout.note .icon { color: var(--ink-soft); }

/* --- steps ------------------------------------------------------------------------ */

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 10px 0 14px; }
ol.steps > li { position: relative; padding: 2px 0 8px 46px; counter-increment: step; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  color: #f6ecd4;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  text-align: center;
  line-height: 30px;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--teal);
}
ol.steps > li.optional::before { background: var(--amber); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--amber); }
.beat { font-family: var(--display); font-weight: 700; font-size: 18px; }
.beat-meta { display: block; font-size: 13.5px; color: var(--ink-soft); }
.pill { display: inline-block; font-family: var(--display); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 0 7px; border-radius: 9px; border: 1px solid; margin-left: 6px; vertical-align: 2px; }
.pill.optional { color: #8a5a1c; border-color: var(--amber); }
.pill.choice { color: var(--rust); border-color: var(--rust); }
.pill.auto { color: var(--teal); border-color: var(--teal-soft); }

blockquote.line {
  margin: 4px 0 8px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--amber-soft);
  font-style: italic;
  color: var(--ink-soft);
}

/* --- maps --------------------------------------------------------------------------- */

figure.map-figure { margin: 18px 0 8px; break-inside: avoid; }
figure.map-figure figcaption { font-family: var(--display); font-style: italic; text-align: center; color: var(--ink-soft); font-size: 15px; margin-top: 4px; }
svg.map { width: 100%; height: auto; display: block; }
.map-paper { fill: #f1e2bf; stroke: none; }
.map-frame { fill: none; stroke: var(--ink); stroke-width: 2.2; outline: none; }
.g-green { fill: #c9cd9b; stroke: #8b8a55; stroke-width: 0.8; }
.g-earth { fill: #e0c99a; stroke: #a08458; stroke-width: 0.8; }
.g-floor { fill: #d6b484; stroke: #96714a; stroke-width: 0.8; }
.g-paved { fill: #ece0bf; stroke: #a99470; stroke-width: 0.8; }
.g-water { fill: #a9c5bd; stroke: #557f7a; stroke-width: 1.1; }
.g-solid { fill: #8a6a48; fill-opacity: 0.88; stroke: #3b2a1a; stroke-width: 1.3; }
.g-roof { fill: #b9a17c; stroke: #6a5038; stroke-width: 1; }
.spirit-dot { fill: #4f8a86; stroke: #fbf2dc; stroke-width: 1.4; }
.leader { stroke: #3b2a1a; stroke-width: 1; }
.leader-dot { fill: #3b2a1a; }
.dungeon-bars path { stroke-width: 4; stroke-linecap: round; }
.bar-lock { stroke: #8c3b2a; }
.bar-gate { stroke: #2f5d5a; }
.world-nodes circle { fill: #8c3b2a; stroke: #f1e2bf; stroke-width: 2; }
.world-nodes text { font-family: var(--display); font-size: 13px; font-weight: 600; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: #f1e2bf; stroke-width: 3px; }
.world-nodes a:hover circle { fill: var(--teal); }
.trees circle { fill: #5f7448; fill-opacity: 0.35; stroke: #3d4a2b; stroke-opacity: 0.55; stroke-width: 0.7; }
.room-label { font-family: var(--display); font-style: italic; font-size: 15px; fill: #4a2f1c; text-anchor: middle; paint-order: stroke; stroke: #f1e2bf; stroke-width: 3px; }
.room-label.big { font-style: normal; font-weight: 700; font-size: 20px; fill: #8c3b2a; }
.room-label.small { font-size: 12.5px; stroke: none; }
.badge text { font-family: var(--display); font-weight: 700; font-size: 11px; fill: #fbf2dc; text-anchor: middle; }
.badge circle, .badge rect { stroke: #fbf2dc; stroke-width: 1.6; }
.compass-ring { fill: rgba(241, 226, 191, 0.85); stroke: var(--ink); stroke-width: 1; }
.compass-n { fill: var(--rust); stroke: var(--ink); stroke-width: 0.8; }
.compass-s { fill: #f1e2bf; stroke: var(--ink); stroke-width: 0.8; }
.compass-label { font-family: var(--display); font-weight: 700; font-size: 13px; text-anchor: middle; fill: var(--ink); }
.scalebar rect { fill: var(--ink); }
.scalebar rect.alt { fill: #f1e2bf; stroke: var(--ink); stroke-width: 1; }
.scalebar text { font-family: var(--display); font-size: 12px; fill: var(--ink); }

/* --- legend and key tables ---------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; margin: 10px 0 14px; font-size: 15.5px; break-inside: avoid; }
th { font-family: var(--display); text-align: left; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); border-bottom: 1.5px solid var(--ink-soft); padding: 4px 8px; }
td { padding: 4px 8px; border-bottom: 1px solid rgba(106, 80, 56, 0.25); vertical-align: top; }
tr:nth-child(even) td { background: rgba(232, 213, 171, 0.35); }
table.key td.mark { width: 34px; }
.mini-badge { display: inline-block; width: 22px; height: 22px; border-radius: 50%; color: #fbf2dc; font-family: var(--display); font-weight: 700; font-size: 12px; text-align: center; line-height: 22px; }
.mini-badge.diamond { border-radius: 2px; transform: rotate(45deg) scale(0.82); }
.mini-badge.diamond span { display: inline-block; transform: rotate(-45deg); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14.5px; margin: 6px 0 4px; }
.legend span.sw { display: inline-block; width: 18px; height: 12px; vertical-align: -1px; margin-right: 5px; border: 1px solid var(--ink-soft); }

/* --- stat blocks --------------------------------------------------------------------- */

.statblock {
  margin: 14px 0;
  border: 1.5px solid var(--ink-soft);
  border-radius: 3px;
  background: rgba(255, 248, 230, 0.45);
  break-inside: avoid;
}
.statblock header { background: var(--teal); color: #f6ecd4; padding: 5px 12px; font-family: var(--display); font-size: 21px; letter-spacing: 0.04em; display: flex; justify-content: space-between; align-items: baseline; }
.statblock header .where { font-size: 14px; font-style: italic; opacity: 0.9; }
.statblock.boss header { background: var(--rust); }
.statblock.miniboss header { background: #8a5a1c; }
.statblock .body { padding: 8px 14px 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14.5px; margin-bottom: 6px; }
.stats b { font-family: var(--display); color: var(--teal); letter-spacing: 0.06em; }
.hearts { color: var(--rust); letter-spacing: 1px; }

.cast { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.cast .person { border-top: 2px solid var(--amber-soft); padding-top: 6px; break-inside: avoid; }
.cast .person h4 { margin: 0 0 2px; font-size: 21px; }
.cast .person .role { font-style: italic; color: var(--ink-soft); font-size: 14.5px; }

.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
kbd {
  display: inline-block;
  min-width: 24px;
  padding: 0 6px;
  border: 1px solid var(--ink-soft);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fbf2dc;
  font-family: var(--body);
  font-size: 13.5px;
  text-align: center;
  line-height: 20px;
  margin: 1px 2px;
}

.flow { width: 100%; height: auto; }
.flow .node rect { fill: #fbf2dc; stroke: var(--ink-soft); stroke-width: 1.1; }
.flow .node.choice rect { stroke: var(--rust); stroke-width: 1.8; }
.flow .node.optional rect { stroke: var(--amber); stroke-dasharray: 4 3; }
.flow .node text { font-family: var(--display); font-size: 12.5px; fill: var(--ink); text-anchor: middle; }
.flow .edge { stroke: var(--ink-soft); stroke-width: 1.1; fill: none; marker-end: url(#arrow); }
.flow .lane-label { font-family: var(--display); font-size: 14px; letter-spacing: 0.25em; text-transform: uppercase; fill: var(--teal); }

.index-cols { columns: 3; column-gap: 26px; font-size: 14.5px; }
.index-cols .letter { font-family: var(--display); font-size: 22px; color: var(--amber); break-after: avoid; margin-top: 8px; }
.index-cols div.entry { break-inside: avoid; }

.two-col { columns: 2; column-gap: 28px; }

nav.jump {
  position: fixed;
  top: 12px;
  right: 12px;
  background: rgba(59, 42, 26, 0.92);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: var(--display);
  font-size: 14px;
  z-index: 5;
}
nav.jump a { color: #f3e7cb; border: none; }

@media (max-width: 760px) {
  .page { padding: 40px 22px; margin: 0; }
  .cast, .controls-grid { grid-template-columns: 1fr; }
  .index-cols { columns: 2; }
}

/* --- print -------------------------------------------------------------------- */

@page { size: auto; margin: 12mm; }

@media print {
  html { background: none; }
  nav.jump { display: none; }
  .page {
    max-width: none;
    margin: 0;
    padding: 10mm 12mm 14mm;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .page::after { inset: 4mm; }
  .cover { min-height: 0; height: 260mm; }
  a { border: none; color: inherit; }
  h2, h3 { break-after: avoid; }
}
