@font-face {
  font-family: 'Quicksand';
  src: url('fonts/Quicksand-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Quicksand';
  src: url('fonts/Quicksand-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --sky1: #ffe9a8;
  --sky2: #ffd0d8;
  --ink: #3b2a4a;
  --card: #fffdf6;
  --shadow: 0 10px 0 rgba(0, 0, 0, .16), 0 16px 26px rgba(80, 40, 90, .22);
  --r: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--sky1);
  color: var(--ink);
  font-family: 'Quicksand', 'DejaVu Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sky {
  min-height: 100vh;
  padding: 20px clamp(14px, 3vw, 48px) 40px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, .75) 0 90px, transparent 91px),
    radial-gradient(circle at 88% 22%, rgba(255, 255, 255, .6) 0 130px, transparent 131px),
    radial-gradient(circle at 70% 88%, rgba(255, 255, 255, .5) 0 100px, transparent 101px),
    linear-gradient(170deg, var(--sky1) 0%, var(--sky2) 100%);
  background-attachment: fixed;
}

/* ---------------- top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  flex-wrap: wrap;
  max-width: 1500px;
  margin: 0 auto 6px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-ball {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ff9db5, #e8477e 60%, #b32a58);
  box-shadow: inset -4px -6px 10px rgba(0, 0, 0, .25);
}

.brand h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 44px);
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 0 3px 0 #d3467a, 0 6px 12px rgba(120, 30, 70, .35);
}

/* ---------------- track tabs (Baby / Big Kids / Fairytales) ---------------- */
.tracks { display: flex; gap: 10px; flex-wrap: wrap; }

.tracktab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 128px;
  padding: 8px 20px;
  border-radius: 18px;
  border: 3px solid #fff;
  background: rgba(255, 255, 255, .85);
  color: #8a2f5c;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
  transition: transform .12s, background .15s;
}
.tracktab:hover { transform: translateY(-2px); }
.tracktab:focus-visible { outline: 4px solid #4aa3ff; outline-offset: 3px; }
.tracktab .tlabel { font: 700 clamp(17px, 1.7vw, 23px) 'Quicksand', sans-serif; }
.tracktab .tage { font: 500 clamp(12px, 1.1vw, 15px) 'Quicksand', sans-serif; opacity: .75; }
.tracktab.on { background: #d3467a; color: #fff; transform: translateY(-2px); }
.tracktab.on .tage { opacity: .9; }

/* ---------------- category chips ---------------- */
.days {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1500px;
  margin: 0 auto 4px;
}

.daytab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 56px;
  padding: 2px 14px;
  border-radius: 16px;
  border: 3px solid #fff;
  background: #fff;
  color: #d3467a;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
  transition: transform .12s, background .15s;
}
.daytab:hover { transform: translateY(-2px); }
.daytab:focus-visible { outline: 4px solid #4aa3ff; outline-offset: 3px; }
.daytab .dnum { font: 700 12px 'Quicksand', sans-serif; opacity: .6; line-height: 1; }
.daytab .dname { font: 700 clamp(14px, 1.3vw, 19px) 'Quicksand', sans-serif; line-height: 1.15; }
.daytab.on { background: #d3467a; color: #fff; transform: translateY(-2px); }
.daytab.on .dnum { opacity: .85; }

.tools { display: flex; gap: 10px; flex-wrap: wrap; }

/* top app tabs: Learn / Stories / Parents / Admin */
.apptabs { display: flex; gap: 8px; flex-wrap: wrap; }
.apptab {
  padding: 10px 18px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: rgba(255,255,255,.7);
  color: #8a2f5c;
  font: 700 16px 'Quicksand', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.12);
}
.apptab.on { background: #8a2f5c; color: #fff; }

/* payment button */
.btn-pay { background: #8a6fd0; }
.btn-pay:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(59,42,74,.55); display: grid;
  place-items: center; z-index: 100; padding: 18px; }
.modal[hidden] { display: none; }
.sheet { position: relative; width: min(560px, 94vw); max-height: 88vh; overflow-y: auto;
  background: #fffdf6; border: 6px solid #fff; border-radius: 28px;
  padding: 28px 24px; box-shadow: var(--shadow); color: var(--ink); }
.sheet h2 { margin: 0 0 4px; color: #8a2f5c; font-size: 28px; }
.sheet h3 { margin: 18px 0 8px; color: #8a2f5c; }
.msub { margin: 0 0 16px; color: #8a2f5c; opacity: .8; }
.sheet .x { position: absolute; top: 10px; right: 14px; border: 0; background: none;
  font-size: 30px; color: #8a2f5c; cursor: pointer; line-height: 1; }
.sheet label { display: block; font-weight: 700; color: #8a2f5c; margin: 10px 0 2px; }
.sheet input, .sheet select { width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 3px solid #ffd0d8; font: 700 16px 'Quicksand', sans-serif; color: var(--ink);
  background: #fff; margin-top: 4px; }
.rowline { display: flex !important; align-items: center; gap: 10px; }
.rowline input { width: auto; }
.plans { display: grid; gap: 10px; margin-bottom: 10px; }
.plan { border: 3px solid #ffd0d8; border-radius: 16px; padding: 12px 14px; cursor: pointer; }
.plan b { color: #d3467a; font-size: 19px; }
.pprice { margin-left: 10px; font-weight: 700; }
.plan small { display: block; opacity: .75; }
.pform { margin-top: 6px; }
.pmsg { min-height: 22px; margin: 10px 0 0; font-weight: 700; color: #3fae5a; }
.reqlist { padding-left: 20px; }

/* maintenance banner */
.maint { position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  background: #b32a58; color: #fff; text-align: center;
  font-weight: 700; padding: 10px 16px; }
.maint[hidden] { display: none; }

/* bottom user/version bar + company footer */
.userbar { display: flex; justify-content: space-between; align-items: center;
  max-width: 1500px; margin: 26px auto 0; padding: 10px 18px;
  background: rgba(255,255,255,.75); border: 3px solid #fff; border-radius: 16px;
  color: #8a2f5c; font-weight: 700; }
.userbar .ver { opacity: .75; }
.userbar .ugrow { flex: 1; }
/* plan badge on top: Guest preview vs paid/trial state */
.planbadge { padding: 6px 16px; border-radius: 999px; border: 3px solid #fff;
  background: rgba(255,255,255,.85); color: #8a2f5c; font-weight: 700; font-size: 15px; }
.planbadge.paid { background: #3fae5a; color: #fff; }
/* sign in/out pill in the top bar */
.btn-sign { display: inline-flex; align-items: center; text-decoration: none;
  background: #8a2f5c; font-size: 15px; }
.btn-sign:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
/* signup link inside the sign-in modal */
.signup { margin: 14px 0 0; text-align: center; font-weight: 700; color: #8a2f5c; }
.signup a { color: #d3467a; }
/* locked preview blocks: dimmed + lock corner */
.block.locked { filter: saturate(.55); opacity: .82; }
.block .lock { position: absolute; top: 8px; right: 12px; font-size: 26px;
  background: rgba(255,255,255,.9); border-radius: 50%; width: 40px; height: 40px;
  display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.cofoot { max-width: 1500px; margin: 10px auto 0; text-align: center;
  color: #8a2f5c; font-weight: 700; opacity: .9; }
.cofoot a { color: #d3467a; }

.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 18px;
  border: 3px solid #fff;
  font: 700 18px 'Quicksand', sans-serif;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .18);
}
.btn:focus-visible { outline: 4px solid #4aa3ff; outline-offset: 3px; }
.btn-speak { background: #3fae5a; }
.btn-speak:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.btn-stop { background: #e8734a; }
.btn-stop:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }

/* ---------------- theme label ---------------- */
.theme {
  max-width: 1500px;
  margin: 8px auto 14px;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 700;
  color: #8a2f5c;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .7);
}

/* ---------------- the toy blocks ---------------- */
.grid {
  max-width: 1500px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 26px);
}

.block {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  padding: clamp(10px, 1.4vw, 22px);
  border: 6px solid #fff;
  border-radius: var(--r);
  background: var(--card);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  font-family: inherit;
}
.block:hover { transform: translateY(-5px) rotate(-.6deg); }
.block:focus-visible { outline: 6px solid #4aa3ff; outline-offset: 4px; }
.block:active { transform: translateY(6px); box-shadow: 0 3px 0 rgba(0, 0, 0, .16); }

.block.tapped { animation: squash .55s ease; }
@keyframes squash {
  0% { transform: scale(1); }
  35% { transform: scale(1.13) rotate(2deg); }
  100% { transform: scale(1); }
}

/* soft coloured panels so the board looks like a set of toy blocks */
.block.c0 { background: #fff3d6; }
.block.c1 { background: #ffe1ea; }
.block.c2 { background: #dff3e4; }
.block.c3 { background: #dceaff; }
.block.c4 { background: #f0e4ff; }
.block.c5 { background: #fff0d9; }

.art {
  display: grid;
  place-items: center;
  width: 68%;
  aspect-ratio: 1 / 1;
}
.art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .18));
}

.name {
  font-size: clamp(22px, 2.5vw, 38px);
  font-weight: 700;
  color: #4a2a3d;
  text-align: center;
  line-height: 1.1;
}

/* small check mark once the word has been heard */
.block.heard::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 12px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #3fae5a;
  color: #fff;
  font: 700 24px 'Quicksand', sans-serif;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}

.hint {
  max-width: 1500px;
  margin: 20px auto 0;
  font-size: clamp(15px, 1.4vw, 21px);
  color: #8a2f5c;
  opacity: .85;
  text-align: center;
}

/* ---------------- speaking bubble ---------------- */
.speak-bubble {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 16px 40px;
  border-radius: 40px;
  background: #fff;
  border: 5px solid #d3467a;
  font: 700 clamp(26px, 3vw, 42px) 'Quicksand', sans-serif;
  color: #d3467a;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .16), 0 18px 30px rgba(120, 30, 70, .3);
  z-index: 50;
  pointer-events: none;
}
.speak-bubble.pop { animation: bubblepop .5s ease; }
@keyframes bubblepop {
  0% { transform: translateX(-50%) scale(.6); opacity: 0; }
  45% { transform: translateX(-50%) scale(1.1); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ---------------- story player ---------------- */
.story-view { max-width: 1500px; margin: 0 auto; }

.btn-back { background: #7a5bb5; margin-bottom: 12px; }
.btn-skip { background: #8a6fd0; }

.story-stage {
  display: flex;
  gap: clamp(16px, 2.5vw, 40px);
  align-items: flex-start;
  flex-wrap: wrap;
}

.story-art {
  flex: 0 0 auto;
  width: clamp(180px, 24vw, 320px);
  aspect-ratio: 1 / 1;
  padding: clamp(10px, 1.4vw, 22px);
  border: 6px solid #fff;
  border-radius: var(--r);
  background: #fff3d6;
  box-shadow: var(--shadow);
}
.story-art img { width: 100%; height: 100%; object-fit: contain; }

.story-panel {
  flex: 1 1 420px;
  min-width: 320px;
  padding: clamp(16px, 2vw, 30px);
  border: 6px solid #fff;
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
}

.story-panel h2 {
  margin: 0 0 12px;
  font-size: clamp(26px, 3vw, 42px);
  color: #8a2f5c;
}

.story-scene {
  margin: 0 0 16px;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.35;
  color: #4a2a3d;
  min-height: 2.7em;
}

.story-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.story-progress {
  height: 14px;
  border-radius: 10px;
  background: #efe0f5;
  overflow: hidden;
  margin-bottom: 14px;
}
.story-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #d3467a, #8a6fd0);
  transition: width .2s linear;
}

.story-list {
  margin: 0;
  padding-left: 26px;
  max-height: 34vh;
  overflow-y: auto;
  font-size: clamp(15px, 1.4vw, 20px);
  line-height: 1.4;
  color: #6a4a60;
}
.story-list li { margin-bottom: 7px; cursor: pointer; border-radius: 8px; }
.story-list li.on { color: #d3467a; font-weight: 700; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .block, .speak-bubble, .daytab { animation: none !important; transition: none !important; }
}
