/* Kindergarten Science Labs: the home page (the 8 lab cards, badges, the grown-ups area).
 * Like the labs, it is a 1280 x 720 stage scaled to fit the window, so it looks the same on a
 * laptop, a Chromebook or a classroom screen. */
@font-face {
  font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/fredoka-latin-wght.woff2") format("woff2");
}
:root {
  --ink: #1f2b3a; --ink-2: #4a5a6e; --ink-3: #7d8b9b; --ui: #2a4a6b; --line: #e2e9f1;
  --good: #2fbf71; --good-dark: #1f8f53; --gold: #ffc531; --gold-dark: #d99100; --warn: #c2410c;
  --round: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --text: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; color: var(--ink); font-family: var(--text);
  background: #bfe3fb; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 4px solid #ffb703; outline-offset: 3px; }
#stage {
  position: fixed; left: 50%; top: 50%; width: 1280px; height: 720px; overflow: hidden; overflow: clip;
  transform: translate(-50%, -50%); transform-origin: 50% 50%; user-select: none;
}

/* ------------------------------------------------------------ sky, clouds and hills */
.sky { position: absolute; inset: 0; overflow: clip; background: linear-gradient(#9fd6fa 0%, #cdeeff 52%, #eaf8ff 100%); }
.cloud { position: absolute; width: 150px; height: 46px; border-radius: 46px; background: #fff; opacity: .9; }
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: #fff; }
.cloud::before { width: 70px; height: 70px; left: 22px; top: -34px; }
.cloud::after { width: 54px; height: 54px; left: 74px; top: -22px; }
.c1 { left: 470px; top: 40px; transform: scale(.9); animation: drift 60s linear infinite alternate; }
.c2 { left: 760px; top: 70px; transform: scale(.6); opacity: .7; animation: drift 80s linear infinite alternate-reverse; }
.c3 { left: 300px; top: 92px; transform: scale(.45); opacity: .6; }
@keyframes drift { to { translate: 60px 0; } }
.hill { position: absolute; border-radius: 50%; }
.h1 { left: -160px; right: 380px; bottom: -330px; height: 420px; background: #8fd36b; }
.h2 { left: 520px; right: -200px; bottom: -350px; height: 430px; background: #76c656; }

/* ------------------------------------------------------------ header */
#top { position: absolute; left: 36px; right: 36px; top: 16px; height: 86px; display: flex; align-items: center; justify-content: space-between; z-index: 5; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand img { width: 76px; height: 76px; border-radius: 22px; box-shadow: 0 5px 0 rgba(31, 58, 92, .18), 0 10px 20px rgba(31, 58, 92, .15); }
.kicker {
  display: inline-block; font-family: var(--round); font-weight: 600; font-size: 15px; letter-spacing: .14em; text-transform: uppercase;
  color: #fff; background: #f26b3a; border-radius: 12px; padding: 2px 10px 1px; margin-bottom: 4px;
}
h1 { margin: 0; font-family: var(--round); font-weight: 700; font-size: 48px; line-height: .95; color: #1d3c63; letter-spacing: -.01em; text-shadow: 0 3px 0 rgba(255, 255, 255, .85); }
.tools { display: flex; align-items: center; gap: 12px; }
.tally {
  height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 20px 0 10px; border-radius: 28px; background: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12); font-family: var(--round); color: var(--ui);
}
.tally b { font-size: 28px; font-weight: 700; }
.tally span { font-size: 20px; font-weight: 500; color: var(--ink-3); }
.mini-medal { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 45%, var(--gold-dark)); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--gold-dark); position: relative; }
.mini-medal::after { content: "★"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 18px; text-shadow: 0 1px 0 var(--gold-dark); }
.tally.bump { animation: bump .6s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }
.rbtn { width: 56px; height: 56px; border: 0; border-radius: 50%; padding: 0; display: grid; place-items: center; background: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.rbtn svg { width: 28px; height: 28px; fill: var(--ui); }
.rbtn:active, .pill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
#b-sound .off, .muted #b-sound .on { display: none; }
.muted #b-sound .off { display: block; }
.pill-btn {
  height: 56px; border: 0; border-radius: 28px; padding: 0 26px; background: #fff; color: var(--ui);
  font-family: var(--round); font-weight: 600; font-size: 20px; box-shadow: 0 4px 0 rgba(0, 0, 0, .14); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.pill-btn.go { background: var(--good); color: #fff; box-shadow: 0 4px 0 var(--good-dark); }
.pill-btn.ghost { background: #eef3f8; box-shadow: 0 4px 0 #cfd9e4; }
.pill-btn.small { height: 44px; font-size: 17px; padding: 0 18px; }
.pill-btn[disabled] { opacity: .55; cursor: default; }

/* ------------------------------------------------------------ the board of labs */
#board { position: absolute; left: 36px; right: 36px; top: 118px; bottom: 26px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; z-index: 2; }
.strand { display: flex; flex-direction: column; gap: 12px; }
.strand[data-strand="push"] { --c: #f26b3a; --cd: #c4491d; }
.strand[data-strand="sun"] { --c: #f0a500; --cd: #c07f00; }
.strand[data-strand="life"] { --c: #27a85f; --cd: #1a7e45; }
.strand[data-strand="earth"] { --c: #2f8ee0; --cd: #1d6bb0; }
.strand h2 {
  margin: 0; height: 40px; display: flex; align-items: center; gap: 8px; align-self: flex-start; padding: 0 16px 0 6px;
  border-radius: 20px; background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--cd);
  font-family: var(--round); font-weight: 600; font-size: 19px; white-space: nowrap;
}
.strand h2 svg { width: 30px; height: 30px; padding: 4px; border-radius: 50%; background: rgba(255, 255, 255, .25); fill: #fff; }
.lab { position: relative; height: 248px; }
.lab + .lab { margin-top: 2px; }
.lab-open {
  position: absolute; inset: 0; display: block; width: 100%; padding: 0; border: 0; text-align: left; overflow: hidden;
  border-radius: 22px; background: #fff; box-shadow: 0 7px 0 var(--cd), 0 14px 26px rgba(20, 50, 80, .2);
  transition: transform .15s ease, box-shadow .15s ease;
}
.lab-open:hover { transform: translateY(-4px); box-shadow: 0 11px 0 var(--cd), 0 18px 30px rgba(20, 50, 80, .22); }
.lab-open:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--cd), 0 8px 16px rgba(20, 50, 80, .2); }
.lab .thumb { display: block; height: 166px; background: #dde8f1 center / cover no-repeat; border-bottom: 5px solid var(--c); }
.lab .info { display: block; padding: 10px 66px 0 16px; }
.lab .title { display: block; font-family: var(--round); font-weight: 600; font-size: 23px; line-height: 1.08; color: var(--ink); }
.lab .code { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); }
.lab-say {
  position: absolute; right: 12px; bottom: 14px; width: 50px; height: 50px; border: 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center; background: var(--c); box-shadow: 0 4px 0 var(--cd); z-index: 2;
}
.lab-say svg { width: 26px; height: 26px; fill: #fff; }
.lab-say:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cd); }
.lab-say.talking { animation: talk 1s ease-in-out infinite; }
@keyframes talk { 50% { transform: scale(1.1); } }
.slot {
  position: absolute; left: 10px; top: 10px; width: 54px; height: 54px; border-radius: 50%; z-index: 2; pointer-events: none;
  border: 3px dashed rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .22); display: grid; place-items: center;
  color: rgba(255, 255, 255, .95); font-size: 24px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.medal {
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c4, var(--gold) 45%, var(--gold-dark));
  border: 4px solid #fff; box-shadow: 0 0 0 3px var(--gold-dark), 0 6px 14px rgba(0, 0, 0, .25); display: grid; place-items: center;
}
.medal .m-star { color: #fff; text-shadow: 0 2px 0 var(--gold-dark); line-height: 1; }
.slot.earned { border: 0; background: none; }
.slot.earned .medal { width: 54px; height: 54px; }
.slot.earned .m-star { font-size: 28px; }
.slot.earned.pop .medal { animation: pop 1s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { 0% { transform: scale(0) rotate(-90deg); } 100% { transform: scale(1) rotate(0); } }
.lock {
  position: absolute; right: 10px; top: 10px; width: 50px; height: 50px; border-radius: 50%; z-index: 2; pointer-events: none;
  background: rgba(24, 38, 56, .78); display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
.lock svg { width: 26px; height: 26px; fill: #fff; }
.free-tag {
  position: absolute; right: 10px; top: 12px; z-index: 2; pointer-events: none; padding: 4px 14px 3px; border-radius: 14px;
  background: var(--good); color: #fff; font-family: var(--round); font-weight: 600; font-size: 17px; box-shadow: 0 3px 0 var(--good-dark);
}
.lab.locked .thumb { filter: saturate(.8) brightness(.96); }

/* ------------------------------------------------------------ narration caption */
#caption {
  position: absolute; left: 50%; bottom: 22px; transform: translate(-50%, 20px); max-width: 940px; z-index: 90;
  display: flex; align-items: center; gap: 14px; padding: 14px 28px 14px 18px; border-radius: 30px; background: #fff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .22); font-family: var(--round); font-weight: 500; font-size: 23px; line-height: 1.25;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
#caption.show { opacity: 1; transform: translate(-50%, 0); }
#caption p { margin: 0; }
.spk { display: flex; align-items: center; gap: 3px; height: 26px; flex: none; }
.spk i { width: 5px; height: 10px; border-radius: 3px; background: #f5a623; }
#caption.talking .spk i { animation: bars .8s ease-in-out infinite; }
#caption.talking .spk i:nth-child(2) { animation-delay: .15s; }
#caption.talking .spk i:nth-child(3) { animation-delay: .3s; }
@keyframes bars { 50% { height: 24px; } }

/* ------------------------------------------------------------ panels */
.panel { position: absolute; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(18, 38, 60, .5); }
.panel.show { display: grid; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.card { position: relative; background: #fff; border-radius: 30px; padding: 30px 40px 32px; text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.panel.show .card { animation: rise .3s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes rise { from { transform: translateY(30px) scale(.96); } }
.card h2 { margin: 0; font-family: var(--round); font-weight: 600; font-size: 34px; line-height: 1.15; color: #1d3c63; }
.card .sub { margin: 8px 0 0; font-family: var(--round); font-size: 21px; color: var(--ink-2); }
.card .row { display: flex; justify-content: center; gap: 14px; margin-top: 24px; }

.locked-card { width: 600px; }
.locked-art { position: relative; width: 360px; height: 222px; margin: 0 auto 22px; }
.locked-art .thumb { position: absolute; inset: 0; border-radius: 20px; background: #dde8f1 center / cover; filter: saturate(.8); box-shadow: 0 6px 0 #d3dde8; }
.big-lock {
  position: absolute; left: 50%; bottom: -20px; width: 96px; height: 96px; margin-left: -48px; border-radius: 50%;
  background: #1f3a5c; border: 6px solid #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(0, 0, 0, .3);
  animation: wiggle 2.4s ease-in-out .4s infinite;
}
.big-lock svg { width: 48px; height: 48px; fill: #ffd23f; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-12deg); } 84% { transform: rotate(10deg); } 92% { transform: rotate(-6deg); } }

.badge-card { width: 520px; overflow: hidden; }
.medal.big { width: 150px; height: 150px; margin: 6px auto 20px; border-width: 8px; box-shadow: 0 0 0 5px var(--gold-dark), 0 12px 26px rgba(0, 0, 0, .3); animation: pop 1s cubic-bezier(.2, 1.6, .4, 1) both; }
.medal.big .m-star { font-size: 76px; text-shadow: 0 4px 0 var(--gold-dark); }
.badge-card .pill-btn { margin-top: 24px; min-width: 160px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 2.6s linear forwards; }
@keyframes fall { to { transform: translateY(640px) rotate(540deg); } }

.gate-card { width: 470px; }
.gate-card .q { display: block; margin-top: 18px; font-family: var(--round); font-weight: 600; font-size: 40px; color: var(--ui); }
#gate-in {
  width: 150px; height: 66px; margin-top: 12px; border: 3px solid #cfd9e4; border-radius: 18px; text-align: center;
  font-family: var(--round); font-size: 34px; font-weight: 600; color: var(--ink); user-select: text;
}
#gate-in:focus { border-color: #2f8ee0; outline: none; }
.msg { min-height: 24px; margin: 10px 0 0; font-size: 16px; color: var(--warn); font-weight: 600; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

/* ------------------------------------------------------------ grown-ups area */
.grown-card { width: 1140px; height: 660px; padding: 0; display: flex; flex-direction: column; text-align: left; user-select: text; }
.g-head { display: flex; align-items: center; gap: 22px; padding: 20px 24px 16px 34px; border-bottom: 2px solid var(--line); }
.g-head h2 { font-size: 30px; }
.tabs { display: flex; gap: 6px; }
.tabs button { height: 44px; border: 0; border-radius: 22px; padding: 0 20px; background: #eef3f8; color: var(--ui); font-family: var(--round); font-weight: 600; font-size: 18px; }
.tabs button[aria-selected="true"] { background: var(--ui); color: #fff; }
.x { margin-left: auto; width: 46px; height: 46px; border: 0; border-radius: 50%; background: #eef3f8; color: var(--ui); font-size: 30px; line-height: 1; }
.g-body { flex: 1; overflow: auto; padding: 22px 34px 30px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }
.g-body h3 { margin: 0 0 6px; font-family: var(--round); font-weight: 600; font-size: 24px; color: #1d3c63; }
.g-body h4 { margin: 22px 0 6px; font-size: 17px; color: var(--ink); }
.g-body p { margin: 6px 0; }
.g-body a { color: #1d6bb0; }
.lead { font-size: 17px; }
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #fff4e5; border-left: 5px solid #f5a623; color: #7a4a00; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.plan { border: 2px solid var(--line); border-radius: 20px; padding: 18px 22px 20px; display: flex; flex-direction: column; }
.plan.best { border-color: #9ad9b4; background: #f6fcf8; }
.plan h4 { margin: 0; font-family: var(--round); font-weight: 600; font-size: 22px; color: var(--ink); }
.plan .blurb { margin: 2px 0 8px; }
.price { font-family: var(--round); font-weight: 700; font-size: 38px; color: var(--ui); line-height: 1.1; }
.price small { font-size: 16px; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.plan ul { margin: 10px 0 16px; padding: 0; list-style: none; flex: 1; }
.plan li { padding-left: 26px; position: relative; margin: 4px 0; }
.plan li::before { content: "✓"; position: absolute; left: 2px; color: var(--good-dark); font-weight: 800; }
.plan .pill-btn { align-self: flex-start; }
.key-form { margin-top: 20px; padding: 18px 22px; border-radius: 18px; background: #f4f8fc; }
.key-form label.k { display: block; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.key-row { display: flex; gap: 12px; }
#lic {
  flex: 1; height: 50px; border: 2px solid #cfd9e4; border-radius: 14px; padding: 0 14px; font-family: Consolas, "Courier New", monospace;
  font-size: 17px; color: var(--ink); user-select: text; text-transform: uppercase;
}
#lic::placeholder { text-transform: none; }
#lic:focus { outline: none; border-color: #2f8ee0; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 15px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.key-msg { min-height: 22px; margin: 10px 0 0; font-weight: 600; }
.key-msg.bad { color: var(--warn); }
.key-msg.good { color: var(--good-dark); }
.fine { font-size: 13px; color: var(--ink-3); }
.lic-ok { display: flex; gap: 18px; align-items: center; }
.lic-ok .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--good); color: #fff; font-size: 38px; display: grid; place-items: center; flex: none; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 18px 0; padding: 16px 20px; border: 2px solid var(--line); border-radius: 16px; }
.facts dt { font-weight: 700; color: var(--ink); }
.facts dd { margin: 0; }
.danger { color: var(--warn) !important; }
.prog { width: 100%; border-collapse: collapse; margin-top: 12px; }
.prog td, .prog th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.prog th { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.prog .medal { width: 34px; height: 34px; border-width: 3px; box-shadow: 0 0 0 2px var(--gold-dark); }
.prog .medal .m-star { font-size: 17px; }
.prog .none { display: inline-block; width: 34px; height: 34px; border-radius: 50%; border: 3px dashed #cfd9e4; }
.cert-row { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
#cert-name { height: 44px; width: 260px; border: 2px solid #cfd9e4; border-radius: 12px; padding: 0 12px; font-size: 16px; user-select: text; }
.std { width: 100%; border-collapse: collapse; margin-top: 8px; }
.std td, .std th { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.std th { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.std td:first-child { white-space: nowrap; font-weight: 700; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }

/* ------------------------------------------------------------ printing (certificate) */
#print-sheet { display: none; }
@media print {
  @page { size: landscape; margin: 12mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  #stage { display: none !important; }
  #print-sheet { display: block; }
}
.cert { border: 6px solid #f0a500; border-radius: 24px; padding: 34px 48px; text-align: center; font-family: var(--round); color: #1d3c63; }
.cert .k { letter-spacing: .2em; text-transform: uppercase; font-size: 16px; color: #f26b3a; font-weight: 600; }
.cert h1 { font-size: 46px; margin: 8px 0 4px; text-shadow: none; }
.cert .name { font-size: 40px; font-weight: 600; margin: 18px auto 6px; padding: 0 30px 6px; border-bottom: 3px solid #c9d6e3; display: inline-block; min-width: 50%; }
.cert .medals { display: flex; justify-content: center; gap: 18px; margin: 24px 0 10px; flex-wrap: wrap; }
.cert .medals div { width: 110px; font-size: 13px; color: #4a5a6e; }
.cert .medals .medal { width: 64px; height: 64px; margin: 0 auto 6px; }
.cert .medals .medal .m-star { font-size: 32px; }
.cert .medals .off .medal { filter: grayscale(1) opacity(.35); }
.cert .date { margin-top: 16px; font-size: 16px; color: #4a5a6e; }
.badge-card > :not(.confetti) { position: relative; z-index: 1; }
.badge-card .confetti { z-index: 0; }
/* keep the whole unlock form in view without scrolling */
[data-pane="unlock"] .plans { margin-top: 12px; }
[data-pane="unlock"] .plan { padding: 14px 20px 16px; }
[data-pane="unlock"] .plan ul { margin: 6px 0 12px; }
[data-pane="unlock"] .plan li { margin: 1px 0; }
[data-pane="unlock"] .price { font-size: 34px; }
[data-pane="unlock"] .key-form { margin-top: 14px; padding: 14px 20px; }
