/*
 * Site-wide styles. One light look, taken from the Trollord mock-up the children tested:
 * pale fjord sky, birch-white cards, berry accent. Mobile first; big touch targets.
 */
:root {
  --sky: #d6ecf6;
  --sky-deep: #7fb8d8;
  --birch: #fffaf0;
  --edge: #e6d9c3;
  --bark: #33282a;
  --muted: #6b5d5a;
  --berry: #b8406f;
  --berry-dark: #8f2f58;
  --meadow: #5e9f4b;
  --danger: #b3261e;
  --radius: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* layout classes must never un-hide elements */
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--bark);
  font: 17px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--berry-dark); }
h1, h2 { line-height: 1.15; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
p { margin: 0 0 1em; }

/* ── Layout ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.brand { font-weight: 800; font-size: 1.3rem; text-decoration: none; color: var(--bark); }
.topbar nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
main { max-width: 44rem; margin: 0 auto; padding: 8px 16px 48px; }
footer { max-width: 44rem; margin: 0 auto; padding: 0 16px 24px; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--birch); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 5px 0 var(--edge);
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--muted); }

/* ── Buttons ────────────────────────────────────────── */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--berry); color: #fff; box-shadow: 0 4px 0 var(--berry-dark);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--berry-dark); }
.btn.secondary { background: var(--birch); color: var(--bark); box-shadow: 0 4px 0 var(--edge); }
.btn.danger { background: var(--danger); box-shadow: 0 4px 0 #7e1a14; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .95rem; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 4px solid var(--berry); outline-offset: 3px;
}

/* ── Forms ──────────────────────────────────────────── */
form .field { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 700; }
input[type=text], input[type=password], input[type=number], select {
  font: inherit; min-height: 48px; padding: 8px 14px; border-radius: 14px;
  border: 2px solid var(--edge); background: #fff; color: var(--bark); width: 100%;
}
.helptext, .field small { color: var(--muted); font-size: .92rem; font-weight: 400; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-weight: 700; }

/* Avatar choices: big emoji tiles instead of radio dots. */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.avatar-opt { position: relative; }
.avatar-opt input { position: absolute; opacity: 0; inset: 0; }
.avatar-opt span {
  display: grid; place-items: center; aspect-ratio: 1; font-size: 2.2rem;
  background: #fff; border: 3px solid var(--edge); border-radius: 18px; cursor: pointer;
}
.avatar-opt input:checked + span { border-color: var(--berry); background: #fde9f1; }
.avatar-opt input:focus-visible + span { outline: 4px solid var(--berry); outline-offset: 2px; }

/* ── Profile picker ─────────────────────────────────── */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.profile-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.profile-tile form { width: 100%; }
.profile-tile button.avatar {
  width: 100%; aspect-ratio: 1; border: 0; border-radius: 28px; cursor: pointer;
  font-size: clamp(3.5rem, 18vw, 5rem); background: var(--birch); box-shadow: 0 6px 0 var(--edge);
}
.profile-tile button.avatar:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--edge); }
.profile-tile .name { font-weight: 800; font-size: 1.15rem; }
.profile-tile .tag { font-size: .85rem; color: var(--muted); }
.profile-tile .edit { font-size: .9rem; }
.add-tile button.avatar, .add-tile a.avatar {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 28px;
  border: 3px dashed var(--sky-deep); color: var(--sky-deep); font-size: 3rem; text-decoration: none;
}

/* ── Kids' area ─────────────────────────────────────── */
.kids-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 24px; }
.kids-hero .big-avatar { font-size: clamp(6rem, 35vw, 9rem); line-height: 1; }
.lock-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--birch); box-shadow: 0 4px 0 var(--edge); font-size: 1.4rem; text-decoration: none;
}

/* ── Parental gate ──────────────────────────────────── */
.hold {
  position: relative; overflow: hidden; width: 100%; min-height: 64px;
  border: 0; border-radius: 999px; font: inherit; font-weight: 800; font-size: 1.05rem;
  background: var(--birch); color: var(--bark); box-shadow: 0 4px 0 var(--edge); cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.hold::before {
  content: ""; position: absolute; inset: 0; background: #f6c544;
  transform: scaleX(var(--progress, 0)); transform-origin: left; opacity: .7;
}
.hold span { position: relative; }
.sum { font-size: 2.4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }

.lang-switch { display: flex; gap: 6px; }
.lang-switch button {
  font: inherit; font-size: .9rem; border: 2px solid var(--bark); background: none; color: var(--bark);
  border-radius: 999px; padding: 2px 12px; cursor: pointer; min-height: 36px;
}
.lang-switch button[aria-pressed="true"] { background: var(--berry); border-color: var(--berry); color: #fff; }

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

/* Sources and licences page */
.sources { padding-left: 1.2rem; display: grid; gap: .8rem; }
footer a { color: inherit; }
