:root {
  --ink: #0f1630;
  --ink-2: #1b2550;
  --paper: #fff8ec;
  --muted: #9aa5c8;
  --a: #ffb35c;
  --b: #5ff0d2;
  --c: #ff8a6b;
  --display: "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Sora", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink); color: #fff; font-family: var(--body);
  overflow: hidden; position: fixed; inset: 0;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.view { position: absolute; inset: 0; }

/* Hoofdscherm */
#home {
  display: grid; grid-template-rows: auto 1fr;
  padding: calc(18px + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: radial-gradient(ellipse at 50% 0%, #2a3a7a 0%, var(--ink) 70%);
}
.home-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.home-head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 64px; }
.home-head h1 {
  margin: 0; font-family: var(--display); font-weight: 800; line-height: 1;
  font-size: clamp(40px, 7vmin, 72px); letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--a), var(--b) 55%, var(--c));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.25));
}
.parent {
  position: absolute; right: 0; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.35); transition: background .2s ease, color .2s ease;
}
.parent:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.6); }
.parent svg { width: 100%; height: 100%; display: block; }
.parent .ring { fill: none; stroke: var(--b); stroke-width: 3; stroke-dasharray: 120; stroke-dashoffset: 120; transform: rotate(-90deg); transform-origin: 22px 22px; }
.parent.holding .ring { stroke-dashoffset: 0; transition: stroke-dashoffset 1.4s linear; }

.cards {
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 3vmin, 32px); align-items: center; align-self: center;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.card {
  position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; cursor: pointer;
  border-radius: clamp(22px, 3.4vmin, 36px); overflow: hidden;
  box-shadow: 0 10px 0 rgba(0,0,0,.28), 0 30px 60px -20px rgba(0,0,0,.6);
  transition: transform .45s cubic-bezier(.3,1.5,.5,1), box-shadow .3s ease;
  animation: bob 4s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.card:hover { transform: translateY(-6px) rotate(var(--tilt, 0deg)); }
.card.press { transform: scale(.94); transition-duration: .15s; }
.card.launch { transform: scale(1.08); }
.card svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card .name {
  position: absolute; left: 0; right: 0; top: 15%; text-align: center; margin: 0;
  font-family: var(--display); font-weight: 800; color: #fff; line-height: .95;
  font-size: clamp(24px, 4.6vmin, 50px); text-shadow: 0 3px 0 rgba(0,0,0,.22), 0 8px 24px rgba(0,0,0,.3);
  transform: rotate(-3deg);
}
.card .go {
  position: absolute; left: 50%; bottom: 7%; translate: -50% 0;
  width: clamp(58px, 9vmin, 92px); height: clamp(58px, 9vmin, 92px); border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 0 rgba(0,0,0,.22);
  animation: pulse 1.8s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.card .go svg { position: static; width: 40%; height: 40%; margin-left: 8%; }
@keyframes bob { 0%,100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes pulse { 0%,100% { scale: 1; } 50% { scale: 1.08; } }

/* Game */
#stage { background: #000; }
#stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.home-btn {
  position: absolute; z-index: 3;
  top: calc(16px + env(safe-area-inset-top, 0px)); left: calc(16px + env(safe-area-inset-left, 0px));
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: background .2s ease, transform .2s ease;
}
.home-btn:hover { background: rgba(255,255,255,.34); }
.home-btn:active { transform: scale(.92); }
.home-btn svg { width: 28px; height: 28px; }
.rotate { position: absolute; inset: 0; z-index: 4; display: none; place-items: center; background: rgba(10,14,30,.88); }
.rotate svg { width: 140px; animation: tilt 2.4s ease-in-out infinite; }
.rotate .tablet { fill: none; stroke: #fff; stroke-width: 5; }
@keyframes tilt { 0%,30% { rotate: 0deg; } 60%,100% { rotate: -90deg; } }
@media (orientation: portrait) { .rotate { display: grid; } }

/* Ouderhoekje */
.sheet { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: rgba(5,8,20,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet-card {
  width: min(720px, 100%); max-height: 100%; overflow: auto; background: #f7f8fc; color: #2b3150;
  border-radius: 24px; padding: 28px; display: grid; gap: 20px; user-select: text; -webkit-user-select: text;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.1; }
.x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #e8ebf5; cursor: pointer; font-size: 18px; transition: background .2s ease; }
.x:hover { background: #d9deee; }
.game-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 18px; align-items: center; padding: 14px 0; border-top: 1px solid #e3e6f0; }
.game-row b { font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 1.2; }
.bar { height: 14px; border-radius: 7px; background: #e8ebf5; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 7px; transition: width .6s ease; }
.nums { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; color: #5d6588; font-variant-numeric: tabular-nums; }
.nums strong { color: #2b3150; font-weight: 600; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.note { font-size: 14px; color: #6d7596; max-width: 380px; }
.reset { border: 0; border-radius: 999px; padding: 11px 18px; background: #e8ebf5; cursor: pointer; font-size: 14px; font-weight: 600; transition: background .2s ease; }
.reset:hover { background: #d9deee; }
.reset.sure { background: #f3d6dc; color: #8a3b4b; }

@media (orientation: portrait) {
  .cards { grid-template-columns: minmax(0, 1fr); max-width: 420px; gap: 18px; }
  .card { aspect-ratio: 16 / 7; }
  .card .name { top: 50%; translate: 0 -50%; left: 6%; right: auto; text-align: left; font-size: clamp(28px, 7vw, 44px); }
  .card .go { left: auto; right: 6%; bottom: 50%; translate: 0 50%; }
}
@media (max-width: 560px) { .game-row { grid-template-columns: minmax(0, 1fr); } .nums { grid-column: 1; } }
@media (prefers-reduced-motion: reduce) { .card, .card .go, .rotate svg { animation: none; } }
.card .stars {
  position: absolute; z-index: 1; top: 4%; right: 5%; display: flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 6px; border-radius: 999px; background: rgba(11,16,32,.35);
  font-family: var(--display); font-weight: 800; font-size: clamp(16px, 2.6vmin, 24px); line-height: 1; color: #fff;
}
.card .stars svg { position: static; width: 1.4em; height: 1.4em; }
.card .stars b { font-weight: 800; padding-top: .12em; font-variant-numeric: tabular-nums; }
@media (orientation: portrait) { .card .stars { top: 8%; } }
