:root {
  --ink: #08111f;
  --ink-soft: rgba(8, 17, 31, 0.72);
  --paper: #f4ead8;
  --gold: #f3bf63;
  --crimson: #a5283c;
  --plum: #2a1630;
  --mist: rgba(255, 248, 232, 0.74);
  --line: rgba(255, 238, 214, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(255, 237, 189, 0.14), transparent 26%),
    radial-gradient(circle at 20% 20%, rgba(155, 31, 56, 0.2), transparent 24%),
    linear-gradient(180deg, #090d17 0%, #110d1b 38%, #170e1f 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(255, 255, 255, 0.02) 28% 29%, transparent 29% 100%),
    linear-gradient(65deg, transparent 0 50%, rgba(255, 255, 255, 0.02) 50% 51%, transparent 51% 100%);
  mix-blend-mode: screen;
  opacity: 0.4;
}

.front-door[hidden],
.front-screen[hidden] {
  display: none !important;
}

.launcher-mode {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(160, 35, 58, 0.34), transparent 34%),
    radial-gradient(circle at 88% 16%, rgba(243, 191, 99, 0.14), transparent 22%),
    linear-gradient(180deg, #03050a 0%, #080813 46%, #120812 100%);
}

.launcher-mode .experience {
  display: none;
}

.front-door {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  color: #f7ead6;
  caret-color: transparent;
  isolation: isolate;
}

.front-door input,
.front-door textarea {
  caret-color: auto;
}

.front-door::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(3, 5, 10, 0.1), rgba(3, 5, 10, 0.94)),
    url("assets/ui/title-shadow-assassination-v1.png") center / cover no-repeat;
  opacity: 0.28;
  filter: saturate(0.72) contrast(1.12);
}

.front-door__grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.12));
}

.front-screen {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 44px 0;
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
}

.title-screen {
  position: relative;
  overflow: hidden;
}

.front-screen.is-exiting {
  pointer-events: none;
  animation: front-screen-fade-out 300ms ease-in forwards;
}

.front-screen.is-entering {
  animation: front-screen-fade-in 420ms cubic-bezier(0.2, 0.78, 0.22, 1) both;
}

.front-panel,
.chapter-shell {
  width: min(760px, 100%);
  border: 1px solid rgba(243, 191, 99, 0.18);
  background:
    linear-gradient(180deg, rgba(18, 13, 24, 0.86), rgba(5, 7, 13, 0.94)),
    rgba(8, 8, 15, 0.92);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(18px);
}

.front-panel {
  padding: clamp(28px, 5vw, 58px);
  border-radius: 8px;
}

.front-panel--warning {
  max-width: 680px;
  text-align: center;
}

.front-panel--title {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  padding: clamp(22px, 4vw, 48px);
  text-align: center;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.title-logo {
  display: block;
  width: min(820px, 92vw);
  max-height: min(46vh, 430px);
  margin: 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 30px rgba(127, 16, 28, 0.42))
    drop-shadow(0 20px 44px rgba(0, 0, 0, 0.56));
  animation: title-logo-splash 3600ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

.title-enter-button {
  min-width: 210px;
  box-shadow:
    0 0 42px rgba(8, 4, 12, 0.82),
    0 0 24px rgba(201, 135, 51, 0.24),
    0 12px 32px rgba(201, 135, 51, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.petal-fall-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 420ms ease;
}

.front-door--intro .petal-fall-layer {
  opacity: 1;
}

.falling-petal {
  --petal-left: 50%;
  --petal-size: 10px;
  --petal-drift: 36px;
  --petal-duration: 10s;
  --petal-delay: 0s;
  --petal-tilt: 18deg;
  position: absolute;
  top: -12vh;
  left: var(--petal-left);
  width: var(--petal-size);
  height: calc(var(--petal-size) * 1.55);
  border-radius: 72% 28% 76% 24%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 222, 196, 0.86), transparent 24%),
    linear-gradient(145deg, rgba(214, 69, 92, 0.92), rgba(106, 12, 28, 0.88) 58%, rgba(39, 4, 13, 0.76));
  box-shadow:
    0 0 12px rgba(180, 24, 46, 0.28),
    inset 0 -2px 5px rgba(34, 0, 8, 0.28);
  opacity: 0;
  transform: translate3d(0, -12vh, 0) rotate(var(--petal-tilt));
  animation: higanbana-petal-fall var(--petal-duration) linear infinite;
  animation-delay: var(--petal-delay);
  will-change: transform, opacity;
}

.falling-petal:nth-child(1) { --petal-left: 4%; --petal-size: 8px; --petal-drift: 90px; --petal-duration: 12s; --petal-delay: -2.8s; --petal-tilt: -18deg; }
.falling-petal:nth-child(2) { --petal-left: 9%; --petal-size: 11px; --petal-drift: 48px; --petal-duration: 9.4s; --petal-delay: -6.1s; --petal-tilt: 31deg; }
.falling-petal:nth-child(3) { --petal-left: 15%; --petal-size: 7px; --petal-drift: -58px; --petal-duration: 11.2s; --petal-delay: -4.3s; --petal-tilt: 9deg; }
.falling-petal:nth-child(4) { --petal-left: 21%; --petal-size: 13px; --petal-drift: 76px; --petal-duration: 10.6s; --petal-delay: -8.8s; --petal-tilt: -34deg; }
.falling-petal:nth-child(5) { --petal-left: 27%; --petal-size: 9px; --petal-drift: -82px; --petal-duration: 13s; --petal-delay: -1.2s; --petal-tilt: 22deg; }
.falling-petal:nth-child(6) { --petal-left: 33%; --petal-size: 10px; --petal-drift: 64px; --petal-duration: 8.8s; --petal-delay: -5.4s; --petal-tilt: -8deg; }
.falling-petal:nth-child(7) { --petal-left: 38%; --petal-size: 8px; --petal-drift: -44px; --petal-duration: 12.4s; --petal-delay: -9.2s; --petal-tilt: 44deg; }
.falling-petal:nth-child(8) { --petal-left: 43%; --petal-size: 12px; --petal-drift: 88px; --petal-duration: 9.8s; --petal-delay: -3.7s; --petal-tilt: -27deg; }
.falling-petal:nth-child(9) { --petal-left: 49%; --petal-size: 7px; --petal-drift: -72px; --petal-duration: 11.6s; --petal-delay: -7.6s; --petal-tilt: 15deg; }
.falling-petal:nth-child(10) { --petal-left: 53%; --petal-size: 10px; --petal-drift: 42px; --petal-duration: 10.2s; --petal-delay: -0.5s; --petal-tilt: -42deg; }
.falling-petal:nth-child(11) { --petal-left: 58%; --petal-size: 14px; --petal-drift: -96px; --petal-duration: 13.6s; --petal-delay: -5.8s; --petal-tilt: 24deg; }
.falling-petal:nth-child(12) { --petal-left: 62%; --petal-size: 8px; --petal-drift: 72px; --petal-duration: 9.2s; --petal-delay: -2.1s; --petal-tilt: -12deg; }
.falling-petal:nth-child(13) { --petal-left: 67%; --petal-size: 11px; --petal-drift: -52px; --petal-duration: 12.8s; --petal-delay: -10.3s; --petal-tilt: 38deg; }
.falling-petal:nth-child(14) { --petal-left: 72%; --petal-size: 9px; --petal-drift: 84px; --petal-duration: 10.8s; --petal-delay: -6.9s; --petal-tilt: -22deg; }
.falling-petal:nth-child(15) { --petal-left: 77%; --petal-size: 13px; --petal-drift: -74px; --petal-duration: 11.9s; --petal-delay: -3.1s; --petal-tilt: 11deg; }
.falling-petal:nth-child(16) { --petal-left: 82%; --petal-size: 8px; --petal-drift: 58px; --petal-duration: 9.6s; --petal-delay: -8.2s; --petal-tilt: -38deg; }
.falling-petal:nth-child(17) { --petal-left: 88%; --petal-size: 10px; --petal-drift: -88px; --petal-duration: 12.1s; --petal-delay: -4.9s; --petal-tilt: 27deg; }
.falling-petal:nth-child(18) { --petal-left: 93%; --petal-size: 7px; --petal-drift: -46px; --petal-duration: 10.1s; --petal-delay: -1.7s; --petal-tilt: -16deg; }
.falling-petal:nth-child(19) { --petal-left: 11%; --petal-size: 12px; --petal-drift: 112px; --petal-duration: 14s; --petal-delay: -11.4s; --petal-tilt: 41deg; }
.falling-petal:nth-child(20) { --petal-left: 31%; --petal-size: 7px; --petal-drift: -102px; --petal-duration: 8.9s; --petal-delay: -6.7s; --petal-tilt: -29deg; }
.falling-petal:nth-child(21) { --petal-left: 47%; --petal-size: 9px; --petal-drift: 106px; --petal-duration: 13.2s; --petal-delay: -9.8s; --petal-tilt: 19deg; }
.falling-petal:nth-child(22) { --petal-left: 69%; --petal-size: 12px; --petal-drift: -118px; --petal-duration: 10.9s; --petal-delay: -2.9s; --petal-tilt: -45deg; }
.falling-petal:nth-child(23) { --petal-left: 86%; --petal-size: 9px; --petal-drift: 74px; --petal-duration: 12.7s; --petal-delay: -7.4s; --petal-tilt: 13deg; }
.falling-petal:nth-child(24) { --petal-left: 96%; --petal-size: 11px; --petal-drift: -86px; --petal-duration: 9.7s; --petal-delay: -5.2s; --petal-tilt: -33deg; }

.front-panel--story {
  width: min(900px, 100%);
  padding: clamp(24px, 4vw, 46px);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 88px);
  overflow: hidden;
}

.front-panel--member {
  max-width: 620px;
}

.front-panel--age {
  position: relative;
  width: min(680px, 100%);
  text-align: center;
  overflow: hidden;
}

.front-panel--age::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(165, 23, 34, 0.34);
  pointer-events: none;
}

.front-panel--age h2 {
  color: #f3bf63;
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 0.8;
  text-shadow:
    0 0 24px rgba(165, 23, 34, 0.58),
    0 12px 42px rgba(0, 0, 0, 0.68);
}

.front-panel--landscape {
  max-width: 640px;
  text-align: center;
}

.front-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.front-panel h2,
.chapter-heading h2 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.front-copy {
  margin: 22px auto 0;
  max-width: 620px;
  color: rgba(247, 234, 214, 0.78);
  font-size: 1.08rem;
  line-height: 1.65;
}

.front-button,
.chapter-play {
  appearance: none;
  border: 1px solid rgba(243, 191, 99, 0.5);
  border-radius: 8px;
  color: #160a0d;
  background: linear-gradient(180deg, #ffd98a, #c98733);
  box-shadow: 0 12px 32px rgba(201, 135, 51, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.front-button {
  margin-top: 30px;
  padding: 14px 22px;
}

.front-button--center {
  display: block;
  width: fit-content;
  margin-right: auto;
  margin-left: auto;
}

.front-button--small {
  margin-top: 0;
  padding: 11px 14px;
  font-size: 0.74rem;
}

.front-button:hover,
.front-button:focus-visible,
.chapter-play:hover,
.chapter-play:focus-visible,
.shop-buy:hover,
.shop-buy:focus-visible,
.shop-play:hover,
.shop-play:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 230, 168, 0.86);
  box-shadow: 0 0 30px rgba(243, 191, 99, 0.34), 0 16px 38px rgba(201, 135, 51, 0.22);
  filter: brightness(1.08);
}

.front-button.is-activating,
.chapter-play.is-activating,
.shop-buy.is-activating,
.shop-play.is-activating,
.auth-mode-tab.is-activating {
  pointer-events: none;
  animation: front-button-blink 220ms ease-in-out both;
}

.front-button--ghost {
  color: #f7ead6;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.prologue-begin-button:disabled,
.age-gate-button:disabled {
  color: rgba(215, 204, 190, 0.44);
  border-color: rgba(140, 132, 125, 0.22);
  background: linear-gradient(180deg, rgba(53, 51, 54, 0.62), rgba(18, 18, 22, 0.8));
  filter: grayscale(0.72) brightness(0.68);
}

.prologue-begin-button.is-awake,
.age-gate-button.is-awake {
  color: #1c080a;
  border-color: rgba(255, 210, 122, 0.76);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 226, 155, 0.76), transparent 40%),
    linear-gradient(180deg, #d6a346, #831521 58%, #4c0b12);
  box-shadow:
    0 0 36px rgba(165, 23, 34, 0.62),
    0 16px 42px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 238, 190, 0.42);
  animation: prologue-begin-awaken 520ms ease-out both;
}

.prologue-begin-button.is-awake.is-activating,
.age-gate-button.is-awake.is-activating {
  animation: front-button-blink 220ms ease-in-out both;
}

.front-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.front-actions--center {
  justify-content: center;
}

.front-actions .front-button {
  margin-top: 30px;
}

.story-terminal {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  max-height: min(54vh, 500px);
  margin-top: clamp(18px, 3vw, 26px);
  padding: clamp(18px, 3.4vw, 30px);
  border-radius: 8px;
  border: 1px solid rgba(243, 191, 99, 0.14);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.58)),
    rgba(8, 9, 15, 0.82);
  color: rgba(248, 234, 214, 0.88);
  font-size: clamp(1.08rem, 1.55vw, 1.24rem);
  line-height: 1.62;
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-color: rgba(243, 191, 99, 0.68) rgba(255, 255, 255, 0.07);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  mask-image: linear-gradient(180deg, transparent 0%, #000 16%, #000 78%, transparent 100%);
}

.story-terminal::-webkit-scrollbar {
  width: 9px;
}

.story-terminal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
}

.story-terminal::-webkit-scrollbar-thumb {
  border: 2px solid rgba(10, 8, 14, 0.86);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(243, 191, 99, 0.85), rgba(165, 40, 60, 0.72));
}

.front-panel--story h2 {
  text-align: center;
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.88;
  text-transform: uppercase;
}

.story-copy {
  display: grid;
  gap: clamp(8px, 1.4vw, 12px);
  min-height: 100%;
  padding: 0 clamp(4px, 1vw, 10px) 38%;
  transform: translateY(45%);
  opacity: 0.92;
  text-align: center;
  will-change: transform, opacity;
}

.story-copy.is-crawling {
  animation: prologue-crawl 13500ms linear forwards;
}

.story-copy.is-complete {
  transform: translateY(-88%);
  opacity: 0.86;
}

.story-copy p {
  display: block;
  margin: 0;
}

.age-gate-consent {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  width: min(760px, 100%);
  margin: clamp(16px, 2.4vw, 24px) auto 0;
  padding: 14px 16px;
  border: 1px solid rgba(243, 191, 99, 0.2);
  border-radius: 8px;
  background: rgba(5, 7, 13, 0.52);
  color: rgba(247, 234, 214, 0.78);
  font: 700 clamp(0.78rem, 1.08vw, 0.93rem)/1.42 Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.age-gate-consent input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: #a51622;
}

.age-gate-consent:has(input:checked) {
  border-color: rgba(214, 163, 70, 0.64);
  color: rgba(255, 241, 214, 0.94);
  box-shadow: 0 0 22px rgba(165, 23, 34, 0.24);
}

.front-panel--story .front-button {
  margin-top: clamp(18px, 3vw, 26px);
}

@keyframes prologue-begin-awaken {
  0% {
    filter: grayscale(0.8) brightness(0.7);
    transform: translateY(1px) scale(0.98);
  }

  42% {
    filter: saturate(1.45) brightness(1.45);
    transform: translateY(-1px) scale(1.04);
    box-shadow:
      0 0 48px rgba(197, 28, 42, 0.82),
      0 0 18px rgba(255, 222, 142, 0.52);
  }

  100% {
    filter: saturate(1.08) brightness(1.04);
    transform: translateY(0) scale(1);
  }
}

@keyframes title-logo-splash {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    filter:
      blur(6px)
      drop-shadow(0 0 18px rgba(127, 16, 28, 0.18))
      drop-shadow(0 18px 34px rgba(0, 0, 0, 0.46));
  }

  24%,
  64% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter:
      blur(0)
      drop-shadow(0 0 30px rgba(127, 16, 28, 0.42))
      drop-shadow(0 20px 44px rgba(0, 0, 0, 0.56));
  }

  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1.012);
    filter:
      blur(5px)
      drop-shadow(0 0 22px rgba(127, 16, 28, 0.26))
      drop-shadow(0 24px 52px rgba(0, 0, 0, 0.54));
  }
}

@keyframes prologue-crawl {
  0% {
    opacity: 0;
    transform: translateY(45%);
  }

  8% {
    opacity: 1;
  }

  88% {
    opacity: 1;
  }

  100% {
    opacity: 0.86;
    transform: translateY(-88%);
  }
}

@keyframes front-button-blink {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    box-shadow: 0 12px 32px rgba(201, 135, 51, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.38);
  }

  14%,
  42%,
  70% {
    transform: translateY(-1px) scale(1.045);
    filter: brightness(1.72) saturate(1.35);
    box-shadow:
      0 0 38px rgba(243, 191, 99, 0.74),
      0 0 16px rgba(255, 248, 214, 0.52),
      inset 0 1px 0 rgba(255, 255, 255, 0.44);
  }

  28%,
  56%,
  84% {
    transform: translateY(1px) scale(0.97);
    filter: brightness(0.86) saturate(1.02);
    box-shadow:
      0 0 18px rgba(165, 40, 60, 0.5),
      inset 0 0 18px rgba(255, 238, 214, 0.18);
  }

  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1.18);
    box-shadow: 0 0 28px rgba(243, 191, 99, 0.42), 0 12px 32px rgba(201, 135, 51, 0.2);
  }
}

@keyframes higanbana-petal-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -12vh, 0) rotate(var(--petal-tilt));
  }

  9% {
    opacity: 0.82;
  }

  54% {
    opacity: 0.64;
    transform: translate3d(calc(var(--petal-drift) * 0.45), 54vh, 0) rotate(calc(var(--petal-tilt) + 230deg));
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--petal-drift), 116vh, 0) rotate(calc(var(--petal-tilt) + 620deg));
  }
}

@keyframes front-screen-fade-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1) blur(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    filter: brightness(0.72) blur(2px);
  }
}

@keyframes front-screen-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(1.012);
    filter: brightness(1.25) blur(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1) blur(0);
  }
}

.chapter-screen {
  align-items: start;
}

.chapter-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 38px);
  border-radius: 8px;
}

.chapter-topbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 380px);
  gap: clamp(16px, 3vw, 32px);
  align-items: start;
  justify-content: space-between;
  margin: 0 0 clamp(18px, 2.8vw, 28px);
  padding-bottom: clamp(14px, 2vw, 20px);
  border-bottom: 1px solid rgba(243, 191, 99, 0.14);
}

.chapter-topbar:has(.member-dashboard[hidden]):has(.chapter-auth-actions[hidden]) {
  grid-template-columns: minmax(360px, 1fr);
}

.chapter-brand {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.chapter-brand-logo {
  display: block;
  width: min(430px, 42vw);
  max-height: 170px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(165, 23, 34, 0.28));
}

.chapter-heading {
  margin-bottom: 24px;
  text-align: center;
}

.chapter-heading h2 {
  color: rgba(243, 191, 99, 0.94);
  font-family: "Segoe UI", sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.35rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(165, 40, 60, 0.28), 0 8px 28px rgba(0, 0, 0, 0.55);
}

.member-dashboard,
.shop-wallet {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(243, 191, 99, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(165, 40, 60, 0.14), rgba(243, 191, 99, 0.07)),
    rgba(255, 255, 255, 0.035);
}

.member-dashboard {
  width: min(380px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-self: end;
  margin: 0;
}

.chapter-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-self: end;
  align-self: start;
  width: min(340px, 100%);
}

.chapter-auth-actions .front-button {
  flex: 1 1 140px;
  margin-top: 0;
  justify-content: center;
}

.chapter-auth-actions[hidden] {
  display: none;
}

.member-dashboard > div:nth-of-type(3) {
  grid-column: 1 / -1;
}

.member-dashboard .front-button {
  width: 100%;
}

.shop-wallet {
  grid-template-columns: 1.1fr 0.9fr 1.2fr auto;
  margin: 0 0 18px;
}

.member-dashboard[hidden],
.local-member-divider[hidden],
.social-login-list[hidden] {
  display: none;
}

.member-dashboard strong,
.shop-wallet strong {
  display: block;
  margin-top: 4px;
  color: #fff4dc;
  font-size: 1.12rem;
  line-height: 1.1;
}

.member-dashboard__label {
  color: rgba(243, 191, 99, 0.86);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chapter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.chapter-card {
  position: relative;
  min-height: 206px;
  display: grid;
  grid-template-columns: minmax(240px, 31%) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(243, 191, 99, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(22, 18, 27, 0.96), rgba(7, 9, 15, 0.96));
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.chapter-card--available:hover,
.chapter-card--available:focus-within {
  transform: translateY(-3px);
  border-color: rgba(243, 191, 99, 0.58);
  box-shadow: 0 0 36px rgba(243, 191, 99, 0.2), 0 24px 70px rgba(0, 0, 0, 0.45);
  filter: brightness(1.12);
}

.chapter-card--locked {
  opacity: 0.46;
  filter: grayscale(0.7);
}

.chapter-card__image {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(243, 191, 99, 0.1), rgba(165, 40, 60, 0.2)),
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.16), transparent 28%),
    #090b13;
}

.chapter-card__image--demo {
  background:
    linear-gradient(180deg, rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.44)),
    url("assets/backgrounds/demo-village-gate.png") center / cover;
}

.chapter-card__image--chapter-01 {
  background:
    linear-gradient(180deg, rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.48)),
    url("assets/backgrounds/pack-01-shadow-garden.png") center / cover;
}

.chapter-card__image--chapter-02 {
  background:
    linear-gradient(180deg, rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.5)),
    url("assets/backgrounds/pack-02-silver-canal.png") center / cover;
}

.chapter-card__body {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 22px 26px;
}

.chapter-card__body span {
  display: block;
  color: var(--gold);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.chapter-card__body h3 {
  margin: 9px 0 8px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1;
}

.chapter-card__body p {
  min-height: 0;
  max-width: 660px;
  margin: 0 0 16px;
  color: rgba(247, 234, 214, 0.72);
  line-height: 1.45;
}

.chapter-card__body .chapter-price {
  min-height: 0;
  margin-bottom: 14px;
  color: rgba(243, 191, 99, 0.82);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-play {
  padding: 10px 13px;
  font-size: 0.76rem;
}

.front-button:disabled,
.chapter-play:disabled {
  cursor: not-allowed;
  color: rgba(247, 234, 214, 0.52);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.detail-shell {
  width: min(960px, 100%);
}

.chapter-detail {
  display: grid;
  grid-template-columns: minmax(240px, 38%) 1fr;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid rgba(243, 191, 99, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 18, 27, 0.96), rgba(7, 9, 15, 0.98)),
    rgba(8, 8, 15, 0.92);
}

.chapter-detail__image {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(243, 191, 99, 0.1), rgba(165, 40, 60, 0.2)),
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.16), transparent 28%),
    #090b13;
}

.chapter-detail__body {
  min-width: 0;
  padding: clamp(24px, 4vw, 44px);
}

.chapter-detail__body .chapter-status {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--gold);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.chapter-detail__body h2 {
  margin: 0;
  color: #fff4dc;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.chapter-detail__body #detailDescription {
  margin: 20px 0 0;
  color: rgba(247, 234, 214, 0.78);
  font-size: 1.04rem;
  line-height: 1.65;
}

.chapter-detail__body .chapter-price {
  margin: 22px 0 0;
  color: rgba(243, 191, 99, 0.9);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.how-to-play {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.how-to-play__card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(243, 191, 99, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(243, 191, 99, 0.08), rgba(165, 40, 60, 0.08)),
    rgba(255, 255, 255, 0.035);
}

.how-to-play__visual {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-items: center;
  margin-bottom: 8px;
}

.how-to-play kbd {
  display: inline-grid;
  min-width: 32px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(243, 191, 99, 0.34);
  border-bottom-color: rgba(243, 191, 99, 0.62);
  border-radius: 6px;
  color: #120b08;
  background: linear-gradient(180deg, #ffd579, #b97824);
  font: 900 0.78rem "Segoe UI", sans-serif;
  letter-spacing: 0;
  box-shadow: 0 3px 0 rgba(58, 29, 8, 0.55);
}

.how-to-play__card strong {
  display: block;
  color: #fff4dc;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.how-to-play__card span {
  display: block;
  margin-top: 4px;
  color: rgba(247, 234, 214, 0.74);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.86rem;
  line-height: 1.35;
}

.shop-shell {
  width: min(960px, 100%);
}

.shop-wallet {
  grid-template-columns: 1fr auto;
}

.shop-message {
  min-height: 24px;
  margin: 0 0 16px;
  color: rgba(247, 234, 214, 0.76);
  line-height: 1.5;
}

.shop-list {
  display: grid;
  gap: 12px;
}

.shop-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(243, 191, 99, 0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(18, 14, 24, 0.92), rgba(7, 9, 15, 0.94));
}

.shop-item h3 {
  margin: 5px 0 4px;
  font-size: 1.35rem;
  line-height: 1.1;
}

.shop-item p {
  margin: 0;
  color: rgba(247, 234, 214, 0.68);
}

.shop-item strong {
  color: rgba(243, 191, 99, 0.9);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shop-item__status {
  color: var(--gold);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.shop-buy,
.shop-play {
  appearance: none;
  min-width: 84px;
  border: 1px solid rgba(243, 191, 99, 0.48);
  border-radius: 8px;
  padding: 10px 13px;
  color: #160a0d;
  background: linear-gradient(180deg, #ffd98a, #c98733);
  box-shadow: 0 12px 30px rgba(201, 135, 51, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.shop-play {
  color: #f7ead6;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

.shop-play[hidden],
.shop-buy[hidden] {
  display: none;
}

.member-field {
  display: grid;
  gap: 8px;
  margin-top: 26px;
  color: rgba(247, 234, 214, 0.76);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.member-field[hidden] {
  display: none;
}

.member-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(243, 191, 99, 0.24);
  border-radius: 8px;
  padding: 0 14px;
  color: #f7ead6;
  background: rgba(0, 0, 0, 0.28);
  font: 1rem "Segoe UI", sans-serif;
  outline: none;
}

.member-field input:focus {
  border-color: rgba(243, 191, 99, 0.72);
  box-shadow: 0 0 0 3px rgba(243, 191, 99, 0.12);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.auth-mode-tabs[hidden] {
  display: none;
}

.auth-mode-tab {
  min-height: 38px;
  border: 1px solid rgba(243, 191, 99, 0.22);
  border-radius: 8px;
  color: rgba(247, 234, 214, 0.78);
  background: rgba(255, 255, 255, 0.045);
  font: 800 0.72rem "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-mode-tab.is-active {
  border-color: rgba(243, 191, 99, 0.72);
  color: #120b08;
  background: linear-gradient(180deg, #ffd579, #b97824);
}

.email-auth-form {
  display: grid;
  gap: 12px;
}

.email-auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-forgot-row {
  margin-top: -2px;
  text-align: right;
}

.auth-forgot-row[hidden] {
  display: none;
}

.auth-forgot-link {
  border: 0;
  padding: 0;
  color: rgba(243, 191, 99, 0.88);
  background: transparent;
  font: 700 0.84rem "Segoe UI", sans-serif;
  cursor: pointer;
}

.auth-forgot-link:hover,
.auth-forgot-link:focus-visible {
  color: #ffd579;
  text-decoration: underline;
  outline: none;
}

.social-login-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.social-login-button {
  width: 100%;
  margin-top: 0;
  justify-content: center;
}

.social-login-button[hidden] {
  display: none;
}

.auth-status {
  min-height: 22px;
  margin: 14px 0 0;
  color: rgba(243, 191, 99, 0.86);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.local-member-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  color: rgba(247, 234, 214, 0.48);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.local-member-divider::before,
.local-member-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(243, 191, 99, 0.18);
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.experience {
  width: min(1360px, calc(100vw - 28px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(17, 10, 26, 0.92), rgba(8, 11, 19, 0.95)),
    rgba(10, 15, 28, 0.9);
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.masthead,
.hud,
.tips {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.masthead {
  margin-bottom: 18px;
}

.brand-block {
  max-width: 720px;
}

.hero-art {
  margin: 0;
  width: min(240px, 24vw);
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 235, 195, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.45));
}

.eyebrow,
.label,
.chip {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.74rem;
}

.eyebrow,
.chip {
  color: var(--gold);
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.1rem, 4.8vw, 4.2rem);
  line-height: 0.95;
  font-weight: 700;
}

.lead,
.objective-block p {
  margin: 0;
  color: rgba(244, 234, 216, 0.82);
  line-height: 1.55;
}

.objective-block {
  max-width: 300px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  border: 1px solid rgba(243, 191, 99, 0.16);
  background: linear-gradient(180deg, rgba(243, 191, 99, 0.08), rgba(255, 255, 255, 0.03));
}

.hud {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}

.edition-switch {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
}

.edition-link {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(243, 191, 99, 0.14);
  color: rgba(248, 234, 214, 0.72);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.12);
}

.edition-link span {
  color: var(--gold);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.edition-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.edition-link:hover,
.edition-link:focus-visible {
  color: #fff7eb;
  border-color: rgba(243, 191, 99, 0.36);
}

.edition-link.is-active {
  color: #fff7eb;
  border-color: rgba(243, 191, 99, 0.42);
  background:
    linear-gradient(90deg, rgba(143, 37, 63, 0.28), rgba(243, 191, 99, 0.1)),
    rgba(255, 255, 255, 0.04);
}

.hud div,
.tips p {
  margin: 0;
}

.hud strong {
  display: block;
  margin-top: 5px;
  font-size: 1.2rem;
  font-weight: 700;
}

.hud-button {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 86px;
  border: 1px solid rgba(243, 191, 99, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffd579, #b97824);
  color: #120b08;
  font: 800 0.8rem Inter, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(185, 120, 36, 0.18);
}

.hud-button:disabled {
  opacity: 0.44;
  cursor: default;
  box-shadow: none;
}

.editor-hud-link {
  display: none;
}

html[data-debug-build] .editor-hud-link {
  display: grid;
}

.execution-preview-toolbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(243, 191, 99, 0.42);
  border-radius: 14px;
  background: rgba(9, 11, 18, 0.88);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
  color: #fff7eb;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.execution-preview-toolbar[hidden] {
  display: none;
}

.execution-preview-toolbar div {
  min-width: 150px;
}

.execution-preview-toolbar span {
  display: block;
  color: rgba(255, 247, 235, 0.66);
  font: 700 0.62rem Inter, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.execution-preview-toolbar strong {
  display: block;
  margin-top: 2px;
  font: 800 0.82rem Inter, system-ui, sans-serif;
}

.execution-preview-toolbar a {
  min-height: 32px;
  border: 1px solid rgba(243, 191, 99, 0.38);
  border-radius: 10px;
  background: rgba(255, 213, 121, 0.12);
  color: #ffd579;
  padding: 6px 10px;
  font: 800 0.72rem Inter, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 680px) {
  .execution-preview-toolbar {
    top: auto;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: none;
    transform: none;
  }

  .execution-preview-toolbar div {
    min-width: 100%;
    text-align: center;
  }
}

.canvas-frame {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(24, 20, 35, 0.82), rgba(6, 10, 18, 0.95));
}

.canvas-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 -180px 180px rgba(0, 0, 0, 0.26);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
}

.tips {
  margin-top: 14px;
  flex-wrap: wrap;
  color: var(--mist);
}

.tips p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.96rem;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: #fff7eb;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
}

@media (max-width: 960px) {
  body {
    padding: 10px;
  }

  .launcher-mode {
    padding: 0;
  }

  .front-screen {
    width: min(100vw - 20px, 720px);
    padding: 14px 0;
  }

  .front-panel,
  .chapter-shell {
    padding: 22px;
  }

  .front-panel--title {
    padding: 20px 16px 24px;
  }

  .title-logo {
    width: min(100%, 560px);
    max-height: 44vh;
  }

  .chapter-topbar,
  .chapter-topbar:has(.member-dashboard[hidden]),
  .chapter-topbar:has(.member-dashboard[hidden]):has(.chapter-auth-actions[hidden]) {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .member-dashboard,
  .chapter-auth-actions {
    width: 100%;
    justify-self: stretch;
  }

  .front-panel--story {
    max-height: calc(100dvh - 28px);
    padding: 18px;
  }

  .story-terminal {
    min-height: 220px;
    max-height: min(48dvh, 380px);
    margin-top: 12px;
    padding: 14px;
    font-size: 1rem;
    line-height: 1.48;
  }

  .front-panel--story h2 {
    font-size: clamp(2.45rem, 10vw, 3.45rem);
  }

  .story-copy {
    gap: 6px;
  }

  .age-gate-consent {
    grid-template-columns: 20px 1fr;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 12px;
    font-size: 0.76rem;
    line-height: 1.34;
  }

  .front-panel--story .front-button {
    margin-top: 12px;
    padding: 12px 18px;
  }

  .chapter-brand-logo {
    width: min(100%, 360px);
    max-height: 120px;
  }

  .chapter-grid,
  .chapter-detail,
  .member-dashboard,
  .shop-wallet,
  .shop-item {
    grid-template-columns: 1fr;
  }

  .chapter-card {
    grid-template-columns: minmax(210px, 34%) minmax(0, 1fr);
  }

  .chapter-heading h2 {
    font-size: clamp(2.05rem, 7vw, 2.8rem);
    letter-spacing: 0.16em;
  }

  .chapter-card__image {
    min-height: 140px;
  }

  .chapter-detail__image {
    min-height: 180px;
  }

  .how-to-play {
    grid-template-columns: 1fr;
  }

  .experience {
    padding: 14px;
    border-radius: 22px;
  }

  .masthead,
  .hud,
  .tips {
    flex-wrap: wrap;
  }

  .objective-block {
    max-width: none;
  }

  .hero-art {
    width: min(100%, 320px);
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  .front-screen {
    width: min(100vw - 16px, 920px);
    padding: 8px 0;
  }

  .front-panel--story {
    max-height: calc(100dvh - 16px);
    padding: 12px 16px;
  }

  .front-panel--story h2 {
    font-size: clamp(2rem, 7vw, 2.8rem);
  }

  .story-terminal {
    min-height: 116px;
    max-height: 42dvh;
    margin-top: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .story-copy {
    gap: 5px;
  }

  .age-gate-consent {
    grid-template-columns: 18px 1fr;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.68rem;
    line-height: 1.24;
  }

  .age-gate-consent input {
    width: 18px;
    height: 18px;
  }

  .front-panel--story .front-button {
    margin-top: 8px;
    padding: 10px 16px;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .chapter-card {
    grid-template-columns: 1fr;
  }

  .chapter-card__body {
    padding: 18px;
  }

  .chapter-heading h2 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
    letter-spacing: 0.12em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .falling-petal,
  .title-logo,
  .story-copy,
  .story-terminal,
  .front-screen.is-entering,
  .front-screen.is-exiting,
  .front-button.is-activating,
  .chapter-play.is-activating,
  .shop-buy.is-activating,
  .shop-play.is-activating,
  .auth-mode-tab.is-activating {
    animation: none;
  }
}

/* ============================================================
   Demo mode (?mode=demo)
   ============================================================ */

.demo-mode {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #05070d;
}

.full-mode {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #05070d;
}

.full-mode .masthead,
.full-mode .tips {
  display: none;
}

.full-mode .experience {
  width: min(1280px, 100vw);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #05070d;
  box-shadow: none;
}

.full-mode .hud {
  margin: 0;
  padding: 8px 18px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(5, 7, 13, 0.92), rgba(5, 7, 13, 0.72));
  backdrop-filter: none;
}

.full-mode .edition-switch {
  margin: 0;
  padding: 6px 10px;
  background: rgba(5, 7, 13, 0.76);
}

.full-mode .edition-link {
  padding: 7px 10px;
  border-radius: 0;
}

.full-mode .canvas-frame {
  border: 0;
  border-radius: 0;
  background: #05070d;
}

.full-mode .canvas-frame::after {
  display: none;
}

.demo-mode .masthead,
.demo-mode .tips,
.demo-mode .edition-switch {
  display: none;
}

.demo-mode .experience {
  width: min(1280px, 100vw);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #05070d;
  box-shadow: none;
}

.demo-mode .hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 8px 18px 26px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(5, 7, 13, 0.78), rgba(5, 7, 13, 0));
  pointer-events: none;
}

.demo-mode #pauseButton,
html[data-debug-build] .demo-mode .editor-hud-link {
  pointer-events: auto;
}

.demo-mode .canvas-frame {
  border: 0;
  border-radius: 0;
  background: #05070d;
}

.demo-mode .canvas-frame::after {
  display: none;
}

/* ============================================================
   Touch / mobile mode (added by touch-controls.js -> body.touch-mode)
   ============================================================ */

/* Maximise the play area: drop the marketing chrome, fill the screen. */
.touch-mode {
  padding: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  height: 100vh;
  height: 100dvh;
}

.touch-mode .masthead,
.touch-mode .tips {
  display: none;
}

.touch-mode .experience {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #05070d;
  display: flex;
  flex-direction: column;
}

.touch-mode .canvas-frame {
  flex: 1 1 auto;
  border-radius: 0;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070d;
  min-height: 0;
}

.touch-mode.full-mode .edition-switch {
  display: none;
}

.touch-mode .canvas-frame::after {
  display: none;
}

.touch-mode canvas {
  width: min(100vw, calc(100dvh * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
  touch-action: none;
}

.touch-mode.tc-exec-vn canvas {
  width: 100vw;
  height: 100dvh;
  object-fit: cover;
}

/* Compact translucent HUD strip pinned to the top, non-interactive. */
.touch-mode .hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 4px 12px;
  padding-right: calc(86px + env(safe-area-inset-right));
  padding-top: calc(4px + env(safe-area-inset-top));
  gap: 12px;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(5, 7, 13, 0.78), rgba(5, 7, 13, 0));
  border: 0;
  backdrop-filter: none;
  pointer-events: none;
  font-size: 0.7rem;
}

.touch-mode .hud .label {
  font-size: 0.52rem;
  letter-spacing: 0.12em;
}

.touch-mode .hud strong {
  margin-top: 1px;
  font-size: 0.82rem;
}

.touch-mode .hud-button {
  display: none;
}

/* ---- Control overlay ---- */
.touch-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none; /* container ignores touches; buttons opt back in */
}

body:not(.touch-mode) .touch-overlay,
body:not(.touch-mode) .rotate-notice {
  display: none;
}

.launcher-mode.touch-mode .experience,
.launcher-mode.touch-mode .touch-overlay,
.launcher-mode.touch-mode .rotate-notice {
  display: none;
}

.launcher-mode.touch-mode {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-user-select: auto;
  user-select: auto;
}

.tc-cluster {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  gap: 14px;
  align-items: center;
}

.tc-left {
  left: calc(16px + env(safe-area-inset-left));
}

.tc-right {
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  align-items: flex-end;
}

.tc-pause-panel {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.tc-btn {
  pointer-events: auto;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08) 34%, rgba(10, 14, 24, 0.5) 100%),
    rgba(12, 16, 26, 0.36);
  color: #fff7eb;
  font-size: 1.7rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.32),
    inset 0 1px 1px rgba(255, 255, 255, 0.28),
    inset 0 -14px 18px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px) saturate(1.12);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, background 0.05s ease, box-shadow 0.05s ease;
}

.tc-btn.is-active {
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 232, 180, 0.48), rgba(243, 191, 99, 0.18) 42%, rgba(18, 18, 24, 0.54) 100%),
    rgba(243, 191, 99, 0.22);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    inset 0 2px 6px rgba(0, 0, 0, 0.18);
  transform: translateY(2px) scale(0.94);
}

.tc-action {
  width: 64px;
  height: 64px;
  font-size: 1.65rem;
}

.tc-action-pad {
  pointer-events: none;
  display: grid;
  grid-template-columns: 64px 84px;
  grid-template-rows: repeat(2, 64px);
  gap: 10px;
  align-items: center;
  justify-items: center;
  grid-template-areas:
    "jump attack"
    "crouch attack";
}

.tc-attack {
  grid-area: attack;
  width: 84px;
  height: 84px;
  justify-self: end;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 221, 221, 0.36), rgba(204, 62, 82, 0.26) 42%, rgba(74, 16, 28, 0.52) 100%),
    rgba(165, 40, 60, 0.36);
  border-color: rgba(255, 164, 174, 0.46);
  font-size: 2rem;
}

.tc-throw {
  grid-area: throw;
  width: 58px;
  height: 58px;
  background: rgba(243, 191, 99, 0.34);
  border-color: rgba(255, 230, 172, 0.44);
  font-size: 1.45rem;
}

.tc-inspect {
  grid-area: inspect;
  width: 56px;
  height: 56px;
  background: rgba(20, 26, 40, 0.58);
  border-color: rgba(255, 255, 255, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.tc-crouch {
  grid-area: crouch;
  width: 58px;
  height: 58px;
  font-size: 1.2rem;
}

.tc-jump {
  grid-area: jump;
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

.tc-pause {
  grid-area: auto;
  width: 52px;
  height: 52px;
  font-size: 1.15rem;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06) 36%, rgba(10, 13, 22, 0.5) 100%),
    rgba(10, 13, 22, 0.36);
}

.tc-zoom-bar {
  display: none;
  gap: 7px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(8, 10, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.tc-zoom-btn {
  pointer-events: auto;
  min-width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(20, 26, 40, 0.68);
  color: #fff7eb;
  font: 700 1.05rem Georgia, "Times New Roman", serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.tc-zoom-btn.is-active {
  background: rgba(243, 191, 99, 0.42);
}

.tc-zoom-reset {
  min-width: 54px;
  font-size: 0.95rem;
}

.touch-mode.tc-paused .tc-left,
.touch-mode.tc-paused .tc-right {
  display: none;
}

.touch-mode.tc-paused .tc-zoom-bar {
  display: flex;
}

/* Hide gameplay clusters during cutscenes; show the choice bar instead. */
.touch-mode.tc-scene .tc-cluster {
  display: none;
}

.touch-mode.tc-scene .tc-pause-panel {
  display: none;
}

.touch-mode.tc-exec-vn .hud {
  display: none;
}

.execution-vn-mode .hud {
  display: none;
  pointer-events: none;
}

.execution-vn-mode .edition-switch,
.execution-vn-mode .tips {
  display: none;
}

.build-version-badge {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 1000;
  padding: 6px 9px;
  border: 1px solid rgba(243, 191, 99, 0.42);
  border-radius: 6px;
  background: rgba(8, 10, 18, 0.82);
  color: #f7ead6;
  font: 700 12px Georgia, "Times New Roman", serif;
  pointer-events: none;
}

.execution-vn-mode .build-version-badge {
  display: none;
}

.touch-mode.tc-exec-vn .touch-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(50vw, 470px);
  background:
    linear-gradient(90deg, rgba(5, 7, 13, 0), rgba(5, 7, 13, 0.82) 24%, rgba(5, 7, 13, 0.96)),
    linear-gradient(180deg, rgba(82, 30, 38, 0.5), rgba(8, 10, 18, 0.88));
  border-left: 1px solid rgba(243, 191, 99, 0.2);
  pointer-events: none;
}

.tc-exec-dialog {
  display: none;
}

.touch-mode.tc-exec-vn .tc-exec-dialog {
  position: absolute;
  top: calc(22px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(156px + env(safe-area-inset-bottom));
  width: min(47vw, 440px);
  min-width: 330px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 14px;
  border: 1px solid rgba(243, 191, 99, 0.35);
  border-radius: 8px;
  background: rgba(8, 10, 18, 0.78);
  color: #f7ead6;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(7px);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s ease, background 0.06s ease;
}

.touch-mode.tc-exec-vn .tc-exec-dialog[hidden] {
  display: none;
}

.touch-mode.tc-exec-vn .tc-exec-dialog.is-active {
  transform: scale(0.985);
  background: rgba(18, 14, 22, 0.86);
}

.tc-exec-speaker {
  color: rgba(243, 191, 99, 0.96);
  font: 700 0.9rem Georgia, "Times New Roman", serif;
}

.tc-exec-text {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
  touch-action: manipulation;
  color: #fff3df;
  font: 700 clamp(0.96rem, 2.05vw, 1.16rem)/1.36 Georgia, "Times New Roman", serif;
  overflow-wrap: anywhere;
  padding-right: 0;
}

.tc-exec-text::-webkit-scrollbar {
  width: 5px;
}

.tc-exec-text::-webkit-scrollbar-thumb {
  background: rgba(243, 191, 99, 0.4);
  border-radius: 999px;
}

.tc-exec-dialog.is-paginated .tc-exec-hint {
  color: rgba(243, 191, 99, 0.82);
}

.tc-exec-hint {
  color: rgba(247, 234, 214, 0.62);
  font: 700 0.72rem Georgia, "Times New Roman", serif;
  text-align: right;
}

.tc-context {
  position: absolute;
  /* Stacked vertically against the right edge, in the empty space beside the
     centred cutscene portrait — clear of both the character and the bottom
     dialog box. */
  right: calc(14px + env(safe-area-inset-right));
  top: 50%;
  left: auto;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  max-width: 42vw;
}

.touch-mode.tc-exec-vn .tc-context {
  right: calc(14px + env(safe-area-inset-right));
  top: auto;
  bottom: calc(8px + env(safe-area-inset-bottom));
  transform: none;
  width: min(47vw, 440px);
  max-width: min(47vw, 440px);
  gap: 5px;
}

.tc-choice {
  pointer-events: auto;
  min-width: 116px;
  min-height: 58px;
  padding: 10px 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(20, 26, 40, 0.82);
  color: #fff7eb;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, background 0.05s ease;
}

.touch-mode.tc-exec-vn .tc-choice {
  width: 100%;
  min-width: 0;
  min-height: clamp(34px, 8.8dvh, 44px);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: clamp(0.82rem, 1.82vw, 0.98rem);
  line-height: 1.14;
}

.tc-choice.is-active {
  transform: scale(0.94);
  background: rgba(243, 191, 99, 0.34);
}

.tc-choice.tc-advance {
  background: rgba(243, 191, 99, 0.22);
  border-color: rgba(243, 191, 99, 0.5);
}

.tc-choice.tc-danger {
  background: rgba(165, 40, 60, 0.62);
  border-color: rgba(243, 140, 150, 0.5);
}

.tc-choice.tc-soft {
  background: rgba(20, 26, 40, 0.62);
  border-color: rgba(255, 255, 255, 0.2);
}

.tc-choice.tc-zoom-image {
  background: rgba(12, 16, 26, 0.72);
  border-color: rgba(126, 215, 154, 0.46);
  color: #d7f6dc;
}

/* ---- Rotate-to-landscape notice ---- */
.rotate-notice {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: #05070d;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

.rotate-notice .rotate-icon {
  font-size: 3.4rem;
  animation: tc-rotate-hint 1.8s ease-in-out infinite;
}

.rotate-notice p {
  margin: 0;
  font-size: 1.15rem;
  color: rgba(244, 234, 216, 0.85);
}

@keyframes tc-rotate-hint {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(78deg); }
}

/* Show the rotate prompt (and hide controls) only on touch + portrait. */
@media (orientation: portrait) {
  .touch-mode .rotate-notice {
    display: flex;
  }
  .touch-mode .touch-overlay {
    display: none;
  }
}
