@font-face {
  font-family: "Lilita One";
  src: url("fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #120a33;
  --bg-deep: #0b0622;
  --panel: #22125e;
  --panel-2: #2c1877;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f1efff;
  --muted: #b9bfe6;
  --gold: #ffc93c;
  --gold-deep: #e59a14;
  --pink: #ec407a;
  --pink-deep: #b8245a;
  --cyan: #2fd8ff;
  --cyan-deep: #0a8fd1;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 24px;
  --gutter: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 600px at 80% -10%, rgba(116, 64, 255, 0.45), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(236, 64, 122, 0.18), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; }
a { color: var(--cyan); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; line-height: 1.1; }
h2 { font-size: clamp(30px, 5vw, 44px); margin: 0 0 12px; }
h3 { font-size: 22px; margin: 0 0 6px; }
p { margin: 0 0 12px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px max(var(--gutter), calc((100% - 1160px) / 2));
  background: rgba(18, 10, 51, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--display); font-size: 21px; }
.brand img { border-radius: 10px; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  font-family: var(--display);
  font-size: 17px;
  color: #3b1d00;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(#ffe07a, var(--gold));
  box-shadow: 0 3px 0 var(--gold-deep);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}
.brand span, .nav-cta { white-space: nowrap; }
@media (max-width: 400px) {
  .nav { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .brand { font-size: 18px; gap: 8px; }
  .brand img { width: 34px; height: 34px; }
  .nav-cta { font-size: 15px; padding: 10px 12px; }
}
@media (max-width: 340px) {
  .brand span { font-size: 16px; }
  .nav-cta { font-size: 14px; padding: 10px 10px; }
}

/* ---------- Layout ---------- */
main { padding: 0 var(--gutter); }
.section { max-width: 1160px; margin: 0 auto; padding: 72px 0 8px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-sub { color: var(--muted); }

.ribbon {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 16px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(#f2648f, var(--pink));
  border: 2px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--pink-deep);
}

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(229, 154, 20, 0.55), 0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 22px;
  font: 400 19px/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 16px;
  border: 3px solid var(--gold);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(3px); }
.btn-gold { color: #2a1600; background: linear-gradient(#ffe68f, var(--gold)); box-shadow: 0 4px 0 var(--gold-deep); }
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-deep); }
.btn-ghost { color: #fff; background: linear-gradient(#5b3bd6, #3f22a8); box-shadow: 0 4px 0 #24117a; }
.btn-ghost:active { box-shadow: 0 1px 0 #24117a; }
.btn.small { min-height: 40px; font-size: 16px; padding: 8px 16px; border-width: 2px; }
.btn.big { min-height: 60px; font-size: 22px; padding: 14px 30px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* ---------- Hero ---------- */
.hero {
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 0 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}
.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(47, 216, 255, 0.12);
  border: 1px solid rgba(47, 216, 255, 0.4);
  color: var(--cyan);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
}
.logo { margin: 18px 0 10px; display: flex; flex-direction: column; line-height: 0.9; }
.logo-top {
  font-size: clamp(64px, 11vw, 120px);
  background: linear-gradient(#fff3b0 10%, var(--gold) 55%, #ff9d1c 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 0 #6a2a00) drop-shadow(0 0 2px #3a1a00);
}
.logo-bottom {
  font-size: clamp(38px, 6.4vw, 70px);
  background: linear-gradient(#b8f4ff 10%, var(--cyan) 50%, #1d7cf2 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #1a1060);
}
.tagline { font-family: var(--display); font-size: clamp(22px, 3vw, 28px); line-height: 1.25; color: #fff; margin-bottom: 12px; }
.lead { color: var(--muted); max-width: 520px; font-size: 18px; }

.store-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 26px 0 26px; }
.app-store-badge { display: inline-block; width: 180px; line-height: 0; border-radius: 12px; transition: transform 0.15s ease; }
.app-store-badge:hover { transform: translateY(-2px); }
.app-store-badge svg { width: 100%; height: auto; }

.stats { list-style: none; display: flex; gap: 12px; padding: 0; margin: 0; flex-wrap: wrap; }
.stats li {
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}
.stats strong { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--gold); margin-right: 4px; }

.hero-phone { position: relative; justify-self: center; }
.phone {
  position: relative;
  width: min(300px, 72vw);
  aspect-ratio: 886 / 1920;
  border-radius: 46px;
  padding: 10px;
  background: linear-gradient(145deg, #4b3a8f, #1b1144);
  box-shadow: 0 0 0 2px #6b58c4, 0 40px 80px rgba(0, 0, 0, 0.55), 0 0 120px rgba(116, 64, 255, 0.45);
  transform: rotate(2deg);
}
.phone video { width: 100%; height: 100%; object-fit: cover; border-radius: 37px; display: block; background: var(--bg-deep); }
.phone-island { position: absolute; top: 22px; left: 50%; width: 31%; height: 22px; transform: translateX(-50%); background: #000; border-radius: 20px; }

.float-tile {
  position: absolute;
  width: 84px;
  height: 84px;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
  animation: bob 5s ease-in-out infinite;
}
.float-tile img { width: 100%; height: 100%; object-fit: contain; }
.t1 { top: 8%; left: -64px; transform: rotate(-10deg); }
.t2 { bottom: 16%; left: -84px; animation-delay: -1.6s; }
.t3 { top: 34%; right: -60px; animation-delay: -3.2s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 32px; gap: 36px; }
  .lead { margin: 0 auto 12px; }
  .store-row, .stats { justify-content: center; }
  .logo { align-items: center; }
  .t1 { left: -34px; } .t2 { left: -40px; } .t3 { right: -30px; }
  .float-tile { width: 64px; height: 64px; padding: 8px; border-radius: 18px; }
}

/* ---------- Demo ---------- */
.demo {
  display: grid;
  grid-template-columns: 220px minmax(0, 460px);
  justify-content: center;
  gap: 28px;
  align-items: start;
}
.demo-side { display: grid; gap: 18px; }
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 3px solid var(--gold);
  border-radius: 22px;
  padding: 26px 14px 14px;
  text-align: center;
}
.panel-label {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 2px 14px;
  font-family: var(--display);
  font-size: 17px;
  color: #fff;
  background: linear-gradient(#f2648f, var(--pink));
  border: 2px solid var(--gold);
  border-radius: 10px;
  white-space: nowrap;
}
.target-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.target-grid .mini {
  aspect-ratio: 1;
  border-radius: 10px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.target-grid img { width: 100%; height: 100%; object-fit: contain; display: block; }
.moves { font-family: var(--display); font-size: 48px; line-height: 1; margin: 4px 0 0; }

.theme-tabs { display: flex; gap: 6px; padding: 5px; background: rgba(0, 0, 0, 0.25); border-radius: 14px; }
.theme-tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 400 15px var(--display);
  cursor: pointer;
}
.theme-tabs button[aria-selected="true"] { background: var(--gold); color: #2a1600; }

.board-wrap { text-align: center; }
.board {
  position: relative;
  padding: 12px;
  border-radius: 30px;
  background: linear-gradient(180deg, #1d1250, #140b3a);
  border: 4px solid var(--gold);
  box-shadow: 0 7px 0 rgba(229, 154, 20, 0.55), 0 0 60px rgba(116, 64, 255, 0.35), inset 0 0 40px rgba(0, 0, 0, 0.5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.board-grid { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 20px; cursor: grab; }
.board-grid:active { cursor: grabbing; }
.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: 33.3333%;
  height: 33.3333%;
  padding: 5px;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.25, 1.1);
}
.tile.no-anim { transition: none; }
.tile .face {
  width: 100%;
  height: 100%;
  border-radius: 20%;
  padding: 11%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 6px 14px rgba(0, 0, 0, 0.35);
}
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.3)); }
.board.solved .tile .face { animation: pop 0.5s ease both; }
.board.solved .tile:nth-child(3n + 2) .face { animation-delay: 0.06s; }
.board.solved .tile:nth-child(3n) .face { animation-delay: 0.12s; }
@keyframes pop { 50% { transform: scale(1.08); } }

.win {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 26px;
  background: rgba(14, 7, 40, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.35s ease both;
}
.win[hidden] { display: none; }
.win-title { font-family: var(--display); font-size: 44px; color: var(--gold); margin: 0; }
.win-stars { font-size: 44px; letter-spacing: 6px; margin: 4px 0 4px; color: var(--gold); text-shadow: 0 3px 0 var(--gold-deep); }
.win-stars .off { color: rgba(255, 255, 255, 0.2); text-shadow: none; }
.win-text { color: var(--muted); margin-bottom: 18px; }
.win-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@keyframes fade { from { opacity: 0; transform: scale(0.96); } }

.demo-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.demo-hint { color: var(--muted); font-size: 15px; margin-top: 12px; min-height: 1.6em; }
.demo-hint .g { color: #3ddc84; }
.demo-hint .o { color: #ff9f43; }

/* Green / orange feedback, as in the game: one frame around the moved
   row or column. Tiles have 5px padding, so a frame 2px in from the cell
   edge with a 3px line sits just around the tile faces. */
.move-flash {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border: 3px solid var(--fc);
  border-radius: 22px;
  box-shadow: 0 0 12px var(--glow);
  animation: flash 1.2s ease forwards;
}
.move-flash.good { --fc: #3ddc84; --glow: rgba(61, 220, 132, 0.7); }
.move-flash.bad { --fc: #ff9f43; --glow: rgba(255, 159, 67, 0.7); }
.move-flash.row { left: 2px; right: 2px; top: calc(var(--i) * 33.3333% + 2px); height: calc(33.3333% - 4px); }
.move-flash.col { top: 2px; bottom: 2px; left: calc(var(--i) * 33.3333% + 2px); width: calc(33.3333% - 4px); }
.move-flash .badge {
  position: absolute;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--fc);
  border: 2px solid #fff;
  color: #fff;
  font: 900 clamp(12px, 3.6vw, 20px)/1 system-ui, -apple-system, sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  animation: badge-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
/* About a third of a tile, on the far end of the line. */
.move-flash.row .badge { height: 30%; right: 4px; top: 35%; }
.move-flash.col .badge { width: 30%; bottom: 4px; left: 35%; }
@keyframes flash { 0% { opacity: 0; } 10%, 65% { opacity: 1; } 100% { opacity: 0; } }
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .move-flash, .move-flash .badge { animation-duration: 0.01s; animation-fill-mode: none; } }

.confetti { position: absolute; top: 40%; left: 50%; width: 10px; height: 14px; border-radius: 3px; z-index: 4; pointer-events: none; animation: burst 1.1s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

@media (max-width: 760px) {
  .demo { grid-template-columns: 1fr; }
  .demo-side { grid-template-columns: 1fr 1fr; gap: 20px 14px; }
  .target-panel { padding: 22px 10px 10px; }
  .target-grid { gap: 4px; max-width: 132px; margin: 0 auto; }
  .target-grid .mini { border-radius: 8px; padding: 3px; }
  .moves-panel { display: grid; place-content: center; }
  .moves { font-size: 44px; }
  .theme-tabs { grid-column: 1 / -1; }
}

/* ---------- Steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps .card { position: relative; padding-top: 34px; }
.step-num {
  position: absolute;
  top: -22px;
  left: 22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 24px;
  color: #2a1600;
  background: linear-gradient(#ffe68f, var(--gold));
  border: 3px solid #fff3c4;
  box-shadow: 0 3px 0 var(--gold-deep);
}
.steps p, .feature p { color: var(--muted); margin: 0; }

/* ---------- Worlds ---------- */
.worlds { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.world {
  position: relative;
  padding: 26px 12px 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 3px solid var(--gold);
  text-align: center;
  transition: transform 0.2s ease;
}
.world:hover { transform: translateY(-4px) rotate(-1deg); }
.world h3 {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 2px 12px;
  font-size: 16px;
  white-space: nowrap;
  background: linear-gradient(#f2648f, var(--pink));
  border: 2px solid var(--gold);
  border-radius: 10px;
}
.world-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.world-tiles span { min-width: 0; aspect-ratio: 1; border-radius: 9px; padding: 3px; border: 1px solid rgba(255, 255, 255, 0.16); }
.world-tiles img { width: 100%; height: 100%; min-width: 0; object-fit: contain; display: block; }
.world p { margin: 10px 0 0; font-family: var(--display); color: var(--gold); font-size: 15px; }
@media (max-width: 960px) { .worlds { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .worlds { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 12px; }
  .world { padding: 24px 8px 10px; }
  .world-tiles { gap: 4px; }
  .world-tiles span { border-radius: 7px; padding: 2px; }
  .world h3 { font-size: 15px; padding: 2px 10px; }
}

/* ---------- Features ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  font-size: 28px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}
@media (max-width: 900px) {
  .steps, .features { grid-template-columns: 1fr 1fr; }
  .steps { row-gap: 40px; }
}
@media (max-width: 600px) { .steps, .features { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.faq .card { padding: 0; border-width: 2px; box-shadow: 0 4px 0 rgba(229, 154, 20, 0.45); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 54px 18px 22px;
  font-family: var(--display);
  font-size: 20px;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  color: var(--gold);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq details p { padding: 0 22px 20px; margin: 0; color: var(--muted); }

/* ---------- Final + footer ---------- */
.final { text-align: center; padding-bottom: 72px; }
.final img { border-radius: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); margin-bottom: 18px; }
.final p { color: var(--muted); margin-bottom: 24px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--gutter) 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.2);
}
.footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; margin-bottom: 12px; }
.footer nav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.footer p { margin: 0 auto; max-width: 640px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .float-tile, .confetti, .board.solved .tile .face { animation: none; }
  .tile { transition-duration: 0.01s; }
}

/* ---------- Motion layer ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 30; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--cyan), var(--gold), var(--pink)); }
.bg-tiles { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-tile { position: absolute; width: 70px; opacity: 0.09; animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { to { rotate: 25deg; translate: 30px -40px; } }
.nav { transition: box-shadow 0.3s ease, background 0.3s ease; }
.nav.scrolled { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); background: rgba(18, 10, 51, 0.92); }

.logo-top { animation: dropIn 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.logo-bottom { animation: riseIn 0.8s 0.25s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes dropIn { from { opacity: 0; translate: 0 -60px; scale: 0.8; } }
@keyframes riseIn { from { opacity: 0; translate: 0 30px; } }

[data-reveal] { opacity: 0; translate: 0 36px; transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.2, 0.9, 0.3, 1); transition-delay: var(--d, 0s); }
[data-reveal].in { opacity: 1; translate: 0 0; }
.ribbon.in, .in .ribbon { animation: wobble 0.7s 0.3s ease both; }
@keyframes wobble { 30% { rotate: -6deg; scale: 1.08; } 60% { rotate: 4deg; } }

.card, .world, .phone, .panel { --rx: 0deg; --ry: 0deg; --lift: 0px; transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift)); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.phone { transform: perspective(1000px) rotate(2deg) rotateX(var(--rx)) rotateY(var(--ry)); }
.card::after, .world::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.14), transparent 60%); }
.card { position: relative; }
@media (hover: hover) {
  .card:hover, .world:hover { --lift: -8px; box-shadow: 0 10px 0 rgba(229, 154, 20, 0.55), 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(255, 201, 60, 0.25); }
  .card:hover::after, .world:hover::after { opacity: 1; }
  .feature:hover .feature-icon { animation: wiggle 0.6s ease; }
  .app-store-badge:hover { box-shadow: 0 0 30px rgba(255, 255, 255, 0.25); }
}
.world:hover { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift)); }
@keyframes wiggle { 25% { rotate: -12deg; scale: 1.15; } 50% { rotate: 10deg; } 75% { rotate: -5deg; } }

.btn { position: relative; overflow: hidden; }
.btn::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); transform: skewX(-20deg); transition: left 0.6s ease; }
.btn:hover::after { left: 130%; }
.btn:hover, .nav-cta:hover { translate: 0 -2px; }

.world-tiles span { transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.faq details[open] p { animation: riseIn 0.35s ease both; }
.board.nudge .tile[data-r="0"] .face { animation: nudge 2.8s 1.5s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { translate: 0 0; } 80% { translate: -14px 0; } 90% { translate: 4px 0; } }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; translate: none; transition: none; }
  .logo-top, .logo-bottom, .bg-tile, .board.nudge .tile .face, .ribbon { animation: none !important; }
}

/* ---------- Small-screen fit ---------- */
.board { container-type: inline-size; }
.win { gap: 0; }
@container (max-width: 380px) {
  .win { padding: 14px; }
  .win-title { font-size: 34px; }
  .win-stars { font-size: 34px; letter-spacing: 4px; margin: 2px 0; }
  .win-text { font-size: 14px; line-height: 1.4; margin-bottom: 12px; text-align: center; }
  .win-actions { flex-wrap: nowrap; gap: 8px; }
  .win-actions .btn { min-height: 42px; font-size: 15px; padding: 8px 12px; border-width: 2px; }
}
@container (max-width: 300px) {
  .win-title { font-size: 30px; }
  .win-stars { font-size: 28px; }
  .win-text { font-size: 13px; }
  .win-actions .btn { font-size: 14px; padding: 8px 10px; }
}
@media (max-width: 360px) {
  .demo-side { gap: 18px 10px; }
  .target-grid { max-width: 112px; }
  .moves { font-size: 38px; }
  .theme-tabs button { min-height: 38px; }
  .board { padding: 8px; border-radius: 24px; }
  .board-grid { border-radius: 16px; }
  .section { padding-top: 56px; }
}

/* Keep the whole board visible on short screens (phones held sideways). */
.board {
  max-width: max(260px, min(100%, calc(100vh - 110px)));
  max-width: max(260px, min(100%, calc(100svh - 110px)));
  margin: 0 auto;
}
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 24px; }
  .phone { width: min(220px, 40vw); }
}

/* Touch screens: a quick lift when a card is tapped. */
@media (hover: none) {
  .card:active, .world:active { --lift: -6px; }
}

/* Touch screens: the card whose turn it is lifts, glows and plays its icon. */
.card.turn { --lift: -10px; scale: 1.03; border-color: #ffe08a; box-shadow: 0 12px 0 rgba(229, 154, 20, 0.6), 0 26px 50px rgba(0, 0, 0, 0.45), 0 0 44px rgba(255, 201, 60, 0.5); }
.card { transition: transform 0.35s cubic-bezier(0.2, 1.2, 0.4, 1), box-shadow 0.35s ease, scale 0.35s cubic-bezier(0.2, 1.2, 0.4, 1), border-color 0.35s ease; }
.card.turn::after { opacity: 1; }
.card.turn .feature-icon { animation: wiggle 0.7s ease; }
.card.turn .step-num { animation: numPop 0.7s ease; }
@keyframes numPop { 30% { scale: 1.3; rotate: -12deg; } 60% { scale: 0.95; rotate: 6deg; } }
.steps > li.in .step-num { animation: numPop 0.7s 0.4s ease both; }

/* "Play in your browser" next to the App Store badge. */
.play-web { min-height: 52px; font-size: 18px; padding: 12px 22px; }
