:root {
  --ink: #090a08;
  --ink-soft: #11120f;
  --ember: #b67528;
  --ember-bright: #d29b49;
  --paper: #c89b55;
  --bone: #ead6aa;
  --line: rgba(205, 153, 75, 0.45);
  --muted: rgba(235, 218, 182, 0.63);
  --shadow: rgba(0, 0, 0, 0.72);
  --page-size: min(74vmin, 760px);
  --turn-duration: 680ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--bone);
}

html { background-color: var(--ink); }

body {
  min-height: 100dvh;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* The UI toggles cover/reader/prompt visibility with the HTML hidden attribute.
   Component display rules (e.g. display:grid) must never override it. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(180, 111, 33, 0.15) 0 4%, transparent 30%),
    radial-gradient(circle at 50% 50%, #11100d 0 22%, #090a08 65%, #050605 100%);
}

.ambient::before,
.ambient::after {
  content: '';
  position: absolute;
  inset: -35%;
  opacity: 0.22;
  background-image:
    radial-gradient(circle, rgba(218, 168, 84, 0.48) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(218, 168, 84, 0.2) 0 1px, transparent 1.5px);
  background-size: 83px 83px, 137px 137px;
  background-position: 0 0, 21px 44px;
  animation: drift 35s linear infinite;
}

.ambient::after {
  opacity: 0.10;
  filter: blur(0.3px);
  animation-duration: 52s;
  animation-direction: reverse;
}

.ambient__glow {
  position: absolute;
  width: 70vmin;
  height: 70vmin;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(188, 120, 43, 0.15), transparent 68%);
  filter: blur(18px);
  animation: breathe 8s ease-in-out infinite;
}

.ambient__ring {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 64vmin;
  height: 64vmin;
  border: 1px solid rgba(191, 132, 57, 0.11);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ambient__ring::before,
.ambient__ring::after {
  content: '';
  position: absolute;
  inset: 10%;
  border: 1px dashed rgba(191, 132, 57, 0.08);
  border-radius: 50%;
}

.ambient__ring::after {
  inset: 34%;
  border-style: solid;
}

.ambient__ring--one { animation: orbit 34s linear infinite; }
.ambient__ring--two {
  width: 86vmin;
  height: 86vmin;
  opacity: 0.6;
  animation: orbit 49s linear reverse infinite;
}
.ambient__ring--three {
  width: 108vmin;
  height: 108vmin;
  opacity: 0.35;
  animation: orbit 72s linear infinite;
}

.experience {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
}

.cover-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 20px;
  padding: max(26px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  perspective: 1800px;
}

.cover-wrap {
  align-self: end;
  width: var(--page-size);
  aspect-ratio: 1;
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 160px);
  transform-style: preserve-3d;
}

.cover-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px 14px 14px 8px;
  overflow: hidden;
  transform-origin: left center;
  transform: rotateY(-2deg) rotateX(0.7deg);
  box-shadow:
    0 3px 0 rgba(207, 153, 70, 0.25),
    -12px 18px 48px rgba(0, 0, 0, 0.68),
    22px 34px 70px rgba(0, 0, 0, 0.38),
    inset 12px 0 18px rgba(255, 199, 107, 0.035);
  transition: transform 900ms cubic-bezier(.2, .74, .18, 1), opacity 700ms ease, filter 700ms ease;
}

.cover-card::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0 auto 0 0;
  width: 4.2%;
  background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(213,150,64,.09), rgba(0,0,0,.14));
  box-shadow: 3px 0 7px rgba(0,0,0,.36);
  pointer-events: none;
}

.cover-card img,
.page-face img,
.turn-sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.cover-card__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 24%, rgba(255, 221, 157, 0.05) 46%, transparent 66%);
  transform: translateX(-70%);
  animation: sheen 9s ease-in-out infinite;
  pointer-events: none;
}

.cover-screen.is-opening .cover-card {
  transform: translateX(-15%) rotateY(-64deg) rotateX(1deg) scale(.96);
  opacity: 0;
  filter: brightness(.65);
}

.cover-copy {
  text-align: center;
  align-self: start;
}

/* The central serpent is the book's entrance. The hotspot is larger than
   the drawing itself so it remains comfortable on touch screens. */
.snake-open {
  position: absolute;
  z-index: 6;
  left: 31.5%;
  top: 39.5%;
  width: 37%;
  height: 23%;
  padding: 0;
  border: 0;
  border-radius: 46%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.snake-open::before {
  content: '';
  position: absolute;
  inset: -18% -13%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center,
      rgba(245, 184, 82, .28) 0%,
      rgba(213, 136, 43, .15) 34%,
      rgba(152, 83, 20, .055) 55%,
      transparent 73%);
  filter: blur(12px);
  opacity: 0;
  transform: scale(.9);
  transition: opacity 220ms ease, transform 320ms cubic-bezier(.2,.72,.18,1);
  pointer-events: none;
}

.cover-card__snake-highlight {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  clip-path: ellipse(18.5% 11.3% at 50% 50.7%);
  filter:
    brightness(1.52)
    contrast(1.06)
    saturate(1.46)
    drop-shadow(0 0 7px rgba(239, 166, 58, .56))
    drop-shadow(0 0 18px rgba(203, 115, 28, .34));
  transform: scale(1.006);
  transition: opacity 230ms ease, filter 230ms ease, transform 320ms cubic-bezier(.2,.72,.18,1);
}

.snake-open:hover::before,
.snake-open:focus-visible::before {
  opacity: 1;
  transform: scale(1.08);
}

.snake-open:hover + .cover-card__snake-highlight,
.snake-open:focus-visible + .cover-card__snake-highlight {
  opacity: .92;
  transform: scale(1.018);
  filter:
    brightness(1.72)
    contrast(1.08)
    saturate(1.58)
    drop-shadow(0 0 8px rgba(255, 196, 96, .72))
    drop-shadow(0 0 24px rgba(218, 126, 29, .52));
}


/* Portal ritual: the serpent remains the trigger, but the transition now feels
   like entering the bestiary. Several creatures emerge as spectral afterimages
   from a dark amber threshold before the cover turns. */
.spirit-portal {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  isolation: isolate;
}

.spirit-portal::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50.7%, rgba(248, 188, 92, .14) 0 7%, rgba(111, 58, 11, .16) 21%, transparent 49%),
    radial-gradient(circle at 50% 50.7%, transparent 0 25%, rgba(0, 0, 0, .28) 62%, rgba(0, 0, 0, .56) 100%);
  mix-blend-mode: screen;
}

.spirit-portal__void {
  position: absolute;
  left: 50%;
  top: 50.7%;
  width: 21%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.22);
  background:
    radial-gradient(circle at 50% 48%, rgba(3, 3, 2, .98) 0 26%, rgba(28, 12, 2, .96) 32%, rgba(128, 67, 14, .72) 47%, rgba(226, 145, 46, .22) 61%, transparent 75%);
  box-shadow:
    0 0 9px rgba(255, 193, 91, .52),
    0 0 28px rgba(218, 126, 31, .46),
    0 0 74px rgba(149, 75, 14, .34),
    inset 0 0 16px rgba(249, 187, 86, .2);
}

.spirit-portal__ring {
  position: absolute;
  left: 50%;
  top: 50.7%;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.32) rotate(0deg);
  border: 1px solid rgba(245, 180, 80, .6);
  box-shadow: 0 0 17px rgba(224, 137, 38, .35);
}

.spirit-portal__ring--two {
  width: 31%;
  border-style: dashed;
  border-color: rgba(222, 142, 47, .34);
}

.spirit-echo {
  --ex: 0%;
  --ey: 0%;
  --mx: 0%;
  --my: 0%;
  --scale-mid: .72;
  --scale-end: 1;
  --r0: 0deg;
  --r1: 0deg;
  --delay: 0ms;
  --duration: 1060ms;
  position: absolute;
  left: 50%;
  top: 50.7%;
  width: 42%;
  aspect-ratio: 1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.12) rotate(var(--r0));
  transform-origin: center;
  mix-blend-mode: screen;
  filter: blur(3px) brightness(1.2) saturate(1.1);
  will-change: transform, opacity, filter;
}

.spirit-echo::before,
.spirit-echo::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-position: inherit;
  background-repeat: inherit;
  background-size: inherit;
  opacity: .28;
  filter: blur(7px);
  transform: translate(-7%, 4%) scale(.96);
}

.spirit-echo::after {
  opacity: .14;
  filter: blur(13px);
  transform: translate(-14%, 8%) scale(.91);
}

.spirit-echo--ave {
  width: 43%;
  background-image: url('assets/spirits/ave.png');
  --mx: -38%; --my: -26%; --ex: -78%; --ey: -58%; --scale-mid: .74; --scale-end: 1.02;
  --r0: 6deg; --r1: -9deg; --delay: 80ms;
}

.spirit-echo--anfibio {
  width: 40%;
  background-image: url('assets/spirits/anfibio.png');
  --mx: 39%; --my: -20%; --ex: 82%; --ey: -43%; --scale-mid: .69; --scale-end: .96;
  --r0: -5deg; --r1: 10deg; --delay: 155ms;
}

.spirit-echo--hongo {
  width: 36%;
  background-image: url('assets/spirits/hongo.png');
  --mx: 2%; --my: -46%; --ex: 4%; --ey: -102%; --scale-mid: .65; --scale-end: .9;
  --r0: 1deg; --r1: -3deg; --delay: 10ms;
}

.spirit-echo--kuntur {
  width: 42%;
  background-image: url('assets/spirits/kuntur.png');
  --mx: -38%; --my: 30%; --ex: -78%; --ey: 64%; --scale-mid: .7; --scale-end: .98;
  --r0: -7deg; --r1: 8deg; --delay: 215ms;
}

.spirit-echo--seres {
  width: 39%;
  background-image: url('assets/spirits/seres.png');
  --mx: 39%; --my: 32%; --ex: 82%; --ey: 68%; --scale-mid: .69; --scale-end: .95;
  --r0: 6deg; --r1: -7deg; --delay: 275ms;
}

.spirit-portal__mist {
  position: absolute;
  left: 50%;
  top: 50.7%;
  width: 55%;
  height: 18%;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.25) rotate(-9deg);
  background: radial-gradient(ellipse, rgba(237, 159, 62, .3), rgba(156, 80, 19, .11) 46%, transparent 74%);
  filter: blur(18px);
  mix-blend-mode: screen;
}

.spirit-portal__mist--two {
  transform: translate(-50%, -50%) scale(.22) rotate(14deg);
}

.cover-screen.is-ritual-activated .cover-card__snake-highlight {
  animation: snakeTouchIgnite 920ms cubic-bezier(.18,.72,.2,1) both;
}

.cover-screen.is-ritual-activated .snake-open::before {
  animation: snakeAuraIgnite 880ms ease-out both;
}

.cover-screen.is-ritual-activated .spirit-portal::before {
  animation: portalVeil 1260ms ease-out both;
}

.cover-screen.is-ritual-activated .spirit-portal__void {
  animation: portalOpen 1260ms cubic-bezier(.12,.74,.18,1) both;
}

.cover-screen.is-ritual-activated .spirit-portal__ring--one {
  animation: portalRing 1180ms 60ms cubic-bezier(.14,.72,.2,1) both;
}

.cover-screen.is-ritual-activated .spirit-portal__ring--two {
  animation: portalRingReverse 1240ms 120ms cubic-bezier(.14,.72,.2,1) both;
}

.cover-screen.is-ritual-activated .spirit-echo {
  animation: spiritEmerge var(--duration) var(--delay) cubic-bezier(.12,.66,.2,1) both;
}

.cover-screen.is-ritual-activated .spirit-portal__mist--one {
  animation: spiritMist 1100ms 90ms ease-out both;
}

.cover-screen.is-ritual-activated .spirit-portal__mist--two {
  animation: spiritMistReverse 1180ms 130ms ease-out both;
}

.snake-open:focus-visible,
.icon-button:focus-visible,
.transport-button:focus-visible,
.autoplay-prompt:focus-visible,
.page-hotspot:focus-visible,
.progress:focus-visible {
  outline: 2px solid #d59a46;
  outline-offset: 5px;
}

.cover-hint {
  margin: 0;
  color: rgba(229, 206, 161, 0.47);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

@media (hover: none), (pointer: coarse) {
  .cover-card__snake-highlight {
    animation: snakeBreathe 2.9s ease-in-out infinite;
    transform-origin: 50% 50.7%;
  }

  .snake-open::before {
    animation: snakeAuraBreathe 2.9s ease-in-out infinite;
  }

  .cover-screen.is-ritual-activated .cover-card__snake-highlight {
    animation: snakeTouchIgnite 920ms cubic-bezier(.18,.72,.2,1) both;
  }

  .cover-screen.is-ritual-activated .snake-open::before {
    animation: snakeAuraIgnite 880ms ease-out both;
  }
}

.reader-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom));
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reader-screen.is-visible {
  opacity: 1;
  transform: scale(1);
}

.reader-header {
  width: min(100%, 980px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 45px;
}

.reader-header__album,
.reader-header__counter,
.track-meta__eyebrow {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
}

.reader-header__album {
  color: rgba(226, 202, 157, .73);
  font-size: 10px;
}

.reader-header__counter {
  margin-top: 5px;
  color: rgba(215, 160, 79, .5);
  font-size: 9px;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(205, 153, 75, 0.22);
  border-radius: 50%;
  background: rgba(9, 10, 8, .62);
  color: rgba(235, 216, 181, .74);
  cursor: pointer;
}

.icon-button--close { font-size: 26px; line-height: 1; }

.reader-core {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 13px;
}

.page-stage {
  position: relative;
  width: var(--page-size);
  max-width: calc(100vw - 34px);
  perspective: 1900px;
}

.book-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: clamp(7px, 1.2vmin, 12px);
  border-radius: 10px 15px 15px 10px;
  background:
    linear-gradient(90deg, #070806 0 1.8%, #17130e 2.8% 3.8%, #090a08 5% 100%);
  box-shadow:
    -22px 28px 64px rgba(0,0,0,.58),
    20px 34px 80px rgba(0,0,0,.4),
    0 0 0 1px rgba(201,143,62,.15),
    inset 0 0 0 1px rgba(229,183,107,.05),
    inset 12px 0 14px rgba(0,0,0,.52);
  transform: rotateX(1.2deg);
  transform-style: preserve-3d;
}

.book-frame::before {
  content: '';
  position: absolute;
  z-index: 5;
  left: 0;
  top: 4%;
  bottom: 4%;
  width: 2.4%;
  border-radius: 8px;
  background: linear-gradient(90deg, #020302, rgba(171,108,36,.13), #050605);
  box-shadow: 3px 0 8px rgba(0,0,0,.72);
  pointer-events: none;
}

.page-stack {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px 9px 9px 4px;
  overflow: visible;
  transform-style: preserve-3d;
  touch-action: pan-y;
}

.page-face,
.turn-sheet {
  position: absolute;
  inset: 0;
  border-radius: 4px 8px 8px 4px;
  overflow: hidden;
  background: #b98a4c;
}

.page-face--base {
  box-shadow:
    inset 0 0 18px rgba(65, 35, 10, .16),
    inset 10px 0 22px rgba(0,0,0,.11);
}

.page-face__edge {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(239, 202, 137, .13),
    inset -5px 0 6px rgba(80, 45, 16, .10),
    inset 7px 0 10px rgba(30, 19, 8, .12);
}

.turn-sheet {
  display: none;
  z-index: 4;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, filter;
}

.turn-sheet__front,
.turn-sheet__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  overflow: hidden;
  border-radius: inherit;
}

.turn-sheet__back {
  transform: rotateY(180deg);
  background:
    linear-gradient(90deg, rgba(105,70,31,.42), rgba(217,178,111,.82) 28%, rgba(191,143,77,.92));
}

.turn-sheet__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 38%, rgba(0,0,0,.35) 84%, rgba(0,0,0,.57));
  opacity: 0;
  animation: pageShade var(--turn-duration) ease-in-out both;
  pointer-events: none;
}

.turn-sheet.is-forward {
  display: block;
  transform-origin: left center;
  animation: turnForward var(--turn-duration) cubic-bezier(.33,.02,.16,.99) both;
}

.turn-sheet.is-backward {
  display: block;
  transform-origin: right center;
  animation: turnBackward var(--turn-duration) cubic-bezier(.33,.02,.16,.99) both;
}

.page-hotspot {
  position: absolute;
  z-index: 7;
  top: 0;
  bottom: 0;
  width: 18%;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}

.page-hotspot--prev { left: 0; }
.page-hotspot--next { right: 0; }

.gesture-hint {
  margin: 10px 0 0;
  text-align: center;
  color: rgba(214, 169, 97, .38);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  letter-spacing: .17em;
  transition: opacity 450ms ease;
}

.gesture-hint.is-hidden { opacity: 0; }

.track-meta {
  min-height: 50px;
  text-align: center;
  max-width: min(92vw, 760px);
}

.track-meta__eyebrow {
  color: rgba(206, 148, 68, .58);
  font-size: 9px;
}

.track-meta__title {
  margin: 4px 0 0;
  color: #dec697;
  font-size: clamp(18px, 2.4vmin, 25px);
  font-weight: 400;
  letter-spacing: .025em;
}

.player {
  width: min(100%, 860px);
  margin: 0 auto;
  padding-top: 10px;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
}

.player__transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.transport-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(201, 147, 70, .25);
  background: rgba(11,12,10,.69);
  color: rgba(229,207,166,.78);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.transport-button:hover:not(:disabled) {
  border-color: rgba(216,159,76,.62);
  background: rgba(41,29,16,.72);
  transform: translateY(-1px);
}

.transport-button:disabled { opacity: .24; cursor: default; }

.transport-button--play {
  width: 50px;
  height: 50px;
  border-color: rgba(213,157,72,.53);
  color: #e0bf83;
  box-shadow: 0 0 24px rgba(170,104,29,.07);
}

#playIcon { display: inline-block; transform: translateY(-1px); font-family: Arial, sans-serif; }

.player__timeline {
  display: grid;
  grid-template-columns: 37px 1fr 37px;
  align-items: center;
  gap: 10px;
}

.time {
  color: rgba(227, 205, 165, .46);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.time:last-child { text-align: right; }

.progress {
  --progress: 0%;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.progress::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #c98b3d var(--progress), rgba(198,150,83,.18) var(--progress));
}

.progress::-moz-range-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(198,150,83,.18);
}

.progress::-moz-range-progress { height: 2px; background: #c98b3d; }

.progress::-webkit-slider-thumb {
  appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -3.5px;
  border: 0;
  border-radius: 50%;
  background: #d8ad6b;
  box-shadow: 0 0 0 4px rgba(196,130,48,.07);
}

.progress::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: #d8ad6b;
}

.autoplay-prompt {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 72px));
  transform: translateX(-50%);
  padding: 11px 16px;
  border: 1px solid rgba(220,164,80,.66);
  border-radius: 999px;
  background: rgba(10,10,8,.93);
  color: #e0c18a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: .14em;
  box-shadow: 0 10px 34px rgba(0,0,0,.48);
  cursor: pointer;
}

@keyframes turnForward {
  0% { transform: rotateY(0deg) translateZ(1px); filter: brightness(1); }
  45% { filter: brightness(.68); }
  100% { transform: rotateY(-112deg) translateZ(1px); filter: brightness(.42); }
}

@keyframes turnBackward {
  0% { transform: rotateY(0deg) translateZ(1px); filter: brightness(1); }
  45% { filter: brightness(.7); }
  100% { transform: rotateY(112deg) translateZ(1px); filter: brightness(.43); }
}

@keyframes pageShade {
  0% { opacity: 0; }
  52% { opacity: .78; }
  100% { opacity: .15; }
}

@keyframes orbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes drift {
  from { transform: translate3d(0,0,0) rotate(0deg); }
  to { transform: translate3d(4%, -3%, 0) rotate(3deg); }
}

@keyframes breathe {
  0%, 100% { opacity: .58; transform: translate(-50%, -50%) scale(.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}

@keyframes sheen {
  0%, 76%, 100% { transform: translateX(-80%); }
  88% { transform: translateX(90%); }
}

@keyframes pulseMark {
  0%, 100% { opacity: .48; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 700px) {
  :root { --page-size: min(92vw, calc(100dvh - 226px)); }

  /* On phones the cover must be centered by the viewport itself. The hint is
     positioned independently so its height can never push the book down. */
  .cover-screen {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cover-wrap {
    align-self: auto;
  }

  .cover-copy {
    position: absolute;
    bottom: max(26px, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    min-height: 0;
    display: block;
    text-align: center;
    pointer-events: none;
  }

  .reader-screen {
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .reader-header { min-height: 38px; }
  .reader-header__album { font-size: 9px; }
  .icon-button { width: 36px; height: 36px; }
  .reader-core { gap: 8px; }
  .gesture-hint { margin-top: 7px; }
  .track-meta { min-height: 44px; }
  .track-meta__title { font-size: 17px; }

  .player {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 5px;
  }

  .player__transport { justify-content: center; order: 2; }
  .player__timeline { order: 1; }
  .transport-button { width: 38px; height: 38px; }
  .transport-button--play { width: 44px; height: 44px; }
}

@media (max-height: 690px) {
  :root { --page-size: min(65vmin, calc(100dvh - 210px)); }
  .reader-header { min-height: 34px; }
  .track-meta { min-height: 38px; }
  .track-meta__title { font-size: 16px; }
  .gesture-hint { display: none; }
  .player { padding-top: 3px; }
}


@keyframes snakeBreathe {
  0%, 100% {
    opacity: .12;
    transform: scale(1.004);
    filter: brightness(1.28) saturate(1.18) drop-shadow(0 0 4px rgba(216, 139, 39, .2));
  }
  50% {
    opacity: .46;
    transform: scale(1.022);
    filter: brightness(1.58) saturate(1.42) drop-shadow(0 0 13px rgba(239, 166, 58, .52));
  }
}

@keyframes snakeAuraBreathe {
  0%, 100% { opacity: .06; transform: scale(.92); }
  50% { opacity: .4; transform: scale(1.045); }
}

@keyframes snakeTouchIgnite {
  0% { opacity: .35; transform: scale(1.01); filter: brightness(1.45) saturate(1.35); }
  36% { opacity: 1; transform: scale(1.055); filter: brightness(2.05) saturate(1.72) drop-shadow(0 0 20px rgba(255, 198, 92, .82)); }
  100% { opacity: .36; transform: scale(1.025); filter: brightness(1.55) saturate(1.42) drop-shadow(0 0 10px rgba(225, 137, 37, .42)); }
}

@keyframes snakeAuraIgnite {
  0% { opacity: .26; transform: scale(.9); }
  42% { opacity: .9; transform: scale(1.16); }
  100% { opacity: 0; transform: scale(1.36); }
}

@keyframes portalVeil {
  0% { opacity: 0; }
  18% { opacity: .18; }
  52% { opacity: .9; }
  100% { opacity: 0; }
}

@keyframes portalOpen {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.18); filter: blur(7px); }
  18% { opacity: .7; }
  46% { opacity: 1; transform: translate(-50%, -50%) scale(1.14); filter: blur(.3px); }
  76% { opacity: .95; transform: translate(-50%, -50%) scale(1.82); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.45); filter: blur(6px); }
}

@keyframes portalRing {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.22) rotate(0deg); }
  30% { opacity: .82; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.1) rotate(86deg); }
}

@keyframes portalRingReverse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); }
  28% { opacity: .56; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.7) rotate(-108deg); }
}

@keyframes spiritEmerge {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.1) rotate(var(--r0));
    filter: blur(10px) brightness(1.75) saturate(.75);
  }
  15% { opacity: .12; }
  35% {
    opacity: .78;
    filter: blur(1.8px) brightness(1.6) saturate(1.12)
      drop-shadow(0 0 10px rgba(255, 196, 101, .7));
  }
  62% {
    opacity: .66;
    transform: translate(calc(-50% + var(--mx)), calc(-50% + var(--my))) scale(var(--scale-mid)) rotate(var(--r1));
    filter: blur(.2px) brightness(1.45) saturate(1.08)
      drop-shadow(0 0 16px rgba(231, 149, 55, .54));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) scale(var(--scale-end)) rotate(var(--r1));
    filter: blur(7px) brightness(1.9) saturate(.75);
  }
}

@keyframes spiritMist {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(-9deg); }
  36% { opacity: .56; }
  100% { opacity: 0; transform: translate(-78%, -125%) scale(2.6) rotate(-18deg); }
}

@keyframes spiritMistReverse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(14deg); }
  36% { opacity: .42; }
  100% { opacity: 0; transform: translate(-18%, 65%) scale(2.45) rotate(24deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
