/* WristBuddy landing. Palette and pixel rules follow
   WristBuddyCompanion/docs/design/companion-ui.md. */

/* Pixelify Sans (SIL OFL 1.1, assets/fonts/OFL.txt), served from this site
   so visitors' browsers never contact a third-party font service. */
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/PixelifySans.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #0B1112;
  --card: #152021;
  --note: #1B2829;
  --frame: #26383A;
  --text: #E8FFF6;
  --text-2: #A3BDB5;
  --primary: #7FE0C4;
  --on-primary: #0A2B23;
  --primary-container: #1F4A4A;
  --plus: #FFD25A;
  --plus-container: #4A3A10;
  --soft: #FF9E9E;
  --empty: #223031;
  --silhouette: #2E4442;

  --satiety: #FFB23E;
  --energy: #4DB8FF;
  --mood: #FF7AA8;

  --endurance: #FF8A3D;
  --strength: #E5484D;
  --wanderer: #6BCB5A;
  --harmony: #A78BFA;

  --sky-top: #141033;
  --sky-mid: #30296E;
  --sky-low: #4B3F9E;
  --grass: #27665A;
  --grass-dark: #1B463F;

  --pixel-font: "Pixelify Sans", ui-monospace, monospace;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--body-font);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--plus); outline-offset: 3px; }

h1, h2, h3, .pixel { font-family: var(--pixel-font); font-weight: 600; letter-spacing: 0.01em; line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.9rem, 4.2vw, 2.8rem); margin: 0 0 0.35em; }
h3 { font-size: 1.35rem; margin: 0 0 0.4em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-left)) 0 max(var(--gutter), env(safe-area-inset-right)); }
section[id] { scroll-margin-top: 64px; }
a, button, summary, [role="button"] { -webkit-tap-highlight-color: transparent; }
.btn, .nav a, summary { touch-action: manipulation; }
.muted { color: var(--text-2); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--pixel-font); font-size: 0.95rem;
  color: var(--primary); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.section { padding: clamp(72px, 10vw, 128px) 0; position: relative; }
.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.lead { font-size: 1.15rem; color: var(--text-2); }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 14px; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Pixel frames (stepped corners, 2px stroke) ---------- */
.frame {
  border: 10px solid transparent;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill='%2326383A' d='M8 0H16V4H20V8H24V16H20V20H16V24H8V20H4V16H0V8H4V4H8Z'/%3E%3Cpath fill='%23152021' d='M10 2H14V6H18V10H22V14H18V18H14V22H10V18H6V14H2V10H6V6H10Z'/%3E%3C/svg%3E") 10 fill / 10px stretch;
  image-rendering: pixelated;
}
.frame.scene-frame {
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill='%2326383A' d='M8 0H16V4H20V8H24V16H20V20H16V24H8V20H4V16H0V8H4V4H8Z'/%3E%3Cpath fill='%23000' d='M10 2H14V6H18V10H22V14H18V18H14V22H10V18H6V14H2V10H6V6H10Z'/%3E%3C/svg%3E") 10 fill / 10px stretch;
}
.frame.mint {
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'%3E%3Cpath fill='%237FE0C4' d='M8 0H16V4H20V8H24V16H20V20H16V24H8V20H4V16H0V8H4V4H8Z'/%3E%3Cpath fill='%23152021' d='M10 2H14V6H18V10H22V14H18V18H14V22H10V18H6V14H2V10H6V6H10Z'/%3E%3C/svg%3E") 10 fill / 10px stretch;
}

/* ---------- Sprites ----------
   Horizontal sheets of 64x64 frames. --n frames, --ms per frame, --s integer scale. */
.sprite {
  --s: 3;
  --n: 1;
  --ms: 250ms;
  display: inline-block;
  flex: none;
  width: calc(var(--s) * 64px);
  height: calc(var(--s) * 64px);
  background-image: var(--src);
  background-repeat: no-repeat;
  background-size: calc(var(--n) * 100%) 100%;
  background-position: 0 0;
  image-rendering: pixelated;
}
.sprite.play {
  animation: sprite calc(var(--ms) * var(--n)) steps(var(--n)) infinite;
}
@keyframes sprite {
  to { background-position: calc(100% * var(--n) / (var(--n) - 1)) 0; }
}
.sprite.small { --s: 1; }
.fx { --s: 3; width: calc(var(--s) * 8px); height: calc(var(--s) * 8px); }

/* Pixel icons from Companion (8x8, rendered by main.js as SVG) */
.pi { display: inline-block; width: 24px; height: 24px; color: currentColor; flex: none; }
.pi svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.pi.lg { width: 40px; height: 40px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--sky-top) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.06);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--pixel-font); font-size: 1.35rem; font-weight: 600; }
.brand img { width: 36px; height: 36px; border-radius: 9px; image-rendering: pixelated; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-toggle { display: none; }
.nav-links .nav-cta { display: none; }
.nav a { color: var(--text-2); text-decoration: none; padding: 8px 12px; font-size: 0.95rem; border-radius: 8px; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav .btn { margin-left: 8px; }
.nav a.btn, .nav a.btn:hover { color: var(--on-primary); background: var(--primary); padding: 0 16px; border-radius: 0; }
/* Language menu */
.lang { position: relative; flex: none; margin-left: 4px; }
.lang summary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 56px; height: 40px; padding: 0 10px; cursor: pointer; list-style: none;
  font-size: 0.9rem; font-weight: 600; white-space: nowrap;
  background: rgba(255, 255, 255, 0.08); border-radius: 8px;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.lang[open] summary::after { transform: rotate(180deg); margin-top: -4px; }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 160px;
  margin: 0; padding: 6px; list-style: none;
  background: var(--sky-top); border: 2px solid var(--frame); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
}
.lang li a { display: block; white-space: nowrap; }
.nav .lang li a[aria-current="true"] { color: var(--on-primary); background: var(--primary); }

/* The longer translated menus need the burger earlier than the English one did. */
@media (max-width: 1080px) {
  .nav { gap: 8px; }
  .nav .btn { margin-left: 0; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 11px; background: rgba(255, 255, 255, 0.08);
    border: 0; border-radius: 8px; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 3px; background: var(--text); transition: transform 0.15s, opacity 0.15s; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--sky-top);
    border-bottom: 2px solid var(--frame);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 8px; font-size: 1.05rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
  .lang { margin-left: 0; }
  .lang summary { height: 44px; }
}
@media (max-width: 520px) {
  .nav > .btn { display: none; }
  .nav-links a.nav-cta { display: flex; justify-content: center; margin-top: 16px; padding: 0 16px; min-height: 48px; align-items: center; border: 0; color: var(--on-primary); background: var(--primary); font-family: var(--pixel-font); }
}
.nav > .btn { white-space: nowrap; }
@media (max-width: 380px) { .brand { font-size: 1.15rem; } .brand img { width: 32px; height: 32px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 600 1rem/1 var(--pixel-font); letter-spacing: 0.02em;
  text-decoration: none; cursor: pointer; border: 0;
  color: var(--on-primary); background: var(--primary);
  clip-path: polygon(0 6px, 3px 6px, 3px 3px, 6px 3px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.12s steps(2), filter 0.12s;
}
.btn:hover { color: var(--on-primary); filter: brightness(1.08); transform: translateY(-2px); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.2); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.14); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 0.9rem; }

/* Store buttons */
.stores { display: flex; flex-wrap: wrap; gap: 12px; }
.store {
  display: inline-flex; align-items: center; gap: 12px;
  min-width: 196px; min-height: 56px; padding: 8px 18px 8px 14px;
  background: #000; color: #fff; text-decoration: none;
  border: 2px solid #3d4f51; border-radius: 12px;
  transition: transform 0.15s, border-color 0.15s;
}
.store:hover { color: #fff; border-color: var(--primary); transform: translateY(-2px); }
.store svg { width: 26px; height: 26px; flex: none; }
.store .lines { display: flex; flex-direction: column; line-height: 1.15; }
.store small { font-size: 0.7rem; opacity: 0.85; }
.store strong { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; }
.store[aria-disabled="true"] { cursor: default; opacity: 0.7; border-style: dashed; }
.store[aria-disabled="true"]:hover { transform: none; border-color: #3d4f51; }
.store .soon {
  margin-left: auto; padding: 2px 8px; font: 600 0.7rem/1.4 var(--pixel-font);
  color: var(--plus); background: var(--plus-container); border-radius: 4px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 48%, var(--sky-low) 100%);
  padding: clamp(40px, 7vw, 88px) 0 0;
  isolation: isolate;
}
/* dithered bands like the app icon sky */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    repeating-conic-gradient(rgba(255,255,255,0.035) 0 25%, transparent 0 50%);
  background-size: 8px 8px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 35%, transparent 55%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 35%, transparent 55%, #000 80%, transparent 100%);
}
.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.star {
  position: absolute; width: 4px; height: 4px; background: #FFF6D8;
  animation: twinkle var(--t, 3s) steps(3) infinite; animation-delay: var(--d, 0s);
}
.star.big {
  width: 4px; height: 4px; background: #FFF6D8;
  box-shadow: 0 -4px #FFD25A, 0 4px #FFD25A, -4px 0 #FFD25A, 4px 0 #FFD25A, 0 -8px #FFD25A, 0 8px #FFD25A, -8px 0 #FFD25A, 8px 0 #FFD25A;
}
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.shooting {
  position: absolute; width: 4px; height: 4px; background: #fff;
  box-shadow: -4px -4px rgba(255,255,255,0.7), -8px -8px rgba(255,255,255,0.45), -12px -12px rgba(255,255,255,0.25), -16px -16px rgba(255,255,255,0.1);
  animation: shoot 1.1s steps(14) forwards;
}
@keyframes shoot { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(220px, 220px); opacity: 0; } }

.hero-grid {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: end;
}
.hero-copy { padding-bottom: clamp(48px, 8vw, 112px); }
.hero-copy h1 { text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); }
.hero-copy h1 .accent { color: var(--primary); }
.hero-copy h1:lang(ru) { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
.hero-copy .lead { color: #D4CCFF; max-width: 34em; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.platforms { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.platforms li {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #D4CCFF;
  padding: 4px 10px; background: rgba(0, 0, 0, 0.22); border-radius: 6px;
}
.platforms .pi { width: 16px; height: 16px; color: var(--primary); }

.hero-stage { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 420px; }
.stage {
  position: relative; --s: 6;
  width: calc(var(--s) * 64px); height: calc(var(--s) * 58px);
  margin-bottom: -2px;
}
.stage .sprite { position: absolute; left: 0; top: 0; --s: inherit; }
.stage .home { z-index: 0; }
.stage .pet { z-index: 1; cursor: pointer; background-color: transparent; border: 0; padding: 0; }
.stage .pet:focus-visible { outline-offset: -20px; }
.stage .fx-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.float-fx { position: absolute; animation: floatUp 1.4s ease-out forwards; }
@keyframes floatUp {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15% { transform: translate(0, -10px) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), -120px) scale(1); opacity: 0; }
}
.tap-hint {
  position: absolute; z-index: 3; top: 30%; left: -6%;
  font: 600 0.95rem/1.2 var(--pixel-font); color: var(--on-primary);
  background: var(--text); padding: 8px 12px;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
  opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.3s;
}
.tap-hint.show { opacity: 1; transform: none; animation: bob 1.6s steps(2) infinite 0.3s; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ground: night grass that continues the scene's ground row */
.ground {
  position: relative; height: 72px;
  background:
    linear-gradient(180deg, transparent 0 12px, var(--grass) 12px 36px, var(--grass-dark) 36px 52px, var(--bg) 52px);
}
.ground::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background:
    linear-gradient(90deg, transparent 0 8px, var(--grass) 8px 12px, transparent 12px 20px, var(--grass) 20px 24px, transparent 24px 32px) 0 4px / 32px 8px repeat-x,
    linear-gradient(90deg, var(--grass) 0 4px, transparent 4px 16px, var(--grass) 16px 20px, transparent 20px 32px) 0 8px / 32px 4px repeat-x;
}
.ground::after {
  content: ""; position: absolute; left: 0; right: 0; top: 20px; height: 24px; opacity: 0.6;
  background:
    linear-gradient(90deg, transparent 0 20px, #FFF6D8 20px 24px, transparent 24px) 0 0 / 140px 4px repeat-x,
    linear-gradient(90deg, transparent 0 86px, #FF9EC8 86px 90px, transparent 90px) 0 12px / 170px 4px repeat-x,
    linear-gradient(90deg, transparent 0 50px, #A78BFA 50px 54px, transparent 54px) 0 8px / 230px 4px repeat-x;
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { padding-bottom: 8px; }
  .hero-copy .lead { margin-left: auto; margin-right: auto; }
  .hero-ctas, .platforms { justify-content: center; }
  .hero-stage { min-height: 0; }
  .stage { --s: 5; }
  .tap-hint { left: 0; }
}
@media (max-width: 420px) {
  .stage { --s: 4; }
}

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.step .art { height: 112px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 8px; }
.step .num {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin-bottom: 6px;
  font: 600 1rem/1 var(--pixel-font); color: var(--on-primary); background: var(--primary);
}
.step p { color: var(--text-2); margin: 0; }
.food-row { display: flex; gap: 6px; align-items: flex-end; }
.food-row img { width: 48px; height: 48px; image-rendering: pixelated; animation: hop 1.2s steps(2) infinite; }
.food-row img:nth-child(2) { animation-delay: 0.4s; }
.food-row img:nth-child(3) { animation-delay: 0.8s; }
@keyframes hop { 50% { transform: translateY(-8px); } }
@media (max-width: 880px) { .steps { grid-template-columns: 1fr; } }

/* Interactive demo */
.demo {
  margin-top: 28px; display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 48px); align-items: center;
  padding: clamp(18px, 3vw, 32px);
}
.demo-stage {
  position: relative; --s: 4; width: calc(var(--s) * 64px); height: calc(var(--s) * 60px); overflow: hidden;
  background:
    linear-gradient(180deg, transparent calc(var(--s) * 57px), #2A6E45 calc(var(--s) * 57px)),
    linear-gradient(180deg, #5FA8EC 0%, #9AD2FF 55%, #CFEEFF 100%);
  box-shadow: 0 0 0 4px var(--frame);
}
.demo-stage::before {
  content: ""; position: absolute; z-index: 0; top: calc(var(--s) * 8px); left: calc(var(--s) * 6px);
  width: calc(var(--s) * 4px); height: calc(var(--s) * 2px); background: #fff;
  box-shadow:
    calc(var(--s) * 2px) calc(var(--s) * -2px) 0 #fff, calc(var(--s) * 4px) 0 0 #fff, calc(var(--s) * 6px) 0 0 #fff,
    calc(var(--s) * 40px) calc(var(--s) * 6px) 0 #fff, calc(var(--s) * 42px) calc(var(--s) * 4px) 0 #fff, calc(var(--s) * 44px) calc(var(--s) * 6px) 0 #fff;
  animation: drift 18s linear infinite alternate;
}
@keyframes drift { to { transform: translateX(calc(var(--s) * 8px)); } }
.demo-stage .sprite { position: absolute; left: 0; top: 0; --s: inherit; }
.demo-stage .fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.drop-food { position: absolute; width: 32px; height: 32px; image-rendering: pixelated; z-index: 2; animation: drop 0.6s cubic-bezier(.5,0,.8,.4) forwards; }
@keyframes drop { from { transform: translateY(-160px); } to { transform: translateY(0); } }
.demo-ui h3 { margin-bottom: 6px; }
.counter { font: 700 2.4rem/1 var(--body-font); font-variant-numeric: tabular-nums; margin: 14px 0 4px; }
.counter small { font-size: 1rem; font-weight: 500; color: var(--text-2); }
.meters { display: grid; gap: 10px; margin: 18px 0 22px; max-width: 420px; }
.meter { display: grid; grid-template-columns: 24px 96px 1fr 44px; gap: 10px; align-items: center; font-size: 0.92rem; }
.meter .label { color: var(--text-2); }
.meter .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.segs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.segs i { height: 12px; background: var(--empty); transition: background 0.2s steps(2); }
.meter[data-k="satiety"] .on { background: var(--satiety); }
.meter[data-k="energy"] .on { background: var(--energy); }
.meter[data-k="mood"] .on { background: var(--mood); }
.meter[data-k="satiety"] .pi { color: var(--satiety); }
.meter[data-k="energy"] .pi { color: var(--energy); }
.meter[data-k="mood"] .pi { color: var(--mood); }
.demo-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.demo-note { font-size: 0.85rem; color: var(--text-2); margin-top: 14px; }
@media (max-width: 760px) {
  .demo { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .meters { margin-left: auto; margin-right: auto; width: 100%; }
  .meter { grid-template-columns: 24px 90px 1fr 40px; gap: 8px; text-align: left; }
  .demo-actions { justify-content: center; }
  .demo-stage { --s: 3; }
}

/* ---------- Grow ---------- */
.grow { background: linear-gradient(180deg, var(--bg), #0E1718 40%, var(--bg)); }
.timeline {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; position: relative; margin-bottom: 72px;
}
.timeline::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 104px; height: 4px;
  background: repeating-linear-gradient(90deg, var(--frame) 0 8px, transparent 8px 14px);
}
.stage-card { text-align: center; position: relative; }
.stage-card .sprite { --s: 3; position: relative; z-index: 1; }
.stage-card .pedestal { width: 120px; height: 8px; margin: -10px auto 14px; background: var(--grass-dark); box-shadow: 0 -4px 0 var(--grass); }
.stage-card h3 { margin-bottom: 4px; }
.stage-card p { color: var(--text-2); font-size: 0.95rem; max-width: 240px; margin: 0 auto; }
.eggs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.eggs span { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; background: var(--note); }
.eggs .sun { color: #FFD25A; } .eggs .berry { color: #FF9EC8; } .eggs .egg-sky { color: #7CC4FF; }
@media (max-width: 880px) {
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .timeline::before { display: none; }
}
@media (max-width: 520px) {
  .stage-card .sprite { --s: 2; }
  .stage-card .pedestal { width: 96px; }
}

.forms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.form-card {
  --accent: var(--primary);
  position: relative; text-align: center; padding: 18px 14px 20px; cursor: pointer;
  transition: transform 0.2s;
}
.form-card:hover, .form-card:focus-visible { transform: translateY(-6px); }
.form-card .sprite { --s: 3; }
.form-card .badge {
  display: inline-block; font: 600 0.78rem/1 var(--pixel-font); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); padding: 6px 10px; background: color-mix(in srgb, var(--accent) 14%, transparent); margin: 6px 0 10px;
}
.form-card h3 { margin-bottom: 4px; }
.form-card p { color: var(--text-2); font-size: 0.92rem; margin: 0; }
.form-card .glow {
  position: absolute; left: 50%; top: 40px; width: 140px; height: 140px; transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%);
  pointer-events: none;
}
.form-card .sprite { position: relative; }
.forms-note { text-align: center; color: var(--text-2); margin: 28px auto 0; max-width: 560px; }
@media (max-width: 1100px) { .forms { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .forms { gap: 10px; } .form-card { padding: 12px 4px 14px; } .form-card .sprite { --s: 2; } .form-card .glow { top: 20px; width: 110px; height: 110px; } }

.sub-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin: 88px 0 24px; }
.sub-head h3 { font-size: 1.7rem; margin: 0; }
.tag-plus {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 0.8rem/1 var(--pixel-font); color: var(--plus); background: var(--plus-container); padding: 6px 10px;
}
.tag-plus .pi { width: 16px; height: 16px; }

.rares { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.rare { text-align: center; padding: 14px 8px 16px; position: relative; }
.rare .sil {
  --s: 2;
  display: inline-block; width: calc(var(--s) * 64px); height: calc(var(--s) * 64px);
  background: var(--silhouette);
  -webkit-mask: var(--src) 0 0 / calc(var(--n) * 100%) 100% no-repeat;
          mask: var(--src) 0 0 / calc(var(--n) * 100%) 100% no-repeat;
  transition: opacity 0.25s;
}
.rare .sprite { --s: 2; position: absolute; left: 50%; top: 14px; transform: translateX(-50%); opacity: 0; transition: opacity 0.25s; }
.rare:hover .sprite, .rare:focus-within .sprite, .rare.revealed .sprite { opacity: 1; }
.rare:hover .sil, .rare:focus-within .sil, .rare.revealed .sil { opacity: 0; }
.rare h4 { font: 600 1rem/1.2 var(--pixel-font); margin: 6px 0 4px; }
.rare p { font-size: 0.82rem; color: var(--text-2); margin: 0; font-style: italic; }
@media (max-width: 1180px) { .rares { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rares { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 360px) { .rare .sil, .rare .sprite { --s: 1; } .rare .sprite { top: 14px; } .rare h4 { font-size: 0.9rem; } }
@media (hover: none) { .form-card:hover { transform: none; } .btn:hover, .store:hover { transform: none; } }

/* Wrapping rows, centred: five per row on wide screens, two on phones, whatever the number of skins. */
.friends { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 3vw, 40px); max-width: 820px; margin-inline: auto; }
.friend { width: 128px; text-align: center; }
.friend .sprite { --s: 2; }
.friend span { display: block; font: 600 1rem/1.2 var(--pixel-font); margin-top: 2px; }
@media (max-width: 640px) { .friends { max-width: 300px; } }

/* ---------- Promises ---------- */
.promises { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.promise { padding: 20px 20px 18px; }
.promise .pi { color: var(--primary); margin-bottom: 10px; }
.promise h3 { font-size: 1.2rem; }
.promise p { color: var(--text-2); margin: 0; font-size: 0.96rem; }
@media (max-width: 960px) { .promises { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .promises { grid-template-columns: 1fr; } }

/* ---------- Apps / download ---------- */
.download { background: radial-gradient(ellipse at 50% 0%, #1A1745 0%, var(--bg) 60%); }
.apps { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.app-card { padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; }
.app-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.app-head img { width: 64px; height: 64px; border-radius: 16px; image-rendering: pixelated; }
.app-head h3 { margin: 0; font-size: 1.5rem; }
.app-head .muted { font-size: 0.9rem; }
.app-card ul { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 8px; }
.app-card li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.app-card li .pi { width: 20px; height: 20px; color: var(--primary); margin-top: 3px; }
.app-card .device { display: flex; justify-content: center; margin: 4px 0 24px; flex: 1; align-items: center; }
.app-card .stores { margin-top: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.app-card .store { min-width: 0; }
@media (max-width: 880px) { .apps { grid-template-columns: 1fr; } }

/* Watch mockup */
.watch {
  position: relative; width: 210px; height: 250px; padding: 16px;
  background: linear-gradient(145deg, #3a4446, #1c2324); border-radius: 58px;
  box-shadow: inset 0 0 0 2px #4f5b5d, 0 20px 40px rgba(0,0,0,0.45);
}
.watch::before, .watch::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%); width: 130px; height: 36px; background: #1F4A4A; z-index: -1;
}
.watch::before { top: -30px; border-radius: 14px 14px 4px 4px; }
.watch::after { bottom: -30px; border-radius: 4px 4px 14px 14px; }
.watch .crown { position: absolute; right: -8px; top: 70px; width: 10px; height: 34px; border-radius: 4px; background: #4f5b5d; }
.watch .screen { width: 100%; height: 100%; background: #000; border-radius: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.watch .sprite { --s: 2; }
.watch .mini-meters { display: flex; gap: 6px; margin-top: 2px; }
.watch .mini-meters i { display: block; width: 30px; height: 6px; background: var(--empty); position: relative; }
.watch .mini-meters i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--v); background: var(--c); }
.watch .time { font: 600 0.8rem/1 var(--body-font); color: var(--text-2); margin-bottom: 4px; }

/* Phone mockup */
.phone {
  width: 236px; height: 440px; padding: 10px; border-radius: 40px;
  background: linear-gradient(145deg, #3a4446, #1c2324);
  box-shadow: inset 0 0 0 2px #4f5b5d, 0 20px 40px rgba(0,0,0,0.45);
}
.phone .screen { width: 100%; height: 100%; border-radius: 31px; background: var(--bg); overflow: hidden; padding: 30px 12px 12px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.phone .screen::before { content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 64px; height: 16px; border-radius: 10px; background: #000; }
.phone .ph-title { font: 600 1rem/1 var(--pixel-font); display: flex; justify-content: space-between; align-items: center; }
.phone .ph-title small { font: 500 0.6rem/1 var(--body-font); color: var(--primary); }
.phone .ph-scene { position: relative; height: 128px; background: #000; display: flex; justify-content: center; overflow: hidden; border: 2px solid var(--frame); }
.phone .ph-scene .sprite { --s: 2; position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.phone .ph-meter { display: grid; grid-template-columns: 14px 1fr; gap: 6px; align-items: center; }
.phone .ph-meter .pi { width: 14px; height: 14px; }
.phone .segs i { height: 8px; }
.phone .ph-card { background: var(--card); padding: 8px 10px; border-radius: 10px; font-size: 0.72rem; color: var(--text-2); display: flex; justify-content: space-between; }
.phone .ph-card b { color: var(--text); font-variant-numeric: tabular-nums; }
.phone .ph-bars { display: flex; align-items: flex-end; gap: 5px; height: 46px; background: var(--card); border-radius: 10px; padding: 6px 10px; }
.phone .ph-bars i { flex: 1; background: var(--primary-container); }
.phone .ph-bars i.today { background: var(--primary); }
.phone .ph-tabs { margin-top: auto; display: flex; justify-content: space-around; padding: 8px 0 2px; border-top: 1px solid var(--frame); color: var(--text-2); }
.phone .ph-tabs .pi { width: 16px; height: 16px; }
.phone .ph-tabs .pi.on { color: var(--primary); }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.faq h3 { font-size: 1.5rem; margin: 28px 0 4px; }
.faq h3:first-child { margin-top: 0; }
.faq details { padding: 4px 18px; }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 0; font-weight: 600; font-size: 1.05rem;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 600 1.4rem/1 var(--pixel-font); color: var(--primary); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }

/* ---------- Contact form ---------- */
.contact-form { max-width: 680px; margin: 0 auto; padding: clamp(18px, 4vw, 32px); display: grid; gap: 18px; }
.contact-form .field { display: grid; gap: 6px; }
.contact-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.contact-form label { font-weight: 600; font-size: 0.95rem; }
.contact-form label .muted { font-weight: 400; }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--frame); border-radius: 0; padding: 10px 12px; min-height: 44px;
}
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form input:focus-visible, .contact-form select:focus-visible, .contact-form textarea:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px; border-color: var(--primary);
}
.contact-form [aria-invalid="true"] { border-color: var(--soft); }
.form-error { color: var(--soft); margin: 0; }
.form-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.form-note { margin: 0; font-size: 0.88rem; flex: 1 1 260px; }
.form-fallback { margin: 0; color: var(--text-2); }
@media (max-width: 600px) { .contact-form .field-row { grid-template-columns: 1fr; } }
.faq details p, .faq details ul, .faq details ol { color: var(--text-2); margin: 0 0 16px; }
.faq details ul, .faq details ol { padding-left: 1.2em; }
.faq details li { margin-bottom: 0.4em; }
.faq details strong { color: var(--text); }
.faq-more { text-align: center; color: var(--text-2); margin: 20px 0 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--frame); padding: 40px 0 calc(48px + env(safe-area-inset-bottom)); color: var(--text-2); font-size: 0.92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer nav a { color: var(--text-2); }
.site-footer nav a:hover { color: var(--text); }
.footer-pet { display: flex; align-items: center; gap: 12px; }
.footer-pet .sprite { --s: 1; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2,.8,.2,1.2); transition-delay: var(--delay, 0s); }
.reveal.in { opacity: 1; transform: none; }
.pop { animation: pop 0.45s cubic-bezier(.2,.8,.2,1.4); }
@keyframes pop { 0% { transform: scale(0.85); } 100% { transform: scale(1); } }

/* ---------- Legal pages ---------- */
.legal-hero { background: linear-gradient(180deg, var(--sky-top), var(--sky-mid)); padding: 56px 0 40px; position: relative; overflow: hidden; }
.legal-hero .wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.legal-hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 6px; hyphens: auto; overflow-wrap: anywhere; }
.legal-hero .wrap > div { min-width: 0; }
.legal-hero p { color: #D4CCFF; margin: 0; }
.legal-hero .sprite { --s: 2; flex: none; }
.legal { max-width: 780px; margin: 0 auto; padding: 48px var(--gutter) 96px; }
.legal h2 { font-size: 1.6rem; margin: 2em 0 0.5em; }
.legal h3 { font-family: var(--body-font); font-size: 1.1rem; font-weight: 700; margin: 1.6em 0 0.4em; }
.legal p, .legal li { color: #CFE5DE; }
.legal ul { padding-left: 1.3em; }
.legal li { margin-bottom: 0.4em; }
.legal .summary { padding: 18px 22px; margin: 0 0 32px; }
.legal .summary p:last-child { margin: 0; }
.legal .legal-note { font-size: 0.9rem; color: var(--text-2); margin-bottom: 20px; }
/* Chinese has no glyphs in the pixel font: use the system sans, not the monospace fallback. */
:root:lang(zh) { --pixel-font: "Pixelify Sans", var(--body-font); --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
.legal table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: 0.94rem; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--frame); }
.legal th { color: var(--text); font-weight: 600; background: var(--card); }
.legal td { color: #CFE5DE; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.legal { overflow-wrap: anywhere; }
@media (max-width: 600px) { .legal { padding-top: 32px; padding-bottom: 64px; } .legal table { font-size: 0.86rem; } .legal th, .legal td { padding: 8px; } }
@media (max-width: 600px) { .legal-hero .sprite { display: none; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sprite.play, .star, .food-row img, .tap-hint.show { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .store, .form-card { transition: none; }
}
