:root {
  color-scheme: dark;
  --ink: #efe8da;
  --muted: #b8af9d;
  --paper: #171714;
  --panel: #24231f;
  --line: #59513f;
  --accent: #c7d977;
  --fog: #9eb7b5;
  --ship: #b9825a;
  --institution: #d3c5a1;
  --egg: #b7a4ff;
  --witness: #e89090;
  --danger: #d86f4a;
  --journal-font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --hand-font: "Bradley Hand", "Snell Roundhand", "Segoe Print", cursive;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #10100e;
  color: var(--ink);
  font-family: var(--journal-font);
}

button {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  justify-content: center;
}

.kicker,
.episode-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
}

h2 {
  margin-bottom: 22px;
  font-size: clamp(1.7rem, 3vw, 3rem);
}

.episode-jump {
  display: grid;
  grid-template-columns: 42px minmax(72px, auto) 42px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.episode-jump-bottom {
  width: fit-content;
  margin: 24px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(89, 81, 63, 0.78);
  border-radius: 999px;
  background: rgba(31, 30, 26, 0.82);
}

.icon-button,
.controls button {
  border: 1px solid var(--line);
  background: #1f1e1a;
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
}

.controls button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.stage {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.25fr);
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}

.stage.full-page {
  position: relative;
  display: block;
  min-height: calc(100vh - 150px);
}

.panel,
.reader {
  min-height: 620px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel {
  --scroll-reveal: 0;
  --foreground-opacity: 0;
  --foreground-blur: 10px;
  --plate-x: 50%;
  --plate-y: 36%;
  --plate-shift-x: 0px;
  --plate-shift: 18px;
  --plate-saturation: 0.85;
  --plate-contrast: 0.95;
  --plate-brightness: 0.82;
  --plate-blur: 0.35px;
  --scroll-pan: 0;
  --art-aspect-ratio: auto;
  --map-zoom: 1;
  --map-pan-x: 0px;
  --map-pan-y: 0px;
  position: sticky;
  top: 22px;
  align-self: start;
  height: clamp(220px, 28vw, 340px);
  min-height: 220px;
  overflow: hidden;
  border-radius: 8px;
  isolation: isolate;
  background: #171714;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--focus-x, 52%) var(--focus-y, 45%), transparent 0 15%, rgba(20, 20, 16, 0.18) 28%, rgba(20, 20, 16, 0.38) 100%);
  opacity: 0;
  backdrop-filter: blur(3px);
  pointer-events: none;
  z-index: 8;
}

.panel.focus-shifting::after {
  animation: focus-vignette 1100ms ease-out;
}

.panel-sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(130deg, #383733, #171714 62%);
  background-size: 100% 30px, auto;
  opacity: 0.22;
  mix-blend-mode: soft-light;
  z-index: 2;
}

.panel-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--plate-x) var(--plate-y);
  filter: saturate(var(--plate-saturation)) contrast(var(--plate-contrast)) brightness(var(--plate-brightness)) blur(var(--plate-blur));
  transform: translate3d(var(--plate-shift-x), var(--plate-shift), 0) scale(1.08);
  transition: transform 90ms linear, object-position 90ms linear;
  will-change: transform, object-position;
  z-index: 1;
}

.panel-foreground-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--plate-x) var(--plate-y);
  opacity: var(--foreground-opacity);
  filter: saturate(0.9) contrast(0.98) brightness(0.84) blur(var(--foreground-blur));
  transform: translate3d(var(--plate-shift-x), var(--plate-shift), 0) scale(1.08);
  z-index: 2;
  pointer-events: none;
  transition: opacity 90ms linear, filter 90ms linear, transform 90ms linear;
  will-change: opacity, filter, transform;
}

.panel-foreground-art[hidden] {
  display: none;
}

.panel.map-panel {
  background:
    radial-gradient(circle at 50% 40%, rgba(229, 213, 172, 0.12), transparent 48%),
    #191713;
}

.panel.actual-ratio-art {
  aspect-ratio: var(--art-aspect-ratio);
  height: auto;
  min-height: unset;
}

.panel.actual-ratio-art:not(.scroll-pan):not(.scroll-reveal) .panel-art,
.panel.actual-ratio-art:not(.scroll-pan):not(.scroll-reveal) .panel-foreground-art {
  transform: none;
}

.panel.map-panel .panel-art {
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  object-position: 50% 50%;
  transform: none;
  filter: saturate(var(--plate-saturation)) contrast(var(--plate-contrast)) brightness(var(--plate-brightness)) blur(var(--plate-blur));
}

.panel.map-panel.explorable-map {
  cursor: grab;
  touch-action: none;
}

.panel.map-panel.explorable-map.is-dragging {
  cursor: grabbing;
}

.panel.map-panel.explorable-map .panel-art {
  transform: translate3d(var(--map-pan-x), var(--map-pan-y), 0) scale(var(--map-zoom));
  transform-origin: center;
  transition: transform 120ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.panel.map-panel.explorable-map.is-dragging .panel-art {
  transition: none;
}

.panel.contain-art .panel-art {
  object-fit: contain;
  object-position: 50% 50%;
  transform: none;
}

.panel.map-panel .panel-layers {
  display: none;
}

.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 14;
  display: grid;
  gap: 6px;
}

.map-controls[hidden] {
  display: none;
}

.map-control {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(239, 232, 218, 0.44);
  border-radius: 50%;
  background: rgba(25, 23, 19, 0.82);
  color: var(--ink);
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1.25rem;
  line-height: 1;
}

.map-control:hover {
  background: rgba(50, 45, 36, 0.92);
}

.stage.full-page .panel {
  position: relative;
  top: auto;
  width: 100%;
  height: clamp(240px, 34vh, 380px);
  min-height: 240px;
}

.stage.full-page .panel-art,
.stage.full-page .panel-foreground-art {
  object-position: 50% 50%;
  transform: none;
}

.stage.full-page .reader {
  position: absolute;
  left: clamp(18px, 4vw, 48px);
  bottom: clamp(18px, 4vw, 48px);
  width: min(600px, calc(100% - 36px));
  min-height: 0;
  padding: clamp(20px, 3vw, 34px);
  border-color: rgba(239, 232, 218, 0.26);
  background:
    linear-gradient(90deg, rgba(16, 16, 14, 0.92), rgba(16, 16, 14, 0.58)),
    rgba(31, 30, 26, 0.78);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  z-index: 4;
}

.stage.full-page .episode-label {
  color: #efe8da;
}

.stage.full-page h2 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

.stage.full-page .episode-note {
  margin-bottom: 14px;
  color: #e2d8c6;
}

.stage.full-page .entry-meta,
.stage.full-page .choice-log {
  display: none;
}

.stage.full-page #episodeBody {
  max-width: 42rem;
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.55;
}

.stage.text-page {
  display: block;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.stage.text-page .panel {
  display: none;
}

.stage.text-page .reader {
  min-height: min(820px, calc(100vh - 190px));
  padding: clamp(44px, 7vw, 76px) clamp(34px, 7vw, 86px);
  border-color: rgba(89, 81, 63, 0.9);
  border-radius: 3px;
  background:
    linear-gradient(rgba(44, 39, 29, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 12%, rgba(239, 232, 218, 0.08), transparent 44%),
    #201f1b;
  background-size: 100% 32px, auto, auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.stage.text-page .episode-label {
  display: none;
}

.stage.text-page h2 {
  text-align: center;
}

.stage.title-page .reader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(760px, calc(100vh - 190px));
  padding-top: clamp(54px, 8vw, 92px);
  padding-bottom: clamp(54px, 8vw, 92px);
}

.stage.title-page h2 {
  max-width: 10ch;
  margin: 0 auto 18px;
  color: #f2e5cf;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  line-height: 0.88;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow:
    0 2px 0 rgba(45, 25, 12, 0.92),
    0 8px 24px rgba(0, 0, 0, 0.62),
    0 0 18px rgba(226, 172, 87, 0.13);
}

.stage.title-page .episode-note {
  margin-bottom: clamp(44px, 7vw, 76px);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  line-height: 1.42;
  text-transform: uppercase;
}

.stage.text-page .episode-note {
  max-width: 34rem;
  margin-right: auto;
  margin-left: auto;
  padding-left: 0;
  border-left: 0;
  text-align: center;
}

.stage.text-page #episodeBody {
  max-width: 38rem;
  margin-right: auto;
  margin-left: auto;
}

.stage.text-page .editor-signature {
  display: block;
  margin-top: 1.8rem;
  color: #d8cfbd;
  font-family: var(--hand-font);
  font-size: 1.15rem;
  text-align: right;
}

.publisher-line,
.publisher-mark,
.publisher-note {
  display: block;
  text-align: center;
}

.publisher-line {
  color: #e9dfcc;
}

.publisher-mark {
  margin: 2.4rem 0 0.35rem;
  color: #efe8da;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
}

.publisher-note {
  margin-top: 2.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stage.text-page .choice-log {
  max-width: 38rem;
  margin-right: auto;
  margin-left: auto;
}

.panel.focus-shifting .panel-art {
  animation: painting-focus-shift 1100ms ease-out;
}

.panel-layers {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.memory-layer {
  position: absolute;
  left: var(--layer-x, 50%);
  top: var(--layer-y, 50%);
  width: var(--layer-size, 42%);
  aspect-ratio: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  filter: blur(8px);
  transition: opacity 520ms ease, filter 520ms ease, transform 520ms ease;
  mix-blend-mode: soft-light;
}

.memory-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 48%;
  background: radial-gradient(circle, rgba(239, 232, 218, 0.22), rgba(239, 232, 218, 0.08) 38%, transparent 72%);
}

.memory-layer[data-kind="fog"]::before,
.memory-layer[data-kind="weather"]::before {
  background: radial-gradient(circle, rgba(190, 215, 212, 0.32), rgba(190, 215, 212, 0.12) 42%, transparent 76%);
}

.memory-layer[data-kind="paper"]::before {
  border-radius: 12%;
  background: linear-gradient(135deg, transparent 0 24%, rgba(234, 221, 184, 0.2) 25% 44%, transparent 45% 100%);
}

.memory-layer[data-kind="figure"]::before {
  border-radius: 45% 45% 38% 38%;
  background: radial-gradient(ellipse at 50% 32%, rgba(239, 232, 218, 0.16), transparent 24%),
    linear-gradient(rgba(239, 232, 218, 0.16), transparent 68%);
}

.memory-layer[data-kind="witness"]::before {
  background: radial-gradient(circle, rgba(232, 144, 144, 0.18), rgba(239, 232, 218, 0.08) 44%, transparent 74%);
}

.memory-layer.revealed {
  opacity: 0.18;
  filter: blur(5px);
}

.memory-layer.active {
  opacity: 0.62;
  filter: blur(0.8px);
  transform: translate(-50%, -50%) scale(1.03);
  animation: layer-focus 1100ms ease-out;
}

.plate-pending {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  z-index: 1;
  color: rgba(239, 232, 218, 0.58);
  font-family: var(--hand-font);
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  text-align: center;
  background:
    radial-gradient(circle at 40% 30%, rgba(239, 232, 218, 0.08), transparent 32%),
    linear-gradient(130deg, #302e28, #141410);
}

.plate-pending[hidden] {
  display: none;
}

.panel.missing-art .panel-sky {
  opacity: 0.4;
}

.panel:not(.missing-art) .panel-bells,
.panel:not(.missing-art) .panel-building,
.panel:not(.missing-art) .panel-ship,
.panel:not(.missing-art) .panel-egg {
  display: none;
}

.panel-bells {
  position: absolute;
  top: 72px;
  left: 16%;
  width: 90px;
  height: 260px;
  border: 3px solid #6e644b;
  border-bottom: 0;
  opacity: 0.22;
  z-index: 3;
  mix-blend-mode: soft-light;
}

.panel-bells::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -46px;
  width: 42px;
  height: 42px;
  border: 3px solid #6e644b;
  transform: rotate(45deg);
}

.panel-building {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: linear-gradient(#3b342a, #221d18);
  clip-path: polygon(0 35%, 22% 21%, 31% 33%, 52% 17%, 65% 30%, 79% 18%, 100% 30%, 100% 100%, 0 100%);
  opacity: 0.12;
  z-index: 3;
  mix-blend-mode: multiply;
}

.panel-ship {
  position: absolute;
  left: 18%;
  bottom: 18%;
  width: 64%;
  height: 90px;
  border-bottom: 16px solid var(--ship);
  border-radius: 0 0 50% 50%;
  opacity: 0;
  transform: translateY(30px);
  z-index: 4;
  mix-blend-mode: screen;
  display: none;
}

.panel-ship::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 4px;
  height: 220px;
  background: #8e6645;
}

.panel-ship::after {
  content: "";
  position: absolute;
  left: 51%;
  bottom: 80px;
  border-left: 80px solid rgba(239, 232, 218, 0.32);
  border-top: 48px solid transparent;
  border-bottom: 48px solid transparent;
}

.panel-egg {
  position: absolute;
  right: 17%;
  bottom: 28%;
  width: 74px;
  height: 102px;
  border: 2px solid rgba(220, 210, 255, 0.85);
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 45% 38%, #fff6 0 8%, #b7a4ff 11%, #45376c 58%, #171714 100%);
  box-shadow: 0 0 32px rgba(183, 164, 255, 0.2);
  opacity: 0;
  z-index: 5;
  display: none;
}

#panelCaption {
  display: none;
}

.panel-sky,
.panel-bells,
.panel-building,
.panel-ship,
.panel-egg {
  display: none !important;
}

.panel[data-dominant="Fog"] .panel-sky {
  filter: blur(2px);
  opacity: 0.52;
}

.panel[data-dominant="Institution"] .panel-sky {
  background:
    repeating-linear-gradient(0deg, rgba(211, 197, 161, 0.14), rgba(211, 197, 161, 0.14) 1px, transparent 1px, transparent 28px),
    linear-gradient(130deg, #383733, #171714 62%);
  opacity: 0.46;
}

.panel[data-dominant="Witness"] {
  box-shadow: inset 0 0 0 3px rgba(232, 144, 144, 0.22);
}

.reader {
  border-radius: 8px;
  padding: clamp(24px, 4vw, 48px);
  background:
    linear-gradient(rgba(199, 217, 119, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 111, 74, 0.08) 1px, transparent 1px),
    var(--panel);
  background-position: 0 0, 42px 0, 0 0;
  background-size: 100% 31px, 100% 100%, auto;
}

#episodeBody {
  font-size: clamp(1.08rem, 1.6vw, 1.35rem);
  line-height: 1.72;
}

.entry-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 26px;
  padding: 12px 0 14px;
  border-top: 1px solid rgba(89, 81, 63, 0.8);
  border-bottom: 1px solid rgba(89, 81, 63, 0.8);
}

.entry-meta div {
  min-width: 0;
}

.entry-meta dt {
  margin-bottom: 4px;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-meta dd {
  margin: 0;
  color: #d8cfbd;
  font-family: var(--hand-font);
  font-size: 1rem;
  line-height: 1.25;
}

.episode-note {
  margin: 0 0 18px;
  padding-left: 0.9rem;
  border-left: 1px solid rgba(199, 217, 119, 0.42);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

#episodeBody p {
  margin: 0 0 1.1em;
}

.contents-list {
  display: grid;
  gap: 8px;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.contents-list li {
  margin: 0;
}

.contents-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(89, 81, 63, 0.64);
  padding: 9px 0 10px;
  background: transparent;
  color: #e6ddcc;
  text-align: left;
}

.contents-kicker,
.contents-title,
.contents-page {
  display: block;
}

.contents-kicker {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contents-title {
  overflow-wrap: anywhere;
  font-family: var(--hand-font);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.12;
}

.contents-page {
  color: var(--muted);
  font-family: var(--hand-font);
  font-size: 1rem;
  line-height: 1.1;
}

.footnote-ref {
  margin-left: 0.12em;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68em;
}

.footnote {
  display: block;
  margin-top: -0.35em;
  padding-left: 0.9rem;
  border-left: 1px solid rgba(199, 217, 119, 0.38);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.45;
}

.pressure {
  border: 0;
  border-bottom: 1px dotted currentColor;
  padding: 0 1px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.pressure:hover,
.pressure:focus-visible {
  color: var(--accent);
  outline: none;
}

.pressure.changed {
  color: var(--accent);
  border-bottom-style: solid;
}

.pressure.state-linked {
  color: #f0c985;
  border-bottom-style: double;
}

.pressure.texture-link {
  color: #d7cdb8;
  border-bottom-color: rgba(215, 205, 184, 0.55);
  border-bottom-style: dotted;
  filter: blur(0.25px);
  text-shadow: 0 0 8px rgba(215, 205, 184, 0.18);
}

.pressure.texture-link:hover,
.pressure.texture-link:focus-visible {
  filter: blur(0);
  color: #efe8da;
  text-shadow: 0 0 10px rgba(239, 232, 218, 0.28);
}

.pressure.ripple {
  animation: text-ripple 520ms ease-out;
}

.choice-log {
  min-height: 34px;
  margin-top: 24px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
}

.choice-log[hidden],
.controls[hidden] {
  display: none;
}

.controls {
  margin-top: 20px;
}

.city-board {
  margin-top: 28px;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1b1a17;
}

.city-board h2 {
  margin-bottom: 18px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.plot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.plot-card {
  min-height: 118px;
  padding: 13px;
  border: 1px solid rgba(89, 81, 63, 0.8);
  border-radius: 8px;
  background: #24231f;
}

.plot-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plot-card h3 {
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: 0;
}

.plot-card span,
.plot-card p {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.plot-card-header span {
  max-width: 42%;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
  text-align: right;
}

.plot-bar {
  height: 7px;
  margin: 14px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #141410;
}

.plot-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--danger));
  transition: width 260ms ease;
}

.plot-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.state-meter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
}

.tag {
  min-width: 86px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.tag strong {
  color: var(--ink);
}

.texture-tag {
  opacity: 0.72;
}

.texture-tag::before {
  content: "clouded ";
  color: var(--muted);
}

@keyframes text-ripple {
  0% {
    text-shadow: 0 0 0 transparent;
    filter: blur(0);
  }

  45% {
    text-shadow: 10px 0 0 rgba(239, 232, 218, 0.18), -10px 0 0 rgba(239, 232, 218, 0.18);
    filter: blur(1px);
  }

  100% {
    text-shadow: 0 0 0 transparent;
    filter: blur(0);
  }
}

@keyframes panel-ripple {
  0% {
    opacity: 0.75;
    transform: scale(0.2);
  }

  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

@keyframes painting-focus-shift {
  0% {
    filter: saturate(0.85) contrast(0.95) brightness(0.82) blur(0.35px);
    transform: scale(1.02);
  }

  30% {
    filter: saturate(0.78) contrast(0.88) brightness(0.76) blur(4px);
    transform: scale(1.045) translate3d(-1.5%, 0.8%, 0);
  }

  62% {
    filter: saturate(0.92) contrast(1.04) brightness(0.88) blur(0.08px);
    transform: scale(1.035) translate3d(1.2%, -0.8%, 0);
  }

  100% {
    filter: saturate(0.85) contrast(0.95) brightness(0.82) blur(0.35px);
    transform: scale(1.02);
  }
}

@keyframes focus-vignette {
  0% {
    opacity: 0;
  }

  28% {
    opacity: 0.72;
  }

  62% {
    opacity: 0.36;
  }

  100% {
    opacity: 0;
  }
}

@keyframes layer-focus {
  0% {
    opacity: 0;
    filter: blur(10px);
  }

  36% {
    opacity: 0.7;
    filter: blur(0.6px);
  }

  100% {
    opacity: 0.18;
    filter: blur(5px);
  }
}

@media (max-width: 820px) {
  .controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  .panel,
  .reader {
    min-height: auto;
  }

  .panel {
    top: 0;
    z-index: 20;
    height: min(34vh, 280px);
    min-height: 180px;
    aspect-ratio: auto;
  }

  .stage.full-page:not(.cover-page) .panel {
    height: min(34vh, 300px);
    min-height: 190px;
  }

  .stage.full-page .reader {
    position: relative;
    left: auto;
    bottom: auto;
    width: 100%;
    margin-top: -84px;
  }

  .state-meter {
    justify-content: flex-start;
  }

  .entry-meta {
    grid-template-columns: 1fr;
  }

  .plot-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 821px) and (max-width: 1080px) {
  .plot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stage.cover-page,
.stage.back-cover-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  width: min(520px, calc(100vw - 32px), calc((100vh - 190px) * 2 / 3));
  min-height: auto;
  margin-right: auto;
  margin-left: auto;
  overflow: hidden;
  border-radius: 8px;
}

.stage.cover-page .panel,
.stage.back-cover-page .panel {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  border-color: rgba(239, 232, 218, 0.3);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  z-index: 1;
}

.stage.cover-page .panel-art,
.stage.cover-page .panel-foreground-art,
.stage.back-cover-page .panel-art,
.stage.back-cover-page .panel-foreground-art {
  object-position: 50% 50%;
  transform: none;
}

.stage.cover-page .reader {
  position: relative;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 68px 34px 36px;
  transform: none;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(rgba(5, 5, 4, 0.56), transparent 32%),
    linear-gradient(transparent 58%, rgba(5, 5, 4, 0.72));
  box-shadow: none;
  backdrop-filter: none;
  overflow: hidden;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

.stage.cover-page .episode-label,
.stage.cover-page .choice-log {
  display: none;
}

.stage.cover-page h2 {
  max-width: 8ch;
  margin: 30px auto 0;
  color: #f2e5cf;
  background:
    linear-gradient(180deg, #fff3d7 0 17%, #f2d79a 26%, #fff8de 38%, #b57e42 62%, #f0d29a 72%, #70431f 100%),
    repeating-linear-gradient(112deg, transparent 0 15px, rgba(29, 18, 12, 0.96) 16px 17px, transparent 18px 31px),
    repeating-linear-gradient(23deg, transparent 0 21px, rgba(47, 28, 16, 0.86) 22px 23px, transparent 24px 42px),
    linear-gradient(67deg, transparent 0 38%, rgba(22, 14, 10, 0.96) 38.4% 38.9%, transparent 39.4% 57%, rgba(22, 14, 10, 0.9) 57.3% 58%, transparent 58.4%);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 4.1rem;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1px rgba(255, 239, 193, 0.58);
  filter:
    drop-shadow(0 2px 0 rgba(45, 25, 12, 0.95))
    drop-shadow(0 6px 16px rgba(0, 0, 0, 0.95))
    drop-shadow(0 0 10px rgba(226, 172, 87, 0.18));
}

.stage.cover-page .episode-note {
  max-width: 28ch;
  margin: 14px auto 0;
  padding-left: 0;
  border-left: 0;
  color: #d9ccb6;
  font-size: 0.74rem;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.86);
}

.stage.cover-page #episodeBody {
  max-width: none;
  margin-top: auto;
  color: #efe2c9;
  font-size: 0.9rem;
  line-height: 1.35;
  text-transform: uppercase;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.88);
}

.stage.cover-page #episodeBody p {
  margin: 0;
}

.stage.cover-page #episodeBody p + p {
  margin-top: 8px;
}

.cover-author,
.cover-translator {
  display: block;
}

.cover-author {
  color: #f4e7cf;
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.cover-translator {
  color: #d8ccb8;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.stage.back-cover-page .reader {
  position: relative;
  left: auto;
  bottom: auto;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 34px;
  transform: none;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(rgba(5, 6, 5, 0.68), transparent 34%),
    linear-gradient(90deg, rgba(5, 6, 5, 0.72), transparent 42%),
    linear-gradient(transparent 50%, rgba(5, 6, 5, 0.82));
  box-shadow: none;
  backdrop-filter: none;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.stage.back-cover-page .episode-label,
.stage.back-cover-page .choice-log {
  display: none;
}

.stage.back-cover-page h2 {
  width: 100%;
  max-width: none;
  margin: 0;
  color: #f1e5ce;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.72),
    0 8px 20px rgba(0, 0, 0, 0.92);
}

.stage.back-cover-page .episode-note {
  max-width: 25ch;
  margin: 10px 0 0;
  padding-left: 0;
  border-left: 0;
  color: #d6d1bd;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.88);
}

.stage.back-cover-page #episodeBody {
  width: 100%;
  max-width: 100%;
  margin-top: auto;
  padding: 18px 18px 16px;
  border: 1px solid rgba(239, 232, 218, 0.28);
  background:
    linear-gradient(180deg, rgba(239, 232, 218, 0.08), transparent 44%),
    rgba(13, 14, 12, 0.76);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(3px);
  color: #e8decb;
  font-size: 0.78rem;
  line-height: 1.46;
}

.stage.back-cover-page #episodeBody p {
  margin: 0;
}

.stage.back-cover-page #episodeBody p + p {
  margin-top: 0.72em;
}

.stage.back-cover-page #episodeBody p:first-child {
  color: #f5ead7;
}

.stage.back-cover-page #episodeBody p:last-child {
  padding-top: 0.76em;
  border-top: 1px solid rgba(239, 232, 218, 0.2);
}

@media (max-width: 620px) {
  .stage.cover-page .reader,
  .stage.back-cover-page .reader {
    position: absolute;
    width: 100%;
    margin-top: 0;
    padding: 32px 24px 28px;
  }

  .stage.cover-page .panel,
  .stage.back-cover-page .panel {
    width: 100%;
  }

  .stage.cover-page h2 {
    font-size: 3rem;
  }

  .stage.back-cover-page h2 {
    font-size: 1.25rem;
  }

  .stage.back-cover-page #episodeBody {
    padding: 14px 14px 13px;
    font-size: 0.72rem;
    line-height: 1.38;
  }
}

@media (max-height: 760px) {
  .stage.cover-page .reader {
    padding-top: 62px;
    padding-bottom: 30px;
  }

  .stage.back-cover-page .reader {
    padding: 26px 26px 24px;
  }

  .stage.cover-page h2 {
    margin-top: 24px;
    font-size: 3.45rem;
  }

  .stage.cover-page .episode-note {
    font-size: 0.68rem;
  }

  .cover-author {
    font-size: 1.16rem;
  }

  .stage.back-cover-page .episode-note {
    font-size: 0.62rem;
  }

  .stage.back-cover-page #episodeBody {
    padding: 14px;
    font-size: 0.7rem;
    line-height: 1.34;
  }
}
