/* ==========================================================================
   The Business Owner's Book of Horrors — Create & Reach VA Services
   styles.css (mobile-first)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   BRAND COLORS — REPLACE: swap the four --cnr-* values with CNR's official
   hex codes. Everything branded (buttons, highlights, final chapter,
   certificate) reads from these variables.
   -------------------------------------------------------------------------- */
:root {
  /* CNR brand (placeholders) */
  --cnr-pink: #e2497d;
  --cnr-orange: #f4a43a;
  --cnr-purple: #8a76c4;
  --cnr-neutral: #fbf5ee;

  /* Night palette */
  --ink-black: #06080f;
  --charcoal: #0f1420;
  --midnight: #172644;
  --navy: #0b1428;
  --candle: #ffbe5c;
  --amber: #ff8a1f;
  --page-1: #151c2b;
  --page-2: #0d121d;
  --text: #ece8df;
  --text-soft: #c2c7d3;
  --line: rgba(255, 190, 92, 0.24);
  --moon: #dfe8fa;
  --pumpkin: #ff8a1f;
  --ok: #8fd6a8;
  --warn: #ffb27a;

  /* Optional photo behind the opening illustration — REPLACE: to use one, add the file and change to
     url("assets/images/office-night.jpg"). Left as none so no missing-file request is made. */
  --scene-photo: none;

  /* Typography — REPLACE fonts here (and the Google Fonts link in index.html) */
  --font-display: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  --font-heading: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-story: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --topbar-h: 58px;
  --radius: 14px;
  --turn-ms: 750ms;
  --ease-page: cubic-bezier(0.45, 0.05, 0.25, 1);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;            /* the book is not a scrolling page */
  background: radial-gradient(120% 90% at 50% 0%, var(--midnight) 0%, var(--navy) 45%, var(--ink-black) 100%);
  background-color: var(--ink-black);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 2.4s ease, color 1.6s ease;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

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

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--candle); color: #1a1208; padding: 10px 14px; border-radius: 8px; font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 10px; }

[tabindex="-1"]:focus { outline: none; }   /* headings receive focus for screen readers only */

:focus-visible {
  outline: 3px solid var(--candle);
  outline-offset: 3px;
  border-radius: 6px;
}

.noscript { position: fixed; inset: auto 16px 16px; padding: 16px; background: #000; color: #fff; z-index: 200; }

/* --------------------------------------------------------------------------
   3. ATMOSPHERE: fog, dust, shadows, cobwebs
   -------------------------------------------------------------------------- */
.atmos { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.fog {
  position: absolute; left: -50%; width: 200%; height: 60%;
  background:
    radial-gradient(40% 50% at 20% 60%, rgba(200, 190, 230, 0.10), transparent 70%),
    radial-gradient(35% 45% at 60% 40%, rgba(180, 170, 220, 0.08), transparent 70%),
    radial-gradient(30% 40% at 85% 70%, rgba(210, 200, 240, 0.07), transparent 70%);
  filter: blur(8px);
  transition: opacity 3s ease;
}
.fog-1 { bottom: -10%; animation: fogDrift 60s linear infinite; }
.fog-2 { bottom: 10%; opacity: .7; animation: fogDrift 90s linear infinite reverse; }
.fog-3 { top: -15%; opacity: .45; animation: fogDrift 120s linear infinite; }

@keyframes fogDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(25%); }
}

.atmos-shadow {
  position: absolute; inset: -20%;
  background: linear-gradient(105deg, transparent 30%, rgba(0, 0, 0, 0.35) 45%, transparent 60%);
  animation: shadowSweep 28s ease-in-out infinite alternate;
}
@keyframes shadowSweep {
  from { transform: translateX(-25%); }
  to   { transform: translateX(25%); }
}

.dust { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .8; transition: opacity 2s ease; }

.cobweb { position: absolute; width: 90px; height: 90px; opacity: .14; transition: opacity 2s ease; }
.cobweb path { stroke: #e6dccf; stroke-width: .8; fill: none; }
.cobweb-tl { top: var(--topbar-h); left: 0; }
.cobweb-br { bottom: 0; right: 0; transform: rotate(180deg); }

.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  transition: opacity 2s ease;
}

.sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 45% at 50% 18%, rgba(120, 150, 205, 0.32), transparent 70%),
    linear-gradient(to bottom, #0e1a33 0%, #0a1226 55%, #05070d 100%);
  transition: background 3s ease;
}
.moon {
  position: absolute; left: 50%; top: 9vh; width: min(34vw, 220px); aspect-ratio: 1; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(circle, #f2f6ff 0 28%, rgba(210, 225, 250, .45) 34%, rgba(130, 160, 215, .12) 55%, transparent 70%);
  opacity: .55; transition: opacity 3s ease, transform 3s ease;
}
.clouds {
  position: absolute; left: -30%; width: 160%; height: 45%; top: -6%;
  background:
    radial-gradient(28% 40% at 15% 50%, rgba(8, 12, 22, .95), transparent 70%),
    radial-gradient(30% 45% at 45% 35%, rgba(12, 18, 32, .9), transparent 70%),
    radial-gradient(26% 40% at 78% 55%, rgba(8, 12, 22, .95), transparent 70%);
  animation: cloudDrift 140s linear infinite alternate;
}
.clouds-2 { top: 4%; opacity: .6; animation-duration: 200s; animation-direction: alternate-reverse; }
@keyframes cloudDrift { from { transform: translateX(-8%); } to { transform: translateX(8%); } }

.lightning { position: absolute; inset: 0; opacity: 0; background: radial-gradient(70% 60% at var(--bx, 30%) 10%, rgba(200, 215, 255, .5), rgba(150, 175, 230, .12) 50%, transparent 75%); }
.lightning .bolt { position: absolute; left: var(--bx, 30%); top: 0; width: 70px; height: 46vh; translate: -50% 0; opacity: 0; }
.lightning .bolt path { fill: #eaf0ff; filter: drop-shadow(0 0 8px #b8c8ff); }
.lightning.is-flash { animation: softFlash 1.6s ease-out; }
.lightning.is-flash .bolt { animation: boltShow 0.9s ease-out; }
@keyframes softFlash { 0% { opacity: 0; } 8% { opacity: .55; } 30% { opacity: .2; } 100% { opacity: 0; } }
@keyframes boltShow { 0% { opacity: 0; } 6% { opacity: .9; } 40% { opacity: .4; } 100% { opacity: 0; } }

.fence { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 64px; opacity: .9; }
.corner-jack { position: absolute; bottom: 6px; width: 74px; height: 68px; filter: drop-shadow(0 0 16px rgba(255, 138, 31, .5)); animation: jackGlow 5s ease-in-out infinite; }
.corner-jack-l { left: 8px; }
.corner-jack-r { right: 8px; width: 56px; }
@keyframes jackGlow { 50% { filter: drop-shadow(0 0 26px rgba(255, 138, 31, .75)); } }
@media (min-width: 900px) { .corner-jack { width: 110px; height: 100px; } .corner-jack-r { width: 84px; } }

.dawn-glow { position: absolute; inset: 0; opacity: 0; transition: opacity 3s ease; }

/* --------------------------------------------------------------------------
   4. TOP BAR + MENU
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; padding-top: env(safe-area-inset-top);
  background: linear-gradient(to bottom, rgba(5, 8, 16, 0.94), rgba(5, 8, 16, 0.6));
  border-bottom: 1px solid rgba(246, 198, 122, 0.12);
  backdrop-filter: blur(6px);
  transition: background 2s ease, border-color 2s ease;
}

.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand-logo { width: 36px; height: 36px; display: block; object-fit: contain; border-radius: 50%; }
.brand-text { display: none; font-family: var(--font-heading); font-weight: 700; letter-spacing: .12em; color: var(--candle); }
.brand-text.show-text { display: inline; }

.progress { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.progress-label {
  font-family: var(--font-heading); font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--candle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.progress-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.progress-dots li {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid rgba(246, 198, 122, 0.55); background: transparent;
  transition: background .4s ease, transform .4s ease;
}
.progress-dots li.done { background: var(--candle); }
.progress-dots li.current { transform: scale(1.45); border-color: var(--cnr-pink); }

.topbar-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(246, 198, 122, 0.25);
  font-size: 13px; font-weight: 600;
}
.icon-btn:hover { background: rgba(246, 198, 122, 0.12); }
.ico { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.ico path[fill="none"] { fill: none; }
.sound-label, .menu-toggle span { display: none; }
.sound-toggle .ico-sound-on { display: none; }
.sound-toggle[aria-pressed="true"] .ico-sound-on { display: block; }
.sound-toggle[aria-pressed="true"] .ico-sound-off { display: none; }
.sound-toggle[aria-pressed="true"] { border-color: var(--cnr-pink); }

.book-menu {
  position: absolute; top: calc(var(--topbar-h) + 6px); right: 10px;
  display: none; flex-direction: column; min-width: 230px; padding: 8px;
  background: #0c1220; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.book-menu.is-open { display: flex; }
.menu-item {
  text-align: left; padding: 12px 12px; border-radius: 8px; background: none; border: 0;
  font-size: 15px; font-weight: 500;
}
.menu-item:hover { background: rgba(246, 198, 122, 0.1); }
.menu-item[aria-pressed="true"]::after { content: " ✓"; color: var(--candle); }
.menu-item[disabled] { opacity: .45; cursor: not-allowed; }
.menu-exit { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }

@media (min-width: 560px) {
  .sound-label, .menu-toggle span { display: inline; }
}

@media (min-width: 1100px) {
  .menu-toggle { display: none; }
  .book-menu {
    position: static; display: flex; flex-direction: row; flex-wrap: nowrap; min-width: 0;
    padding: 0; background: none; border: 0; box-shadow: none; gap: 2px; order: 3;
  }
  .menu-item { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .menu-exit { border: 0; margin: 0; border-radius: 8px; }
  .progress { order: 0; }
  .topbar-actions { order: 4; }
}

/* --------------------------------------------------------------------------
   5. STAGE + PAGES (one visible at a time)
   -------------------------------------------------------------------------- */
.stage {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; z-index: 10;
  perspective: 2200px;
  outline: none;
}

.page {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.page-chapter { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }

.page-inner {
  position: relative;
  max-width: 820px; height: 100%; margin: 0 auto;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 18px 22px;
  border-radius: 6px 14px 14px 6px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0, rgba(0, 0, 0, 0.15) 14px, transparent 34px),
    radial-gradient(120% 80% at 70% 0%, rgba(160, 185, 235, 0.08), transparent 60%),
    radial-gradient(80% 50% at 10% 100%, rgba(255, 138, 31, 0.06), transparent 70%),
    linear-gradient(160deg, var(--page-1), var(--page-2));
  border: 1px solid rgba(246, 198, 122, 0.18);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(0, 0, 0, 0.45),
    6px 0 0 -2px #0d1220, 9px 0 0 -3px #090d18;   /* stacked page edges */
  scrollbar-width: thin; scrollbar-color: rgba(246, 198, 122, .35) transparent;
  transition: background 2.4s ease, border-color 2s ease, color 1.6s ease;
}
/* corner filigree */
.page-inner::before, .page-inner::after {
  content: ""; position: absolute; width: 46px; height: 46px; pointer-events: none;
  border: 1px solid rgba(246, 198, 122, 0.35);
}
.page-inner::before { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.page-inner::after { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; opacity: .6; }

@media (min-width: 600px) { .activity { padding: 18px 18px; } }
@media (min-width: 720px) {
  .page-chapter { padding: 18px 24px 22px; }
  .page-inner { padding: 40px 48px 28px 56px; }
}

/* ---- Page-turn animations ---- */
.page.turn-forward  { z-index: 3; transform-origin: left center; animation: turnAway var(--turn-ms) var(--ease-page) forwards; }
.page.enter-forward { z-index: 2; animation: revealUnder var(--turn-ms) ease forwards; }
.page.turn-back     { z-index: 2; animation: sinkUnder var(--turn-ms) ease forwards; }
.page.enter-back    { z-index: 3; transform-origin: left center; animation: turnIn var(--turn-ms) var(--ease-page) forwards; }

@keyframes turnAway {
  0%   { transform: rotateY(0deg); filter: brightness(1); }
  60%  { opacity: 1; }
  100% { transform: rotateY(-115deg); filter: brightness(.35); opacity: 0; }
}
@keyframes turnIn {
  0%   { transform: rotateY(-115deg); filter: brightness(.35); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: rotateY(0deg); filter: brightness(1); opacity: 1; }
}
@keyframes revealUnder {
  from { filter: brightness(.45); transform: scale(.985); }
  to   { filter: brightness(1); transform: scale(1); }
}
@keyframes sinkUnder {
  from { filter: brightness(1); opacity: 1; }
  to   { filter: brightness(.4); opacity: .6; }
}

/* --------------------------------------------------------------------------
   6. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: .02em; text-align: center;
  border: 1px solid transparent; transition: transform .15s ease, box-shadow .25s ease, background .25s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
  background: linear-gradient(135deg, var(--candle), var(--amber));
  color: #1d1206;
  box-shadow: 0 0 0 1px rgba(255, 220, 160, 0.4) inset, 0 8px 28px rgba(232, 163, 61, 0.35);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(255, 220, 160, 0.6) inset, 0 10px 34px rgba(232, 163, 61, 0.5); }

.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: rgba(246, 198, 122, 0.45); color: var(--text); }
.btn-ghost:hover { background: rgba(246, 198, 122, 0.12); }

.btn-text { background: none; border: 0; color: var(--text-soft); padding: 10px 8px; min-height: 44px; font-weight: 600; }
.btn-text:hover { color: var(--candle); }
.btn-text[disabled] { opacity: .35; cursor: not-allowed; }

.btn-turn {
  background: linear-gradient(135deg, var(--cnr-pink), var(--cnr-purple));
  color: #fff; box-shadow: 0 8px 30px color-mix(in srgb, var(--cnr-pink) 40%, transparent);
  animation: turnPulse 2.8s ease-in-out infinite;
}
@keyframes turnPulse {
  0%, 100% { box-shadow: 0 8px 26px color-mix(in srgb, var(--cnr-pink) 30%, transparent); }
  50%      { box-shadow: 0 8px 40px color-mix(in srgb, var(--cnr-pink) 60%, transparent); }
}

/* --------------------------------------------------------------------------
   7. OPENING SCENE
   -------------------------------------------------------------------------- */
.page-intro { overflow-y: auto; overscroll-behavior: contain; }

.intro-scene {
  position: fixed; left: 0; right: 0; bottom: 0; height: 46vh; height: 46dvh;
  background: var(--scene-photo) center / cover no-repeat;
  transition: transform 1.4s var(--ease-page), opacity 1.2s ease;
  transform-origin: 50% 78%;
  pointer-events: none;
}
.office-scene { width: 100%; height: 100%; display: block; }
.intro-scene::after {   /* fade scene into the text area */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(10, 18, 38, 1) 0%, rgba(10, 18, 38, .55) 20%, rgba(10, 18, 38, 0) 44%);
}
.page-intro.is-opening .intro-scene { transform: scale(1.5) translateY(6%); opacity: .35; transition-delay: .5s; }

.lamp-glow, .lamp-bulb, .lantern-glow, .lantern-flame { animation: lampFlicker 7s ease-in-out infinite; }
.lantern:nth-of-type(2) .lantern-glow, .lantern:nth-of-type(2) .lantern-flame { animation-delay: -3s; }
.jack-face { animation: jackFace 4s ease-in-out infinite; }
@keyframes jackFace { 50% { opacity: .78; } }
.gate-fog { animation: screenBreath 9s ease-in-out infinite; }
.storm-clouds { animation: blindShift 30s ease-in-out infinite alternate; }
.gate-leaf { transform-box: fill-box; transition: transform 1.6s var(--ease-page); }
.gate-left { transform-origin: left center; }
.gate-right { transform-origin: right center; }
.page-intro.is-opening .gate-left, .page-intro.is-opening .gate-right { transform: scaleX(.18); }
.book-aura { animation: screenBreath 4s ease-in-out infinite; }
@keyframes lampFlicker {   /* gentle; never a rapid flash */
  0%, 100% { opacity: 1; }
  42% { opacity: .92; }
  45% { opacity: .78; }
  48% { opacity: .95; }
  70% { opacity: .88; }
}
.screen-glow { animation: screenBreath 5s ease-in-out infinite; }
@keyframes screenBreath { 50% { opacity: .7; } }
.notif-badge, .screen-notifs circle { animation: badgePulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes badgePulse { 50% { transform: scale(1.15); } }
.cal-glow { animation: calGlow 4s ease-in-out infinite; }
@keyframes calGlow { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.blind-light { animation: blindShift 16s ease-in-out infinite alternate; }
@keyframes blindShift { from { transform: translateX(-12px); } to { transform: translateX(14px); } }

.intro-card {
  position: relative; z-index: 2;
  max-width: 640px; margin: 0 auto; padding: 28px 22px 40vh;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85);
  text-align: center;
  animation: cardIn .9s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.eyebrow {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--text-soft);
}
.book-title {
  margin: 0; font-family: var(--font-heading); font-weight: 500; font-size: clamp(20px, 5.4vw, 30px);
  letter-spacing: .06em; line-height: 1.15; color: var(--text);
}
.book-title span {
  display: block; margin-top: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(36px, 11vw, 74px); line-height: 1.02;
  color: var(--candle);
  text-shadow: 0 0 18px rgba(255, 170, 70, 0.55), 0 0 46px rgba(255, 120, 20, 0.35);
}
.tagline { margin: 16px auto 0; max-width: 34em; font-family: var(--font-story); font-style: italic; font-size: 19px; color: var(--text-soft); }
.intro-divider { width: 120px; height: 1px; margin: 22px auto; background: linear-gradient(90deg, transparent, var(--candle), transparent); }
.intro-hook { margin: 0; font-family: var(--font-heading); font-size: clamp(19px, 4.6vw, 26px); color: var(--text); letter-spacing: .03em; }
.intro-copy { margin: 12px auto 0; max-width: 32em; color: var(--text-soft); }
.intro-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 26px; }
.intro-step-title { margin: 0; font-family: var(--font-heading); font-size: 28px; color: var(--candle); }
.vision-text {
  margin: 10vh 0 0; font-family: var(--font-story); font-size: clamp(24px, 6vw, 36px); line-height: 1.35; outline: none;
}
.vision-text em { display: block; margin-top: 14px; color: var(--candle); font-size: .82em; }

@media (min-width: 720px) {
  .intro-scene { height: 52vh; }
  .intro-card { padding-top: 6vh; padding-bottom: 46vh; }
  .intro-actions { flex-direction: row; justify-content: center; }
}
@media (min-width: 720px) and (min-aspect-ratio: 4/3) {
  .page-intro { background: linear-gradient(90deg, rgba(6, 9, 18, .9) 0%, rgba(8, 14, 30, .55) 40%, transparent 70%); }
  .intro-scene { height: 100%; left: 30%; }
  .intro-scene::after { background: linear-gradient(to right, rgba(8, 13, 27, 1) 0%, rgba(8, 13, 27, .6) 18%, rgba(8, 13, 27, 0) 45%); }
  .intro-card { margin: 0 0 0 5vw; padding: 9vh 24px 40px; text-align: left; max-width: 560px; }
  .intro-divider { margin-left: 0; }
  .intro-copy, .tagline { margin-left: 0; }
  .intro-actions { justify-content: flex-start; }
}

/* --------------------------------------------------------------------------
   8. CHAPTER TYPOGRAPHY
   -------------------------------------------------------------------------- */
.chapter-kicker {
  margin: 0 0 6px; font-family: var(--font-heading); font-size: 12px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--cnr-pink);
}
.chapter-title {
  margin: 0 0 18px; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(28px, 7.5vw, 46px); line-height: 1.08; color: var(--candle);
  text-shadow: 0 0 16px rgba(246, 198, 122, 0.4);
  outline: none;
}
.page.is-active .chapter-title { animation: inkIn 1.2s ease both; }
@keyframes inkIn {
  from { opacity: 0; letter-spacing: .08em; filter: blur(4px); }
  to   { opacity: 1; letter-spacing: 0; filter: blur(0); }
}

.story { font-family: var(--font-story); font-size: 21px; line-height: 1.45; color: var(--text); }
.story p { margin: 0 0 12px; }
.story-sting { color: var(--candle); font-style: italic; }

.activity {
  margin: 22px 0 8px; padding: 14px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(8, 6, 12, 0.45);
}
.activity-prompt { margin: 14px 0 10px; font-weight: 600; color: var(--text); }
.hint { min-height: 1.5em; margin: 10px 0 0; color: var(--warn); font-size: 15px; }
.small-note { margin: 8px 0 0; font-size: 14px; color: var(--text-soft); }
.tray-title {
  margin: 0 0 10px; font-family: var(--font-heading); font-size: 14px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--candle);
}
.tray-help { margin: 0 0 12px; font-size: 14px; color: var(--text-soft); }
.success-msg {
  margin: 16px 0 0; padding: 12px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent);
  color: #d6f5e1; font-weight: 700; text-align: center;
}

/* ---- resolution + team card ---- */
.resolution { margin-top: 18px; opacity: 0; transform: translateY(10px); transition: opacity .8s ease, transform .8s ease; }
.resolution.is-visible { opacity: 1; transform: none; }
.final-line {
  margin: 0 0 14px; font-family: var(--font-story); font-style: italic; font-size: 24px; line-height: 1.3; color: var(--candle);
  text-shadow: 0 0 14px rgba(246, 198, 122, 0.3);
}
.team-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px;
  border-radius: var(--radius); background: rgba(246, 198, 122, 0.06); border: 1px solid var(--line);
}
.team-avatars { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.avatar {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
}
.avatar-owner { background: linear-gradient(135deg, var(--candle), var(--amber)); color: #2a1a06; }
.avatar-va { background: linear-gradient(135deg, var(--cnr-pink), var(--cnr-purple)); color: #fff; }
.team-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; color: var(--text-soft); }
.team-tasks strong { color: var(--text); }

/* ---- footer ---- */
.page-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
}
.lock-hint { flex: 1 1 160px; margin: 0; font-size: 14px; color: var(--text-soft); text-align: center; }
.lock-hint::before { content: "🔒 "; }
.lock-hint.unlocked::before { content: "✦ "; color: var(--candle); }
@media (max-width: 519px) {
  .page-foot { flex-direction: column-reverse; align-items: stretch; }
  .page-foot .btn-turn { width: 100%; }
}

/* --------------------------------------------------------------------------
   9. CHAPTER 1 — silent inbox
   -------------------------------------------------------------------------- */
.device-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mock-inbox {
  grid-column: 1 / -1; padding: 12px; border-radius: 10px; background: #0e1424; border: 1px solid #28344f;
}
.mock-head { display: flex; align-items: center; gap: 5px; margin-bottom: 10px; }
.mock-head .dot { width: 8px; height: 8px; border-radius: 50%; background: #33405e; }
.mock-title { margin-left: 8px; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.mock-empty { padding: 16px; text-align: center; font-size: 14px; color: #9aa5bb; font-style: italic; }
.mock-lines { display: grid; gap: 6px; }
.mock-lines span { height: 8px; border-radius: 4px; background: #1a2337; }
.mock-phone {
  padding: 14px 10px; border-radius: 18px; background: #0c111d; border: 2px solid #28344f; text-align: center;
}
.phone-notch { width: 40px; height: 5px; border-radius: 3px; margin: 0 auto 10px; background: #28344f; }
.phone-time { font-family: var(--font-heading); font-size: 20px; color: var(--text); }
.phone-status { font-size: 13px; color: #9aa5bb; }
.lead-counter {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px dashed rgba(246, 198, 122, 0.4); padding: 10px;
}
.counter-num { font-family: var(--font-display); font-size: 52px; line-height: 1; color: #d7dfee; text-shadow: 0 0 12px rgba(200, 190, 255, .3); }
.counter-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-soft); text-align: center; }
@media (min-width: 600px) {
  .device-row { grid-template-columns: 2fr 1fr 1fr; }
  .mock-inbox { grid-column: auto; }
}

.notif-zone { min-height: 10px; margin-top: 14px; }
.notif-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--cnr-pink);
  background: linear-gradient(135deg, rgba(233, 85, 154, 0.18), rgba(138, 79, 196, 0.18));
  animation: notifIn .6s var(--ease-page) both, notifGlow 2.4s ease-in-out .6s infinite;
}
.notif-btn .bell { font-size: 26px; }
.notif-btn strong { display: block; font-size: 16px; }
.notif-btn span.sub { font-size: 14px; color: var(--text-soft); }
@keyframes notifIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes notifGlow { 50% { box-shadow: 0 0 26px color-mix(in srgb, var(--cnr-pink) 45%, transparent); } }

.notif-reveal {
  padding: 16px; border-radius: 14px; background: #111a2b; border: 1px solid #2f3d5c;
  display: flex; gap: 14px; align-items: center; animation: notifIn .5s ease both;
}
.notif-reveal .gear { font-size: 30px; animation: slowSpin 8s linear infinite; display: inline-block; }
@keyframes slowSpin { to { transform: rotate(360deg); } }
.notif-reveal strong { display: block; font-size: 18px; }
.notif-reveal p { margin: 2px 0 0; font-size: 14px; color: var(--text-soft); }

/* --------------------------------------------------------------------------
   10. CHAPTER 2 — haunted calendar
   -------------------------------------------------------------------------- */
.haunted-calendar { border-radius: 12px; overflow: hidden; border: 1px solid #2a3754; background: #10172a; }
.cal-head {
  display: flex; justify-content: space-between; padding: 10px 14px;
  background: linear-gradient(90deg, #5a2a0c, #1d2b48); font-family: var(--font-heading); font-size: 14px; letter-spacing: .08em;
}
.cal-date { color: var(--candle); }
.cal-slots { list-style: none; margin: 0; padding: 6px; display: grid; gap: 6px; }
.cal-slot { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: stretch; min-height: 52px; }
.cal-time { align-self: center; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.cal-appt {
  position: relative; display: flex; flex-direction: column; justify-content: center; padding: 8px 12px;
  border-radius: 8px; background: #1b2640; border-left: 4px solid var(--cnr-purple); font-size: 14px; text-align: left;
  border-top: 0; border-right: 0; border-bottom: 0; color: var(--text); overflow: hidden;
}
.cal-appt small { color: var(--text-soft); font-size: 12px; }
.cal-appt.is-flicker { border-left-color: var(--cnr-pink); animation: apptFlicker 3.2s ease-in-out infinite; }
@keyframes apptFlicker {   /* soft and slow (below 3 flashes per second) */
  0%, 100% { opacity: 1; box-shadow: 0 0 0 transparent; }
  50% { opacity: .55; box-shadow: 0 0 18px color-mix(in srgb, var(--cnr-pink) 50%, transparent); }
}
.cal-appt.is-cancelled { animation: none; opacity: .7; background: #141b2a; border-left-color: #4a5670; }
.stamp {
  position: absolute; right: 10px; top: 50%; translate: 0 -50%;
  padding: 2px 10px; border: 3px solid #e2557f; border-radius: 6px;
  color: #ff7aa2; font-family: var(--font-heading); font-weight: 700; letter-spacing: .14em; font-size: 14px;
  rotate: -10deg; animation: stampIn .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes stampIn { from { opacity: 0; scale: 2; } to { opacity: .95; scale: 1; } }
.cal-open {
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
  border: 1px dashed rgba(246, 198, 122, 0.4); background: transparent; color: var(--text-soft); font-size: 14px; font-weight: 600;
  min-height: 48px;
}
.cal-open:not([disabled]):hover { background: rgba(246, 198, 122, 0.1); color: var(--candle); }
.cal-open[disabled] { cursor: default; opacity: .7; }
.cal-open.is-ready { border-color: var(--candle); color: var(--candle); animation: readyPulse 2s ease-in-out infinite; }
@keyframes readyPulse { 50% { background: rgba(246, 198, 122, 0.1); } }
.cal-appt.is-placed { border-left-color: var(--ok); animation: placeIn .5s ease both; }
@keyframes placeIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.tray { margin-top: 14px; }
.tray-cards { display: grid; gap: 10px; }
.pick-card {
  text-align: left; padding: 12px 14px; border-radius: 10px; background: #162034; border: 1px solid #2c3b58; font-size: 15px;
}
.pick-card small { display: block; color: var(--text-soft); font-size: 13px; }
.pick-card[aria-pressed="true"] { border-color: var(--candle); box-shadow: 0 0 0 2px rgba(246, 198, 122, 0.35); background: #1f2c45; }
@media (min-width: 600px) { .tray-cards { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------------------
   11. CHAPTER 3 — countdown + roster
   -------------------------------------------------------------------------- */
.job-card { padding: 14px 16px; border-radius: 12px; background: #141d30; border: 1px solid #2b3a56; }
.job-time { margin: 0; font-size: 13px; font-weight: 700; color: var(--cnr-orange); text-transform: uppercase; letter-spacing: .1em; }
.job-name { margin: 4px 0; font-family: var(--font-heading); font-size: 18px; }
.job-assigned { margin: 0; color: var(--text-soft); font-size: 15px; }
.fading-name { font-weight: 700; color: var(--text); transition: opacity 2s ease, filter 2s ease; }
.fading-name.is-faded { opacity: .2; filter: blur(2px); text-decoration: line-through; }
.fading-name.is-replaced { opacity: 1; filter: none; text-decoration: none; color: var(--ok); }
.job-gap { color: var(--warn); font-weight: 700; }
.ch3-start { margin-top: 14px; text-align: center; }
.countdown { margin-top: 14px; }
.countdown-bar { height: 10px; border-radius: 6px; background: #212c42; overflow: hidden; }
.countdown-bar span {
  display: block; height: 100%; width: 100%; transform-origin: left center;
  background: linear-gradient(90deg, var(--cnr-orange), var(--cnr-pink));
  transition: transform 1s linear;
}
.countdown-text { margin: 6px 0 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.roster { margin-top: 14px; }
.roster-list { display: grid; gap: 8px; }
.roster-btn {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; border-radius: 10px; background: #162034; border: 1px solid #2c3b58; min-height: 52px;
}
.roster-btn .status { font-size: 13px; font-weight: 700; }
.roster-btn .status.free { color: var(--ok); }
.roster-btn .status.busy { color: var(--warn); }
.roster-btn.is-chosen { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, #162034); }
.ch3-retry { margin-top: 12px; text-align: center; padding: 14px; border-radius: 12px; border: 1px solid var(--line); }
.ch3-retry p { margin: 0 0 10px; }
@media (min-width: 600px) { .roster-list { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------------------
   12. CHAPTER 4 — short-staffed
   -------------------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px 6px; border-radius: 10px; background: #141d30; border: 1px solid #2b3a56; text-align: center; }
.stat-num { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); }
.stat-warn .stat-num { color: var(--warn); }
.job-list { display: grid; gap: 8px; }
.job-toggle {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 10px; background: #162034; border: 1px solid #2c3b58;
  animation: placeIn .4s ease both;
}
.job-toggle .job-t { font-weight: 700; }
.job-toggle .job-d { grid-column: 1 / 2; font-size: 13px; color: var(--text-soft); }
.job-toggle .prio {
  grid-row: 1 / 3; grid-column: 2; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
}
.prio-high { background: color-mix(in srgb, var(--cnr-pink) 25%, transparent); color: #ffc2dc; }
.prio-flex { background: rgba(255, 255, 255, 0.07); color: var(--text-soft); }
.job-toggle[aria-pressed="true"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, #162034); }
.job-toggle[aria-pressed="true"] .job-t::before { content: "✓ "; color: var(--ok); }
.job-toggle .assigned-to { grid-column: 1 / -1; font-size: 13px; color: var(--ok); font-weight: 600; }

/* --------------------------------------------------------------------------
   13. CHAPTER 5 — ghost invoices
   -------------------------------------------------------------------------- */
.ghost-arena {
  position: relative; height: 260px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(80% 70% at 50% 60%, rgba(138, 79, 196, 0.15), transparent 70%), #0b111e;
  border: 1px solid #26334d;
}
.ghost-inv {
  position: absolute; width: 112px; padding: 8px 10px; border-radius: 8px 8px 18px 18px;
  background: linear-gradient(180deg, rgba(240, 232, 220, 0.92), rgba(220, 210, 235, 0.55));
  color: #2a2030; text-align: left; border: 0;
  box-shadow: 0 0 22px rgba(220, 210, 255, 0.25);
  font-size: 12px;
}
.ghost-inv strong { display: block; font-size: 13px; }
.ghost-inv .st { display: inline-block; margin-top: 4px; padding: 2px 6px; border-radius: 4px; font-weight: 800; font-size: 11px; background: rgba(0,0,0,.08); }
.ghost-inv.is-unpaid .st { background: #8f2a4f; color: #fff; }
.ghost-inv.g1 { left: 6%;  top: 10%; animation: floatA 7s ease-in-out infinite; }
.ghost-inv.g2 { left: 56%; top: 8%;  animation: floatB 8s ease-in-out infinite; }
.ghost-inv.g3 { left: 10%; top: 58%; animation: floatB 9s ease-in-out infinite reverse; }
.ghost-inv.g4 { left: 52%; top: 54%; animation: floatA 6s ease-in-out infinite, ghostFade 6s ease-in-out infinite; }
@keyframes floatA { 0%,100% { transform: translate(0,0) rotate(-3deg); } 50% { transform: translate(16px,-14px) rotate(3deg); } }
@keyframes floatB { 0%,100% { transform: translate(0,0) rotate(2deg); } 50% { transform: translate(-14px,12px) rotate(-3deg); } }
@keyframes ghostFade { 0%, 100% { opacity: 1; } 55% { opacity: 1; } 75% { opacity: .12; } 88% { opacity: .12; } }
.ghost-inv.is-caught { animation: caught .8s ease forwards !important; opacity: 1; box-shadow: 0 0 0 3px var(--candle), 0 0 30px rgba(246,198,122,.6); }
@keyframes caught { to { transform: translate(0,0) scale(1.08) rotate(0); } }
.ghost-arena.is-settled .ghost-inv:not(.is-caught) { animation: none; opacity: .35; }
.ch5-controls { display: flex; justify-content: center; margin-top: 12px; }
.payment-review { display: grid; gap: 12px; margin-top: 14px; }
.record, .draft { padding: 14px; border-radius: 12px; background: #141d30; border: 1px solid #2b3a56; }
.record-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.record-list li { display: flex; gap: 8px; align-items: center; }
.record-list time { margin-left: auto; color: var(--text-soft); font-size: 13px; }
.ok { color: var(--ok); font-weight: 800; }
.warn { color: var(--warn); font-weight: 800; }
.draft { font-size: 14px; color: var(--text-soft); background: #f3ece2; color: #2b2330; border-color: #d8cdbf; }
.draft .tray-title { color: #7b3fa0; }
.draft p { margin: 0 0 8px; }
@media (min-width: 600px) { .ghost-inv { width: 136px; padding: 10px 12px; } }
@media (min-width: 640px) { .payment-review { grid-template-columns: 1fr 1.3fr; } }

/* --------------------------------------------------------------------------
   14. CHAPTER 6 — SOP maze + sortable
   -------------------------------------------------------------------------- */
.maze-wrap { border-radius: 12px; overflow: hidden; background: #0b101c; border: 1px solid #26334d; transition: background 1.5s ease; }
.maze { display: block; width: 100%; height: auto; }
.maze-walls path { stroke: #3f4d6b; stroke-width: 6; transition: stroke 1.5s ease, opacity 1.5s ease; }
.maze-notes rect { fill: #e7d98a; opacity: .55; transition: opacity 1.5s ease, transform 1.5s ease; }
.maze-notes rect:nth-child(2n) { fill: #f0a3c4; }
.maze-path { stroke: var(--candle); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 900; stroke-dashoffset: 900; opacity: 0; }
.hero-owner { fill: var(--candle); }
.hero-va { fill: var(--cnr-pink); }
.maze-exit circle { fill: #2e3a56; transition: fill 1s ease; }
.maze-wrap.is-lit { background: radial-gradient(90% 90% at 50% 50%, rgba(246, 198, 122, 0.12), #120e18); }
.maze-wrap.is-lit .maze-walls path { stroke: #232e45; opacity: .55; }
.maze-wrap.is-lit .maze-notes rect { opacity: .2; }
.maze-wrap.is-lit .maze-path { opacity: 1; animation: drawPath 2.2s ease forwards; filter: drop-shadow(0 0 6px rgba(246,198,122,.8)); }
.maze-wrap.is-lit .maze-exit circle { fill: var(--candle); }
.maze-wrap.is-lit .maze-heroes { animation: heroWalk 2.4s ease forwards; }
@keyframes drawPath { to { stroke-dashoffset: 0; } }
@keyframes heroWalk { to { transform: translateX(352px) translateY(28px); } }

.sop-status { margin: 0 0 10px; font-size: 14px; color: var(--text-soft); }
.sortable { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sort-item {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 4px;
  padding: 6px 6px 6px 4px; border-radius: 10px; background: #162034; border: 1px solid #2c3b58;
  position: relative; user-select: none; -webkit-user-select: none;
}
.sort-item.is-correct { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.sort-item.is-correct .sort-label::after { content: " ✓"; color: var(--ok); }
.sort-item.is-dragging { z-index: 5; box-shadow: 0 14px 30px rgba(0,0,0,.5); background: #1f2c45; border-color: var(--candle); transition: none; }
.drag-handle {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px;
  background: none; border: 0; color: var(--text-soft); cursor: grab; touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 18px; height: 18px; fill: currentColor; }
.sort-label { font-weight: 600; font-size: 15px; }
.sort-num { color: var(--candle); font-family: var(--font-heading); margin-right: 6px; }
.sort-btns { display: flex; gap: 4px; }
.move-btn {
  width: 40px; height: 44px; border-radius: 8px; border: 1px solid #2c3b58; background: #0f1626; font-size: 14px;
}
.move-btn:hover:not([disabled]) { border-color: var(--candle); }
.move-btn[disabled] { opacity: .3; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   15. CHAPTER 7 — pipeline
   -------------------------------------------------------------------------- */
.pipeline { display: grid; gap: 14px; }
.fog-tray { position: relative; contain: paint; padding: 12px; border-radius: 12px; background: #0d1320; border: 1px solid #26334d; overflow: hidden; }
.tray-fog {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(50% 60% at 30% 50%, rgba(210, 205, 235, .32), transparent 70%),
    radial-gradient(45% 55% at 75% 40%, rgba(210, 205, 235, .28), transparent 70%);
  animation: fogDrift 20s ease-in-out infinite alternate;
  transition: opacity 1s ease;
}
.lead-cards { position: relative; z-index: 1; display: grid; gap: 8px; min-height: 40px; }
.lead-cards:empty::after { content: "The fog has cleared."; color: var(--text-soft); font-style: italic; font-size: 14px; }
.lead-card {
  position: relative; padding: 10px 12px; border-radius: 10px; background: #18233a; border: 1px solid #2c3b58;
  display: grid; gap: 6px; touch-action: none;
}
.lead-card .lead-top { display: flex; align-items: center; gap: 8px; }
.lead-card .lead-name { font-weight: 700; }
.lead-card .lead-clue { font-size: 13px; color: var(--text-soft); }
.lead-card .grip { width: 28px; height: 28px; display: grid; place-items: center; color: var(--text-soft); cursor: grab; flex: 0 0 auto; }
.lead-card .grip svg { width: 16px; height: 16px; fill: currentColor; }
.lead-card select {
  width: 100%; min-height: 40px; padding: 6px 10px; border-radius: 8px;
  background: #0f1626; border: 1px solid #2c3b58; color: var(--text);
}
.lead-card.is-placed { touch-action: auto; background: color-mix(in srgb, var(--ok) 8%, #18233a); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.lead-card.is-placed .grip, .lead-card.is-placed select { display: none; }
.lead-card.is-placed .lead-name::before { content: "✓ "; color: var(--ok); }
.lead-card:not(.is-placed) { cursor: pointer; }
.lead-card.is-picked { border-color: var(--candle); box-shadow: 0 0 0 2px rgba(255, 190, 92, .45), 0 0 22px rgba(255, 138, 31, .3); background: #1f2c45; }
.stages.is-picking .stage-col { cursor: pointer; border-color: var(--candle); animation: readyPulse 2s ease-in-out infinite; }
.hint.is-info { color: var(--candle); }
.lead-card.is-shake { animation: shake .4s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.drag-ghost { position: fixed; z-index: 80; pointer-events: none; opacity: .95; box-shadow: 0 18px 40px rgba(0,0,0,.6); transform: rotate(-2deg); }

.stages { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stage-col {
  min-height: 92px; padding: 8px; border-radius: 10px; border: 1px dashed rgba(246, 198, 122, 0.3);
  background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 6px;
  transition: background .2s ease, border-color .2s ease;
}
.stage-col h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--candle); }
.stage-col.is-over { background: rgba(246, 198, 122, 0.12); border-color: var(--candle); border-style: solid; }
.stage-col .lead-card { padding: 8px; font-size: 13px; }
.stage-col .lead-card .lead-clue { display: none; }
@media (min-width: 640px) { .stages { grid-template-columns: repeat(3, 1fr); } }

.sales-dashboard { margin-top: 16px; padding: 14px; border-radius: 12px; background: #0f1626; border: 1px solid var(--line); animation: placeIn .6s ease both; }
.dash-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.tile { padding: 12px; border-radius: 10px; background: #162034; text-align: center; }
.tile-num { display: block; font-family: var(--font-display); font-size: 28px; color: var(--candle); }
.tile-label { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; }
.dash-bars { display: grid; gap: 6px; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.bar-row i { display: block; height: 10px; border-radius: 5px; width: calc(var(--w) * 100%); background: linear-gradient(90deg, var(--cnr-purple), var(--cnr-pink)); animation: barGrow 1s ease both; transform-origin: left; }
@keyframes barGrow { from { transform: scaleX(0); } }
.next-actions { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-soft); }
@media (min-width: 640px) { .dash-tiles { grid-template-columns: repeat(4, 1fr); } }

/* --------------------------------------------------------------------------
   16. FINAL CHAPTER — the storm clears, the lanterns light up.
   Still Halloween: the moon brightens, pumpkins glow, and CNR's
   brand colors arrive as warm light (body.theme-dawn).
   -------------------------------------------------------------------------- */
body.theme-dawn .sky {
  background:
    radial-gradient(60% 45% at 50% 18%, rgba(170, 195, 245, 0.45), transparent 70%),
    linear-gradient(to bottom, #13234a 0%, #0c1630 55%, #06080f 100%);
}
body.theme-dawn .moon { opacity: 1; transform: scale(1.15); }
body.theme-dawn .clouds { opacity: .25; }
body.theme-dawn .fog { opacity: .3; }
body.theme-dawn .dawn-glow { opacity: 1; }
body.theme-dawn .progress-dots li.done { background: var(--pumpkin); border-color: var(--pumpkin); }

.dawn-glow {
  background:
    radial-gradient(45% 35% at 0% 100%, rgba(255, 138, 31, .28), transparent 70%),
    radial-gradient(45% 35% at 100% 100%, rgba(255, 138, 31, .24), transparent 70%),
    radial-gradient(50% 40% at 80% 10%, color-mix(in srgb, var(--cnr-pink) 22%, transparent), transparent 70%),
    radial-gradient(50% 40% at 15% 15%, color-mix(in srgb, var(--cnr-purple) 22%, transparent), transparent 70%);
}

body.theme-dawn .page-final .page-inner {
  background:
    radial-gradient(90% 45% at 50% 0%, rgba(255, 150, 50, 0.14), transparent 70%),
    radial-gradient(90% 60% at 50% 100%, color-mix(in srgb, var(--cnr-purple) 16%, transparent), transparent 70%),
    linear-gradient(160deg, var(--page-1), var(--page-2));
  border-color: rgba(255, 170, 80, 0.4);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 138, 31, 0.12), inset 0 0 60px rgba(0, 0, 0, 0.4), 6px 0 0 -2px #0d1220, 9px 0 0 -3px #090d18;
}
.page-final .chapter-kicker { color: var(--pumpkin); }
body.theme-dawn .page-final .chapter-title {
  background: linear-gradient(90deg, var(--candle), var(--pumpkin) 45%, var(--cnr-pink));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 14px rgba(255, 138, 31, .35));
}

.survival-lines p { margin: 0 0 6px; }
.survival-lines p::before { content: "🎃 "; font-size: .8em; }
.survival-lines p.story-sting::before { content: ""; }
.page-final.is-active .survival-lines p { animation: lineIn .8s ease both; animation-delay: calc(var(--i) * 0.35s + .4s); }
@keyframes lineIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.final-headline {
  margin: 26px 0 14px; font-family: var(--font-heading); font-weight: 700; font-size: clamp(22px, 5.5vw, 32px); line-height: 1.2;
  color: var(--candle); text-wrap: balance;
}
.final-headline span { display: block; color: var(--cnr-pink); }
.appreciation { font-size: 16px; color: var(--text-soft); }
.appreciation p { margin: 0 0 12px; }
.final-actions { margin-top: 22px; text-align: center; }
.btn-celebrate {
  background: linear-gradient(135deg, var(--candle), var(--pumpkin)); color: #2a1102;
  box-shadow: 0 10px 34px rgba(255, 138, 31, 0.45); font-size: 17px; padding: 14px 28px;
}

/* closing book */
.closing-book { position: absolute; inset: 0; display: grid; place-items: center; perspective: 1400px; background: rgba(6, 9, 18, 0.75); z-index: 4; }
.cb-book { position: relative; width: min(60vw, 260px); aspect-ratio: 3 / 4; transform-style: preserve-3d; max-width: 100%; }
.cb-pages { position: absolute; inset: 4% 0 4% 3%; background: repeating-linear-gradient(90deg, #e6d6b4 0 3px, #c9b48c 3px 4px); border-radius: 2px 8px 8px 2px; }
.cb-cover {
  position: absolute; inset: 0; transform-origin: left center; border-radius: 4px 12px 12px 4px;
  background: linear-gradient(135deg, #5a1f2a, #2a0b13);
  box-shadow: inset 0 0 0 6px rgba(243, 211, 138, 0.5), 0 0 40px rgba(255, 138, 31, 0.35), 0 20px 50px rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; transform: rotateY(-160deg);
  animation: closeCover 1.4s var(--ease-page) .1s forwards;
}
.cb-cover span { font-family: var(--font-display); color: #f3d38a; font-size: 24px; opacity: 0; animation: lineIn .6s ease 1.3s forwards; }
@keyframes closeCover { to { transform: rotateY(0deg); } }

/* farewell + certificate area */
.farewell { text-align: center; animation: lineIn 1s ease both; }
.farewell-lines {
  margin: 10px 0 8px; font-family: var(--font-story); font-size: clamp(26px, 7vw, 40px); line-height: 1.25; color: var(--text); outline: none;
  text-wrap: balance;
}
.farewell-lines span { display: block; font-style: italic; color: var(--candle); text-shadow: 0 0 18px rgba(255, 138, 31, .35); }
.farewell-sign { margin: 0 0 26px; font-family: var(--font-heading); font-size: 18px; letter-spacing: .06em; color: var(--pumpkin); }
.cert-section { text-align: left; padding: 18px; border-radius: var(--radius); background: rgba(6, 9, 18, 0.55); border: 1px solid var(--line); }
.cert-heading { margin: 0 0 12px; font-family: var(--font-heading); font-size: 18px; color: var(--candle); }
.cert-note { color: var(--text-soft); }
.cert-form label { display: block; margin-bottom: 6px; font-weight: 700; color: var(--text); }
.cert-input-row { display: flex; flex-direction: column; gap: 10px; }
.cert-form input {
  min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 2px solid rgba(255, 190, 92, .35);
  background: #0c1220; color: var(--text); min-width: 0;
}
.cert-form input:focus-visible { border-color: var(--candle); outline-offset: 1px; }
.cert-error { min-height: 1.3em; margin: 6px 0 0; color: var(--warn); font-weight: 600; font-size: 14px; }
.cert-privacy { margin: 2px 0 0; font-size: 13px; color: var(--text-soft); }
@media (min-width: 600px) { .cert-input-row { flex-direction: row; } .cert-input-row input { flex: 1; } }
.cert-section .btn-primary { background: linear-gradient(135deg, var(--candle), var(--pumpkin)); color: #2a1102; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.explore {
  position: relative; margin-top: 22px; padding: 22px 18px 18px; text-align: center; border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(80% 70% at 50% 0%, rgba(160, 185, 235, 0.14), transparent 70%),
    radial-gradient(60% 60% at 50% 120%, rgba(255, 138, 31, 0.18), transparent 70%),
    rgba(6, 9, 18, 0.6);
  border: 1px solid rgba(255, 190, 92, 0.35);
}
.explore-bats { width: 90px; height: auto; fill: #c2c7d3; opacity: .55; display: block; margin: 0 auto 6px; }
.explore-heading { margin: 0 0 8px; font-family: var(--font-heading); font-size: clamp(19px, 4.6vw, 24px); line-height: 1.25; color: var(--candle); text-wrap: balance; }
.explore-copy { margin: 0 auto 16px; max-width: 34em; font-size: 15px; color: var(--text-soft); }
.explore-links { display: grid; gap: 10px; }
@media (min-width: 640px) { .explore-links { grid-template-columns: 1fr 1fr; } }
.explore-link {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; min-height: 64px; min-width: 0;
  padding: 12px 14px; border-radius: 14px; text-align: left; text-decoration: none; color: var(--text);
  background: #111a2c; border: 1px solid #2c3b58;
  transition: transform .2s ease, border-color .2s ease, box-shadow .25s ease, background .2s ease;
}
.explore-link:hover { transform: translateY(-2px); border-color: var(--candle); box-shadow: 0 10px 28px rgba(255, 138, 31, 0.22); background: #152036; }
.explore-link:focus-visible { outline: 3px solid var(--candle); outline-offset: 3px; }
.ex-ico { width: 44px; height: 44px; padding: 10px; border-radius: 50%; fill: #fff; }
.explore-fb .ex-ico { background: #1877f2; box-shadow: 0 0 18px rgba(24, 119, 242, .45); }
.explore-web .ex-ico { background: linear-gradient(135deg, var(--candle), var(--pumpkin)); fill: #2a1102; box-shadow: 0 0 18px rgba(255, 138, 31, .45); }
.ex-text { display: flex; flex-direction: column; min-width: 0; }
.ex-label { font-weight: 700; font-size: 16px; }
.ex-url { font-size: 12.5px; color: var(--text-soft); overflow-wrap: anywhere; }
.ex-arrow { font-size: 18px; color: var(--candle); }
.explore-note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-soft); opacity: .85; }

.cert-links { margin: 1.2cqw 0 0; font-size: 1.45cqw; letter-spacing: .03em; color: #6a4a2a; display: flex; flex-wrap: wrap; justify-content: center; gap: .4cqw 1.2cqw; }
.cert-links a { color: #7a3510; text-decoration: none; border-bottom: 1px dotted rgba(122, 53, 16, .5); }
.cert-links a:hover { color: #a3410f; border-bottom-style: solid; }

.farewell-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

/* the certificate: aged parchment from the haunted book */
.certificate {
  position: relative; aspect-ratio: 1.414 / 1; width: 100%; max-width: 100%; padding: 3%;
  background:
    radial-gradient(120% 120% at 50% 45%, transparent 55%, rgba(70, 40, 15, .38) 100%),
    radial-gradient(90% 90% at 50% 40%, #f7ecd3, #e6d2a8);
  border-radius: 4px; box-shadow: 0 0 0 1px #3b2a18, 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 138, 31, .15);
  color: #2b1d12; container-type: inline-size;
}
.cert-border {
  position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 3px double #2b2420; outline: 1px solid rgba(214, 100, 20, .7); outline-offset: -9px; padding: 2% 8%;
}
.cert-arch { width: 40%; height: auto; margin-bottom: .2cqw; }
.cert-jack { position: absolute; bottom: 2.4cqw; width: 8cqw; height: auto; }
.cert-jack-l { left: 2.4cqw; }
.cert-jack-r { right: 2.4cqw; }
.cert-org { margin: 0; font-family: var(--font-heading); font-size: 1.9cqw; letter-spacing: .24em; text-transform: uppercase; color: #a3410f; }
.cert-title { margin: 1cqw 0 1.6cqw; font-family: var(--font-display); font-size: 4.3cqw; line-height: 1.1; color: #1f1612; }
.cert-small { margin: 0; font-family: var(--font-story); font-style: italic; font-size: 2.5cqw; }
.cert-name { margin: .6cqw 0 1cqw; font-family: var(--font-story); font-weight: 500; font-size: 5.6cqw; line-height: 1.1; color: #9c3a0c; border-bottom: 1px solid rgba(43, 36, 32, .45); padding: 0 4cqw .6cqw; word-break: break-word; }
.cert-body { margin: 0; max-width: 88%; font-size: 1.95cqw; line-height: 1.5; color: #2b1d12; }
.cert-motto { margin: 1.6cqw 0 0; font-family: var(--font-story); font-style: italic; font-size: 2.6cqw; color: #5b2a6e; }
.cert-foot { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 3cqw; align-items: center; margin-top: 1.8cqw; font-size: 1.7cqw; color: #4a3626; padding: 0 6cqw; }
.cert-logo { width: 22cqw; height: auto; display: block; }
.cert-sig { justify-self: start; font-family: var(--font-story); font-style: italic; font-size: 2cqw; border-top: 1px solid rgba(43, 36, 32, .5); padding-top: .6cqw; }
.cert-date { justify-self: end; border-top: 1px solid rgba(43, 36, 32, .5); padding-top: .6cqw; }

/* --------------------------------------------------------------------------
   17. CAPTIONS + DIALOG
   -------------------------------------------------------------------------- */
.captions {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 40;
  padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.78); color: #f3ead9;
  font-size: 14px; font-style: italic; letter-spacing: .03em; pointer-events: none;
  opacity: 0; transition: opacity .5s ease; max-width: calc(100vw - 32px); text-align: center;
}
.captions.is-visible { opacity: 1; }

.confirm-dialog {
  max-width: min(92vw, 420px); padding: 22px; border-radius: 16px;
  background: #0f1626; color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.confirm-dialog::backdrop { background: rgba(5, 4, 8, 0.7); }
.confirm-dialog h2 { margin: 0 0 8px; font-family: var(--font-heading); color: var(--candle); font-size: 22px; }
.confirm-dialog p { margin: 0 0 18px; color: var(--text-soft); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* --------------------------------------------------------------------------
   18. REDUCED MOTION + "SKIP ANIMATIONS"
   html.no-anim is toggled by the Skip Animations control and defaults on
   when the visitor's OS asks for reduced motion.
   -------------------------------------------------------------------------- */
html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  animation-delay: 0ms !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html.no-anim .dust { display: none; }
html.no-anim .lightning { display: none; }
html.no-anim .ghost-inv.g4 { opacity: .55; }   /* fading invoice rests at half-visible */
html.no-anim .maze-wrap.is-lit .maze-path { stroke-dashoffset: 0; }

@media (prefers-reduced-motion: reduce) {
  .fog, .atmos-shadow, .tray-fog, .blind-light, .clouds, .storm-clouds { animation: none !important; }
  .lightning { display: none; }
}

/* --------------------------------------------------------------------------
   19. PRINT — only the certificate prints
   -------------------------------------------------------------------------- */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { height: auto; overflow: visible; background: #fff !important; }
  body * { visibility: hidden !important; }
  .atmos, .topbar, .captions { display: none !important; }
  #certificate, #certificate * { visibility: visible !important; }
  .stage, .page, .page-inner { position: static !important; overflow: visible !important; transform: none !important; box-shadow: none !important; background: none !important; border: 0 !important; height: auto !important; }
  #certificate { position: fixed; left: 0; top: 0; width: 100%; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --------------------------------------------------------------------------
   20. SMALL / SHORT PHONE TWEAKS
   -------------------------------------------------------------------------- */
@media (max-height: 720px) and (max-width: 719px) {
  .intro-scene { height: 36vh; height: 36dvh; opacity: .75; }
  .intro-card { padding-top: 18px; padding-bottom: 32vh; }
  .book-title span { font-size: clamp(32px, 10vw, 60px); }
  .tagline { font-size: 17px; }
}
@media (max-width: 380px) {
  .explore { padding: 18px 12px 14px; }
  .explore-link { grid-template-columns: 38px 1fr; gap: 10px; padding: 10px 12px; }
  .explore-link .ex-arrow { display: none; }
  .ex-ico { width: 38px; height: 38px; padding: 8px; }
  .ex-label { font-size: 15px; }
  .ex-url { font-size: 11.5px; word-break: break-all; }
}

/* --------------------------------------------------------------------------
   21. CERTIFICATE REQUEST FORM + "SENT" STATE + SITE LINK
   -------------------------------------------------------------------------- */
.cert-intro { margin: 0 0 14px; color: var(--text-soft); font-size: 15px; }
.cert-form { display: grid; gap: 12px; }
.cert-field { display: grid; gap: 6px; }
.cert-field label { margin: 0; }
.cert-form input[type="text"], .cert-form input[type="email"] { width: 100%; font-size: 16px; }   /* 16px stops iPhone zooming in */
.cert-form input[aria-invalid="true"] { border-color: var(--warn); }
.cert-check { display: grid !important; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-weight: 500 !important; font-size: 14px; color: var(--text-soft) !important; cursor: pointer; }
.cert-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--pumpkin); }
.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); opacity: 0; pointer-events: none; }
.cert-submit { width: 100%; margin-top: 2px; }
.cert-submit.is-sending { opacity: .8; cursor: progress; }
.cert-submit.is-sending::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: slowSpin .8s linear infinite; }
.cert-error:empty { display: none; }
.cert-sent { text-align: center; padding: 10px 4px 4px; }
.cert-sent-icon { font-size: 46px; line-height: 1; filter: drop-shadow(0 0 16px rgba(255, 138, 31, .6)); animation: jackGlow 3s ease-in-out infinite; }
.cert-sent-title { margin: 10px 0 6px; font-family: var(--font-heading); font-size: 20px; color: var(--candle); outline: none; }
.cert-sent-copy { margin: 0 auto 8px; max-width: 30em; color: var(--text-soft); font-size: 15px; }
.cert-sent-copy strong { color: var(--text); overflow-wrap: anywhere; }
.cert-fallback { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--text); background: rgba(255, 178, 122, .1); border: 1px solid rgba(255, 178, 122, .4); }

.site-credit { margin: 18px 0 0; text-align: center; font-size: 12px; letter-spacing: .04em; opacity: .7; }
.site-credit a { color: var(--text-soft); text-decoration: none; border-bottom: 1px dotted rgba(194, 199, 211, .45); padding: 6px 2px; }
.site-credit a:hover, .site-credit a:focus-visible { color: var(--candle); opacity: 1; }
#intro-cover .site-credit { margin-top: 20px; }
#intro-cover .site-credit a { text-shadow: 0 1px 8px rgba(0, 0, 0, .9); }
.site-credit { margin-top: 10px; }
.site-credit a { display: inline-block; padding: 12px 8px; border-bottom: 0; text-decoration: underline dotted rgba(194, 199, 211, .45); text-underline-offset: 3px; }
