:root {
  --bg: #fff8f1;
  --bg-2: #ffeef8;
  --panel: #ffffff;
  --text: #24213d;
  --muted: #6b6590;
  --border-soft: #efe9ff;

  --brand: #7c5cff;
  --brand-2: #ff6fb5;
  --brand-3: #ffb54c;
  --brand-4: #3ecfc0;

  --tile-back: #7c5cff;
  --tile-front: #ffffff;
  --success: #4ad18a;

  --shadow-sm: 0 6px 18px rgba(68, 48, 140, 0.10);
  --shadow-md: 0 14px 36px rgba(68, 48, 140, 0.14);
  --shadow-lg: 0 24px 60px rgba(68, 48, 140, 0.18);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ffe1f1 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, #e5dcff 0%, transparent 55%),
    radial-gradient(900px 600px at 50% 110%, #fff1c9 0%, transparent 55%),
    var(--bg);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button,
a,
.game-card,
.tile,
.balloon,
.shape-tile {
  -webkit-tap-highlight-color: transparent;
}

/* Decorative background */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
}

.blob-1 {
  width: 420px;
  height: 420px;
  background: #ffc2e0;
  top: -120px;
  left: -80px;
}

.blob-2 {
  width: 380px;
  height: 380px;
  background: #c7b8ff;
  top: 120px;
  right: -100px;
}

.blob-3 {
  width: 500px;
  height: 500px;
  background: #ffe29a;
  bottom: -200px;
  left: 30%;
}

.floaty {
  position: absolute;
  font-size: 28px;
  opacity: 0.85;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.floaty-1 { top: 12%; left: 6%; animation-delay: 0s; }
.floaty-2 { top: 28%; right: 10%; animation-delay: -1.5s; font-size: 34px; }
.floaty-3 { top: 62%; left: 4%; animation-delay: -2.5s; font-size: 32px; }
.floaty-4 { top: 72%; right: 6%; animation-delay: -3.5s; font-size: 36px; }
.floaty-5 { top: 46%; right: 22%; animation-delay: -4.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-14px) rotate(3deg); }
}

/* Header */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) clamp(14px, 4vw, 40px) 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}

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

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  background: white;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  padding: 0;
  line-height: 1;
}

@media (hover: hover) {
  .icon-button:hover {
    transform: translateY(-2px);
    border-color: #ddd3ff;
  }
}

.icon-button[aria-pressed="true"] {
  background: #fff1f7;
  border-color: #ffd1e6;
}

.install-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 92, 255, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

@media (hover: hover) {
  .install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(124, 92, 255, 0.45);
  }
}

.install-button .install-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  font-weight: 900;
}

.no-ads-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #e8fff3;
  color: #0b7a4a;
  font-weight: 800;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 2px solid #bff0d5;
  box-shadow: var(--shadow-sm);
}

.no-ads-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2bb673;
  box-shadow: 0 0 0 4px rgba(43, 182, 115, 0.18);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

/* Main layout */
.app {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px clamp(14px, 4vw, 40px) calc(40px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 30px 0 40px;
}

.eyebrow {
  display: inline-block;
  font-weight: 800;
  color: var(--brand);
  background: #efe9ff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.hero-copy h1 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.02;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.grad {
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--muted);
  max-width: 520px;
  margin: 0 0 22px;
  line-height: 1.55;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.hero-badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 2px solid var(--border-soft);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Hero art */
.hero-art {
  position: relative;
  height: 420px;
}

.hero-card {
  position: absolute;
  width: 130px;
  height: 130px;
  background: white;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 68px;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--border-soft);
  animation: bob 4s ease-in-out infinite;
}

.card-a { top: 20px;  left: 20px;  transform: rotate(-8deg); background: #fff1f7; }
.card-b { top: 60px;  right: 20px; transform: rotate(10deg); background: #fff8e1; animation-delay: -1s; }
.card-c { bottom: 40px; left: 60px; transform: rotate(6deg);  background: #ecf5ff; animation-delay: -2s; }
.card-d { bottom: 10px; right: 40px; transform: rotate(-12deg); background: #ecfff4; animation-delay: -3s; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50%      { transform: translateY(-10px) rotate(var(--r, 0deg)); }
}

.card-a { --r: -8deg; }
.card-b { --r: 10deg; }
.card-c { --r: 6deg; }
.card-d { --r: -12deg; }

.sparkle {
  position: absolute;
  color: var(--brand-3);
  font-size: 28px;
  filter: drop-shadow(0 2px 6px rgba(255, 181, 76, 0.4));
  animation: twinkle 2.4s ease-in-out infinite;
}

.s1 { top: 8%; left: 42%; animation-delay: 0s; }
.s2 { top: 54%; left: 8%; animation-delay: -0.8s; }
.s3 { top: 30%; right: 0; animation-delay: -1.6s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* Buttons */
button,
.primary-button,
.ghost-button,
.secondary-button {
  font-family: inherit;
}

.primary-button,
.ghost-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  box-shadow: 0 10px 24px rgba(124, 92, 255, 0.35);
}

@media (hover: hover) {
  .primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(124, 92, 255, 0.45);
  }
}

.primary-button.big {
  padding: 14px 26px;
  font-size: 1.05rem;
}

.ghost-button {
  background: white;
  color: var(--text);
  border: 2px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
  .ghost-button:hover {
    transform: translateY(-2px);
    border-color: #ddd3ff;
  }
}

.secondary-button {
  background: #fff0f8;
  color: #9a3977;
  box-shadow: var(--shadow-sm);
}

@media (hover: hover) {
  .secondary-button:hover {
    transform: translateY(-2px);
  }
}

button[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Sections */
.section {
  margin-top: 48px;
}

.section-head {
  text-align: center;
  margin-bottom: 22px;
}

.section-head h2 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 6px;
}

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

/* Game cards */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: white;
  border: 2px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #e0d5ff;
  }
}

.game-card:active {
  transform: translateY(-1px);
}

.game-card.is-coming .card-art {
  filter: grayscale(0.2) saturate(0.8);
}

.card-art {
  position: relative;
  height: 140px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 72px;
  overflow: hidden;
  isolation: isolate;
}

.card-art::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.25), transparent 60%);
  z-index: -1;
}

.card-sparkle {
  position: absolute;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  animation: twinkle 2.4s ease-in-out infinite;
}
.card-sparkle.one { top: 10px; left: 14px; }
.card-sparkle.two { bottom: 10px; right: 18px; animation-delay: -1s; }

.game-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.game-tag.soon {
  background: rgba(255, 255, 255, 0.95);
  color: #8a6a00;
}

.game-card h3 {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.25rem;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.game-card .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.meta-chip {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3efff;
  color: #5d47c9;
}

.game-card button {
  margin-top: auto;
  width: 100%;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.feature {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px;
  border: 2px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff3f9, #efe9ff);
  font-size: 24px;
  margin-bottom: 10px;
}

.feature h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Parent note */
.parent-card {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(135deg, #fff7fb 0%, #f3efff 100%);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.parent-card h2 {
  margin: 0 0 8px;
  font-family: "Fredoka", "Nunito", sans-serif;
}

.parent-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Game shell (when a game is open) */
.panel {
  background: white;
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2.4vw, 24px);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-soft);
  width: min(760px, 100%);
  margin: 0 auto;
}

.game-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: clamp(8px, 2vw, 20px) 0 calc(24px + env(safe-area-inset-bottom));
}

.shell-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(18px, 3vw, 28px);
}

.shell-spacer {
  display: block;
  width: 44px;
  height: 44px;
}

.shell-title {
  margin: 0;
  text-align: center;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  color: var(--text);
  letter-spacing: -0.01em;
}

.shell-back {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: #ffffff;
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, color 140ms ease, border-color 140ms ease;
  padding: 0;
  line-height: 1;
}

@media (hover: hover) {
  .shell-back:hover {
    color: var(--text);
    border-color: #ddd3ff;
    transform: translateX(-2px);
  }
}

.shell-back:active {
  transform: translateX(-1px);
}

.game-mount {
  width: 100%;
}

/* Focus mode when a game is active */
body.is-playing .site-nav,
body.is-playing .no-ads-pill,
body.is-playing .floaty {
  display: none !important;
}

body.is-playing .blob {
  opacity: 0.18;
}

body.is-playing .site-footer {
  display: none;
}

body.is-playing .site-header {
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: 4px;
}

body.is-playing .app {
  padding-top: 4px;
}

body.is-playing .install-button {
  display: none !important;
}

/* Memory game */
.memory-game {
  display: grid;
  gap: 18px;
}

.memory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.memory-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.memory-meta p {
  margin: 0;
  background: #ffffff;
  color: #4a3aa3;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
  border: 1px solid #e7dcff;
}

.memory-header .secondary-button {
  background: #ffffff;
  color: #5f4ca8;
  border: 1px solid #dfd4ff;
  box-shadow: none;
  padding: 8px 14px;
}

.memory-status {
  margin: 0;
  min-height: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brand);
  transition: color 200ms ease;
}

.memory-status.is-match  { color: #179a56; }
.memory-status.is-miss   { color: #c44a72; }
.memory-status.is-win    { color: var(--brand); }

.game-board {
  --board-max: 500px;
  --tile-gap: clamp(6px, 1.2vw, 12px);
  display: grid;
  gap: var(--tile-gap);
  justify-content: center;
  align-content: start;
  margin: 0 auto;
  width: 100%;
  max-width: var(--board-max);
}

.memory-board-wrap {
  background: transparent;
  padding: 0;
}

.tile {
  aspect-ratio: 1 / 1;
  position: relative;
  border-radius: 16px;
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  background: transparent;
  padding: 0;
  border: none;
  container-type: inline-size;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.tile:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 3px;
}

.tile.is-locked {
  cursor: default;
}

.tile-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  user-select: none;
  overflow: hidden;
}

.tile-back {
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(255, 255, 255, 0.35) 0%, transparent 45%),
    linear-gradient(160deg, #7c5cff 0%, #a48bff 55%, #ff6fb5 120%);
  box-shadow:
    inset 0 -6px 12px rgba(0, 0, 0, 0.18),
    inset 0 3px 6px rgba(255, 255, 255, 0.35);
}

.tile-back::after {
  content: "★";
  color: rgba(255, 255, 255, 0.55);
  font-size: 28cqi;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tile-front {
  background: #ffffff;
  border: 2px solid #ece7ff;
  transform: rotateY(180deg);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.04);
}

.tile-front .emoji {
  font-size: 46.5cqi;
  line-height: 1;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-2%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
}

.tile.flipped {
  transform: rotateY(180deg);
}

.tile.matched {
  cursor: default;
  pointer-events: none;
  animation: matchPop 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tile.matched .tile-front {
  background: linear-gradient(160deg, #f5fff7 0%, #eafff1 100%);
  border-color: #7ad69b;
  box-shadow:
    0 0 0 3px rgba(122, 214, 155, 0.28),
    inset 0 -4px 0 rgba(74, 209, 138, 0.18);
}

@keyframes matchPop {
  0%   { transform: rotateY(180deg) scale(1); }
  40%  { transform: rotateY(180deg) scale(1.06); }
  100% { transform: rotateY(180deg) scale(1); }
}

.tile.shake {
  animation: tileShake 420ms ease;
}

@keyframes tileShake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  20%      { transform: rotateY(180deg) translateX(-4px); }
  40%      { transform: rotateY(180deg) translateX(4px); }
  60%      { transform: rotateY(180deg) translateX(-3px); }
  80%      { transform: rotateY(180deg) translateX(3px); }
}

@media (max-width: 560px) {
  .game-board { --board-max: 96vw; }
}

@media (max-width: 760px) {
  body.is-playing .site-header {
    justify-content: flex-end;
    gap: 8px;
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 2px;
  }

  body.is-playing .brand {
    display: none !important;
  }

  body.is-playing .icon-button {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  body.is-playing .game-shell {
    padding-top: 2px;
  }

  body.is-playing .shell-header {
    grid-template-columns: 36px 1fr 0;
    gap: 8px;
    margin-bottom: 10px;
  }

  body.is-playing .shell-back {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  body.is-playing .shell-spacer {
    display: none;
  }

  body.is-playing .shell-title {
    text-align: left;
    font-size: clamp(1.02rem, 4.4vw, 1.28rem);
    line-height: 1.15;
  }

  body.is-playing .memory-game,
  body.is-playing .shape-sprint-game,
  body.is-playing .color-pop-game {
    gap: 10px;
  }

  body.is-playing .memory-header,
  body.is-playing .shape-sprint-header,
  body.is-playing .color-pop-header {
    gap: 8px;
    padding: 0;
    justify-content: center;
  }

  body.is-playing .memory-meta,
  body.is-playing .shape-sprint-meta,
  body.is-playing .color-pop-meta {
    gap: 6px;
    justify-content: center;
  }

  body.is-playing .memory-meta p,
  body.is-playing .shape-sprint-meta p,
  body.is-playing .color-pop-meta p {
    font-size: 0.76rem;
    padding: 4px 8px;
  }

  body.is-playing .memory-header .secondary-button,
  body.is-playing .shape-sprint-header .secondary-button,
  body.is-playing .color-pop-header .secondary-button {
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  body.is-playing .shape-target-card,
  body.is-playing .color-target-card {
    padding: 8px 10px;
    border-radius: 14px;
  }

  body.is-playing .target-hint {
    margin: 0 0 4px;
    font-size: 0.75rem;
  }

  body.is-playing .shape-target-preview,
  body.is-playing .color-target-preview {
    padding: 6px 10px;
    gap: 8px;
  }

  body.is-playing .shape-target-preview .symbol {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1.75rem;
  }

  body.is-playing .shape-target-preview .name,
  body.is-playing .color-target-preview .name {
    font-size: 0.92rem;
  }

  body.is-playing .color-target-preview .swatch {
    width: 20px;
    height: 20px;
  }

  body.is-playing .color-play-area {
    height: min(66svh, 540px);
    min-height: 300px;
  }
}

/* Shape Sprint */
.shape-sprint-game {
  display: grid;
  gap: 16px;
}

.shape-sprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.shape-sprint-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shape-sprint-meta p {
  margin: 0;
  background: #ffffff;
  color: #3f3473;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 1px solid #e7dcff;
  white-space: nowrap;
}

.shape-target-card {
  border: 1px solid #e9e0ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  padding: 12px;
  text-align: center;
}

.target-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.shape-target-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e7dcff;
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
}

.shape-target-preview .symbol {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.15rem;
  line-height: 1;
}

.shape-target-preview .name {
  font-weight: 800;
  font-size: 1rem;
  color: #3f3473;
}

.shape-board-wrap {
  padding: 0;
}

.shape-board {
  --shape-board-max: 420px;
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: var(--shape-board-max);
  margin: 0 auto;
}

.shape-tile {
  aspect-ratio: 1 / 1;
  border: 2px solid #e7dcff;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

@media (hover: hover) {
  .shape-tile:hover {
    transform: translateY(-2px);
    border-color: #d8c8ff;
  }
}

.shape-tile:active {
  transform: translateY(0);
  background: #fbf8ff;
}

.shape-glyph {
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.25rem, 8.1vw, 3.375rem);
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08));
}

.shape-tile.is-correct {
  background: #ecfff3;
  border-color: #7ad69b;
}

.shape-tile.is-wrong {
  background: #fff2f6;
  border-color: #f4a8c6;
}

.shape-timer-track {
  height: 8px;
  border-radius: 999px;
  background: #eee7ff;
  overflow: hidden;
}

.shape-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3ecfc0 0%, #7c5cff 55%, #ff6fb5 100%);
  transition: width 60ms linear;
}

.shape-status {
  margin: 0;
  min-height: 24px;
  text-align: center;
  font-weight: 700;
  color: var(--brand);
}

.shape-status.ok {
  color: #179a56;
}

.shape-status.warn {
  color: #c44a72;
}

.shape-status.end {
  color: #564a8a;
}

/* Color Pop (Balloon Chase) */
.color-pop-game {
  display: grid;
  gap: 16px;
}

.color-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.color-pop-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-pop-meta p {
  margin: 0;
  background: #ffffff;
  color: #3f3473;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 1px solid #e7dcff;
  white-space: nowrap;
}

.color-target-card {
  border: 1px solid #e9e0ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  padding: 12px;
  text-align: center;
}

.target-hint {
  margin: 0 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.color-target-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e7dcff;
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
}

.color-target-preview .swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.14),
    0 2px 8px rgba(0, 0, 0, 0.08);
}

.color-target-preview .name {
  font-weight: 800;
  font-size: 1.05rem;
  color: #3f3473;
}

.color-play-area {
  position: relative;
  width: 100%;
  height: min(68vh, 560px);
  height: min(68svh, 560px);
  min-height: 360px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 85%, rgba(255, 255, 255, 0.9), transparent 55%),
    linear-gradient(180deg, #e6f6ff 0%, #edfaf3 55%, #fff4e0 100%);
  border: 1px solid #e7dcff;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 -12px 24px rgba(255, 255, 255, 0.6);
}

.play-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  filter: blur(4px);
  pointer-events: none;
}

.play-cloud-a {
  width: 120px;
  height: 40px;
  top: 12%;
  left: -30px;
  animation: cloudDrift 40s linear infinite;
}

.play-cloud-b {
  width: 90px;
  height: 30px;
  top: 38%;
  right: -40px;
  animation: cloudDrift 55s linear infinite reverse;
  opacity: 0.7;
}

@keyframes cloudDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(180px); }
}

.balloon {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  will-change: transform;
  touch-action: manipulation;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18));
  transition: filter 120ms ease;
}

.balloon:focus-visible {
  outline: none;
}

.balloon-body {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 35%;
  animation: balloonBob 2.8s ease-in-out infinite;
}

.balloon svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes balloonBob {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.balloon.pop {
  pointer-events: none;
}

.balloon.pop .balloon-body {
  animation: balloonPop 320ms ease-out forwards;
}

.balloon.is-correct .balloon-body {
  filter: brightness(1.15);
}

.balloon.is-wrong .balloon-body {
  filter: saturate(0.6);
}

@keyframes balloonPop {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.35); opacity: 0.9; }
  100% { transform: scale(0.2); opacity: 0; }
}

.color-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(63, 52, 115, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2;
}

.color-overlay.hidden {
  display: none;
}

.color-overlay-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 22px 24px;
  text-align: center;
  border: 1px solid #e7dcff;
  box-shadow: 0 20px 40px rgba(63, 52, 115, 0.18);
  max-width: 80%;
}

.color-overlay-card h3 {
  margin: 0 0 6px;
  color: #3f3473;
  font-size: 1.25rem;
}

.color-overlay-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 600;
}

.color-status {
  margin: 0;
  min-height: 24px;
  text-align: center;
  font-weight: 700;
  color: var(--brand);
}

.color-status.ok {
  color: #179a56;
}

.color-status.warn {
  color: #c44a72;
}

.color-status.end {
  color: #564a8a;
}

@media (max-width: 480px) {
  .color-play-area {
    height: min(70svh, 520px);
    min-height: 320px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .color-play-area {
    height: min(72svh, 360px);
    min-height: 260px;
  }
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 16px calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
}

.site-footer p {
  margin: 2px 0;
}

.site-footer .muted {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 10px;
  }

  .hero-art {
    height: 300px;
    order: -1;
  }

  .hero-card {
    width: 100px;
    height: 100px;
    font-size: 52px;
  }

  .site-nav {
    display: none;
  }
}

@media (max-width: 560px) {
  .no-ads-pill {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  .shell-header {
    flex-direction: row;
    align-items: center;
    margin-bottom: 16px;
  }

  .memory-header,
  .shape-sprint-header,
  .color-pop-header {
    justify-content: center;
  }

  .memory-meta,
  .shape-sprint-meta,
  .color-pop-meta {
    justify-content: center;
  }

  .memory-meta p,
  .shape-sprint-meta p,
  .color-pop-meta p {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  .hero-art {
    height: 240px;
  }

  .hero-card {
    width: 88px;
    height: 88px;
    font-size: 44px;
    border-radius: 20px;
  }

  .hero-badges {
    gap: 6px;
  }

  .hero-badges li {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  .install-button {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .install-button span:last-child {
    display: none;
  }

  .install-button .install-icon {
    width: 16px;
    height: 16px;
  }

  .site-footer {
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
    font-size: 0.9rem;
  }

  .floaty {
    opacity: 0.55;
    font-size: 22px;
  }

  .floaty-2 { font-size: 26px; }
  .floaty-3 { font-size: 24px; }
  .floaty-4 { font-size: 28px; }

  .game-board {
    --tile-gap: clamp(5px, 1.6vw, 10px);
  }

  .color-target-preview .swatch {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 420px) {
  .site-header {
    gap: 8px;
  }

  .brand {
    font-size: 1.15rem;
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .no-ads-pill {
    display: none;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero {
    padding: 18px 0 28px;
  }

  .hero-art {
    height: 220px;
  }

  .hero-card {
    width: 78px;
    height: 78px;
    font-size: 36px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button.big,
  .hero-cta .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .section {
    margin-top: 32px;
  }

  .shell-header {
    grid-template-columns: 40px 1fr 40px;
    gap: 8px;
  }

  .shell-back,
  .shell-spacer {
    width: 40px;
    height: 40px;
  }

  .shell-title {
    font-size: 1.2rem;
  }
}

@media (max-width: 340px) {
  .brand-name {
    display: none;
  }
}

/* Standalone / installed-app tweaks */
@media (display-mode: standalone) {
  .install-button {
    display: none !important;
  }
}

/* iOS install sheet */
.ios-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
}

.ios-sheet.hidden {
  display: none !important;
}

.ios-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 33, 61, 0.45);
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}

.ios-sheet-card {
  position: relative;
  width: min(460px, 100%);
  background: white;
  border-radius: 28px 28px 0 0;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(36, 33, 61, 0.25);
  animation: slideUp 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ios-sheet-card h3 {
  margin: 0 0 16px;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.35rem;
  padding-right: 28px;
}

.ios-sheet-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f3efff;
  color: #5d47c9;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.ios-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 12px;
}

.ios-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #faf8ff;
  border: 2px solid var(--border-soft);
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.45;
}

.step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.ios-share {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 7px;
  background: #eef3ff;
  color: #2f60c7;
  font-weight: 800;
}

.ios-note {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
