/* Word Lantern website (docs/website.md). Layout and components only: every
   color is a var(--token) that tool/build_website.dart appends from the
   app's palette (lib/ui/palette.dart), for light and dark mode (W8). */

/* W9: the app's font, Baloo 2 (SIL Open Font License, /assets/Baloo2-OFL.txt),
   served from this site. The app ships SemiBold, Bold and ExtraBold; body text
   uses SemiBold, as in the app. */
@font-face {
  font-family: "Baloo 2";
  src: url("/assets/Baloo2-SemiBold.ttf") format("truetype");
  font-weight: 400 600;
  font-display: swap;
}

@font-face {
  font-family: "Baloo 2";
  src: url("/assets/Baloo2-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Baloo 2";
  src: url("/assets/Baloo2-ExtraBold.ttf") format("truetype");
  font-weight: 800 900;
  font-display: swap;
}

:root {
  --radius: 28px;
  --max: 1080px;
  --bar-h: 56px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --read: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  --scroll-pad: 88px;
  scroll-padding-top: var(--scroll-pad);
  background: var(--bg-bottom);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Baloo 2", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom)) fixed;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
  outline: none;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

h2 {
  font-size: clamp(28px, 4vw, 38px);
}

h3 {
  font-size: 21px;
  font-weight: 700;
}

p {
  margin: 0 0 14px;
}

.wrap {
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 12px;
  z-index: 20;
}

.skip:focus {
  left: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--link);
}

.lead {
  font-size: 20px;
  color: var(--muted);
  max-width: 62ch;
}

.meta {
  font-size: 15px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.button.primary {
  border-color: transparent;
  background: var(--button);
  color: var(--on-button);
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.store-button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticks li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 10px;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--glow);
}

/* ---------- Header (W9) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 16px 0;
  pointer-events: none;
}

.bar {
  pointer-events: auto;
  position: relative;
  width: min(100%, calc(var(--max) + 24px));
  min-height: var(--bar-h);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg-top) var(--bar-glass), transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: inset 0 0 0 1px var(--bar-ring), 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.site-header.scrolled .bar {
  background: color-mix(in srgb, var(--bg-top) var(--bar-glass-scrolled), transparent);
  box-shadow: inset 0 0 0 1px var(--bar-ring), var(--bar-shadow);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 21px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.site-nav {
  display: flex;
  gap: 2px;
}

.site-nav a {
  padding: 7px 15px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  opacity: 0.82;
  transition: opacity 0.25s var(--ease), background-color 0.25s var(--ease);
}

.site-nav a:hover {
  opacity: 1;
  background: var(--nav-hover);
}

.site-nav a[aria-current="page"] {
  opacity: 1;
  background: var(--nav-current);
}

/* The right end of the bar: the light/dark switch (W8.1), then the phone
   menu button. */
.bar-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.mode-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.25s var(--ease);
}

.mode-toggle:hover {
  background: var(--nav-hover);
}

.mode-toggle:focus-visible,
.menu:focus-visible,
.site-nav a:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.mode-toggle .icon-sun,
.mode-toggle[aria-pressed="true"] .icon-moon {
  display: none;
}

.mode-toggle[aria-pressed="true"] .icon-sun {
  display: block;
}

/* The phone menu: hidden on wider screens. */
.menu,
.scrim,
.sheet {
  display: none;
}

.menu {
  justify-self: end;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.menu:hover {
  background: var(--nav-hover);
}

.menu span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.4s var(--ease);
}

.menu span:first-child {
  top: 17px;
}

.menu span:last-child {
  top: 25px;
}

.site-header.open .menu span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.site-header.open .menu span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--menu-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.site-header.open .scrim {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  pointer-events: auto;
  position: absolute;
  top: calc(100% + 8px);
  left: 16px;
  right: 16px;
  padding: 10px;
  border-radius: 28px;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg-top) 92%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: inset 0 0 0 1px var(--bar-ring), var(--bar-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top;
  transition: opacity 0.25s var(--ease), transform 0.4s var(--ease), visibility 0s linear 0.4s;
}

.site-header.open .sheet {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.25s var(--ease), transform 0.4s var(--ease);
}

.sheet ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sheet li,
.sheet .more {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s var(--ease), transform 0.45s var(--ease);
}

.site-header.open .sheet li,
.site-header.open .sheet .more {
  opacity: 1;
  transform: none;
  transition-delay: calc(45ms * var(--i) + 60ms);
}

.sheet li a {
  display: block;
  padding: 8px 16px;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.25;
}

.sheet li a:hover {
  background: var(--nav-hover);
}

.sheet li a[aria-current="page"] {
  background: var(--nav-current);
}

.sheet .more {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin: 8px 6px 0;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
}

.sheet .more a {
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

@media (max-width: 720px) {
  .bar {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    display: none;
  }

  .menu,
  .scrim,
  .sheet {
    display: block;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 72px;
  padding: 32px 0 40px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-footer a {
  color: var(--muted);
}

/* ---------- Store buttons (W5) ---------- */

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
}

.store-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 24px 10px 20px;
  border-radius: 20px;
  border: 1px solid var(--store-edge);
  background: var(--store-bg);
  color: var(--store-ink);
  box-shadow: var(--store-shadow);
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.store-button svg {
  flex: none;
  width: auto;
  height: 32px;
}

.store-button > span {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.store-button small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.8;
}

a.store-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--store-shadow-hover);
}

.store-button[aria-disabled="true"] {
  cursor: default;
}

.store-button[aria-disabled="true"] svg,
.store-button[aria-disabled="true"] > span {
  opacity: 0.6;
}

/* ---------- Light and dark images (W8.4) ---------- */

/* Utilities, so they win over a component's own display. */
.on-dark {
  display: none !important;
}

:root[data-mode="dark"] .on-light {
  display: none !important;
}

:root[data-mode="dark"] .on-dark {
  display: block !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .on-light {
    display: none !important;
  }

  :root:not([data-mode="light"]) .on-dark {
    display: block !important;
  }
}

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

.tag {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--link);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hl {
  color: var(--link);
}

.section-head {
  max-width: 760px;
  margin-bottom: 40px;
}

.section-head h2 {
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.04;
}

.section-head.split {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 56px;
}

.section-head.split > div {
  max-width: 620px;
}

.section-head.split .lead {
  max-width: 420px;
  margin: 0;
}

/* ---------- Devices: real screens in a phone or tablet frame (W3.3) ---------- */

.device {
  position: relative;
  flex: none;
  padding: 9px;
  border-radius: 46px;
  background: var(--device);
  box-shadow: 0 0 0 1.5px var(--device-edge), 0 40px 80px -36px rgba(20, 10, 30, 0.55);
}

.device .screen {
  overflow: hidden;
  border-radius: 38px;
  background: var(--bg-top);
}

.device img {
  display: block;
  width: 100%;
  height: auto;
}

.device.phone {
  width: var(--phone-w, 250px);
}

.device.tablet {
  width: var(--tablet-w, 420px);
  padding: 13px;
  border-radius: 34px;
}

.device.tablet .screen {
  border-radius: 22px;
}

/* A tablet on its side (W3.3). */
.device.tablet.landscape {
  width: var(--landscape-w, 520px);
}

/* ---------- Hero, with the game on stage ---------- */

.hero {
  position: relative;
  padding: 56px 0 0;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  left: 50%;
  top: 140px;
  width: 1100px;
  aspect-ratio: 1;
  margin-left: -550px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--lantern) 0%, transparent 64%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  margin: 22px 0 18px;
  font-size: clamp(54px, 9vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.hero .lead {
  max-width: 640px;
  margin-inline: auto;
}

.hero .store-buttons {
  justify-content: center;
  margin-top: 18px;
}

.stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-top: 56px;
  padding: 0 16px;
}

.stage .device {
  --phone-w: 236px;
  position: relative;
  z-index: 1;
}

.stage-left {
  margin-right: -64px;
  transform: translateY(64px) rotate(-5deg);
}

.stage-right {
  margin-left: -64px;
  transform: translateY(64px) rotate(5deg);
}

/* ---------- The game (W3.4) ---------- */

.game {
  position: relative;
  z-index: 2;
  width: min(100%, 470px);
  padding: 22px 22px 18px;
  text-align: left;
}

.game-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.game-head .eyebrow {
  margin-bottom: 2px;
}

.game-head h2 {
  margin: 0;
  font-size: 24px;
}

.game-count {
  flex: none;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.game-help {
  margin: 8px 0 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--muted);
}

.game-board {
  position: relative;
  aspect-ratio: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.game-pills,
.game-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game-pills line {
  stroke-width: 0.8;
  stroke-linecap: round;
}

.game-pills .select {
  stroke: var(--select);
}

.game-pills .miss {
  animation: miss 0.35s ease;
}

@keyframes miss {
  25% {
    transform: translateX(-0.12px);
  }

  50% {
    transform: translateX(0.12px);
  }

  75% {
    transform: translateX(-0.06px);
  }
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
}

.game-grid .cell {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0.12em 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: clamp(17px, 4.8vw, 24px);
  line-height: 1;
  cursor: pointer;
}

.game-grid .cell:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.game-grid .cell[aria-pressed="true"] {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.game-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.game-words li {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.game-words li.found {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  text-decoration: line-through;
}

.game-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 14px;
}

.game-status {
  flex: 1 1 180px;
  min-height: 1.5em;
  margin: 0;
  font-weight: 700;
}

.game.solved .game-board {
  filter: drop-shadow(0 0 22px var(--lantern));
}

/* ---------- Highlight strip ---------- */

.strip {
  position: relative;
  z-index: 3;
  margin-top: 10px;
  padding: 20px 0;
  background: var(--strip);
  color: var(--on-strip);
}

.strip ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 34px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  font-size: 20px;
  font-weight: 700;
}

.strip li {
  position: relative;
}

.strip li + li::before {
  content: "✦";
  position: absolute;
  left: -24px;
  font-size: 14px;
  top: 0.35em;
}

/* ---------- Screens tour (W3.5) ---------- */

.tour-section {
  padding: 120px 0 80px;
  /* Clips the glow without breaking the pinned panel (W3.1: no sideways
     scrolling). */
  overflow-x: clip;
  --head: 84px;
  --step: 75svh;
}

.tour-copy {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tour-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.tour-num {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  color: var(--link);
}

.tour-step h3 {
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.05;
}

.tour-step p {
  max-width: 440px;
  font-size: 19px;
  color: var(--muted);
}

.tour-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}

.tour-go {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.tour-go:hover {
  background: var(--nav-hover);
  color: var(--ink);
}

.tour-go.on {
  background: var(--button);
  color: var(--on-button);
}

.tour-go:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.tour-go-num {
  font-size: 13px;
  opacity: 0.85;
}

.tour-stage {
  position: relative;
}

.tour-glow {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 620px;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--lantern) 0%, transparent 66%);
}

/* Without scripts, the tour is a plain list: each step, then its screen. */
html:not(.js) .tour-nav,
html:not(.js) .tour-mark,
html:not(.js) .tour-glow {
  display: none;
}

html:not(.js) .tour-pin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

html:not(.js) .tour-frames {
  margin-bottom: 24px;
  --phone-w: 220px;
  --tablet-w: 340px;
  --landscape-w: min(100%, 460px);
}

html:not(.js) .tour-frames .screen {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--device);
}

html:not(.js) .tour-shot img {
  border-radius: 30px;
}

html:not(.js) .tour-step {
  margin-bottom: 32px;
}

/* With scripts: the panel is pinned to the window for the length of the
   section, with the device in the middle of the window; each step's screen
   and words fade in as the page scrolls (website/src/app.js). The last step
   keeps half a step of scrolling, so it too sits centered before the page
   moves on. */
.js .tour {
  position: relative;
  height: calc(100svh + (var(--steps) - 0.5) * var(--step));
}

.js .tour-pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.js .tour-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  height: 100%;
  padding: var(--head) 0 24px;
}

.js .tour-copy {
  position: relative;
  min-height: 280px;
}

.js .tour-step {
  position: absolute;
  inset: 50% 0 auto;
  opacity: 0;
  translate: 0 -38%;
  transition: opacity 0.4s ease, translate 0.5s var(--ease);
  pointer-events: none;
}

.js .tour-step.on {
  opacity: 1;
  translate: 0 -50%;
  pointer-events: auto;
}

.js .tour-step.past {
  translate: 0 -62%;
}

.js .tour-stage {
  height: 100%;
  display: grid;
  place-items: center;
}

.js .tour-frames {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  scale: 0.94;
  transition: opacity 0.45s ease, scale 0.6s var(--ease);
}

.js .tour-frames.on {
  opacity: 1;
  scale: 1;
}

/* Centered in the window, so it keeps clear of the header above it. */
.js .tour-frames .device {
  --phone-w: min(290px, calc((100svh - 2 * var(--head) - 24px) * 0.44));
  --tablet-w: min(460px, calc((100svh - 2 * var(--head) - 24px) * 0.7));
  --landscape-w: min(600px, 100%, calc((100svh - 2 * var(--head) - 50px) * 1.3));
}

/* Every screen of one device sits in its one frame; the step's screen
   shows. */
.js .tour-frames .screen {
  display: grid;
}

.js .tour-shot {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.js .tour-shot.on {
  opacity: 1;
}

/* Snap points, one per step: scrolling comes to rest with the device
   centered on a step, never between two. */
.js .tour-mark {
  position: absolute;
  left: 0;
  top: calc(var(--i) * var(--step));
  height: 1px;
  width: 1px;
  scroll-snap-align: start;
  /* Rest with the mark at the very top, not under the page's scroll
     padding, so the panel is pinned. */
  scroll-margin-top: calc(-1 * var(--scroll-pad));
}

html.js:has(.tour) {
  scroll-snap-type: y proximity;
}

/* ---------- What's inside ---------- */

.inside {
  padding: 40px 0 110px;
}

.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature {
  padding: 28px;
}

.feature-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.feature-body h3 {
  margin: 0;
}

.feature h3 {
  font-size: 24px;
}

.feature p {
  margin: 0;
  color: var(--muted);
}

.feature-wide {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.feature-wide .feature-body {
  max-width: 420px;
}

.feature-wide h3 {
  font-size: 32px;
}

.feature-icon,
.offer-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--link);
}

.grow {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.grow i {
  display: block;
  border-radius: 14px;
}

.grow i:nth-child(1) {
  width: 44px;
  height: 44px;
  background: var(--pill-0);
}

.grow i:nth-child(2) {
  width: 60px;
  height: 60px;
  background: var(--pill-1);
}

.grow i:nth-child(3) {
  width: 80px;
  height: 80px;
  background: var(--pill-3);
}

.grow i:nth-child(4) {
  width: 104px;
  height: 104px;
  border-radius: 20px;
  background: var(--glow);
}

/* ---------- Puzzle styles: a staircase to each level ---------- */

.styles-section .eyebrow {
  color: var(--ink);
}

.styles-section {
  padding: 110px 0 0;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  border-bottom: 3px solid var(--accent);
}

.stairs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 18px;
}

.stair {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: calc(380px + var(--i) * 60px);
  padding: 30px 26px 32px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: color-mix(in srgb, var(--surface) calc(100% - var(--i) * 6%), var(--accent));
}

.stair:last-child {
  box-shadow: inset 0 3px 0 var(--accent);
}

.stair-level {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}

.stair-level b {
  /* Five steps across: "400" still fits beside "Level". */
  font-size: clamp(48px, 4.6vw, 76px);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.03em;
  color: var(--link);
}

.stair-level > span[aria-hidden] {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.stair h3 {
  font-size: 26px;
}

.stair p {
  margin: 0;
  color: var(--muted);
}

.stair-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stair-chips span {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* The ground step is the surface color itself: its chip needs an edge. */
.stair-classic .stair-chips span {
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- Prices ---------- */

.prices {
  padding: 120px 0 100px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.free-card {
  padding: 34px;
}

.free-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.free-head h3 {
  margin: 0;
  font-size: 34px;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.offers {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.offer {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 26px;
}

.offer-main {
  box-shadow: inset 0 0 0 2px var(--accent), var(--shadow);
}

.offer h3 {
  margin-bottom: 4px;
}

.offer p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Story ---------- */

.story {
  padding: clamp(28px, 6vw, 72px);
  margin-bottom: 100px;
}

.story h2 {
  font-size: clamp(22px, 2.4vw, 28px);
  color: var(--muted);
}

.story-line {
  max-width: 980px;
  margin: 4px 0 40px;
  font-size: clamp(26px, 3.4vw, 42px);
  font-weight: 700;
  line-height: 1.2;
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 36px;
}

.story-seen {
  padding: 26px;
  border-radius: 24px;
  background: var(--surface-soft);
}

.story-seen p {
  margin: 0;
}

.story-made {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
}

.story-made h4 {
  margin: 0 0 6px;
  font-size: 21px;
}

.story-made p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Call to action ---------- */

.cta-band {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 44px clamp(24px, 5vw, 60px);
  border-radius: 36px;
  background: var(--glow);
  color: #2b1d33;
}

.cta-band h2 {
  margin: 0 0 4px;
  font-size: clamp(26px, 3.4vw, 40px);
}

.cta-band p {
  margin: 0;
  font-size: 18px;
}

.cta-band .button {
  min-height: 56px;
  border-color: transparent;
  background: #2b1d33;
  color: #ffffff;
  font-size: 19px;
}

/* ---------- Home on narrower screens ---------- */

@media (max-width: 980px) {
  .stage-left,
  .stage-right {
    display: none;
  }

  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stairs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Classic is the ground floor: the whole first row. */
  .stair-classic {
    grid-column: 1 / -1;
  }

  .stair {
    min-height: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 28px;
  }

  .price-grid,
  .story-grid {
    grid-template-columns: 1fr;
  }

  /* The tour: the device in the middle of the window, its words pinned
     to the bottom, clear of it. */
  .tour-section {
    --caption: 196px;
  }

  .js .tour-pin {
    display: block;
  }

  .js .tour-stage {
    position: absolute;
    inset: 0;
  }

  .js .tour-text {
    position: absolute;
    inset: auto 0 0;
    height: var(--caption);
    justify-content: flex-end;
    gap: 10px;
    padding: 0 0 12px;
  }

  .js .tour-copy {
    flex: 1;
    min-height: 0;
  }

  .js .tour-step {
    inset: auto 0 0;
    translate: 0 12px;
  }

  .js .tour-step.on,
  .js .tour-step.past {
    translate: none;
  }

  .js .tour-frames .device {
    --phone-w: min(250px, calc((100svh - 2 * max(var(--head), var(--caption)) - 12px) * 0.44));
    --tablet-w: min(400px, calc((100svh - 2 * max(var(--head), var(--caption)) - 12px) * 0.7));
    --landscape-w: min(100vw - 32px, 560px, calc((100svh - 2 * max(var(--head), var(--caption)) - 38px) * 1.3));
  }

  .tour-glow {
    width: 100%;
  }

  .tour-num {
    font-size: 30px;
  }

  .tour-step h3 {
    font-size: 26px;
    margin-bottom: 6px;
  }

  .tour-step p {
    font-size: 16px;
    margin: 0;
  }

  .js .tour-meta {
    margin-bottom: 4px;
  }

  /* One row of numbers sharing the width (about 44 px each on a phone). */
  .tour-nav {
    display: flex;
    justify-content: center;
    gap: 0;
  }

  .tour-go {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    max-width: 56px;
    padding: 6px 0;
  }

  .tour-go-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tour-go-num {
    font-size: 15px;
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 32px;
  }

  .stage {
    margin-top: 36px;
  }

  .game {
    padding: 18px 14px 14px;
  }

  .bento,
  .stairs,
  .story-made {
    grid-template-columns: 1fr;
  }

  .feature-wide {
    grid-column: auto;
  }

  .grow {
    display: none;
  }

  .strip ul {
    gap: 6px 26px;
    font-size: 17px;
  }

  .strip li + li::before {
    left: -18px;
  }

  .tour-section {
    padding-top: 80px;
  }

  .stair-level b {
    font-size: 60px;
  }

  .free-card,
  .offer {
    padding: 24px 20px;
  }
}

/* On a short window (a phone on its side, or a small phone) the tour
   can't pin with a useful device size: it becomes the plain list. */
@media (max-height: 560px), (max-width: 980px) and (max-height: 640px) {
  .js .tour {
    height: auto;
  }

  .js .tour-pin {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
  }

  .js .tour-step,
  .js .tour-frames,
  .js .tour-shot {
    position: static;
    opacity: 1;
    translate: none;
    scale: none;
  }

  .js .tour-frames .screen {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--device);
  }

  .js .tour-copy {
    min-height: 0;
  }

  .js .tour-text {
    position: static;
    height: auto;
  }

  .js .tour-stage {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
  }

  .js .tour-frames {
    --phone-w: 160px;
    --tablet-w: 260px;
    --landscape-w: 340px;
  }

  .js .tour-mark,
  .tour-nav,
  .tour-glow {
    display: none;
  }

  html.js:has(.tour) {
    scroll-snap-type: none;
  }
}

/* ---------- Inner pages ---------- */

.page-hero {
  padding: 48px 0 28px;
}

.page-hero h1 {
  font-size: clamp(36px, 6vw, 56px);
}

.faq-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}

.faq-toc {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
}

.faq-toc a {
  padding: 6px 12px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.faq-toc a:hover {
  background: var(--nav-hover);
}

.faq-group {
  margin-bottom: 32px;
}

.faq-group h2 {
  font-size: 26px;
}

details.card {
  margin-bottom: 12px;
  border-radius: 22px;
  box-shadow: none;
}

summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 52px 16px 22px;
  position: relative;
  font-weight: 700;
  font-size: 19px;
  border-radius: 22px;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  line-height: 1;
  color: var(--link);
  transition: transform 0.2s ease;
}

details[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}

details > div {
  padding: 0 22px 8px;
  color: var(--muted);
}

.still {
  padding: 24px;
}

.policy {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
  align-items: start;
}

.policy-body {
  padding: clamp(22px, 4vw, 44px);
  max-width: var(--read);
  overflow-wrap: anywhere;
}

.policy-body h2 {
  font-size: 24px;
  margin-top: 28px;
}

.policy-body h2:first-child {
  margin-top: 0;
}

.policy-toc {
  position: sticky;
  top: 92px;
  padding: 20px;
  font-size: 16px;
}

.policy-toc ol {
  margin: 10px 0 14px;
  padding-left: 22px;
}

.policy-toc li {
  margin-bottom: 4px;
}

/* ---------- Shared puzzle (/play/) ---------- */

.play-card {
  max-width: 640px;
  margin: 40px auto 0;
  padding: clamp(24px, 6vw, 48px);
  text-align: center;
}

.hero-icon img {
  display: block;
  border-radius: 22%;
  box-shadow: var(--shadow);
}

.play-card .hero-icon img {
  width: 120px;
  margin: 0 auto 18px;
}

.play-card h1 {
  font-size: clamp(32px, 6vw, 46px);
}

.play-card h2 {
  font-size: 24px;
  margin-top: 28px;
}

.play-card .lead {
  margin-inline: auto;
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 6px;
}

.play-actions[hidden],
.play-missing[hidden] {
  display: none;
}

.play-card .store-buttons {
  justify-content: center;
  margin-top: 16px;
}

/* ---------- 404 ---------- */

.lost {
  text-align: center;
  padding: 64px 0 24px;
}

.lost .lead {
  margin-inline: auto;
}

.lost-letters {
  display: inline-flex;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pill-0);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

.lost-letters span {
  width: 1.1em;
  padding-top: 0.12em;
}

.lost-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .faq-layout,
  .policy {
    grid-template-columns: 1fr;
  }

  .faq-toc,
  .policy-toc {
    position: static;
  }

  .faq-toc {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .policy-toc {
    order: -1;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .store-button {
    width: 100%;
    max-width: 290px;
    justify-content: center;
  }

  .store-buttons {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Generated by tool/build_website.dart from lib/ui/palette.dart. */
:root {
  color-scheme: light;
  --bg-top: #fff4ea;
  --bg-bottom: #ffe9da;
  --ink: #17161f;
  --muted: #67657e;
  --surface: #ffffff;
  --surface-soft: #ffe4d6;
  --line: #fbe3dc;
  --link: #ad4c32;
  --accent: #e8613a;
  --button: #b85b2d;
  --on-button: #ffffff;
  --glow: linear-gradient(135deg, #ff6f59, #ff9f5a, #ffd36e);
  --lantern: rgba(255, 181, 71, 0.30);
  --shadow: 0 10px 30px rgba(232, 97, 58, 0.12);
  --pill-0: #ffd5a8;
  --pill-1: #f7b9d0;
  --pill-2: #a9ecf0;
  --pill-3: #c9b8ff;
  --pill-4: #b8f0b0;
  --pill-5: #ffe89a;
  --pill-6: #add3ff;
  --pill-7: #ffb8a8;
  --select: rgba(232, 97, 58, 0.35);
  --strip: #f6bf36;
  --on-strip: #2b1d33;
  --device: #2b1d33;
  --device-edge: rgba(43, 29, 51, 0.18);
  --bar-glass: 62%;
  --bar-glass-scrolled: 86%;
  --bar-ring: rgba(255, 255, 255, 0.6);
  --bar-shadow: 0 14px 34px -16px rgba(23, 22, 31, 0.30);
  --nav-hover: rgba(23, 22, 31, 0.06);
  --nav-current: rgba(23, 22, 31, 0.09);
  --menu-scrim: rgba(23, 22, 31, 0.20);
  --store-bg: #ffffff;
  --store-ink: #111114;
  --store-edge: rgba(0, 0, 0, 0.05);
  --store-shadow: 0 10px 24px rgba(15, 17, 21, 0.14), 0 2px 6px rgba(15, 17, 21, 0.08);
  --store-shadow-hover: 0 14px 32px rgba(15, 17, 21, 0.18), 0 3px 8px rgba(15, 17, 21, 0.1);
}
@media (prefers-color-scheme: dark) {
:root:not([data-mode="light"]) {
  color-scheme: dark;
  --bg-top: #2b1d33;
  --bg-bottom: #1f1426;
  --ink: #f1f0f7;
  --muted: #bbb7be;
  --surface: #3a2d41;
  --surface-soft: #423649;
  --line: #493d50;
  --link: #f2a893;
  --accent: #e8613a;
  --button: #b85b2d;
  --on-button: #ffffff;
  --glow: linear-gradient(135deg, #ff6f59, #ff9f5a, #ffd36e);
  --lantern: rgba(255, 181, 71, 0.22);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --pill-0: #7a4a1e;
  --pill-1: #7a2e4c;
  --pill-2: #1f5e63;
  --pill-3: #4a3a8a;
  --pill-4: #2d6327;
  --pill-5: #6e5a14;
  --pill-6: #244e80;
  --pill-7: #7a3424;
  --select: rgba(232, 97, 58, 0.50);
  --strip: #f6bf36;
  --on-strip: #2b1d33;
  --device: #0f0a14;
  --device-edge: rgba(255, 255, 255, 0.14);
  --bar-glass: 55%;
  --bar-glass-scrolled: 80%;
  --bar-ring: rgba(255, 255, 255, 0.08);
  --bar-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.6);
  --nav-hover: rgba(255, 255, 255, 0.10);
  --nav-current: rgba(255, 255, 255, 0.15);
  --menu-scrim: rgba(0, 0, 0, 0.45);
  --store-bg: #17121b;
  --store-ink: #ffffff;
  --store-edge: rgba(255, 255, 255, 0.10);
  --store-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --store-shadow-hover: 0 16px 36px rgba(0, 0, 0, 0.65), 0 3px 8px rgba(0, 0, 0, 0.45);
}
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --bg-top: #2b1d33;
  --bg-bottom: #1f1426;
  --ink: #f1f0f7;
  --muted: #bbb7be;
  --surface: #3a2d41;
  --surface-soft: #423649;
  --line: #493d50;
  --link: #f2a893;
  --accent: #e8613a;
  --button: #b85b2d;
  --on-button: #ffffff;
  --glow: linear-gradient(135deg, #ff6f59, #ff9f5a, #ffd36e);
  --lantern: rgba(255, 181, 71, 0.22);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --pill-0: #7a4a1e;
  --pill-1: #7a2e4c;
  --pill-2: #1f5e63;
  --pill-3: #4a3a8a;
  --pill-4: #2d6327;
  --pill-5: #6e5a14;
  --pill-6: #244e80;
  --pill-7: #7a3424;
  --select: rgba(232, 97, 58, 0.50);
  --strip: #f6bf36;
  --on-strip: #2b1d33;
  --device: #0f0a14;
  --device-edge: rgba(255, 255, 255, 0.14);
  --bar-glass: 55%;
  --bar-glass-scrolled: 80%;
  --bar-ring: rgba(255, 255, 255, 0.08);
  --bar-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.6);
  --nav-hover: rgba(255, 255, 255, 0.10);
  --nav-current: rgba(255, 255, 255, 0.15);
  --menu-scrim: rgba(0, 0, 0, 0.45);
  --store-bg: #17121b;
  --store-ink: #ffffff;
  --store-edge: rgba(255, 255, 255, 0.10);
  --store-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --store-shadow-hover: 0 16px 36px rgba(0, 0, 0, 0.65), 0 3px 8px rgba(0, 0, 0, 0.45);
}
