/* Tidewords marketing site: the 2.0 "Candy Shore" look, lifted from the game
   (docs/visual-style.md, scripts/art.gd, scripts/fx.gd, scripts/shaders.gd) so
   the web reads as the app. Plain CSS, no build step. */

:root {
  /* Candy Shore palette: Art.C_* faces and the darker edges they extrude into */
  --c-orange: #ff8a2b;
  --c-orange-edge: #c4520e;
  --c-gold: #ffc93c;
  --c-gold-edge: #c98400;
  --c-pink: #ff4f7b;
  --c-pink-edge: #c2264f;
  --c-mint: #2fd27a;
  --c-mint-edge: #14984f;
  --c-blue: #2f9ddd;
  --c-blue-edge: #1b65a8;
  --c-teal: #22c3e6;
  --c-teal-edge: #0f86b5;
  --c-purple: #9b5cff;
  --c-purple-edge: #5e2fc2;
  --c-ink: #0b3a5e;
  --c-cream: #fffaf0;
  --c-cream-edge: #e9c88f;
  --letter-blue: #2589d4;   /* Art.LETTER_BLUE, the TIDE tiles' letters */
  --letter-orange: #dc600e; /* Art.LETTER_ORANGE, the WORDS tiles' letters */

  /* the home sea (Shaders.OVERLAY): sky blue, the sea, a deeper teal */
  --sky: #6fd6ff;
  --sea: #22c3e6;
  --deep: #1298cc;
  --abyss: #0e7fb4;
  /* the beach (visual-style.md) */
  --sand-top: #ffe6a8;
  --sand-bot: #f5c672;

  /* text */
  --text: #0b3a5e;       /* C_INK: headings, and all text on sand */
  --text-body: #234e6d;  /* body copy on cream panels (AA on the deepest cream) */
  --link: #1b65a8;       /* C_BLUE_EDGE */

  /* cream candy panels: the "normal" tile face */
  --cream-top: #fffefb;
  --cream-mid: #fff6e3;
  --cream-deep: #fbe7c0;
  --cream-line: rgba(140, 77, 26, 0.32);

  /* Baloo 2's vertical metrics, in em: ascent 1.078, descent 0.524, cap
     height 0.625. Its capitals sit (1.078 - 0.524 - 0.625) / 2 = 0.0355em
     above the middle of their line box, so a label nudges down by that much
     to centre its capitals rather than its line box. */
  --cap: 0.625em;
  --cap-nudge: 0.0355em;

  --shadow-soft: rgba(5, 52, 84, 0.3);
  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  /* the home screen's sea, deepening as you scroll down towards the beach */
  background-color: var(--abyss);
  background-image: linear-gradient(
    180deg,
    var(--sky) 0,
    var(--sea) 760px,
    #1cb1df 1700px,
    var(--deep) 2800px,
    var(--abyss) 100%
  );
  background-repeat: no-repeat;
  min-height: 100vh;
}

img { max-width: 100%; }

a { color: var(--link); }

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

/* ===================================================================== *
 * optical centring on candy surfaces (Art.candy_box, OPTICAL_DROP = 0.3).
 * Each surface's face is its own box (the extruded edge is a box-shadow
 * below it), so content centred in the box is centred on the face. A label
 * dead centre still reads high, because the eye takes in the whole raised
 * shape, edge included, so content drops by 0.3 of the edge depth: the same
 * in every state, so a press moves it only by the press. A text label also
 * adds --lift (var(--cap-nudge)) so its capitals, not its line box, are what
 * is centred. Each surface sets --depth (its resting edge), --pad-v (even
 * vertical padding, at least the drop) and, for text, --lift; a press
 * changes only --edge-now, the edge it draws.
 * ===================================================================== */
.store-btn,
.card .chip,
.pill-link,
.icon,
.social a,
.mini-logo span,
.howto li::before {
  --drop: calc(var(--depth) * 0.3);
  padding-top: calc(var(--pad-v) + var(--drop) + var(--lift, 0px));
  padding-bottom: calc(var(--pad-v) - var(--drop) - var(--lift, 0px));
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ===================================================================== *
 * candy lettering (Fx.candy_settings): a white face, a thick darker outline
 * and the same shape again a little lower as the extrusion. The stroke is
 * drawn under the fill (paint-order), so 0.2em of stroke shows 0.1em outside,
 * the game's outline_size of 0.2 x the font size.
 * ===================================================================== */
.candy {
  --edge: var(--c-blue-edge);
  --edge-dark: #134775;   /* edge darkened 30%, as candy_settings' shadow */
  color: #fff;
  font-weight: 800;
  -webkit-text-stroke: 0.2em var(--edge);
  paint-order: stroke fill;
  text-shadow:
    0 0.08em 0 var(--edge-dark),
    0 0.16em 0.3em rgba(4, 40, 70, 0.28);
  letter-spacing: 0.01em;
  line-height: 1.12;
}
.candy-orange { --edge: var(--c-orange-edge); --edge-dark: #893909; }

.section-title {
  margin: 0 0 22px;
  text-align: center;
  font-size: clamp(32px, 6.2vw, 50px);
  text-wrap: balance;
}

/* ===================================================================== *
 * the sea: light rays fanning down from above the top centre and a soft
 * glow behind the logo (Shaders.OVERLAY), plus drifting bubbles
 * ===================================================================== */
.sea {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.sea::before,
.sea::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
/* rays: two periodic fans (as the shader's two sines) from a point above the
   top centre, fading out with depth */
.sea::before {
  background:
    repeating-conic-gradient(
      from 180deg at 50% -40%,
      rgba(236, 255, 255, 0) 0deg,
      rgba(236, 255, 255, 0.16) 3deg,
      rgba(236, 255, 255, 0) 7deg,
      rgba(236, 255, 255, 0) 16deg
    ),
    repeating-conic-gradient(
      from 186deg at 50% -40%,
      rgba(236, 255, 255, 0) 0deg,
      rgba(236, 255, 255, 0.11) 2deg,
      rgba(236, 255, 255, 0) 4.5deg,
      rgba(236, 255, 255, 0) 11deg
    );
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 88%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 88%);
}
/* the soft glow behind the logo */
.sea::after {
  background: radial-gradient(
    ellipse 62% 46% at 50% 30%,
    rgba(224, 249, 255, 0.42) 0%,
    rgba(224, 249, 255, 0.14) 45%,
    rgba(224, 249, 255, 0) 75%
  );
}

/* cartoon bubbles as the home screen draws them: a faint body, a white rim
   and a highlight dot. Decorative: the container is aria-hidden. */
.bubbles {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
/* any section can carry a scatter of bubbles behind its content */
.bubbly {
  position: relative;
  isolation: isolate;
}
.bubbles i {
  --s: 20px;
  --a: 0.85;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  border: max(1.5px, calc(var(--s) * 0.075)) solid rgba(255, 255, 255, 0.5);
  background:
    radial-gradient(circle at 31% 29%, rgba(255, 255, 255, 0.85) 0 12%, rgba(255, 255, 255, 0) 14%),
    rgba(255, 255, 255, 0.1);
  opacity: var(--a);
}
.bubbles i:nth-child(1)  { --x: 5%;  --y: 16%; --s: 30px; --d: 17s; --t: -3s; }
.bubbles i:nth-child(2)  { --x: 11%; --y: 44%; --s: 14px; --d: 12s; --t: -8s; }
.bubbles i:nth-child(3)  { --x: 3%;  --y: 70%; --s: 22px; --d: 15s; --t: -1s; }
.bubbles i:nth-child(4)  { --x: 17%; --y: 84%; --s: 12px; --d: 11s; --t: -5s; }
.bubbles i:nth-child(5)  { --x: 21%; --y: 26%; --s: 10px; --d: 13s; --t: -10s; }
.bubbles i:nth-child(6)  { --x: 92%; --y: 12%; --s: 18px; --d: 14s; --t: -6s; }
.bubbles i:nth-child(7)  { --x: 85%; --y: 36%; --s: 34px; --d: 19s; --t: -2s; }
.bubbles i:nth-child(8)  { --x: 95%; --y: 58%; --s: 13px; --d: 12s; --t: -9s; }
.bubbles i:nth-child(9)  { --x: 81%; --y: 76%; --s: 20px; --d: 16s; --t: -4s; }
.bubbles i:nth-child(10) { --x: 90%; --y: 90%; --s: 11px; --d: 10s; --t: -7s; }
.bubbles i:nth-child(11) { --x: 30%; --y: 92%; --s: 16px; --d: 14s; --t: -11s; }
.bubbles i:nth-child(12) { --x: 68%; --y: 95%; --s: 24px; --d: 18s; --t: -5s; }
.bubbles i:nth-child(13) { --x: 74%; --y: 8%;  --s: 9px;  --d: 12s; --t: -2s; }
.bubbles i:nth-child(14) { --x: 27%; --y: 5%;  --s: 15px; --d: 15s; --t: -12s; }
.bubbles i:nth-child(15) { --x: 13%; --y: 58%; --s: 40px; --d: 21s; --t: -9s;  --a: 0.7; }
.bubbles i:nth-child(16) { --x: 88%; --y: 62%; --s: 46px; --d: 23s; --t: -14s; --a: 0.65; }
.bubbles i:nth-child(17) { --x: 34%; --y: 72%; --s: 9px;  --d: 11s; --t: -3s; }
.bubbles i:nth-child(18) { --x: 63%; --y: 22%; --s: 12px; --d: 13s; --t: -8s; }
.bubbles i:nth-child(19) { --x: 8%;  --y: 33%; --s: 11px; --d: 12s; --t: -6s; }
.bubbles i:nth-child(20) { --x: 78%; --y: 50%; --s: 10px; --d: 14s; --t: -1s; }

/* ===================================================================== *
 * hero
 * ===================================================================== */
.hero {
  text-align: center;
  padding: clamp(40px, 7vw, 76px) 0 clamp(48px, 7vw, 84px);
}

/* The stacked TIDE / WORDS wordmark, rendered from the game's own tiles by
   tools/make_site_wordmark.gd. Where motion is allowed the two rows bob a
   little out of step, as on the home screen (game.gd _bob_logo): the image
   shows the TIDE row and an aria-hidden copy of the same file the WORDS row.
   They meet at --wm-split (printed by the tool) through a short crossfade
   that lies in the gap between the rows, where there is only the TIDE tiles'
   soft shadow, so the shadow never shows a seam as the rows drift apart. */
.wordmark {
  --wm-split: 46.54%;
  --wm-top: linear-gradient(180deg, #000 calc(var(--wm-split) - 1.8%), transparent calc(var(--wm-split) + 1.8%));
  --wm-bottom: linear-gradient(180deg, transparent calc(var(--wm-split) - 1.8%), #000 calc(var(--wm-split) + 1.8%));
  position: relative;
  width: min(88%, clamp(440px, 30vw, 560px));
  margin: 0 auto;
  line-height: 0;
}
.wordmark img {
  display: block;
  width: 100%;
  height: auto;
}
.wordmark .wm-words { display: none; }

/* The wordmark is an image, so the h1's text is hidden here: crawlers read
   an image-only h1 as empty, and screen readers hear it once (the img's
   alt is empty). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.tagline {
  margin: clamp(18px, 3vw, 28px) auto 0;
  max-width: 14em;
  font-size: clamp(32px, 2.6vw + 25px, 70px);
  text-wrap: balance;
}
.subtag {
  margin: 14px 0 0;
  font-size: clamp(14px, 3.6vw, 17px);
  font-weight: 800;
  letter-spacing: clamp(0.14em, 0.8vw, 0.28em);
  text-transform: uppercase;
  color: #fff;
  /* white caps on a solid ink outline (AA on the light sky) */
  -webkit-text-stroke: 0.24em var(--c-ink);
  paint-order: stroke fill;
  text-shadow: 0 0.1em 0 var(--c-ink);
}

/* ===================================================================== *
 * candy buttons (Art.candy_box): a gradient face with a rim light and a
 * white gloss band over the top, a thin darker outline, the extruded edge
 * underneath and a soft drop shadow. Pressing sinks the face to a 2px edge.
 * ===================================================================== */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 18px;
  justify-content: center;
  margin: clamp(28px, 4vw, 40px) 0 0;
}
.store-btn {
  --hi: #74c9f4;
  --face: var(--c-blue);
  --lo: #1f86cc;
  --edge: var(--c-blue-edge);
  --line: #134c7e;
  --depth: 6px;
  --edge-now: var(--depth);
  --pad-v: 10px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 232px;
  min-height: 64px;
  padding-inline: 22px 26px;
  border-radius: 20px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, var(--hi) 0%, var(--face) 52%, var(--lo) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -3px 0 rgba(0, 0, 0, 0.08),
    0 0 0 2px var(--line),
    0 var(--edge-now) 0 0 var(--edge),
    0 var(--edge-now) 0 2px var(--line),
    0 calc(var(--edge-now) + 8px) 18px var(--shadow-soft);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out, filter 0.12s ease;
}
.store-btn.alt {
  /* C_ORANGE, a shade deeper where the label sits so white type holds up
     even before its outline */
  --hi: #ffa552;
  --face: #f2751b;
  --lo: #df600d;
  --edge: var(--c-orange-edge);
  --line: #8f3a08;
}
.store-btn::before {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  top: 3px;
  height: 46%;
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.05));
  pointer-events: none;
}
.store-btn:hover { filter: brightness(1.06) saturate(1.05); }
.store-btn:active {
  --edge-now: 2px;
  transform: translateY(calc(var(--depth) - 2px));
}
.store-btn:focus-visible { outline-offset: 5px; border-radius: 22px; }
.store-btn svg {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  fill: #fff;
  filter: drop-shadow(0 2px 0 var(--edge));
}
.store-btn .meta {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
}
/* Both lines get the same leading around their capitals (cap height plus
   6px) and the cap nudge, so the two-line label's capitals, from the top of
   DOWNLOAD to the foot of App Store, are centred as one block. */
.store-btn .meta small,
.store-btn .meta b {
  position: relative;
  top: var(--cap-nudge);
  line-height: calc(var(--cap) + 6px);
}
/* the labels get a little candy outline in the button's edge colour, which
   keeps white type readable on the bright faces */
.store-btn .meta small {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-shadow:
    0 1px 0 var(--edge), 0 -1px 0 var(--edge), 1px 0 0 var(--edge), -1px 0 0 var(--edge),
    1px 1px 0 var(--edge), -1px 1px 0 var(--edge), 1px -1px 0 var(--edge), -1px -1px 0 var(--edge);
}
.store-btn .meta b {
  font-size: 22px;
  font-weight: 800;
  -webkit-text-stroke: 0.16em var(--edge);
  paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--line);
}

/* ===================================================================== *
 * cream candy panels: the cream tile face (fffefb to fbe7c0) with its rim
 * light, gloss band, thin outline, extruded cream edge and soft shadow
 * ===================================================================== */
.card {
  --depth: 7px;
  position: relative;
  border-radius: 26px;
  padding: 24px 22px 24px;
  background: linear-gradient(180deg, var(--cream-top) 0%, var(--cream-mid) 50%, var(--cream-deep) 100%);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -4px 10px rgba(239, 205, 146, 0.45),
    0 0 0 2px var(--cream-line),
    0 var(--depth) 0 0 var(--c-cream-edge),
    0 var(--depth) 0 2px var(--cream-line),
    0 calc(var(--depth) + 12px) 26px var(--shadow-soft);
}
.card::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 4px;
  height: min(40%, 64px);
  border-radius: 21px 21px 40% 40% / 21px 21px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.card > * { position: relative; }
.card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; line-height: 1.2; color: var(--text); }
.card p { margin: 0; color: var(--text-body); }

/* ===================================================================== *
 * feature cards: six cream panels, each with its idea on a candy tile
 * coloured from the game's tile kinds
 * ===================================================================== */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 24px;
  margin-bottom: clamp(64px, 9vw, 104px);
}
.features .card { padding-top: 22px; }

.icon {
  --t-top: #a2f0ff;
  --t-mid: #58d8f2;
  --t-deep: #25c2e6;
  --t-side: #0b72a0;
  --t-line: rgba(5, 69, 107, 0.55);
  position: relative;
  display: grid;
  place-items: center;
  --depth: 5px;
  --pad-v: 4px;
  width: 60px;
  height: 60px;
  margin: 0 0 18px;
  border-radius: 17px;
  background: linear-gradient(180deg, var(--t-top) 0%, var(--t-mid) 50%, var(--t-deep) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 0 0 2px var(--t-line),
    0 var(--depth) 0 0 var(--t-side),
    0 var(--depth) 0 2px var(--t-line),
    0 calc(var(--depth) + 6px) 14px rgba(5, 52, 84, 0.22);
}
.icon::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 3px;
  height: 42%;
  border-radius: 13px 13px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.05));
}
/* the idea's emoji, as an image (assets/icons/) so it centres the same on
   every platform: each is cropped square around its visual centre */
.icon img {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 1px rgba(5, 52, 84, 0.25));
}
/* tile kinds from Art.TILE_PALETTES (time, rare, wild, life) plus candy
   orange and mint from the palette */
.icon-orange { --t-top: #ffc58f; --t-mid: #ffa052; --t-deep: #ff8a2b; --t-side: #c4520e; --t-line: rgba(122, 46, 4, 0.55); }
.icon-purple { --t-top: #d6bcff; --t-mid: #b28cff; --t-deep: #9b62ff; --t-side: #552ab2; --t-line: rgba(56, 23, 128, 0.6); }
.icon-gold   { --t-top: #fffae0; --t-mid: #ffeeb0; --t-deep: #ffd466; --t-side: #c98400; --t-line: rgba(140, 82, 0, 0.6); }
.icon-mint   { --t-top: #b3f5cf; --t-mid: #6fe3a4; --t-deep: #2fd27a; --t-side: #14984f; --t-line: rgba(6, 92, 45, 0.55); }
.icon-pink   { --t-top: #ffa6bb; --t-mid: #ff7898; --t-deep: #ff527e; --t-side: #b01f47; --t-line: rgba(115, 13, 46, 0.6); }

/* ===================================================================== *
 * screenshots: three real game screens in candy phone frames, each with
 * the store slide's headline as a real caption
 * ===================================================================== */
.shots { margin: 0 0 clamp(52px, 7vw, 84px); }
/* keep the bubbles out of the caption band under the phones */
.shots .bubbles { bottom: 16%; }
.shots-text {
  max-width: 760px;
  margin: 0 auto;
}
.shots-text p { margin: 0 0 12px; }
.shots-text p:last-child { margin-bottom: 0; }

.phones {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(20px, 4vw, 52px);
  max-width: var(--maxw);
  margin: clamp(40px, 6vw, 60px) auto 0;
  padding: 0 var(--gutter) 12px;
}
.phones figure {
  flex: 0 1 280px;
  min-width: 0;
  margin: 0;
  text-align: center;
}
.phones figure:nth-child(2) { margin-top: -26px; }

/* The phone: a glossy ink body with a white rim, as the store slides frame
   the screen. */
.phone {
  position: relative;
  padding: 4.2%;
  border-radius: 15% / 8%;
  background: linear-gradient(160deg, #1d5f8e 0%, var(--c-ink) 45%, #072a45 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.18),
    inset 0 3px 0 rgba(255, 255, 255, 0.25),
    0 0 0 3px rgba(255, 255, 255, 0.92),
    0 0 0 5px rgba(11, 58, 94, 0.35),
    0 22px 40px rgba(3, 35, 58, 0.45);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 560 / 1044;
  /* rounder than the capture's own corners (7.5% / 4%), which it hides */
  border-radius: 11% / 6%;
  background: var(--sea);
}
.phones figcaption {
  margin: 22px 0 0;
  font-size: clamp(21px, 2.2vw, 25px);
  text-wrap: balance;
}

/* ===================================================================== *
 * explainer: what it is and how to play, cream panels with a candy title
 * chip on the top edge, as the game's results panel wears its title. One
 * centred column at every width: the two are unequal by nature (prose and a
 * step list), and side by side the short one left a tall empty patch of sea.
 * ===================================================================== */
.explainer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 64px;
  max-width: 820px;
  margin-bottom: clamp(56px, 8vw, 88px);
  padding-top: 26px;
}
.panel {
  padding: 0 clamp(20px, 3vw, 32px) clamp(24px, 3vw, 32px);
}
.panel p { margin: 0 0 14px; line-height: 1.6; }
.panel p:last-child { margin-bottom: 0; }
.panel a { color: var(--link); font-weight: 700; text-underline-offset: 2px; }
.panel a:hover { color: var(--c-ink); }
.panel strong { color: var(--text); }

.card .chip {
  --face: var(--c-blue);
  --hi: #74c9f4;
  --lo: #1f86cc;
  --edge: var(--c-blue-edge);
  --line: #134c7e;
  --depth: 5px;
  --pad-v: 9px;
  --lift: var(--cap-nudge);
  position: relative;
  display: table;
  margin: -26px auto 22px;
  padding-inline: 24px;
  border-radius: 18px;
  text-align: center;
  font-size: clamp(21px, 2.6vw, 25px);
  color: #fff;
  line-height: 1.12;
  background: linear-gradient(180deg, var(--hi) 0%, var(--face) 52%, var(--lo) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    0 0 0 2px var(--line),
    0 var(--depth) 0 0 var(--edge),
    0 var(--depth) 0 2px var(--line),
    0 calc(var(--depth) + 7px) 16px rgba(5, 52, 84, 0.25);
}
.card .chip::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 3px;
  height: 42%;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08));
}
.card .chip-orange {
  --face: var(--c-orange);
  --hi: #ffb466;
  --lo: #f2701a;
  --edge: var(--c-orange-edge);
  --line: #8f3a08;
}

/* how to play: numbered steps on little gold letter tiles */
.howto ol {
  counter-reset: step;
  list-style: none;
  margin: 4px 0 18px;
  padding: 0;
}
.howto li {
  counter-increment: step;
  position: relative;
  margin: 0 0 16px;
  padding-left: 54px;
  min-height: 40px;
  color: var(--text-body);
  line-height: 1.55;
}
.howto li:last-child { margin-bottom: 0; }
.howto li::before {
  --depth: 4px;
  --pad-v: 4px;
  --lift: var(--cap-nudge);
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: #b84a06;  /* LETTER_ORANGE deepened for AA on the gold face */
  background: linear-gradient(180deg, #fffae0 0%, #ffeeb0 50%, #ffd466 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    0 0 0 1.5px rgba(140, 82, 0, 0.55),
    0 var(--depth) 0 0 #e59a12,
    0 var(--depth) 0 1.5px rgba(140, 82, 0, 0.55),
    0 calc(var(--depth) + 3px) 8px rgba(5, 52, 84, 0.18);
}
.howto li strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 2px;
}

/* ===================================================================== *
 * social: round glass-white candy buttons
 * ===================================================================== */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(44px, 6vw, 64px);
}
.social a {
  --depth: 5px;
  --edge-now: var(--depth);
  --pad-v: 4px;
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #eefaff 55%, #d3f1fd 100%);
  box-shadow:
    inset 0 2px 0 #fff,
    0 0 0 2px rgba(11, 58, 94, 0.32),
    0 var(--edge-now) 0 0 #8fcfe9,
    0 var(--edge-now) 0 2px rgba(11, 58, 94, 0.32),
    0 calc(var(--edge-now) + 6px) 16px rgba(3, 35, 58, 0.3);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
}
.social a:hover { transform: translateY(-2px); }
.social a:active {
  --edge-now: 2px;
  transform: translateY(calc(var(--depth) - 2px));
}
.social a:focus-visible { outline-color: #fff; outline-offset: 5px; border-radius: 50%; }
.social svg { width: 24px; height: 24px; fill: var(--c-ink); }

/* ===================================================================== *
 * footer: the beach. A foam line where the sea meets the sand, as in the
 * game's playfield, then warm sand under ink text.
 * ===================================================================== */
footer {
  position: relative;
  margin-top: 46px;
  padding: 34px 0 44px;
  text-align: center;
  color: var(--text);
  background: linear-gradient(180deg, var(--sand-top) 0%, #fcd98e 55%, var(--sand-bot) 100%);
}
footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 46px;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='46' viewBox='0 0 520 46'%3E%3Cpath d='M0 18C65 8 130 8 195 18S325 28 390 18 455 8 520 18' fill='none' stroke='%23ffffff' stroke-opacity='.35' stroke-width='3'/%3E%3Cpath d='M0 30C65 20 130 20 195 30S325 40 390 30 455 20 520 30V46H0Z' fill='%23ffe6a8'/%3E%3Cpath d='M0 30C65 20 130 20 195 30S325 40 390 30 455 20 520 30' fill='none' stroke='%23ffffff' stroke-width='9' stroke-linecap='round'/%3E%3C/svg%3E")
    repeat-x left bottom / 520px 46px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  margin-bottom: 16px;
}

/* a small cream candy pill (the privacy link, the legal page's back link) */
.pill-link {
  --depth: 4px;
  --edge-now: var(--depth);
  --pad-v: 9.5px;
  --lift: var(--cap-nudge);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 20px;
  /* Baloo 2's own content height (ascent plus descent, 1.6em), so there is
     no leading for the browser to round, which otherwise lifts the label by
     up to a pixel; it also keeps the pill one height wherever it sits */
  line-height: 1.6;
  border-radius: 16px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(180deg, var(--cream-top), var(--cream-mid) 55%, var(--cream-deep));
  box-shadow:
    inset 0 2px 0 #fff,
    0 0 0 2px var(--cream-line),
    0 var(--edge-now) 0 0 #dcae62,
    0 var(--edge-now) 0 2px var(--cream-line),
    0 calc(var(--edge-now) + 5px) 12px rgba(120, 72, 10, 0.2);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
}
/* the leading glyph (an emoji, an arrow from a fallback font) is its own
   flex item, so its font's metrics never move the label's line box */
.pill-link .glyph { flex: none; }
.pill-link:hover { transform: translateY(-1px); }
.pill-link:active {
  --edge-now: 1px;
  transform: translateY(calc(var(--depth) - 1px));
}

.copyright { margin: 0; font-size: 15px; font-weight: 600; }
.copyright a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* registered-company details: present but quiet under the copyright line */
.company {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #3b5466;
}

/* ===================================================================== *
 * /download: a compact one-tap page on the same sea
 * ===================================================================== */
.dl {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px var(--gutter) 40px;
  text-align: center;
}
.dl-card { width: 100%; max-width: 32rem; }
.dl .wordmark { width: min(400px, 86%); }
.dl .tagline { font-size: clamp(30px, 7vw, 46px); }

/* ===================================================================== *
 * legal page: plain and readable, lightly dressed in the same look
 * ===================================================================== */
.legal-page { padding: clamp(24px, 4vw, 48px) var(--gutter) clamp(40px, 6vw, 72px); }
.legal {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 44px) clamp(20px, 4vw, 48px);
  border-radius: 24px;
  background: #fffdf8;
  box-shadow:
    0 0 0 2px var(--cream-line),
    0 6px 0 0 var(--c-cream-edge),
    0 6px 0 2px var(--cream-line),
    0 18px 30px var(--shadow-soft);
  line-height: 1.65;
}
.legal h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 18px 0 6px;
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.15;
  color: var(--text);
}
.legal h2 {
  margin: 34px 0 8px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
}
.legal p,
.legal li { color: #1f4560; font-weight: 500; }
.legal ul { padding-left: 22px; }
.legal li { margin: 0 0 4px; }
.legal a { color: var(--link); text-underline-offset: 2px; }
.legal a.pill-link { color: var(--text); text-decoration: none; }
.legal a.back { margin: 0; }
.legal a.back:last-child { margin-top: 28px; }

/* the T and W tiles, as small candy tiles, beside the legal page title */
.mini-logo {
  display: inline-flex;
  gap: 6px;
  flex: none;
}
.mini-logo span {
  --depth: 4px;
  --pad-v: 4px;
  --lift: var(--cap-nudge);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--letter-blue);
  background: linear-gradient(180deg, #fffefb 0%, #fff6e3 50%, #fbe7c0 100%);
  box-shadow:
    inset 0 2px 0 #fff,
    0 0 0 1.5px rgba(140, 77, 26, 0.5),
    0 var(--depth) 0 0 #d99245,
    0 var(--depth) 0 1.5px rgba(140, 77, 26, 0.5),
    0 calc(var(--depth) + 3px) 8px rgba(5, 52, 84, 0.18);
}
/* the letters come from data-letter, so the h1's text is only "Privacy Policy" */
.mini-logo span::before { content: attr(data-letter); }
.mini-logo span.gold {
  color: var(--letter-orange);
  background: linear-gradient(180deg, #fffae0 0%, #ffeeb0 50%, #ffd466 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    0 0 0 1.5px rgba(140, 82, 0, 0.55),
    0 var(--depth) 0 0 #e59a12,
    0 var(--depth) 0 1.5px rgba(140, 82, 0, 0.55),
    0 calc(var(--depth) + 3px) 8px rgba(5, 52, 84, 0.18);
}

/* ===================================================================== *
 * motion: only where the viewer has not asked for less. The bubbles drift
 * up and fade, the wordmark's rows bob out of step (3s, as the game).
 * ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .bubbles i {
    animation: drift var(--d, 14s) linear var(--t, 0s) infinite;
  }
  .wordmark img {
    -webkit-mask-image: var(--wm-top);
    mask-image: var(--wm-top);
    animation: bob 3s ease-in-out infinite;
  }
  .wordmark .wm-words {
    display: block;
    position: absolute;
    inset: 0;
    background: url("assets/wordmark.webp") 0 0 / 100% 100% no-repeat;
    -webkit-mask-image: var(--wm-bottom);
    mask-image: var(--wm-bottom);
    animation: bob 3s ease-in-out -0.62s infinite;
  }
}
@keyframes drift {
  0%   { transform: translate3d(0, 28px, 0); opacity: 0; }
  14%  { opacity: var(--a); }
  50%  { transform: translate3d(7px, -50px, 0); }
  86%  { opacity: var(--a); }
  100% { transform: translate3d(0, -130px, 0); opacity: 0; }
}
@keyframes bob {
  0%, 100% { transform: translateY(1.9%); }
  50%      { transform: translateY(-1.9%); }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===================================================================== *
 * responsive
 * ===================================================================== */
@media (max-width: 1023px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Below 640px three phones side by side are too small to read: swipe through
   them instead, one and a bit per view, snapping, the next peeking in from
   the edge. The scroll stays inside the row; the page never scrolls sideways. */
@media (max-width: 639px) {
  body { font-size: 16.5px; }
  .features {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
  /* compact cards on phones: the candy tile beside the text */
  .features .card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 16px;
    align-items: start;
    padding-top: 20px;
    padding-bottom: 22px;
  }
  .features .icon {
    grid-row: span 2;
    width: 52px;
    height: 52px;
    margin: 3px 0 0;
    border-radius: 15px;
  }
  .features .icon img { width: 30px; height: 30px; }
  .features .card h2 { font-size: 20px; }
  .phones {
    justify-content: flex-start;
    gap: 22px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    /* inset by the frame's 5px rim, which sits outside its box */
    scroll-padding-inline: calc(var(--gutter) + 5px);
    padding: 6px calc(var(--gutter) + 5px) 18px;
    scrollbar-width: thin;
  }
  .phones figure {
    flex: 0 0 min(66vw, 250px);
    scroll-snap-align: start;
  }
  .phones figure:nth-child(2) { margin-top: 0; }
  .phones::after {
    /* keeps the gutter after the last phone inside the scroller */
    content: "";
    flex: 0 0 1px;
  }
  .store-btn {
    flex: 1 1 100%;
    max-width: 320px;
    justify-content: center;
  }
  .card { padding-left: 20px; padding-right: 20px; }
  .howto li { padding-left: 50px; }
}
