/* www.pawnless.app landing (new.html). The game's own fonts (Pirata One for
   titles, Modern Antiqua for text), its gold, its wood and the five worlds'
   real art and colours; landing.js swaps the world palette as the visitor
   scrolls. Everything animated has a still version for reduced motion. */

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #ffbf52;
}
@property --accent-text {
  syntax: '<color>';
  inherits: true;
  initial-value: #f7d722;
}
@property --sheen {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}

:root {
  color-scheme: dark;
  --ink: #0d0905;
  --text: #f4ead6;
  --muted: #c9b894;
  --line: rgba(255, 223, 160, 0.16);
  --panel: rgba(20, 13, 7, 0.72);
  --panel-strong: rgba(14, 9, 5, 0.84);
  --radius: 22px;
  --gutter: clamp(16px, 4vw, 48px);
  --font-title: 'Pirata One', 'Times New Roman', serif;
  --font-body: 'Modern Antiqua', Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(16px, 1.05vw + 11px, 19px);
  line-height: 1.65;
  overflow-x: hidden;
  transition: --accent 1.2s var(--ease), --accent-text 1.2s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

/* ---------------------------------------------------------------- gold */
/* A fixed, always-ordered gradient twice as wide as the text; the sheen
   only slides it across (0% to 100% keeps it inside its own width, so it
   never shows a seam). Moving a colour stop instead let it overtake the
   next one, which drew a hard edge. */
.gold {
  background: linear-gradient(105deg,
      #66490c 0%, #b28728 18%, #f1c40f 34%, #fff7c2 42%,
      #f1c40f 50%, #b28728 70%, #66490c 100%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: var(--sheen) 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gold-sheen 9s ease-in-out infinite;
}
@keyframes gold-sheen {
  0%, 100% { --sheen: 0%; }
  50% { --sheen: 100%; }
}

/* ------------------------------------------------------------ scenery */
.scenery { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.scenery-layer {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.4s var(--ease);
}
.scenery-layer.on { opacity: 1; animation: drift 40s ease-in-out infinite alternate; }
.scenery-layer[data-layer="6"] { filter: brightness(0.62) saturate(0.95); }
@keyframes drift {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to { transform: scale(1.14) translate3d(-1.5%, -1%, 0); }
}
.scenery-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 5, 2, 0.72) 0%, rgba(8, 5, 2, 0.15) 30%, rgba(8, 5, 2, 0.2) 70%, rgba(8, 5, 2, 0.85) 100%),
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(5, 3, 1, 0.75) 100%);
}
.dust {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ------------------------------------------------------------- topbar */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  background: linear-gradient(180deg, rgba(10, 6, 3, 0.82), rgba(10, 6, 3, 0.35));
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.brand span { font-family: var(--font-title); font-size: 26px; line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font: 600 13px/1 var(--font-body);
  cursor: pointer;
}
.lang-toggle span { padding: 6px 9px; border-radius: 999px; transition: background 0.3s, color 0.3s; }
.lang-toggle span.on { background: color-mix(in srgb, var(--accent) 85%, white 0%); color: #1a1006; }

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, rgba(0, 0, 0, 0.35));
  color: var(--text);
  font: 600 15px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.3s;
  cursor: pointer;
}
.download-menu { position: relative; }
.download-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: rgba(14, 9, 5, 0.95);
  border: 1px solid rgba(241, 196, 15, 0.35);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.9);
  animation: panel-in 0.25s var(--ease);
}
.download-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } }
.stores-menu { flex-wrap: nowrap; margin-top: 0; }
.stores-menu .store img { height: 46px; }
.pill-button:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--accent) 28%, rgba(0, 0, 0, 0.35)); }
.pill-gold {
  border-color: #f1c40f;
  background: linear-gradient(180deg, #ffe58a, #d9a515 55%, #a37612);
  color: #2a1a05;
  box-shadow: 0 10px 30px -10px rgba(241, 196, 15, 0.6);
}
.pill-gold:hover { background: linear-gradient(180deg, #fff0b0, #e6b522 55%, #b48416); }
.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font: 600 14px/1 var(--font-body);
  cursor: pointer;
}
.ghost-button:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* ------------------------------------------------------------- rail */
.world-rail {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: 50%;
  z-index: 15;
  display: none;
  flex-direction: column;
  gap: 14px;
  transform: translateY(-50%);
}
.world-rail a { position: relative; display: block; padding: 4px; text-decoration: none; }
.rail-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 230, 180, 0.5);
  background: rgba(0, 0, 0, 0.4);
  transition: all 0.4s var(--ease);
}
.rail-label {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  margin-top: -0.7em;
  pointer-events: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(10, 6, 3, 0.8);
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0;
  transform: translateX(6px);
  transition: all 0.3s var(--ease);
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}
.world-rail a:hover .rail-label, .world-rail a:focus-visible .rail-label { opacity: 1; transform: none; }
.world-rail a.on .rail-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transform: scale(1.3);
}
@media (min-width: 1100px) { .world-rail { display: flex; } }

/* ------------------------------------------------------------ layout */
main { position: relative; z-index: 2; }
section {
  position: relative;
  padding: clamp(80px, 12vh, 140px) var(--gutter);
  max-width: 1240px;
  margin: 0 auto;
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  transition: color 1s;
}
.section-title {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 0.98;
  margin: 10px 0 18px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

/* -------------------------------------------------------------- hero */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding-top: clamp(96px, 14vh, 140px);
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.05fr 1fr; }
}
.hero { overflow-x: clip; }
.hero-copy { position: relative; isolation: isolate; }
.hero-copy::before {
  content: '';
  position: absolute;
  inset: -14% -16%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(8, 5, 2, 0.72), rgba(8, 5, 2, 0.45) 60%, rgba(8, 5, 2, 0) 100%);
  pointer-events: none;
}
.hero-title {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(76px, 13vw, 168px);
  line-height: 0.85;
  margin: 6px 0 18px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(241, 196, 15, 0.18));
}
.hero-line {
  font-size: clamp(21px, 1.8vw + 10px, 30px);
  line-height: 1.3;
  max-width: 22ch;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.hero-sub { margin-top: 14px; color: var(--muted); max-width: 42ch; text-shadow: 0 1px 8px #000; }
.play-web {
  display: inline-block;
  margin-top: 14px;
  font-size: 15px;
  color: #e6d9bb;
  text-shadow: 0 1px 6px #000;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.play-web:hover { color: var(--text); }
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.scroll-cue::after {
  content: '';
  width: 1px;
  height: 38px;
  background: linear-gradient(var(--accent), transparent);
  animation: cue 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@media (min-width: 900px) and (min-height: 760px) { .scroll-cue { display: flex; } }

/* ------------------------------------------------------------ stores */
.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.store {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: transform 0.25s var(--ease), filter 0.3s;
}
.store img { height: 52px; width: auto; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55)); }
.store:hover { transform: translateY(-2px); }
.store.pending { cursor: default; }
.store.pending img { filter: grayscale(1) brightness(0.75); opacity: 0.6; }
.store.pending:hover { transform: none; }
.store-soon { font-size: 12px; color: #e6d9bb; text-shadow: 0 1px 4px #000; letter-spacing: 0.08em; text-transform: uppercase; }
.stores-big { justify-content: center; }
.stores-big .store img { height: 60px; }

/* -------------------------------------------------------------- demo */
.demo { display: flex; justify-content: center; }
/* Sized from the viewport height too, so the whole frame fits on screen
   next to the title on a laptop. */
.demo-frame {
  position: relative;
  width: clamp(300px, min(470px, calc(100svh - 345px)), 100%);
  padding: 16px 18px 14px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(30, 18, 8, 0.86), rgba(14, 8, 3, 0.93)),
    url('game/carved_fantasy_wood.webp') center / cover;
  border: 1px solid rgba(241, 196, 15, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 170, 0.18),
    0 40px 80px -30px rgba(0, 0, 0, 0.9),
    0 0 0 6px rgba(0, 0, 0, 0.25),
    0 0 70px -18px color-mix(in srgb, var(--accent) 60%, transparent);
}
/* Title and move meter on the left, the target as tall as both together
   on the right, so it reads at a glance. */
.demo-top { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.demo-left { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.demo-title { display: flex; flex-direction: column; min-width: 0; }
.demo-chapter { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.demo-name {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(34px, 3vw + 14px, 46px);
  line-height: 1;
  color: #ffe08a;
  text-shadow: 0 0 22px rgba(241, 196, 15, 0.35), 0 3px 10px rgba(0, 0, 0, 0.8);
}
.demo-target { flex: none; width: 32%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.demo-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.demo-label b { color: #ffe08a; font: 700 15px/1 ui-monospace, 'JetBrains Mono', monospace; letter-spacing: 0; }
.demo-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(241, 196, 15, 0.16);
}
.demo-count { display: flex; align-items: baseline; gap: 5px; font: 700 clamp(22px, 1vw + 14px, 28px)/1 ui-monospace, 'JetBrains Mono', monospace; color: var(--muted); }
.demo-count b { font-size: clamp(38px, 2vw + 22px, 50px); color: #ffe08a; display: inline-block; }
.demo.over .demo-count b { color: #ffb36b; }
.demo-moves.bump { animation: bump 0.35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.3); color: #fff; } }
.demo-live-stars { display: flex; gap: 6px; }
.demo-live-stars .star { width: clamp(24px, 1vw + 16px, 30px); height: clamp(24px, 1vw + 16px, 30px); transition: background 0.4s; }
.demo-live-stars .star.lost { animation: star-lost 0.6s var(--ease); }
@keyframes star-lost { 30% { transform: scale(1.35) rotate(-14deg); } 100% { transform: none; } }
.demo-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.demo-hint { font-size: 14px; color: var(--muted); min-height: 1.4em; line-height: 1.35; }
.demo-hint.warn { color: #ffb36b; }

.board-wrap { position: relative; }
/* The board sits in a gilded frame, as in the game. */
.board-frame {
  padding: clamp(6px, 1.2vw, 9px);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 236, 170, 0.35), rgba(80, 52, 10, 0.35)),
    url('game/gold_metal_texture.webp') center / 300% auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 200, 0.6),
    inset 0 -2px 4px rgba(60, 35, 0, 0.6),
    0 18px 40px -16px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.6);
}
.board {
  --light: #feeecd;
  --dark: #44312c;
  position: relative;
  display: grid;
  /* minmax(0, 1fr) on both axes: nine equal squares whatever the pieces'
     own image sizes (plain 1fr rows grew to fit them). */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  aspect-ratio: 1;
  width: 100%;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 4px 14px rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.board-mini { width: 100%; border-radius: 8px; border: 2px solid rgba(178, 135, 40, 0.8); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.8); }
.square {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  background: var(--light);
  border: 0;
  padding: 0;
  cursor: pointer;
}
.square.dark { background: var(--dark); }
.board-mini .square, .board-show .square { cursor: default; }
.square img {
  position: absolute;
  left: 8%;
  top: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s var(--ease), filter 0.3s;
  pointer-events: none;
}
.board-play .square:hover img { transform: translateY(-3px); }
.square.home::before {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 140, 0.55), rgba(255, 226, 140, 0) 70%);
  animation: home-in 0.5s var(--ease) both;
}
@keyframes home-in { from { transform: scale(0.4); opacity: 0; } }
.square.selected { box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent); }
.square.selected img { transform: translateY(-5px) scale(1.08); filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.55)); }
.square.target::after {
  content: '';
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  box-shadow: 0 0 14px var(--accent);
  animation: dot 1.4s ease-in-out infinite;
}
@keyframes dot { 50% { transform: scale(0.8); opacity: 0.7; } }
/* The pre-selected knight's heartbeat on arrival: two quick, big beats
   and a rest, until the visitor's first tap. */
.square.beat img { animation: beat 1.4s ease-in-out infinite; }
@keyframes beat {
  0%, 46%, 100% { transform: translateY(-5px) scale(1.08); }
  12% { transform: translateY(-8px) scale(1.34); }
  24% { transform: translateY(-5px) scale(1.08); }
  34% { transform: translateY(-7px) scale(1.24); }
}
.demo-fail {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(80%, 300px);
  padding: 16px 16px 18px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-radius: 18px;
  background: rgba(14, 8, 3, 0.92);
  border: 1px solid rgba(255, 179, 107, 0.6);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.9), 0 0 30px -8px rgba(255, 150, 80, 0.45);
  text-align: center;
  animation: invite-in 0.5s var(--ease) both;
}
.demo-fail[hidden] { display: none; }
.demo-fail b { font-family: var(--font-title); font-weight: 400; font-size: clamp(28px, 2vw + 16px, 36px); line-height: 1.05; color: #ffb36b; }
.demo-fail span { font-size: 15px; line-height: 1.35; color: #f4ead6; }
.demo-fail .pill-button { margin-top: 4px; }
.demo-invite {
  position: absolute;
  left: 50%;
  /* A little above centre: on small screens the beating knight's head
     reaches up into the middle row at the peak of each beat. */
  top: 46%;
  z-index: 3;
  /* Narrow enough to stay clear of the knight's marked squares (the one
     to its right and the one above). */
  width: min(52%, 220px);
  padding: 8px 10px 10px;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background: rgba(14, 8, 3, 0.86);
  border: 1px solid rgba(241, 196, 15, 0.55);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.8), 0 0 30px -8px rgba(241, 196, 15, 0.45);
  text-align: center;
  pointer-events: none;
  animation: invite-in 0.7s var(--ease) 0.4s both;
}
.demo-invite b { display: block; font-family: var(--font-title); font-weight: 400; font-size: clamp(26px, 2vw + 14px, 34px); line-height: 1.05; color: #ffe08a; }
.demo-invite span { display: block; margin-top: 4px; font-size: clamp(13px, 0.4vw + 11px, 15px); line-height: 1.35; color: #f4ead6; }
.demo-invite.gone { animation: invite-out 0.35s var(--ease) both; }
@keyframes invite-out { to { opacity: 0; transform: translate(-50%, -50%) scale(0.9); visibility: hidden; } }
@keyframes invite-in { from { opacity: 0; transform: translate(-50%, -40%) scale(0.92); } }
.board.solved { animation: solved 0.9s var(--ease); }
.board.solved img { filter: drop-shadow(0 0 12px rgba(255, 220, 120, 0.9)); }
@keyframes solved { 30% { transform: scale(1.03); box-shadow: 0 0 60px rgba(241, 196, 15, 0.6); } }
.board.failed { animation: failed 0.45s ease-in-out; }
@keyframes failed { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.demo-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(40, 24, 6, 0.88), rgba(8, 5, 2, 0.95));
  backdrop-filter: blur(3px);
  animation: result-in 0.6s var(--ease) both;
}
.demo-result[hidden] { display: none; }
@keyframes result-in { from { opacity: 0; transform: scale(0.94); } }
.demo-stars { display: flex; gap: 8px; }
.demo-stars .star { width: 44px; height: 44px; }
.demo-verdict { font-family: var(--font-title); font-size: 40px; line-height: 1; color: #ffe08a; }
.demo-next { color: var(--muted); max-width: 26ch; line-height: 1.4; }
.demo-result-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 4px; }
.stores-result { justify-content: center; margin-top: 0; gap: 10px; }
.stores-result .store img { height: 44px; }

.star {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.18);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.star.on { background: linear-gradient(180deg, #fff3b0, #f1c40f 60%, #b88a12); }
.demo-stars .star.on { animation: star-pop 0.5s var(--ease) both; }
.demo-stars .star:nth-child(2) { animation-delay: 0.12s; }
.demo-stars .star:nth-child(3) { animation-delay: 0.24s; }
@keyframes star-pop { from { transform: scale(0) rotate(-30deg); } }

.burst { position: fixed; pointer-events: none; z-index: 30; width: 34px; height: 34px; mix-blend-mode: screen; }

/* -------------------------------------------------------------- book */
.book, .world {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 90px);
  min-height: 100svh;
}
@media (min-width: 900px) {
  .book, .world { grid-template-columns: 1.1fr 0.9fr; }
  .world-flip { grid-template-columns: 0.9fr 1.1fr; }
  .world-flip .world-copy { order: 2; }
}
.book-copy, .world-copy {
  position: relative;
  z-index: 2;
  padding: clamp(22px, 3vw, 40px);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-strong), var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
  transition: border-color 1.2s;
}
.book-copy p, .world-copy > p { color: #eadfc8; }
.world-number { font-size: 14px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.world-name {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 80px);
  line-height: 0.95;
  margin: 8px 0 6px;
  color: var(--accent-text);
  text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 45%, transparent), 0 4px 18px rgba(0, 0, 0, 0.8);
}
.world-idea { font-size: clamp(20px, 1.4vw + 12px, 26px); font-weight: 400; margin-bottom: 14px; color: var(--text); }
.star-rule { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 22px; font-size: 15px; color: var(--muted); }
.star-rule > span { display: inline-flex; align-items: center; gap: 4px; }
.star-rule > span > span { margin-left: 6px; }

/* ------------------------------------------------------------- phone */
.phone {
  position: relative;
  z-index: 2;
  justify-self: center;
  width: clamp(210px, 26vw, 300px);
  aspect-ratio: 1290 / 2796;
  margin: 0;
  padding: 10px;
  border-radius: 40px;
  background: linear-gradient(145deg, #2b2016, #0d0905);
  border: 1px solid rgba(255, 220, 150, 0.22);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.6),
    0 50px 90px -30px rgba(0, 0, 0, 0.95),
    0 0 80px -30px color-mix(in srgb, var(--accent) 70%, transparent);
  transform: perspective(1200px) rotateY(var(--tilt-y, -8deg)) rotateX(var(--tilt-x, 4deg));
  transition: transform 0.6s var(--ease), box-shadow 1.2s;
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 31px; }
.world-flip .phone { --tilt-y: 8deg; }

/* --------------------------------------------------------- showcases */
.showcase { display: flex; flex-direction: column; align-items: center; gap: 18px; justify-self: center; }
.showcase-inline { flex-direction: row; align-items: center; gap: 20px; margin-top: 24px; }
/* The element that turns: the frame AND the board inside it, as one piece,
   exactly like the game's #playable-board-rotator. */
.show-rotator { --rot-w: clamp(220px, 26vw, 330px); width: var(--rot-w); margin: calc(var(--rot-w) * 0.21) 0; will-change: transform; }
.show-small { --rot-w: clamp(150px, 14vw, 190px); margin: 0; }
.show-rotator { flex-shrink: 0; }
.show-control { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.show-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 52px;
  border-radius: 14px;
  color: #ffe08a;
  background: linear-gradient(180deg, rgba(60, 40, 14, 0.95), rgba(26, 16, 6, 0.95));
  border: 1px solid rgba(241, 196, 15, 0.45);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 170, 0.25);
  transition: transform 0.09s ease-out, box-shadow 0.09s ease-out, background 0.2s;
}
.show-button svg { width: 28px; height: 28px; }
.show-button.pressed {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 170, 0.25), 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
  background: linear-gradient(180deg, rgba(90, 62, 20, 0.95), rgba(40, 24, 8, 0.95));
}
.showcase-caption {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 6, 3, 0.7);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #eadfc8;
  text-align: center;
}

.piece-morph { display: flex; gap: 10px; margin-top: 22px; }
.piece-morph .slot { position: relative; width: 54px; aspect-ratio: 1; }
.piece-morph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6)); }
.piece-morph img.next { opacity: 0; transform: translateY(8px) scale(0.9); }
.piece-morph.flip img.prev { opacity: 0; transform: translateY(-8px) scale(0.9); }
.piece-morph.flip img.next { opacity: 1; transform: none; }

/* The game's own jigsaw (renderChapterJigsawGrid() and .chapter-jigsaw-*
   in src/index.css): owned pieces overlap their neighbours, cut by their
   silhouette mask, with the raised edge blended on top. */
.jigsaw-wrap { margin-top: 24px; width: min(320px, 100%); }
.jigsaw {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #1a110a;
  border: 1px solid rgba(178, 135, 40, 0.4);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(0, 0, 0, 0.6);
  transition: opacity 0.6s;
}
.jigsaw.fading { opacity: 0; }
.jigsaw-cell { position: absolute; overflow: hidden; }
.jigsaw-locked { display: flex; align-items: center; justify-content: center; color: rgba(140, 103, 41, 0.5); opacity: 0.3; z-index: 1; }
.jigsaw-locked svg { width: 22%; height: 22%; }
.jigsaw-owned {
  z-index: 2;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  filter: sepia() saturate(1) brightness(0.65) contrast(1.2);
  transition: filter 1200ms ease-out;
}
.jigsaw.complete .jigsaw-owned { filter: none; }
.jigsaw-photo { position: absolute; object-fit: cover; object-position: center; max-width: none; max-height: none; pointer-events: none; }
.jigsaw-bevel { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; mix-blend-mode: hard-light; opacity: 0.8; }
.jigsaw-reveal { animation: jigsaw-reveal 700ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes jigsaw-reveal {
  0% { opacity: 0; transform: scale(0.4) translateY(-28px) rotate(-10deg); }
  55% { opacity: 1; transform: scale(1.12) translateY(3px) rotate(3deg); }
  75% { transform: scale(0.96) translateY(0) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
}
.jigsaw-caption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
.jigsaw-caption > span:first-child { color: #ffe08a; font-weight: 700; }

/* ---------------------------------------------------------- threshold */
.threshold {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  /* The rays and halo reach well past the door; never past the page. */
  overflow: hidden;
}
.threshold-scene {
  --door-w: clamp(150px, 17vw, 230px);
  --violet: #7e69b0;
  position: relative;
  width: min(940px, 100%);
  height: clamp(330px, 54svh, 560px);
  pointer-events: none;
}
/* Light rays fanning out from behind the door, turning very slowly. */
.threshold-rays {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 190%;
  aspect-ratio: 1;
  transform: translate(-50%, 50%);
  background: repeating-conic-gradient(from 0deg at 50% 50%,
      rgba(255, 228, 170, 0) 0deg, rgba(255, 228, 170, 0.16) 3deg, rgba(255, 228, 170, 0) 7deg,
      rgba(0, 0, 0, 0) 13deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.55) 18%, transparent 46%);
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.55) 18%, transparent 46%);
  mix-blend-mode: screen;
  opacity: 0.35;
  animation: rays 90s linear infinite;
  transition: opacity 2s var(--ease);
}
@keyframes rays { to { transform: translate(-50%, 50%) rotate(360deg); } }
.threshold-door {
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: var(--door-w);
  aspect-ratio: 0.56;
  transform: translateX(-50%);
}
.door-halo {
  position: absolute;
  inset: -55% -95%;
  background:
    radial-gradient(40% 46% at 50% 55%, rgba(255, 226, 150, 0.32), transparent 70%),
    radial-gradient(60% 60% at 50% 55%, color-mix(in srgb, var(--violet) 45%, transparent), transparent 72%);
  animation: halo 6s ease-in-out infinite;
  transition: transform 2.4s var(--ease), opacity 2.4s;
  opacity: 0.7;
}
@keyframes halo { 50% { filter: brightness(1.25); } }
.door-arch {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 4px 4px / 30% 30% 4px 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.55), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.55)),
    linear-gradient(180deg, #2a2036, #120c18 70%, #0a0710);
  border: 3px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 3px #6b5d8e,
    0 0 0 5px rgba(241, 196, 15, 0.55),
    0 0 40px color-mix(in srgb, var(--violet) 70%, transparent),
    inset 0 0 40px rgba(0, 0, 0, 0.8);
}
/* The two closed leaves, with carved panels. */
.door-arch::before, .door-arch::after {
  content: '';
  position: absolute;
  top: 26%;
  bottom: 8%;
  width: 30%;
  border-radius: 40% 40% 3px 3px / 16% 16% 3px 3px;
  border: 1px solid rgba(241, 196, 15, 0.22);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.7);
}
.door-arch::before { left: 12%; }
.door-arch::after { right: 12%; }
/* The light behind the door, only ever seen through the seam. */
.door-seam {
  position: absolute;
  left: 50%;
  top: 9%;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 246, 210, 0.2), #fff6d2 30%, #ffe08a 75%, #fff6d2);
  box-shadow: 0 0 10px #ffe9a8, 0 0 26px rgba(255, 210, 120, 0.9), 0 0 60px color-mix(in srgb, var(--violet) 80%, transparent);
  animation: seam 3.4s ease-in-out infinite;
  transition: width 2s var(--ease), box-shadow 2s;
}
@keyframes seam { 50% { opacity: 0.7; } }
/* Light spilling under the door onto the floor. */
.threshold-floor {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: calc(var(--door-w) * 3.6);
  height: 18%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 30%, rgba(255, 222, 150, 0.32), color-mix(in srgb, var(--violet) 22%, transparent) 50%, transparent 75%);
  transition: opacity 2s;
  opacity: 0.6;
}
.threshold-figures {
  position: absolute;
  left: 50%;
  bottom: 2%;
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 3.2vw, 44px);
  transform: translateX(-50%);
}
.figure {
  position: relative;
  width: clamp(46px, 6.4vw, 84px);
  transform: translateY(calc(var(--arc) * -22px)) scale(calc(1 - var(--arc) * 0.07));
}
.figure img {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: brightness(0.12) saturate(0) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.8));
  opacity: 0.75;
  transition: filter 1.2s var(--ease), transform 1.2s var(--ease), opacity 1.2s;
}
.figure-base {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -6px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) 80%, transparent), transparent);
  opacity: 0;
  transition: opacity 1.2s;
}
.figure.awake img {
  filter: drop-shadow(0 0 14px var(--glow)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.7));
  opacity: 1;
  transform: translateY(-8px);
  animation: figure-float 5s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.9s);
}
.figure.awake .figure-base { opacity: 0.9; }
@keyframes figure-float { 50% { transform: translateY(-14px); } }
/* All five awake: the door answers. */
.threshold-scene.open .threshold-rays { opacity: 0.85; }
.threshold-scene.open .door-halo { opacity: 1; transform: scale(1.18); }
.threshold-scene.open .door-seam { width: 6px; box-shadow: 0 0 14px #fff2c4, 0 0 40px rgba(255, 210, 120, 1), 0 0 110px color-mix(in srgb, var(--violet) 90%, transparent); }
.threshold-scene.open .threshold-floor { opacity: 1; }

.threshold-copy {
  position: relative;
  max-width: 660px;
  padding: 18px clamp(16px, 3vw, 32px) 8px;
  border-radius: var(--radius);
  background: radial-gradient(80% 90% at 50% 50%, rgba(8, 5, 12, 0.72), rgba(8, 5, 12, 0) 100%);
}
.threshold-copy .section-title { margin-top: 6px; }
.threshold-copy .eyebrow { color: #cdbdf2; text-shadow: 0 1px 8px #000; }
.threshold-line { color: #e6dcf5; font-size: clamp(18px, 1.2vw + 12px, 22px); text-shadow: 0 2px 12px #000; }

/* --------------------------------------------------------------- news */
.news { min-height: auto; }
.news-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.news-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.news-card time { font-size: 13px; color: var(--accent); letter-spacing: 0.1em; }
.news-card h3 { font-family: var(--font-title); font-weight: 400; font-size: 28px; line-height: 1.05; margin: 6px 0 8px; }
.news-card p { color: #e2d6bd; }

/* -------------------------------------------------------------- footer */
.footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px var(--gutter) max(40px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(6, 4, 2, 0.85);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.footer img { border-radius: 10px; }
.footer a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.footer-small { font-size: 13px; opacity: 0.7; }

/* -------------------------------------------------------------- reveal */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in-view { opacity: 1; transform: none; }
.phone.reveal { transform: perspective(1200px) rotateY(var(--tilt-y, -8deg)) rotateX(14deg) translateY(60px); }
.phone.reveal.in-view { transform: perspective(1200px) rotateY(var(--tilt-y, -8deg)) rotateX(var(--tilt-x, 4deg)); }

/* ------------------------------------------------------- small screens */
@media (max-width: 899px) {
  .hero { text-align: center; }
  .hero-line, .hero-sub { margin-left: auto; margin-right: auto; }
  .hero .stores { justify-content: center; }
  .topbar .pill-button { display: none; }
  .phone { --tilt-y: 0deg; --tilt-x: 0deg; }
  .showcase-inline { flex-direction: column; justify-content: center; }
}

/* ------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal, .phone.reveal { opacity: 1; transform: none; }
  .figure, .figure.awake img { transform: none; }
  .dust { display: none; }
}
