:root {
  --bg: #0c0d10;
  --bg-raise: #16181d;
  --ink: #f3efe6;
  --muted: #9a9386;
  --rule: #2a2d34;
  --paper: #f7f1e4;
  --paper-ink: #1a1714;
  --accent: #c4a35a;
  --hamza: #6b4423;
  --dron: #c2410c;
  --puja: #d4a017;
  --raz: #2b4cb8;
  --cherry: #8b0a12;
  --pam: #ffffff;
  --max: 42rem;
  --page-pad: clamp(1rem, 4vw, 2rem);
  --mast: 3.6rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 20;
  background: var(--paper);
  color: var(--paper-ink);
  padding: 0.4rem 0.7rem;
}

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-height: var(--mast);
  padding: 0.55rem var(--page-pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.mast-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
}

.mast-brand strong {
  font-family: Fraunces, Georgia, serif;
  font-size: 1rem;
}

.mast-brand span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-left: 0.85rem;
  row-gap: 0.25rem;
}

.chapters a {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--muted);
}

.chapters a[aria-current="page"] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.modes {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
}

.modes button {
  background: transparent;
  border: 0;
  padding: 0.35rem 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
}

.modes button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.codes-toggle {
  flex-shrink: 0;
  margin-left: 0.35rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
}

.codes-toggle--solo {
  margin-left: auto;
}

.codes-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.story {
  max-width: calc(var(--max) + 6rem);
  margin: 0 auto;
  padding: 0 var(--page-pad) 5rem;
}

[data-code] {
  scroll-margin-top: calc(var(--mast) + 0.75rem);
}

.leaf--cover {
  padding: 4.8rem 0 3.2rem;
}

body[data-page="0"] .story {
  max-width: calc(var(--max) + 6rem);
  margin: 0 auto;
  padding: 0 var(--page-pad) 5rem;
}

body[data-page="0"] .leaf--cover {
  padding-top: 1.6rem;
}

.title-plate {
  margin: 0;
}

.title-plate .panel-art {
  border-radius: 0.3rem;
}

.cover-kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.leaf--cover h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  font-weight: 500;
  line-height: 1.05;
}

.cover-tag {
  margin: 0.75rem 0 0;
  font-size: 1.2rem;
}

.coming-soon {
  margin-top: 1.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.95rem;
}

.part-label {
  margin: 0 0 1.1rem;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.leaf--text .panels {
  max-width: 40rem;
}

.cover-cast {
  max-width: 40rem;
  margin: 2rem 0 0;
  text-align: left;
}

.cover-cast h2 {
  margin: 0 0 0.85rem;
  font-family: Outfit, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.cover-cast p {
  margin: 0 0 0.85rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
}

.cover-cast p:last-child {
  margin-bottom: 0;
}

.cover-preface {
  max-width: 36rem;
  margin: 1.8rem 0 0;
}

.cover-preface p {
  margin: 0 0 0.85rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--ink);
}

.cover-preface p:last-child {
  margin-bottom: 0;
}

.cover-byline {
  margin: 2rem 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.cover-studio {
  margin: 1rem 0 0;
  max-width: 22rem;
}

.cover-studio img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.3rem;
  background: #050505;
}

.cover-copy {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.cover-copy a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.cover-copy a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.cover-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.cover-social svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.cover-social a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.cover-chapter {
  margin: 2.4rem 0 0;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cover-line {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.cover-start {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 2.4rem;
}

.cover-start a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.cover-start a:hover {
  border-bottom: 1px solid var(--accent);
}

.panels {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.6rem 0 0.4rem;
}

.panel {
  margin: 0;
}

.panel--text {
  padding-bottom: 0.35rem;
}

.panel--text + .panel--text {
  margin-top: 1.15rem;
}

body.hide-codes .code {
  display: none !important;
}

.code {
  display: block;
  width: fit-content;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: var(--accent);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--accent);
  border-radius: 0.25rem;
  padding: 0.12rem 0.38rem;
  margin: 0 0 0.4rem;
  cursor: pointer;
  user-select: all;
  pointer-events: auto;
  text-transform: none;
}

.caption .code,
.speech .code,
.bio .code,
.continue .code,
.cover-kicker .code,
.cover-tag .code,
.cover-preface .code,
.leaf--cover h1 .code,
.part-label .code,
.bio-name .code,
.bio-role .code {
  display: inline-block;
  margin: 0 0.4rem 0.15rem 0;
  vertical-align: middle;
}

.code--art {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 5;
  margin: 0;
  background: rgba(12, 13, 16, 0.84);
}

.code--copied {
  background: var(--accent);
  color: var(--bg);
}

.scene-break {
  height: 1px;
  margin: 0.35rem auto 1.7rem;
  max-width: 13rem;
  background: var(--rule);
  position: relative;
}

.scene-break::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: translate(-50%, -50%) rotate(45deg);
}

.prose {
  margin: 0 0 1rem;
}

.prose p {
  margin: 0 0 0.85rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink);
}

.prose p:last-child {
  margin-bottom: 0;
}

.panel-art {
  position: relative;
  overflow: hidden;
  border-radius: 0.3rem;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.panel-art--placeholder {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, var(--ink));
  border: 1px dashed var(--accent);
}

.placeholder-label {
  margin: 0;
  max-width: 34rem;
  padding: 2.4rem 1.5rem 1.2rem;
  text-align: center;
  font-family: Outfit, sans-serif;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--muted);
}

.panel-canvas {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.panel-shield {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: transparent;
  cursor: default;
}

html.capture-block .panel-shield {
  background: var(--bg);
}

.title-lock {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(
    180deg,
    rgba(8, 9, 12, 0.12),
    rgba(8, 9, 12, 0.4) 46%,
    rgba(8, 9, 12, 0.12)
  );
}

.title-lock h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 500;
  line-height: 1.05;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.65);
}

.title-lock p {
  margin: 0.45rem 0 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--paper);
}

.letter {
  margin-top: 0.7rem;
}

.talk {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.caption {
  display: inline-block;
  margin: 0 0 0.45rem;
  padding: 0.2rem 0.55rem;
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.speech {
  margin: 0;
  padding: 0.85rem 1rem 1rem 1.1rem;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 0.15rem 0.85rem 0.85rem 0.15rem;
  border-left: 4px solid var(--accent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.speech strong {
  display: inline;
  font-family: inherit;
  font-style: normal;
  font-weight: 700;
  font-size: inherit;
  letter-spacing: inherit;
  color: inherit;
  white-space: nowrap;
}

.speech[data-speaker="HAMZA"] {
  background: var(--hamza);
  color: #f7f1e4;
  border-left-color: #3d2414;
}

.speech[data-speaker="DRON"] {
  background: var(--dron);
  color: #fff6ee;
  border-left-color: #7a2208;
}

.speech[data-speaker="PUJA"] {
  background: var(--puja);
  color: #1a1408;
  border-left-color: #8a5a00;
}

.speech[data-speaker="RAZ"] {
  background: var(--raz);
  color: #f2f5ff;
  border-left-color: #162a6e;
}

.speech[data-speaker="CHERRY"] {
  background: var(--cherry);
  color: #fff0f0;
  border-left-color: #4a0508;
}

.speech[data-speaker="PAM"] {
  background: var(--pam);
  color: #1a1714;
  border-left-color: #cfc9be;
}

.speech[data-speaker="VILLAGER"] {
  border-left-color: #8a7a55;
}

.speech[data-speaker="GHOST QUEEN"] {
  border-left-color: #7ec8e3;
}

.speech[data-speaker="JOSHI"] {
  border-left-color: #c9a227;
}

.speech[data-speaker="RADHA"] {
  border-left-color: #c43c4a;
}

.speech[data-speaker="JAY"] {
  border-left-color: #4a7ea8;
}

.speech[data-speaker="JACKY"] {
  border-left-color: #6b3a3a;
}

.speech[data-speaker="MOTHER"],
.speech[data-speaker="HAMZA'S MOTHER"] {
  border-left-color: #8b9a62;
}

.speech[data-speaker="HALLUCINATION"],
.speech[data-speaker="RAZ'S HALLUCINATION"],
.speech[data-speaker="DRON'S HALLUCINATION"],
.speech[data-speaker="HAMZA'S HALLUCINATION"] {
  border-left-color: #7a5aa8;
}

.speech p {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.4;
}

.dossier {
  display: grid;
  gap: 1.2rem;
  padding: 1.6rem 0 0.4rem;
}

@media (min-width: 880px) {
  .dossier {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

.bio {
  margin: 0;
  padding: 1.15rem 1.2rem 1.3rem;
  background: var(--bg-raise);
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
}

.bio-name {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.bio[data-character="hamza"] {
  border-left: 4px solid var(--hamza);
}

.bio[data-character="hamza"] .bio-name {
  color: #c4a07a;
}

.bio[data-character="dron"] {
  border-left: 4px solid var(--dron);
}

.bio[data-character="dron"] .bio-name {
  color: #e0703a;
}

.bio[data-character="puja"] {
  border-left: 4px solid var(--puja);
}

.bio[data-character="puja"] .bio-name {
  color: var(--puja);
}

.bio[data-character="raz"] {
  border-left: 4px solid var(--raz);
}

.bio[data-character="raz"] .bio-name {
  color: #7ea0ff;
}

.bio[data-character="pam"] {
  border-left: 4px solid #d8d4cc;
}

.bio[data-character="pam"] .bio-name {
  color: var(--pam);
}

.bio[data-character="cherry"] {
  border-left: 4px solid var(--cherry);
}

.bio[data-character="cherry"] .bio-name {
  color: #e04555;
}

.bio-role {
  margin: 0.15rem 0 1rem;
  color: var(--muted);
}

.bio div {
  margin: 0 0 0.85rem;
}

.bio dt {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.bio dd {
  margin: 0.15rem 0 0;
  font-family: "Source Serif 4", Georgia, serif;
}

.continue {
  margin: 2.5rem 0 0;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.hits,
.pager {
  display: none;
}

body[data-mode="pages"] {
  overflow: hidden;
}

body[data-mode="pages"] .continue {
  display: none;
}

body[data-mode="pages"] .story {
  max-width: none;
  height: calc(100vh - var(--mast));
  padding: 0;
}

body[data-mode="pages"] .stage {
  position: relative;
  height: 100%;
  perspective: 2200px;
}

body[data-mode="pages"] .leaf {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 1.4rem var(--page-pad) 5.5rem;
  max-width: calc(var(--max) + 6rem);
  width: 100%;
  margin: 0 auto;
  left: 0;
  right: 0;
  background: var(--bg);
  transform-origin: left center;
  backface-visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body[data-mode="pages"] .leaf--cover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
}

body[data-mode="pages"] .leaf.is-current {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

body[data-mode="pages"] .leaf.is-past,
body[data-mode="pages"] .leaf.is-ahead {
  z-index: 1;
}

body[data-mode="pages"] .leaf.is-flip-out {
  animation: flip-out 0.55s ease forwards;
  z-index: 3;
}

body[data-mode="pages"] .leaf.is-flip-in {
  animation: flip-in 0.55s ease forwards;
  z-index: 4;
}

body[data-mode="pages"] .leaf.is-flip-back-out {
  animation: flip-back-out 0.55s ease forwards;
  z-index: 3;
}

body[data-mode="pages"] .leaf.is-flip-back-in {
  animation: flip-back-in 0.55s ease forwards;
  z-index: 4;
}

@keyframes flip-out {
  from {
    transform: rotateY(0);
    opacity: 1;
  }
  to {
    transform: rotateY(-78deg);
    opacity: 0;
  }
}

@keyframes flip-in {
  from {
    transform: rotateY(78deg);
    opacity: 0;
  }
  to {
    transform: rotateY(0);
    opacity: 1;
  }
}

@keyframes flip-back-out {
  from {
    transform: rotateY(0);
    opacity: 1;
  }
  to {
    transform: rotateY(78deg);
    opacity: 0;
  }
}

@keyframes flip-back-in {
  from {
    transform: rotateY(-78deg);
    opacity: 0;
  }
  to {
    transform: rotateY(0);
    opacity: 1;
  }
}

body[data-mode="pages"] .hits {
  display: block;
  position: fixed;
  inset: var(--mast) 0 0;
  z-index: 15;
  pointer-events: none;
}

body[data-mode="pages"] .hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

body[data-mode="pages"] .hit--prev {
  left: 0;
  cursor: w-resize;
}

body[data-mode="pages"] .hit--next {
  right: 0;
  cursor: e-resize;
}

body[data-mode="pages"] .pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1rem;
  z-index: 16;
}

.pager button {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-raise);
  cursor: pointer;
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager p {
  margin: 0;
  min-width: 4rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

@media print {
  .panel-art {
    display: none !important;
  }
}
