:root {
  color-scheme: dark;
  --background: #100d0e;
  --surface: #191415;
  --ink: #eee1ce;
  --muted: #c3b2a4;
  --ember: #e18166;
  --line: #48302d;
  --display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--body);
  line-height: 1.6;
  background: var(--background);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid #ffa789; outline-offset: 5px; }
::selection { color: #fff2e3; background: #77362e; }

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; }
h2 { font-size: clamp(2.7rem, 5vw, 4.5rem); line-height: 1.07; letter-spacing: -.035em; }
.eyebrow {
  display: block;
  color: var(--ember);
  font-size: .8125rem;
  font-weight: 650;
  letter-spacing: .2em;
  line-height: 1.45;
  text-transform: uppercase;
}
.container { width: min(72rem, calc(100% - 5rem)); margin-inline: auto; }
.section { scroll-margin-top: 2rem; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: .75rem;
  left: .75rem;
  padding: .65rem 1rem;
  color: #1b1110;
  background: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid #3c2a28;
  background: #130e0e;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(81rem, calc(100% - 5rem));
  min-height: 4.5rem;
  margin-inline: auto;
}
.header-identity {
  display: flex;
  align-items: center;
  gap: clamp(.8rem, 2vw, 1.35rem);
}
.soul-counter {
  display: grid;
  gap: .16rem;
  border-inline-start: 1px solid var(--line);
  padding-inline-start: clamp(.8rem, 2vw, 1.35rem);
  line-height: 1.15;
  white-space: nowrap;
}
.soul-counter-label {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.soul-counter-value {
  color: #f4a78d;
  font: 600 1rem/1.15 ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  width: fit-content;
  color: var(--ink);
  font: 400 1.25rem/1 var(--display);
  letter-spacing: .16em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-nav { display: flex; align-items: center; gap: clamp(.65rem, 1.4vw, 1.5rem); }
.site-nav a, .menu-toggle {
  color: #ddcfc2;
  font-size: .875rem;
  font-weight: 550;
  text-decoration: none;
}
.site-nav a:hover, .footer-top:hover { color: var(--ember); }
.site-nav a { white-space: nowrap; }
.site-nav .nav-feature { border: 1px solid #6e3b30; padding: .48rem 1.05rem; color: #f3b29c; }
.site-nav .nav-feature:hover { background: #2a1916; }
.menu-toggle { display: none; }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: clamp(34rem, 50vw, 46rem);
  overflow: hidden;
  padding: 5.4rem 1.5rem 7rem;
  text-align: center;
  background: #211414;
}
.hero::before, .hero::after, .hero-embers { position: absolute; inset: 0; pointer-events: none; }
.hero::before {
  z-index: -2;
  content: "";
  background: url("assets/gate.webp") center 58% / cover no-repeat;
}
.hero::after {
  z-index: -1;
  content: "";
  background:
    linear-gradient(0deg, var(--background) 0%, transparent 28%, transparent 79%, rgba(10, 6, 6, .2)),
    radial-gradient(ellipse at 50% 43%, rgba(12, 7, 7, .15) 15%, transparent 67%);
}
.hero-content { position: relative; }
.hero-kicker { color: #f3b49d; text-shadow: 0 1px 8px #140807; }
.hero h1 {
  margin: .55rem -.1em 0 0;
  color: #f5e4ce;
  font-size: clamp(3.4rem, 11vw, 9.1rem);
  line-height: 1.01;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-shadow: 0 3px 36px #140606, 0 2px 4px #170907;
}
.title-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin: .95rem auto 1.1rem;
}
.title-rule::before, .title-rule::after {
  content: "";
  width: clamp(2.5rem, 8vw, 6.25rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, #db775c);
}
.title-rule::after { transform: rotate(180deg); }
.title-rule span { width: .45rem; height: .45rem; border: 1px solid #df8066; transform: rotate(45deg); }
.hero-quote {
  color: #f2ddc7;
  font: italic 400 clamp(1.25rem, 3vw, 2rem)/1.3 Georgia, serif;
  text-shadow: 0 2px 12px #190807, 0 1px 4px #190807;
}
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 2.35rem; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  border: 1px solid transparent;
  padding: .65rem 1.2rem;
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .035em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.button-primary { color: #fff1e4; background: #973d2d; border-color: #d57356; }
.button-primary:hover { background: #ad4832; }
.button-ghost { color: #f2ddd0; background: #170f10ed; border-color: #8f5d50; }
.button-ghost:hover { border-color: #e18a71; background: #2e1c19; }
.button:disabled { opacity: .5; cursor: default; }
.button:disabled:hover { background: #170f10ed; border-color: #8f5d50; }

.music-toggle {
  position: fixed;
  z-index: 3;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  gap: .5rem;
  min-width: 8.25rem;
  padding-inline: .8rem;
  background: #170f10f5;
  box-shadow: 0 .35rem 1.3rem #0008;
}
.music-toggle.is-playing { border-color: var(--ember); }
.music-icon { color: var(--ember); font-size: 1.12rem; line-height: 1; }

.hero-embers { z-index: -1; overflow: hidden; }
.hero-embers i {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #f3a279;
  box-shadow: 0 0 10px 2px #c4402f;
  opacity: .63;
  transform: rotate(30deg);
}
.hero-embers i:nth-child(1) { left: 14%; top: 69%; }
.hero-embers i:nth-child(2) { left: 18%; top: 78%; width: 2px; height: 2px; }
.hero-embers i:nth-child(3) { left: 25%; top: 57%; }
.hero-embers i:nth-child(4) { left: 29%; top: 76%; width: 2px; height: 2px; }
.hero-embers i:nth-child(5) { left: 35%; top: 83%; width: 2px; height: 2px; }
.hero-embers i:nth-child(6) { left: 60%; top: 74%; }
.hero-embers i:nth-child(7) { left: 72%; top: 66%; width: 2px; height: 2px; }
.hero-embers i:nth-child(8) { left: 81%; top: 72%; }
.hero-embers i:nth-child(9) { left: 87%; top: 57%; width: 2px; height: 2px; }

.demons-section {
  padding: 3.35rem 0 clamp(4.4rem, 9vw, 8rem);
  background: radial-gradient(ellipse at 50% 30%, #241513 0%, var(--background) 66%);
}
.section-heading { margin-bottom: 2.35rem; text-align: center; }
.section-heading h2 { margin: .6rem 0 .85rem; }
.section-heading p { color: var(--muted); font-size: 1rem; }
.demon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.45rem; }
.demon-card {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(22rem, 34vw, 30.5rem);
  overflow: hidden;
  border: 1px solid #664139;
  background: #291b1a;
}
.demon-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(0deg, #130d0e 0%, #160e0fee 11%, #140f1082 41%, transparent 67%),
    linear-gradient(90deg, #1a1012b0, transparent 62%);
  pointer-events: none;
}
.demon-card:hover { border-color: #ac705d; }
.demon-art { position: absolute; z-index: -2; inset: 0; overflow: hidden; }
.demon-art img { position: absolute; width: auto; height: auto; max-width: none; }
.xisu-card .demon-art {
  background: radial-gradient(ellipse at 61% 42%, #864436 0%, #402728 42%, #251719 75%);
}
.xisu-card img {
  width: 82%;
  top: 2%;
  left: 15%;
  filter: brightness(1.55) sepia(.16) drop-shadow(0 0 1.35rem #a65d4660);
}
.nyxil-card .demon-art { background: #a37e6e; }
.nyxil-card img {
  width: 100%;
  top: 0;
  left: 0;
  filter: sepia(.24) saturate(.7) brightness(.83);
  mix-blend-mode: multiply;
}
.card-content { padding: 1.7rem clamp(1.2rem, 3vw, 2rem) 1.85rem; }
.card-content h3 { margin-top: .2rem; font-size: clamp(2.6rem, 5vw, 4.25rem); line-height: 1; }
.card-content p { margin-top: .4rem; color: #d6bdad; font-family: Georgia, serif; font-size: 1.03rem; font-style: italic; }
.card-content .domain { color: #f1987e; }
.profile-link { display: inline-block; margin-top: .95rem; color: #f0aa93; font-size: .875rem; font-weight: 620; text-underline-offset: .25em; }
.profile-link:hover { color: #ffdfcd; }
.xisu-card-links { display: flex; flex-wrap: wrap; column-gap: 1rem; }
.xisu-trigger {
  border: 0;
  padding: 0;
  background: none;
  text-align: start;
  text-decoration: underline;
  cursor: pointer;
}
.hero-conversation.xisu-trigger { margin-top: .95rem; }

.xisu-encounter {
  position: fixed;
  z-index: 4;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: clamp(5.6rem, 22vw, 8.3rem) minmax(0, 1fr);
  width: min(27rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  border: 1px solid #925344;
  background: #1e1416;
  box-shadow: 0 .75rem 2.5rem #000a;
}
.xisu-encounter:not([data-scene="opening"]) {
  grid-template-columns: clamp(5.35rem, 22vw, 10.25rem) minmax(0, 1fr);
  width: min(36rem, calc(100% - 2rem));
}
.xisu-encounter-art {
  position: relative;
  overflow: hidden;
  border-right: 1px solid #4f2e29;
  background: radial-gradient(ellipse at 48% 53%, #753b31, #2c191b 75%);
}
.xisu-encounter-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 57% top;
  filter: brightness(1.16);
}
.xisu-encounter:not([data-scene="opening"]) .xisu-encounter-art img {
  top: auto;
  height: min(100%, 17rem);
}
.xisu-encounter-content { position: relative; padding: 1rem 1.15rem 1.15rem; }
.xisu-encounter-name { padding-right: 2rem; font: 1.65rem/1.15 var(--display); }
.xisu-encounter-line {
  margin: .55rem 0 .9rem;
  color: #f2ddcd;
  font: 1.13rem/1.4 Georgia, serif;
}
.xisu-choices { display: grid; gap: .5rem; }
.xisu-choices .button {
  justify-content: flex-start;
  min-height: 2.75rem;
  padding-inline: .67rem;
  line-height: 1.35;
  text-align: start;
}
.xisu-encounter[data-scene="opening"] .xisu-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.xisu-encounter[data-scene="opening"] .xisu-choices .button { justify-content: center; }
.xisu-return {
  min-height: 2.75rem;
  margin-top: .45rem;
  border: 0;
  padding: .35rem 0;
  background: none;
  color: #f0aa93;
  font-size: .875rem;
  font-weight: 620;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: .25em;
  cursor: pointer;
}
.xisu-return:hover { color: #ffdfcd; }
.xisu-dismiss {
  position: absolute;
  top: .25rem;
  right: .25rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: transparent;
  color: #ecd5ca;
  font-size: 1.4rem;
  cursor: pointer;
}
.xisu-dismiss:hover { color: #fff2e9; background: #352020; }

@media (max-width: 760px) {
  .xisu-encounter {
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 3.5rem);
    max-height: calc(100dvh - 5.5rem - env(safe-area-inset-bottom));
  }
  .xisu-encounter-content { padding: .85rem .88rem 1rem; }
  .xisu-encounter:not([data-scene="opening"]) .xisu-encounter-art img { height: min(100%, 12rem); }
}

.profile-source:target { outline: 1px solid var(--ember); }
.profile-source { margin-top: 1.5rem; border: 1px solid var(--line); padding: clamp(1.1rem, 4vw, 2.3rem); background: var(--surface); }
.profile-source h3 { font-size: 2.7rem; line-height: 1; margin-bottom: .6rem; }
.profile-source > p + p { margin-top: .8rem; }
.profile-source > .eyebrow { margin-bottom: 1.25rem; }
.profile-dialog {
  position: fixed;
  width: min(36rem, calc(100% - 2rem));
  max-height: 88svh;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #805144;
  box-shadow: 0 1.2rem 5rem #000a;
}
.profile-dialog::backdrop { background: #080606d9; }
.profile-dialog .profile-source { margin: 0; border: 0; }
.dialog-close {
  position: absolute;
  top: .8rem;
  right: .8rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  background: #211616;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { border-color: var(--ember); }
.media { margin-top: 1.3rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.media summary { width: fit-content; color: #efaa94; cursor: pointer; }
.media img, .media video { display: block; width: 100%; height: auto; margin-top: .85rem; background: #000; }
.media video { max-height: 23rem; }

.world-section {
  padding: clamp(3.75rem, 8vw, 7.3rem) 0;
  border-block: 1px solid var(--line);
  background: radial-gradient(ellipse at 18% 20%, #29201e, #181213 68%);
}
.world-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(1.4rem, 5vw, 4.5rem);
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}
.world-heading h2 { max-width: 15ch; }
.world-heading p { max-width: 30rem; color: var(--muted); line-height: 1.75; }

.descent { margin-bottom: clamp(2.5rem, 6vw, 5rem); scroll-margin-top: 1.5rem; }
.descent-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-bottom: 1rem;
}
.descent-header h3 { font-size: clamp(2.25rem, 4vw, 3.4rem); line-height: 1.1; }
.descent-header a, .descent-back-to-map { color: var(--muted); font-size: .875rem; text-underline-offset: .25em; }
.descent-header a:hover, .descent-back-to-map:hover { color: var(--ink); }
.descent-atlas { margin-top: .8rem; border: 1px solid #655346; }
.descent-atlas > summary {
  min-height: 2.75rem;
  padding: .55rem 1rem;
  color: var(--ink);
  background: #201916;
  cursor: pointer;
  scroll-margin-top: 1.5rem;
}
.descent-map {
  padding: clamp(1.15rem, 3vw, 1.85rem) clamp(.65rem, 3vw, 1.85rem) 1.65rem;
  background:
    radial-gradient(ellipse at 50% 10%, #41362d99, transparent 68%),
    repeating-linear-gradient(125deg, #d9c3a20a 0 1px, transparent 1px 5px),
    #181513;
  text-align: center;
}
.descent-stops {
  position: relative;
  isolation: isolate;
  max-width: 33rem;
  margin: 0 auto;
  padding: .4rem .3rem 1.3rem;
  list-style: none;
}
.descent-stops::before {
  position: absolute;
  z-index: -1;
  inset: .1rem -.28rem 0;
  background:
    repeating-linear-gradient(153deg, transparent 0 4px, #dbc29b28 4px 5px, transparent 5px 8px),
    linear-gradient(90deg, #74604b, #3e3429 23%, #312820 50%, #42372b 77%, #74604b);
  clip-path: polygon(0 0, 100% 0, 96% 9%, 94% 20%, 88% 34%, 84% 51%, 80% 67%, 76% 83%, 72% 95%, 50% 100%, 28% 95%, 23% 81%, 20% 67%, 15% 51%, 11% 34%, 7% 20%, 4% 9%);
  content: "";
}
.descent-stops li {
  width: calc(100% - var(--taper));
  margin-inline: auto;
}
.descent-stop {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 2ch auto;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: .35rem .4rem .5rem;
  border: 0;
  color: #eddec7;
  background: transparent;
  font: 1.125rem/1.15 var(--display);
  text-align: left;
  cursor: pointer;
}
.descent-stop::before, .descent-stop::after {
  position: absolute;
  z-index: -1;
  inset: 0 .65rem .12rem;
  clip-path: polygon(0 0, 100% 0, 96% 75%, 73% 91%, 50% 100%, 27% 91%, 4% 75%);
  content: "";
}
.descent-stop::before { background: #806c55; }
.descent-stop::after {
  inset: 1px calc(.65rem + 1px) .24rem;
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, #dcc49f0d 5px 6px),
    linear-gradient(90deg, #312820, #27211d 26%, #29231f 74%, #302820);
}
.descent-stop:hover::after { background: #493a2e; }
.descent-stop[aria-current="step"] { color: #fff0d8; font-weight: 700; }
.descent-stop[aria-current="step"]::before { background: #d5ae7b; }
.descent-stop[aria-current="step"]::after { background: linear-gradient(90deg, #52382a, #604230, #52382a); }
.descent-stop:focus-visible { z-index: 1; outline-offset: -2px; }
.descent-numeral { color: #d0b898; font-size: .8125rem; text-align: right; }
.descent-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(19rem, 43%) minmax(0, 1fr);
  align-items: center;
  aspect-ratio: 3 / 2;
  padding: clamp(1.3rem, 3.4vw, 2.9rem);
  border: 1px solid #6a6056;
  background: #151311;
}
.descent-chart {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, #0d0c0b65, transparent 52%),
    url("assets/descent-woodcut.webp") center / cover;
}
.descent-map-tag {
  position: absolute;
  inset-block-start: clamp(1.75rem, var(--map-depth), calc(100% - 1.75rem));
  inset-inline-end: clamp(.7rem, 2.4vw, 2.2rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .55rem;
  max-width: 12rem;
  padding: .45rem .72rem;
  transform: translateY(-50%);
  border: 1px solid #a59a8b;
  background: #100e0df2;
  color: #f5ebd9;
  box-shadow: 0 .2rem .75rem #0008;
}
.descent-map-tag::before {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 100%;
  width: clamp(1.25rem, 6vw, 5.5rem);
  height: 1px;
  background: #e1d5c1;
  content: "";
}
.descent-map-tag::after {
  position: absolute;
  inset-block-start: calc(50% - 2px);
  inset-inline-end: calc(100% + clamp(1.25rem, 6vw, 5.5rem));
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f5ebd9;
  content: "";
}
.descent-map-numeral { color: #c8bba7; font: .875rem/1.15 var(--display); }
.descent-map-name { font: 1.35rem/1.15 var(--display); }
.descent-map-landmark { flex-basis: 100%; color: #d7cdbd; font-size: .875rem; }
.descent-panel {
  min-width: 0;
  padding: clamp(1.05rem, 3vw, 2rem);
  border: 1px solid #827164;
  background: #171311f5;
  box-shadow: 0 .85rem 2.3rem #0008;
}
.descent-depth { color: #d9b78f; }
.descent-stage h4 {
  margin: .48rem 0 .9rem;
  color: var(--ink);
  font: clamp(2rem, 4vw, 3.1rem)/1.06 var(--display);
  scroll-margin-top: 1.5rem;
}
.descent-passage { color: #eadbc8; font: 1.14rem/1.65 Georgia, serif; }
.descent-landmark { margin-top: 1rem; padding: .65rem .8rem; border-inline-start: 2px solid #a79378; background: #cbb39b0d; }
.descent-landmark h5 { margin: 0 0 .18rem; color: #f0d8ba; font: 1.12rem/1.3 var(--display); }
.descent-landmark h5 a { text-underline-offset: .22em; }
.descent-landmark p { color: var(--muted); }
.descent-observation { margin-top: 1.15rem; border-block: 1px solid #594638; padding-block: .75rem; }
.descent-observation summary { color: #e9c4a2; cursor: pointer; }
.descent-observation summary:hover { color: #fff0db; }
.descent-observation p { margin: .62rem 0 0; color: var(--muted); }
.descent-ruler { margin-top: 1.05rem; color: var(--muted); font-size: .9rem; }
.descent-lore { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; }
.descent-lore .profile-link, .descent-judgment { margin-top: .6rem; }
.descent-controls { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.descent-back-to-map { display: inline-block; margin-top: .9rem; }
#layer-archive { scroll-margin-top: 1.5rem; }
.river-record {
  margin-top: 1.25rem;
  padding: clamp(1.15rem, 2.3vw, 1.7rem);
  border: 1px solid var(--line);
  background: #201819;
  scroll-margin-top: 1.5rem;
}
.river-record h3 { margin-bottom: .45rem; font-size: 1.75rem; }
.river-record p { max-width: 50rem; color: var(--muted); }

.layer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.layer {
  display: flex;
  flex-direction: column;
  padding: clamp(1.15rem, 2.3vw, 1.7rem);
  border: 1px solid #583c37;
  border-top-color: #9a5949;
  background: linear-gradient(150deg, #271a1a, #1a1415 72%);
}
.layer h3 { color: var(--ink); font-size: clamp(2rem, 3vw, 2.65rem); line-height: 1.1; }
.layer > p { margin: .8rem 0 1.15rem; color: var(--muted); font-size: 1rem; }
.layer-ranks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin: auto 0 0;
  padding-top: .85rem;
  border-top: 1px solid #583c37;
}
.layer-ranks dt { color: #e58f78; font-size: .875rem; font-weight: 600; }
.layer-ranks dd { margin: .1rem 0 0; font-family: var(--display); font-size: 1.1rem; }
.roster-heading {
  margin-top: clamp(2rem, 5vw, 3.6rem);
  margin-bottom: 1rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}
.demon-roster {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.roster-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: .25rem;
  border: 1px solid var(--line);
  padding: .9rem 1rem;
  background: #201617;
  text-decoration: none;
}
.roster-link:hover { border-color: var(--ember); background: #2a1b1a; }
.roster-domain {
  color: var(--ember);
  font-size: .8125rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.roster-name { font: 1.45rem/1.2 var(--display); }
.roster-title { color: var(--muted); font-size: .875rem; line-height: 1.4; }

.layer > .profile-link { align-self: flex-start; }
.profile-source h4 {
  margin: 1.15rem 0 .28rem;
  color: var(--ink);
  font: 1.2rem/1.25 var(--display);
}
.profile-source .profile-epithet {
  margin-top: -.6rem;
  color: #e99d85;
  font: italic 1.13rem/1.4 Georgia, serif;
}
.general-roster, .rank-list { display: grid; gap: .7rem; margin: .75rem 0 0; }
.general-roster > div, .rank-list > div { padding-top: .65rem; border-top: 1px solid var(--line); }
.general-roster dt, .rank-list dt { color: #f0a28a; font-weight: 650; }
.general-roster dd, .rank-list dd { margin: .12rem 0 0; color: var(--muted); }

.court-section {
  padding: clamp(4rem, 8vw, 7.5rem) 0;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 83% 14%, #2b1a19, #140e0f 56%);
}
.court-intro { max-width: 44rem; }
.court-intro p, .court-subheading p {
  margin-top: 1rem;
  color: var(--muted);
  line-height: 1.75;
}
.court-shortcuts { display: flex; flex-wrap: wrap; gap: .45rem 1.3rem; margin-top: 1.15rem; }
.court-shortcuts a { color: #f0aa93; text-underline-offset: .25em; }
.court-shortcuts a:hover { color: #ffdfcd; }
.court-grid, .pact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.45rem, 5vw, 4.5rem);
  align-items: start;
  margin-top: clamp(1.75rem, 4vw, 3.4rem);
}
.court-copy h3, .court-hierarchy h3 { font-size: clamp(1.55rem, 3vw, 2.15rem); }
.court-copy p { margin-top: .8rem; color: var(--muted); line-height: 1.7; }
.court-hierarchy, .pact-example {
  padding: clamp(1.1rem, 3vw, 1.7rem);
  border: 1px solid #65423c;
  background: #211718;
}
.court-subsection {
  margin-top: clamp(2.8rem, 7vw, 6rem);
  padding-top: clamp(1.85rem, 4vw, 3.8rem);
  border-top: 1px solid var(--line);
}
.court-subheading { max-width: 46rem; }
.court-subheading h3 { font-size: clamp(2rem, 4.3vw, 3.2rem); line-height: 1.1; }
.judge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1.65rem;
}
.judge {
  padding: clamp(1.08rem, 3vw, 1.6rem);
  border: 1px solid var(--line);
  border-top-color: #985948;
  background: #1d1415;
}
.judge h4, .pact-grid h4 { margin: 0; color: var(--ink); font: 1.5rem/1.25 var(--display); }
.judge p { margin-top: .63rem; color: var(--muted); }
.pact-grid { margin-top: 1.6rem; }

.pact-trial {
  padding-block: clamp(3.75rem, 8vw, 6.75rem);
  border-top: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 8%, #35201d, #171112 65%);
}
.pact-trial-inner { max-width: 58rem; }
.pact-trial-heading { margin-bottom: 1.4rem; }
.pact-trial-heading p { margin-top: .7rem; color: var(--muted); }
.pact-play {
  padding: clamp(1.05rem, 4vw, 2.6rem);
  border: 1px solid #755046;
  background: #211718;
  box-shadow: 0 .85rem 2.5rem #0d070780;
}
.pact-play h3 { font-size: clamp(1.85rem, 4vw, 2.85rem); line-height: 1.1; }
.pact-play h3:focus, .pact-ending h4:focus { outline: none; }
.pact-needs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
  margin-top: 1.1rem;
}
.pact-need {
  justify-content: flex-start;
  min-height: 3.65rem;
  padding-inline: .75rem;
  border-color: #62433b;
  text-align: start;
  letter-spacing: 0;
}
.pact-offer { max-width: 45rem; margin-inline: auto; }
.pact-speaker { margin-bottom: .5rem; }
.pact-requested { margin-top: .55rem; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.pact-approach { margin-top: 1.1rem; color: var(--ink); font: 1.13rem/1.6 var(--display); }
.pact-contract {
  display: grid;
  gap: .8rem;
  margin: 1.15rem 0 0;
  padding: clamp(.9rem, 3vw, 1.45rem);
  border: 1px solid #745044;
  background: #302220;
}
.pact-contract dt { color: #ecad96; font-size: .875rem; font-weight: 650; }
.pact-contract dd { margin: .24rem 0 0; }
.pact-clause { font-family: var(--display); font-style: italic; }
.pact-decision, .pact-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: 1.1rem; }
.pact-ending { margin-top: 1.1rem; padding: .85rem 1rem; border-inline-start: 2px solid var(--ember); background: #281a19; }
.pact-ending h4 { margin: 0 0 .35rem; font: 1.4rem/1.2 var(--display); }
.pact-ending p { color: var(--ink); }
.pact-text-button {
  min-height: 2.75rem;
  padding: .15rem 0;
  border: 0;
  color: #f1ad98;
  background: transparent;
  font-size: .875rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.pact-text-button:hover { color: var(--ink); }

.horsemen-section {
  padding-block: clamp(3.5rem, 8vw, 6.25rem);
  border-block: 1px solid var(--line);
  background: #161112;
}
.horsemen-intro { max-width: 42rem; margin-top: .9rem; color: var(--muted); }
.horsemen-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1.65rem;
}
.rider {
  padding: clamp(1.08rem, 3vw, 1.6rem);
  border: 1px solid var(--line);
  background: #1d1415;
}
.rider-war { border-top-color: #ba6351; }
.rider-famine { border-top-color: #ac8958; }
.rider-pestilence { border-top-color: #8d976e; }
.rider-death { border-top-color: #aaa4a4; }
.rider h3 { font-size: 1.65rem; line-height: 1.25; }
.rider p { margin-top: .63rem; color: var(--muted); }

.prologue-section {
  padding: clamp(4.5rem, 9vw, 7.4rem) 1.25rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 18%, #422321b8, transparent 68%),
    linear-gradient(#140d0eeb, #110d0ef7),
    url("assets/gate.webp") center 62% / cover;
}
.reader {
  width: min(100%, 52rem);
  margin-inline: auto;
  border: 1px solid #735044;
  outline: 1px solid #462c28;
  outline-offset: 5px;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: #181113ed;
}
.reader-mark { margin: 0 auto 1.1rem; }
.reader h2 { margin: .7rem 0 1.25rem; font-size: clamp(2.45rem, 6vw, 3.85rem); }
.reader-page { max-width: 37rem; margin-inline: auto; color: #e7d6c3; font: 400 clamp(1.15rem, 2.5vw, 1.43rem)/1.65 Georgia, serif; }
.reader-page + .reader-page { margin-top: 1rem; }
.reader-page p + p { margin-top: .65rem; }
.reader-page.long-passage { text-align: left; }
.enhanced .reader-pages { display: grid; align-content: center; min-height: 10.4rem; }
.enhanced .reader-page { margin-block: 0; }
.reader-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .65rem; max-width: 23rem; margin: 1.65rem auto 0; }
.reader-count { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }

.site-footer { border-top: 1px solid #402d2a; background: #0f0c0c; }
.enhanced .site-footer { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; padding-block: 1.7rem; }
.footer-inner .brand { font-size: 1rem; }
.footer-inner p, .footer-top { color: var(--muted); font-size: .875rem; }
.footer-top { text-underline-offset: .24em; }

@media (max-width: 920px) {
  .demon-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layer-grid, .horsemen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .header-inner { width: calc(100% - 2.25rem); min-height: 4rem; flex-wrap: wrap; gap: .5rem 1rem; padding-block: .65rem; }
  .enhanced .menu-toggle {
    display: block;
    min-height: 2.75rem;
    border: 1px solid #684237;
    padding: .35rem .8rem;
    background: #1e1313;
    cursor: pointer;
  }
  .site-nav { width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 1rem; padding: .4rem 0 .25rem; }
  .enhanced .menu-toggle[aria-expanded="false"] + .site-nav { display: none; }
}

@media (max-width: 800px) {
  .descent-stage { grid-template-columns: minmax(0, 1fr); aspect-ratio: auto; padding: 0; }
  .descent-chart {
    position: relative;
    z-index: auto;
    aspect-ratio: 3 / 2;
    background:
      linear-gradient(0deg, #151311 0%, transparent 20%),
      url("assets/descent-woodcut.webp") center / cover;
  }
  .descent-map-tag { padding: .35rem .48rem; }
  .descent-map-name { font-size: 1.16rem; }
  .descent-panel { margin: 0 .65rem .65rem; }
}

@media (max-width: 720px) {
  .container { width: calc(100% - 2.25rem); }
  .hero { min-height: 34rem; padding: 4rem 1.15rem 5.25rem; }
  .hero::before { background-position: 50% 56%; }
  .hero h1 { font-size: clamp(3.2rem, 10.5vw, 5.6rem); }
  .demons-section { padding-top: 2.25rem; }
  .demon-grid, .world-heading, .court-grid, .pact-grid, .judge-grid { grid-template-columns: minmax(0, 1fr); }
  .demon-card { min-height: clamp(24rem, 78vw, 34rem); }
  .world-heading { gap: .85rem; }
  .footer-inner { flex-wrap: wrap; gap: .55rem 1rem; }
  .footer-inner p { order: 1; width: 100%; }
}

@media (max-width: 540px) {
  .header-inner { column-gap: .5rem; }
  .header-identity { gap: .6rem; }
  .header-identity .brand { gap: .35rem; font-size: .95rem; letter-spacing: .1em; }
  .header-identity .brand img { width: 1.35rem; height: auto; }
  .soul-counter { padding-inline-start: .6rem; }
  .soul-counter-label { font-size: .75rem; letter-spacing: .035em; }
  .soul-counter-value { font-size: .84rem; }
  .demon-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pact-needs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layer-grid, .horsemen-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 355px) {
  .header-inner { width: calc(100% - 1.25rem); }
  .header-identity { gap: .45rem; }
  .header-identity .brand { font-size: .825rem; letter-spacing: .055em; }
  .header-identity .brand img { width: 1.25rem; }
  .soul-counter { padding-inline-start: .45rem; }
  .soul-counter-value { font-size: .75rem; }
  .enhanced .menu-toggle { padding-inline: .45rem; }
  .hero h1 { font-size: 2.8rem; }
  .hero-actions { gap: .55rem; }
  .reader-controls { gap: .35rem; }
  .reader-controls .button { padding-inline: .55rem; }
  .descent-stop { gap: .35rem; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
}

.suggestions-section {
  padding: clamp(3.25rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--line);
  background: radial-gradient(ellipse at 20% 0%, #291d1c, #181213 70%);
}
.suggestions-inner {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 6vw, 5rem);
  align-items: start;
}
.suggestions-inner > div p { max-width: 28rem; margin-top: .85rem; color: var(--muted); }
.suggestions-form {
  display: grid;
  justify-items: start;
  gap: .75rem;
  padding: clamp(1rem, 3vw, 1.65rem);
  border: 1px solid #654640;
  background: #1d1516;
}
.suggestions-form label { color: var(--ink); font-weight: 600; }
.suggestions-form textarea {
  width: 100%;
  min-height: 8rem;
  padding: .65rem .8rem;
  border: 1px solid #80584c;
  border-radius: 0;
  background: #130e0f;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.suggestions-status { color: var(--muted); }
.suggestions-status:empty { position: absolute; }
@media (max-width: 720px) {
  .suggestions-inner { grid-template-columns: minmax(0, 1fr); }
}

.inbox-page {
  max-width: 49rem;
  padding-block: clamp(2.25rem, 7vw, 5rem);
}
.inbox-page h1 {
  margin: .8rem 0 1rem;
  font-size: clamp(2.65rem, 7vw, 4.3rem);
  line-height: 1.04;
}
.inbox-page > p { margin-bottom: 1rem; color: var(--muted); }
.inbox-notes { display: grid; gap: .8rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.inbox-note { padding: 1rem 1.25rem; border: 1px solid var(--line); background: #211718; }
.inbox-note time { color: var(--muted); font-size: .875rem; }
.inbox-note p { margin-top: .55rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.inbox-pagination { display: flex; flex-wrap: wrap; gap: 1rem; }
.inbox-pagination:empty { display: none; }
