/* Jugnu Lab — one stylesheet for parents, children and admin.
   Rules: big readable type, one clear main button per screen, pictures before words. */

:root {
  --ink: #1b2340;
  --ink-soft: #4a5275;
  --muted: #6b7290;
  --line: #dfe3ee;
  --bg: #f7f8fc;
  --card: #ffffff;
  --brand: #2f4fd8;        /* main action blue */
  --brand-ink: #ffffff;
  --brand-soft: #e8edff;
  --glow: #ffc83d;         /* firefly yellow */
  --glow-soft: #fff4d1;
  --good: #1e8a4c;
  --good-soft: #e3f6ea;
  --warn: #a75d00;
  --warn-soft: #fff1dc;
  --bad: #b3261e;
  --bad-soft: #fde8e7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 35, 64, .06), 0 4px 16px rgba(27, 35, 64, .06);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); font-weight: 900; }
h2 { font-size: 1.4rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ur { font-family: var(--font-ur); direction: rtl; line-height: 2.1; }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
main { padding: 24px 0 64px; min-height: 60vh; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* ---------- top bar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.logo .dot { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff6c9, var(--glow) 55%, #f0a500); box-shadow: 0 0 12px var(--glow); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav button {
  font: inherit; font-size: 1rem; font-weight: 700; color: var(--ink-soft); text-decoration: none;
  padding: 10px 14px; border-radius: 999px; background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--brand-soft); color: var(--brand); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }

footer.site { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .9rem; }
footer.site .row { justify-content: space-between; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px;
  font: inherit; font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #2441b8; color: var(--brand-ink); }
.btn-glow { background: var(--glow); border-color: var(--glow); color: var(--ink); }
.btn-glow:hover { background: #ffb800; color: var(--ink); border-color: #ffb800; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-good:hover { background: #17703d; color: #fff; }
.btn-danger { color: var(--bad); border-color: #f2c4c1; }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.btn-big { min-height: 64px; padding: 14px 32px; font-size: 1.25rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--brand); padding: 8px; min-height: 0; text-decoration: underline; }
button[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- cards & notices ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.notice { border-radius: var(--radius-sm); padding: 14px 16px; background: var(--brand-soft); border: 1px solid #c9d4ff; }
.notice.good { background: var(--good-soft); border-color: #b4e3c6; }
.notice.warn { background: var(--warn-soft); border-color: #f5d3a3; }
.notice.bad { background: var(--bad-soft); border-color: #f2c4c1; }
.notice.dev { background: #f1ecff; border: 1px dashed #8b6bd9; font-family: ui-monospace, Menlo, monospace; font-size: .95rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 800; background: var(--brand-soft); color: var(--brand); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.grey { background: #eceef4; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 20px; }
.field > span { display: block; font-weight: 800; margin-bottom: 6px; }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; margin-top: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 12px 14px; min-height: 52px;
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
textarea { min-height: 96px; line-height: 1.45; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; min-height: 240px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field-error, .validation-summary-errors { color: var(--bad); font-weight: 700; font-size: .95rem; }
.validation-summary-errors ul { margin: 0; padding-left: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; }
.check input { width: 24px; height: 24px; margin-top: 2px; }
.code-input { font-size: 2rem !important; letter-spacing: .4em; text-align: center; font-weight: 900; text-transform: uppercase; }

/* ---------- step indicator (forms with several steps) ---------- */
.steps-indicator { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; }
.steps-indicator li { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.steps-indicator li.done { background: var(--brand); }

/* ---------- picture tiles (avatars, picture passwords) ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); max-width: 420px; margin: 0 auto; }
.tiles.avatars { grid-template-columns: repeat(auto-fit, minmax(96px, 128px)); justify-content: center; max-width: 720px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  aspect-ratio: 1; border: 3px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer;
  font: inherit; font-weight: 800; color: var(--ink); padding: 8px; text-decoration: none;
  transition: transform .08s ease;
}
.tile .pic { font-size: clamp(2.5rem, 10vw, 3.5rem); line-height: 1; }
.tile .label { font-size: .95rem; }
.tile:hover { border-color: var(--brand); }
.tile:active { transform: scale(.96); }
.tile.selected, .tile[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.tile .order {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 900; display: none; align-items: center; justify-content: center;
}
.tile.selected .order { display: flex; }
input.tile-radio { position: absolute; opacity: 0; pointer-events: none; }
input.tile-radio:checked + .tile { border-color: var(--brand); background: var(--brand-soft); }
input.tile-radio:focus-visible + .tile { outline: 3px solid var(--glow); outline-offset: 2px; }
.chosen { display: flex; gap: 12px; justify-content: center; min-height: 72px; margin: 16px 0; }
.chosen span { width: 64px; height: 64px; border-radius: 16px; border: 3px dashed var(--line); display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.chosen span.filled { border-style: solid; border-color: var(--brand); background: var(--brand-soft); }

/* ---------- hero (home) ---------- */
.hero { padding: 40px 0 24px; text-align: center; }
.hero .lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 640px; margin: 0 auto 24px; }
.doors { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 24px; }
.door { display: block; text-decoration: none; color: var(--ink); text-align: center; padding: 32px 24px; border-radius: 24px; border: 3px solid var(--line); background: #fff; }
.door:hover { border-color: var(--brand); }
.door .pic { font-size: 4rem; line-height: 1; display: block; margin-bottom: 8px; }
.door strong { display: block; font-size: 1.5rem; font-weight: 900; }
.door.kid { background: var(--glow-soft); border-color: #ffe08a; }
.door.kid:hover { border-color: var(--glow); }
.how { counter-reset: how; list-style: none; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.how li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.how li::before { counter-increment: how; content: counter(how); display: flex; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 900; align-items: center; justify-content: center; margin-bottom: 8px; }

/* ---------- parent dashboard ---------- */
.child-card { display: flex; flex-direction: column; gap: 12px; }
.child-head { display: flex; align-items: center; gap: 12px; }
.child-head .avatar { font-size: 3rem; line-height: 1; width: 72px; height: 72px; border-radius: 50%; background: var(--glow-soft); display: flex; align-items: center; justify-content: center; }
.child-head h3 { margin: 0; }
.meter { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--good); border-radius: 6px; }
.family-code { font-size: 2rem; font-weight: 900; letter-spacing: .25em; font-family: ui-monospace, Menlo, monospace; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 1.5rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 700; }

/* ---------- tables (admin) ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: #f2f4fa; font-weight: 800; white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }

/* ========== children's area ========== */
body.kids { background: #fdf9ef; font-size: 20px; }
.kids .topbar { background: #1d2b53; border: 0; }
.kids .topbar .logo { color: #fff; }
.kids .nav a, .kids .nav button { color: #dfe5ff; font-size: 1.05rem; }
.kids .nav a:hover, .kids .nav button:hover, .kids .nav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
.kid-chip { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; }
.kid-chip .avatar { font-size: 1.8rem; }
.kid-chip .stars { background: rgba(255,255,255,.14); padding: 2px 10px; border-radius: 999px; }

/* the learning map: islands with stops along a path */
.island { border-radius: 28px; padding: 24px; margin-bottom: 24px; background: #fff; border: 3px solid var(--line); }
.island-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.island-head .emoji { font-size: 2.6rem; line-height: 1; width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; }
.island-head h2 { margin: 0; }
.island.locked { background: #f3f3f6; border-style: dashed; }
.island.locked .island-head { opacity: .7; }
.path { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 10px;
  border-radius: 22px; border: 3px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; height: 100%;
}
.stop .pic { font-size: 2.8rem; line-height: 1; }
.stop .code { font-size: .8rem; font-weight: 900; color: var(--muted); }
.stop strong { font-size: 1.05rem; line-height: 1.2; }
.stop .state { font-size: .9rem; font-weight: 800; }
.stop.done { border-color: #a9dfbf; background: var(--good-soft); }
.stop.done .state { color: var(--good); }
.stop.open { border-color: var(--glow); background: var(--glow-soft); }
.stop.open.next { box-shadow: 0 0 0 4px var(--glow), 0 0 24px rgba(255, 200, 61, .7); animation: pulse 2s ease-in-out infinite; }
.stop.locked { opacity: .55; background: #f6f6f8; }
a.stop:hover { border-color: var(--brand); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--glow), 0 0 36px rgba(255, 200, 61, .9); } }

.next-banner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #1d2b53; color: #fff; border-radius: 28px; padding: 20px 24px; margin-bottom: 24px; }
.next-banner .pic { font-size: 3.2rem; line-height: 1; }
.next-banner .grow { flex: 1; min-width: 200px; }
.next-banner h2 { margin: 0; color: #fff; }

/* the project player: one step per screen */
.player { max-width: 760px; margin: 0 auto; }
.player-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.player-top .title { flex: 1; font-weight: 900; font-size: 1.1rem; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 0 0 20px; padding: 0; list-style: none; }
.dots li { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dots li.done { background: var(--good); }
.dots li.now { background: var(--brand); transform: scale(1.3); }
.screen { background: #fff; border: 3px solid var(--line); border-radius: 28px; padding: 28px 24px; min-height: 320px; }
.screen .big-pic { font-size: 4.5rem; line-height: 1; text-align: center; margin-bottom: 12px; }
.screen .step-no { font-weight: 900; color: var(--brand); font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.screen .step-text { font-size: clamp(1.3rem, 3.4vw, 1.7rem); font-weight: 800; line-height: 1.35; margin: 8px 0 16px; }
.screen.junior .step-text { font-size: clamp(1.5rem, 4.2vw, 2rem); }
.grownup { background: var(--warn-soft); border: 2px solid #f5d3a3; border-radius: 16px; padding: 12px 16px; font-size: 1rem; }
.grownup b { color: var(--warn); }
.player-nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 20px; }
.player-nav .btn { flex: 1; max-width: 280px; }
.parts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.parts li label { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); font-weight: 700; cursor: pointer; }
.parts li input { width: 26px; height: 26px; flex-shrink: 0; }
.parts li input:checked + span { text-decoration: line-through; color: var(--muted); }
.wiring { background: #1d2b53; color: #fff; border-radius: 16px; padding: 14px 18px; font-weight: 700; }
.speak { min-width: 56px; }
.tool-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
details.code-box { margin-top: 12px; }
details.code-box summary { cursor: pointer; font-weight: 800; padding: 10px 0; }
pre.code { background: #0f1630; color: #e8ecff; padding: 16px; border-radius: 14px; overflow-x: auto; font-size: .85rem; line-height: 1.5; margin: 0; }
.celebrate { text-align: center; }
.celebrate .big-pic { font-size: 6rem; animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.badges { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.badge { text-align: center; padding: 16px 10px; border-radius: 22px; background: #fff; border: 3px solid var(--line); }
.badge .pic { font-size: 2.8rem; display: block; line-height: 1.1; }
.badge.gold { border-color: var(--glow); background: var(--glow-soft); }
.badge.empty { opacity: .45; border-style: dashed; }

.game-stage { background: #fff; border: 3px solid var(--line); border-radius: 28px; padding: 16px; min-height: 420px; }
.game-list .stop .state { color: var(--brand); }

.break-screen { text-align: center; max-width: 560px; margin: 40px auto; }
.break-screen .big-pic { font-size: 6rem; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  body.kids { font-size: 18px; }
  .card { padding: 18px; }
  .screen { padding: 20px 16px; border-radius: 22px; }
  .island { padding: 16px; border-radius: 22px; }
  .path { grid-template-columns: repeat(2, 1fr); }
  .nav a, .nav button { padding: 8px 10px; }
  .topbar .wrap { min-height: 56px; gap: 8px; }
  .logo span:last-child { display: none; }
  /* adults: one scrollable row of links */
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a, .nav button { white-space: nowrap; }
  /* children: the four main places become a bottom tab bar, like a phone app */
  .kids .topbar .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #1d2b53;
    box-shadow: 0 -2px 12px rgba(0,0,0,.2);
  }
  .kids .topbar .nav a { text-align: center; padding: 8px 2px; border-radius: 14px; font-size: .9rem; }
  .kids .kid-chip { margin-left: auto; }
  .kids .kid-chip .stars { white-space: nowrap; }
  body.kids main { padding-bottom: 104px; }
  body.kids footer.site { padding-bottom: 96px; }
}

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