@font-face {
  font-family: 'Baloo 2'; font-weight: 800; font-display: swap;
  src: url('/vendor/fonts/baloo-2-latin-800-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito'; font-weight: 600; font-display: swap;
  src: url('/vendor/fonts/nunito-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito'; font-weight: 800; font-display: swap;
  src: url('/vendor/fonts/nunito-latin-800-normal.woff2') format('woff2');
}

:root {
  --sky: #1d1747; --sky-deep: #130f33; --card: #2a2263; --line: #3b3285;
  --text: #ffffff; --muted: #b9b3e6; --sun: #ffd34d; --accent: #ff8a2a; --danger: #ff6b5b;
  --display: 'Baloo 2', ui-rounded, system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--sky-deep); }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--body); font-weight: 600;
  /* a quiet night sky: a few soft star dots over a deep gradient */
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 9%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 32%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 64%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 52%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 86%, #fff5 50%, transparent 51%),
    linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 100%) fixed;
}
a { color: var(--sun); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.hidden { display: none !important; }

header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
}
.brand { font-family: var(--display); font-size: 20px; letter-spacing: .01em; line-height: 1; }
.brand span { color: var(--sun); }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; min-width: 0; }
.account .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 760px; margin: 0 auto; padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 40px); }
h1 { font-family: var(--display); font-size: 30px; line-height: 1.1; margin: 8px 0 18px; }
h2 { font-family: var(--display); font-size: 22px; line-height: 1.1; margin: 0; }
.muted { color: var(--muted); }

button, .button {
  font: inherit; font-weight: 800; color: var(--text); background: transparent; border: 2px solid var(--line);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary, .button.primary { background: var(--sun); border-color: var(--sun); color: var(--sky-deep); }
button.danger { color: var(--danger); border-color: rgba(255, 107, 91, .45); }
button:disabled { opacity: .5; cursor: default; }
input[type=text] {
  font: inherit; color: var(--text); background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 14px; min-width: 0;
}
input[type=text]:focus { border-color: var(--sun); outline: none; }

/* ---------- child: pictures first, since most players can't read yet ---------- */
.loading { display: flex; justify-content: center; gap: 10px; padding-top: 30vh; }
.loading .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sun); animation: bob 1s ease-in-out infinite; }
.loading .dot:nth-child(2) { animation-delay: .15s; }
.loading .dot:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 50% { transform: translateY(-10px); opacity: .5; } }

.me { display: flex; align-items: center; gap: 12px; margin: calc(env(safe-area-inset-top, 0px) + 16px) 0 22px; }
.badge {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sun); color: var(--sky-deep); font-family: var(--display); font-size: 32px; line-height: 1;
  box-shadow: 0 4px 0 #c99a12;
}
.me-name { font-family: var(--display); font-size: clamp(28px, 8vw, 40px); line-height: 1; }

.shelf { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px 16px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .shelf { grid-template-columns: repeat(3, 1fr); } }

/* The signature: each game is a chunky toy block in its own color that presses down like a button.
   The picture does the talking; the name underneath is for grown-ups and early readers. */
.block {
  --tile: var(--accent);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 10px 12px; border-radius: 28px; color: #fff; text-decoration: none; text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 85%, #fff) 0%, var(--tile) 70%);
  box-shadow: 0 9px 0 color-mix(in srgb, var(--tile) 55%, #000), 0 16px 24px rgba(0, 0, 0, .35);
  transition: transform .12s ease, box-shadow .12s ease;
  animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.block:active { transform: translateY(7px); box-shadow: 0 2px 0 color-mix(in srgb, var(--tile) 55%, #000), 0 4px 10px rgba(0, 0, 0, .3); }
.block img {
  width: min(120px, 34vw); aspect-ratio: 1; height: auto; border-radius: 26px; background: rgba(0, 0, 0, .18);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
}
.block .title { font-family: var(--display); font-size: 17px; line-height: 1.05; opacity: .95; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
@keyframes pop-in { from { opacity: 0; transform: translateY(18px) scale(.9); } }

.empty { display: flex; justify-content: center; align-items: flex-end; gap: 18px; padding: 40px 10px; }
.empty svg { width: 150px; }
.empty svg.grownup { width: 60px; fill: var(--muted); }
.empty .box { fill: #8c6eff; }
.empty .lid { fill: #a993ff; transform-origin: 22px 22px; animation: lid 2.4s ease-in-out infinite; }
.empty .knob { fill: var(--sun); }
@keyframes lid { 0%, 60%, 100% { transform: rotate(0); } 75% { transform: rotate(-14deg); } }

.grownups {
  position: fixed; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); border: 2px solid var(--line);
}
.grownups svg { width: 20px; height: 20px; fill: var(--muted); }
.grownups .shackle { fill: none; stroke: var(--muted); stroke-width: 2.4; }

/* ---------- activation ---------- */
.activate { max-width: 380px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.activate-art { width: 72px; margin: 0 auto; fill: var(--card); stroke: var(--sun); stroke-width: 2.5; }
.activate-art circle { fill: var(--sun); stroke: none; }
.activate-art .tick { fill: none; stroke: var(--sun); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.activate h1 { font-size: 40px; margin-bottom: 0; }
.activate input {
  width: 100%; text-align: center; font-family: var(--display); font-size: 34px; letter-spacing: .18em;
  text-transform: uppercase; padding: 14px 10px 10px; border-radius: 20px;
  box-shadow: 0 6px 0 var(--line);
}
.activate button.primary { font-size: 20px; padding: 14px 20px; box-shadow: 0 6px 0 #c99a12; }
.activate button.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #c99a12; }
.message { min-height: 1.4em; color: var(--danger); }

/* ---------- parent settings ---------- */
.add { display: flex; gap: 10px; margin-bottom: 22px; }
.add input { flex: 1; }
.kids { display: grid; gap: 16px; }
.kid { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 16px; display: grid; gap: 14px; }
.kid-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kid-head .actions, .kid > .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.games { display: flex; flex-wrap: wrap; gap: 8px; }
.games label {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 2px solid var(--line);
  border-radius: 999px; cursor: pointer;
}
.games label:has(input:checked) { border-color: var(--sun); }
.games img { width: 28px; height: 28px; border-radius: 8px; }
.code { font-family: var(--display); font-size: 34px; letter-spacing: .18em; color: var(--sun); }
.devices { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .block, .loading .dot, .empty .lid { animation: none; transition: none; }
}
