/* rkd games: big, bright, touch-first. Designed for little fingers on an iPad. */
:root {
  --bg: #fff7e6;
  --bg-dots: #ffe8b8;
  --ink: #2b2140;
  --ink-soft: #5d5470;
  --card: #ffffff;
  --purple: #5b3cc4;
  --pink: #ff4f8b;
  --orange: #ff9f1c;
  --green: #2ec4b6;
  --shadow: 0 6px 0 rgba(43, 33, 64, 0.12), 0 12px 24px rgba(43, 33, 64, 0.12);
  --radius: 28px;
  --font: "Avenir Next Rounded", "Arial Rounded MT Bold", ui-rounded, "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 2px, transparent 2px);
  background-size: 28px 28px;
  touch-action: manipulation; /* no double-tap zoom */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: inherit; }

/* ---------- Home ---------- */
.site-header { text-align: center; padding: 28px 16px 8px; }
.logo { margin: 0; font-size: clamp(44px, 9vw, 84px); line-height: 1; letter-spacing: -1px; font-weight: 900; }
.logo span { display: inline-block; transform-origin: bottom; }
.logo-r { color: var(--pink); transform: rotate(-8deg); }
.logo-k { color: var(--orange); transform: translateY(-6px); }
.logo-d { color: var(--green); transform: rotate(8deg); }
.tagline { margin: 10px 0 0; font-size: clamp(22px, 4vw, 32px); font-weight: 800; color: var(--purple); }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tile {
  display: flex; flex-direction: column; height: 100%;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
a.tile:active { transform: translateY(4px) scale(0.98); box-shadow: 0 2px 0 rgba(43, 33, 64, 0.12); }
@media (hover: hover) { a.tile:hover { transform: translateY(-4px) rotate(-0.5deg); } }
a.tile:focus-visible { outline: 6px solid var(--purple); outline-offset: 4px; }

.tile-pic {
  position: relative; aspect-ratio: 4 / 3;
  background: var(--tile, var(--orange));
  display: flex; align-items: center; justify-content: center;
}
.tile-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { font-size: 96px; }
.badge {
  position: absolute; top: 14px; right: 14px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 16px;
  padding: 6px 14px; border-radius: 999px;
}
.tile-text { padding: 16px 20px 22px; }
.tile-text h2 { margin: 0 0 6px; font-size: 28px; font-weight: 900; line-height: 1.1; }
.tile-text p { margin: 0; font-size: 19px; line-height: 1.35; color: var(--ink-soft); }
.is-soon { opacity: 0.6; filter: grayscale(0.4); }

.site-footer { text-align: center; padding: 32px 16px 40px; color: var(--ink-soft); font-size: 16px; }

/* ---------- Game page ---------- */
.topbar { padding: 16px; }
.back {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 0 26px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow);
  font-size: 24px; font-weight: 900; text-decoration: none;
}
.back:active { transform: translateY(3px); }

.game-hero { max-width: 760px; text-align: center; padding-top: 0; }
.hero-pic {
  margin: 0 auto 20px; width: min(100%, 520px); aspect-ratio: 4 / 3;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background: var(--tile, var(--orange));
  display: flex; align-items: center; justify-content: center;
}
.hero-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-hero h1 { margin: 0 0 8px; font-size: clamp(40px, 7vw, 64px); font-weight: 900; line-height: 1.05; }
.hero-desc { margin: 0 0 8px; font-size: clamp(22px, 3.4vw, 28px); color: var(--ink-soft); }
.how { margin: 0 auto; max-width: 560px; font-size: 20px; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 28px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 88px; min-width: 240px; padding: 0 36px;
  border-radius: 999px; font-size: 36px; font-weight: 900; text-decoration: none;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.btn:focus-visible { outline: 6px solid var(--purple); outline-offset: 4px; }
.btn-play { background: var(--green); color: #fff; min-width: 300px; font-size: 44px; }
.btn-download { background: var(--card); color: var(--ink); font-size: 28px; min-height: 72px; }

.grownups {
  margin: 12px auto 40px; max-width: 600px; text-align: left;
  background: rgba(255, 255, 255, 0.7); border-radius: 18px; padding: 14px 20px;
  font-size: 16px; color: var(--ink-soft);
}
.grownups summary { cursor: pointer; font-weight: 700; min-height: 32px; display: list-item; }
.grownups code { background: #f1ecff; padding: 1px 6px; border-radius: 6px; }

/* ---------- Not found ---------- */
.lost { text-align: center; padding: 60px 16px; }
.lost h1 { font-size: 56px; margin: 0 0 12px; }
.lost p { font-size: 24px; }

@media (max-width: 560px) {
  .grid { gap: 18px; }
  .btn, .btn-play { min-width: 0; width: 100%; }
}

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