/* Welcome ---------------------------------------------------------------- */
.welcome { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
.welcome > .row { grid-column: 1 / -1; }
.welcome-hero { display: flex; flex-direction: column; gap: var(--s-3); }
.welcome-kicker { color: var(--go-dark); font-size: var(--text-lg); }
.welcome-title { font-size: var(--text-hero); text-shadow: 0 var(--px) 0 var(--white); }
.welcome-lead { font-size: var(--text-lg); max-width: 28ch; font-weight: 600; }
.welcome-cast { display: flex; align-items: flex-end; gap: var(--s-2); margin-top: var(--s-2); }
.welcome-cast svg { width: clamp(84px, 24vw, 132px); height: auto; }
.welcome-cast svg:nth-child(2) { width: clamp(104px, 30vw, 164px); }
.welcome-points { display: flex; flex-direction: column; gap: var(--s-2); }
.welcome-points li { display: flex; align-items: center; gap: var(--s-3); font-weight: 700; background: rgb(255 255 255 / 0.7); border-radius: var(--radius); padding: var(--s-2) var(--s-3); }
.welcome-points svg { width: 28px; height: 28px; flex: none; }
.welcome-side { display: flex; flex-direction: column; gap: var(--s-3); }
.welcome-tabs button { flex: 1; min-height: 48px; }
.welcome-form h2 { font-size: var(--text-lg); margin-top: var(--s-2); }
.welcome-form h2:first-child { margin-top: 0; }
@media (min-width: 860px) {
  .welcome { grid-template-columns: 1.05fr 0.95fr; align-items: start; }
  .welcome-hero { position: sticky; top: var(--s-5); padding-top: var(--s-5); }
}

/* Who's playing ---------------------------------------------------------- */
.who-title { font-size: var(--text-hero); text-shadow: 0 var(--px) 0 var(--white); }
.who-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-4); }
.who-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  width: 164px; padding: var(--s-4);
  background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--drop);
  transition: transform var(--fast) var(--ease);
}
.who-card:hover { transform: translateY(-3px); }
.who-card:active { transform: translateY(var(--px)); box-shadow: none; }
.who-card svg.pixel, .who-card svg.avatar { width: 112px; height: auto; }
.who-card .pill svg { width: 18px; }
.who-card strong { font-size: var(--text-lg); }
.who-actions { justify-content: center; }
.btn svg { width: 22px; height: 22px; flex: none; }

/* Hub -------------------------------------------------------------------- */
.hub-hello { display: flex; align-items: center; gap: var(--s-4); }
.hub-hello svg { width: clamp(96px, 26vw, 140px); height: auto; flex: none; }
.hub-hello h1 { font-size: var(--text-xl); text-shadow: 0 3px 0 var(--white); }
.quest { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.quest > svg { width: 48px; height: auto; flex: none; }
.quest-blocks { display: flex; gap: var(--s-1); }
.quest-block { width: 28px; height: 28px; background: var(--stone-light); border: var(--edge); border-radius: 4px; box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.15); }
.quest-block.done { background: var(--gem); }

.worlds { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
.world {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-4); text-align: left;
  background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--drop);
  transition: transform var(--fast) var(--ease);
}
.world:hover { transform: translateY(-2px); }
.world:active { transform: translateY(var(--px)); }
.world-glyph { width: 56px; height: 56px; flex: none; display: grid; place-items: center; color: var(--white); border: var(--edge); border-radius: 4px; font-size: var(--text-lg); }
.world-name { font-size: var(--text-lg); line-height: 1.15; }
.world-progress { display: flex; align-items: center; gap: var(--s-2); width: 100%; margin-top: auto; }
.world-progress .meter { flex: 1; min-width: 0; height: 10px; }
.world-count { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.world-count svg { width: 16px; height: 16px; }
.section-title { font-size: var(--text-lg); margin-bottom: calc(-1 * var(--s-2)); }
.section-title .sub { display: inline; margin-left: var(--s-2); }
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-4) var(--s-3); text-align: center;
  background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--drop);
}
@media (min-width: 700px) {
  .worlds { grid-template-columns: repeat(3, 1fr); }
}
.pick-card { display: flex; align-items: center; gap: var(--s-3); }
.pick-card > svg { width: 44px; height: auto; flex: none; }

/* Math Mine topic map ---------------------------------------------------- */
.mine-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.mine-head h1 { font-size: var(--text-xl); text-shadow: 0 3px 0 var(--white); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.tile {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-3); background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--drop);
  transition: transform var(--fast) var(--ease);
}
.tile:hover { transform: translateY(-3px); }
.tile:active { transform: translateY(var(--px)); box-shadow: none; }
.tile.mastered { background: #fff3c4; }
.tile-ore { position: relative; width: 72px; height: 72px; border: var(--edge); }
.tile-ore svg { width: 100%; height: 100%; }
.tile-glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--white); font-size: 1.35rem; text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.tile-name { font-size: var(--text-base); text-align: center; }
.tile .stars svg { width: 20px; height: 20px; }
/* Locked by the child's plan: the topic stays visible, softened, with a lock where the stars would be. */
.tile.locked .tile-ore, .tile.locked .tile-name { opacity: 0.55; }
.lock-mark { display: inline-grid; place-items: center; }
.lock-mark svg { width: 20px; height: 20px; }
.seg .lock-mark { margin-inline-start: 4px; vertical-align: -2px; }
.seg .lock-mark svg { width: 14px; height: 14px; }
.world { position: relative; }
.world > .lock-mark { position: absolute; top: var(--s-3); right: var(--s-3); }
.lock-big { display: grid; place-items: center; }
.lock-big svg { width: 72px; height: 72px; }
@media (max-width: 380px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* Shop and rewards ------------------------------------------------------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.item { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-3); background: var(--paper); border: var(--edge); border-radius: var(--radius); box-shadow: var(--drop); text-align: center; }
.item.wearing { background: var(--good-bg); }
.item-art { width: 96px; height: 84px; display: grid; place-items: center; }
.item-art svg { width: 96px; height: auto; }
.item-swatch { width: 96px; height: 68px; border: var(--edge); border-radius: 12px; background: var(--scene) left bottom / 180px 54px repeat-x, linear-gradient(to bottom, var(--sky-1), var(--sky-2)); }
.item-name { font-family: var(--font-display); font-weight: 800; }
.price { display: inline-flex; align-items: center; gap: var(--s-1); font-weight: 800; }
.price svg { width: 18px; height: 18px; }
.shop-me { display: flex; align-items: center; gap: var(--s-4); }
.shop-me svg { width: 120px; height: auto; flex: none; }

.reward-list { display: flex; flex-direction: column; gap: var(--s-3); }
.reward { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.reward-icon { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; background: var(--white); border: var(--edge); border-radius: 4px; flex: none; }
.reward-title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg); }
.meter { height: 14px; background: var(--white); border: 2px solid var(--line); border-radius: 999px; overflow: hidden; min-width: 120px; }
.meter > span { display: block; height: 100%; width: 100%; background: var(--gem); transform-origin: left; }

/* Top bar stays on one line on phones. */
.topbar { flex-wrap: nowrap; }
.topbar .who span { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn.small { min-height: 40px; padding-inline: var(--s-2); min-width: 40px; }
@media (max-width: 430px) {
  .topbar { gap: 6px; }
  .topbar .who span { display: none; }
  .topbar .pill { padding: 0 var(--s-2); gap: var(--s-1); }
}
.mine > .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 560px) { .mine > .seg { grid-template-columns: repeat(6, 1fr); } }



/* Topic pictures are soft coloured tiles. */
:root .tile-ore { border: 0; border-radius: 20px; background: var(--tile, var(--gem)); box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.12); }
:root .tile-glyph { text-shadow: 0 1px 2px rgb(0 0 0 / 0.35); }

/* Streak card: days in a row, the week at a glance, the next reward. */
.streak { display: grid; gap: var(--s-3); }
.streak-head { display: flex; align-items: center; gap: var(--s-3); }
.streak-head > svg { width: 44px; height: 44px; flex: none; }
.streak-count { font-size: var(--text-xl); line-height: 1.1; }
.streak-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.streak-day { display: grid; justify-items: center; gap: 2px; font-size: var(--text-sm); font-weight: 700; color: var(--ink-soft, #5b6275); }
.streak-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper-2); display: grid; place-items: center; color: var(--white); font-weight: 800; }
.streak-day.done .streak-dot { background: #ff9d2e; border-color: #e97c12; }
.streak-day.today .streak-dot { border: 2px dashed #e97c12; background: #fff3df; }
.streak-day.ahead { opacity: 0.6; }
.streak.celebrate .streak-head > svg { animation: streak-pop 700ms var(--ease-out-expo, ease-out) both; }
.streak.celebrate .streak-day.done:last-of-type .streak-dot, .streak.celebrate .streak-day.done .streak-dot { animation: streak-pop 500ms ease-out both; }
@keyframes streak-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

.who-card .kid-photo { width: 104px; margin: 4px 0; }

.streak-day.saved .streak-dot { background: #e6f0ff; border-color: #4a8cf0; }
.streak-dot .shield { width: 18px; height: 18px; }
.streak-savers { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--text-sm); color: var(--ink-soft, #5b6275); }
.streak-savers .shield { width: 20px; height: 20px; flex: none; }
.streak-news { margin: 0; font-weight: 700; text-align: center; }

/* Streak and today's goal: stacked on a phone, side by side on a wide screen. */
.hub-today { display: grid; gap: var(--s-4); }
@media (min-width: 760px) { .hub-today { grid-template-columns: 1.2fr 1fr; align-items: stretch; } }

/* Subject mascots. */
.mascot { display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.world .mascot { width: 84px; margin: -10px 0 -6px -8px; }
.mine-head { align-items: flex-end; flex-wrap: nowrap; }
.mine-title { display: grid; gap: var(--s-2); justify-items: start; min-width: 0; }
.mine-head .mascot { width: 112px; flex: none; margin: -28px -4px -22px 0; }

/* Badges: the shelf, the card on the home screen and the new badges on the result screen. */
.badge-disc { width: 64px; height: 64px; flex: none; display: grid; place-items: center; overflow: hidden; border: 5px solid var(--wood); border-radius: 50%; background: var(--paper); box-shadow: 0 3px 0 rgb(0 0 0 / 0.12); font-size: 1.75rem; line-height: 1; }
.badge-disc .mascot { width: 54px; margin: 6px 0 0; }
.badge-disc.pic { border: 0; background: none; box-shadow: none; overflow: visible; }
.badge-disc.pic img { width: 100%; height: 100%; display: block; }
.badge-disc.locked { filter: grayscale(1); opacity: 0.45; box-shadow: none; }
.badges section { display: grid; gap: var(--s-3); }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); list-style: none; padding: 0; margin: 0; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); text-align: center; }
.badge-name { font-size: 1.05rem; line-height: 1.2; }
.badge-how { font-size: var(--text-sm); line-height: 1.3; }
.badge-got { margin-top: auto; font-weight: 800; color: var(--go-dark); font-size: var(--text-sm); }
.badge-progress { display: flex; align-items: center; gap: var(--s-2); width: 100%; margin-top: auto; }
.badge-progress .meter { flex: 1; min-width: 0; height: 10px; }
.badge-count { font-weight: 800; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.badges-card { display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.badges-card .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.badges-row { display: flex; }
.badges-row .badge-disc { width: 44px; height: 44px; border-width: 4px; font-size: 1.2rem; margin-left: -10px; }
.badges-row .badge-disc .mascot { width: 36px; margin-top: 4px; }
.badges-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.badges-new { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-4); list-style: none; padding: 0; margin: 0 0 var(--s-3); }
.badges-new li { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); max-width: 8rem; animation: badge-pop 600ms var(--ease) both; }
@keyframes badge-pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@media (min-width: 720px) { .badge-grid { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .badges-new li { animation: none; } }
