/* Hoppy Chess: warm, round and playful. Big tap targets for small fingers. */
:root {
  --bg: #fff7ea;
  --card: #ffffff;
  --fg: #2d2a32;
  --muted: #7a7385;
  --line: #f0e3cc;
  --go: #3bb273;
  --go-dark: #2a8f5a;
  --accent: #ff9f43;
  --xp: #8b6bff;
  --star: #ffc83d;
  --bad: #ff6b6b;
  --sq-light: #f4e6cb;
  --sq-dark: #d9bd95;
  --bubble-line: #e6d4b4;
  --shadow: 0 4px 0 rgba(91, 64, 30, 0.12), 0 10px 24px rgba(91, 64, 30, 0.08);
  --round: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --text: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Always light: Hoppy, the stars and the board colours are designed for the cream background. */
:root { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--fg);
  font-family: var(--text); font-size: 1.0625rem; line-height: 1.5;
  padding: 0 max(16px, env(safe-area-inset-left)) 4rem max(16px, env(safe-area-inset-right));
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--round); font-weight: 600; line-height: 1.2; margin: 0; }
a { color: var(--xp); font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.loading { text-align: center; padding-top: 30vh; font-family: var(--round); color: var(--muted); }

main { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; padding-top: 1rem; }
main.narrow { max-width: 30rem; }

/* top bar */
.top { max-width: 34rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0 0.25rem; }
.logo { display: flex; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--fg); font-family: var(--round); font-weight: 700; font-size: 1.15rem; }
.logo svg { width: 2.4rem; height: 2.4rem; }
.me { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--fg); background: var(--card); padding: 0.35rem 0.8rem 0.35rem 0.4rem; border-radius: 999px; box-shadow: var(--shadow); min-width: 0; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text b { font-size: 0.95rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9rem; }
.me-text small { font-size: 0.72rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.xpbar { display: block; width: 7rem; height: 0.4rem; border-radius: 99px; background: var(--line); overflow: hidden; margin: 0.2rem 0 0.1rem; }
.xpbar i { display: block; height: 100%; background: var(--xp); border-radius: 99px; transition: width 0.6s; }
.avatar { display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--bg); font-size: 1.35rem; flex: none; }
.avatar.big { width: 3.6rem; height: 3.6rem; font-size: 2.1rem; }

/* mascot + speech bubble */
.talk { display: flex; align-items: flex-end; gap: 0.6rem; min-height: 5.5rem; }
/* on phones keep room for a three-line bubble, so a longer message doesn't push the board down */
@media (max-width: 600px) { .play .talk { min-height: 7.6rem; } }
.mascot { flex: none; width: 5.5rem; height: 5.5rem; }
.mascot svg, .hero-mascot svg { width: 100%; height: 100%; }
.talk.pop .mascot { animation: hop 0.5s ease; }
.bubble { position: relative; flex: 1; background: var(--card); border: 2px solid var(--bubble-line); border-radius: 1.1rem; padding: 0.8rem 1rem; font-weight: 600; font-size: 1.08rem; margin-bottom: 1rem; }
/* the tail: a turned square whose two outlined sides point at Hoppy */
.bubble::before { content: ""; position: absolute; left: -0.5rem; bottom: 1.2rem; width: 0.9rem; height: 0.9rem; background: var(--card); border: 2px solid var(--bubble-line); border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; transform: rotate(45deg); }
.talk.pop .bubble { animation: pop 0.25s ease; }
@keyframes hop { 30% { transform: translateY(-14px) rotate(-6deg); } 60% { transform: translateY(0) rotate(3deg); } }
@keyframes pop { from { transform: scale(0.94); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; font: 700 1rem var(--round); padding: 0.75rem 1.2rem; border-radius: 1rem; border: 0; cursor: pointer; text-decoration: none; background: var(--card); color: var(--fg); box-shadow: 0 4px 0 var(--line); transition: transform 0.08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn.go { background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dark); }
.btn.go:active { box-shadow: 0 1px 0 var(--go-dark); }
.btn.big { font-size: 1.2rem; padding: 1rem 1.4rem; width: 100%; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:active { transform: none; box-shadow: inset 0 0 0 2px var(--line); }
.btn:focus-visible, .choice:focus-visible, .node:focus-visible, .player:focus-visible, .avatar-pick:focus-visible { outline: 3px solid var(--xp); outline-offset: 2px; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }

.card { background: var(--card); border-radius: 1.4rem; padding: 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.8rem; }
.card h2 { font-size: 1.2rem; }

/* welcome */
.welcome { padding-top: 2rem; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.hero-mascot { width: 9rem; height: 9rem; animation: hop 1.2s ease 0.3s; }
.hero h1 { font-size: 2.4rem; font-weight: 700; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 26rem; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.7rem; }
.player { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.9rem 0.5rem; border-radius: 1.1rem; border: 2px solid var(--line); background: transparent; color: var(--fg); font: inherit; cursor: pointer; text-decoration: none; }
.player:hover { border-color: var(--xp); }
.player small { color: var(--muted); font-weight: 700; }
.player.add .avatar { color: var(--muted); }
.restore summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.restore form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.err { color: var(--bad); font-weight: 700; }
select { width: 100%; font: inherit; font-size: 1.1rem; padding: 0.7rem 0.9rem; border-radius: 0.9rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }
.field small { font-weight: 600; }
.signin { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.4rem; }
.signin form { display: flex; flex-direction: column; gap: 0.6rem; }
.btn.wide { width: 100%; }
.btn .g { font-family: Arial, sans-serif; color: #4285f4; }
input[type=email] { width: 100%; font: inherit; padding: 0.7rem 0.9rem; border-radius: 0.9rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }
.small { font-size: 0.85rem; }
details.card summary { cursor: pointer; }
.tabs { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.2rem; scrollbar-width: none; }
.tab { flex: none; padding: 0.45rem 0.9rem; border-radius: 999px; background: var(--card); color: var(--fg); text-decoration: none; font-weight: 700; font-size: 0.9rem; box-shadow: inset 0 0 0 2px var(--line); }
.tab.on { background: var(--xp); color: #fff; box-shadow: none; }
.ranks ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.ranks li { display: grid; grid-template-columns: 2.2rem auto 1fr auto; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 0.9rem; }
.ranks li:nth-child(odd) { background: var(--bg); }
.ranks li.me { background: rgba(59, 178, 115, 0.16); outline: 2px solid var(--go); }
.ranks .rank { font: 700 1.1rem var(--round); text-align: center; }
.ranks .who, .ranks .score { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ranks .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .score { text-align: right; }
.ranks small { color: var(--muted); font-weight: 700; font-size: 0.75rem; }
.nudge { text-decoration: none; color: var(--fg); font-weight: 700; padding: 0.8rem 1rem; }
textarea, input[type=text], input:not([type]) { width: 100%; font: inherit; padding: 0.7rem 0.9rem; border-radius: 0.9rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }
textarea { font-family: ui-monospace, monospace; font-size: 0.8rem; word-break: break-all; }
input:focus, textarea:focus { outline: none; border-color: var(--xp); }
.foot { text-align: center; color: var(--muted); font-size: 0.9rem; padding-top: 1rem; }

/* create player */
.field { display: flex; flex-direction: column; gap: 0.5rem; font-weight: 700; }
.field input { font-size: 1.2rem; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
.avatar-pick { aspect-ratio: 1; font-size: 1.8rem; border-radius: 1rem; border: 3px solid transparent; background: var(--bg); cursor: pointer; }
.avatar-pick.on { border-color: var(--xp); transform: scale(1.08); }

/* level check */
.choices { display: grid; gap: 0.7rem; }
.choice { display: grid; grid-template-columns: 3rem 1fr; grid-template-rows: auto auto; column-gap: 0.7rem; align-items: center; text-align: left; padding: 0.9rem 1rem; border-radius: 1.2rem; border: 0; background: var(--card); color: var(--fg); box-shadow: var(--shadow); cursor: pointer; font: inherit; }
.choice span { grid-row: span 2; font-size: 2rem; text-align: center; }
.choice b { font-family: var(--round); font-size: 1.15rem; }
.choice small { color: var(--muted); font-weight: 600; }
.choice:hover { outline: 3px solid var(--xp); }
.result { text-align: center; align-items: center; }
.rating-big { font-family: var(--round); font-size: 3rem; font-weight: 700; color: var(--accent); line-height: 1; }

/* play screen */
.play { gap: 0.8rem; }
.progress { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--muted); font-size: 0.9rem; flex-wrap: wrap; }
.dots { display: flex; gap: 0.3rem; }
.dots i { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--line); }
.dots i.ok { background: var(--go); } .dots i.no { background: var(--bad); } .dots i.now { background: var(--xp); }
.status { text-align: center; font-weight: 700; color: var(--muted); min-height: 1.5em; }
.board-wrap { display: flex; justify-content: center; position: relative; }
.promo { position: absolute; inset: 0; margin: auto; width: min(90%, 22rem); height: fit-content; z-index: 20; background: var(--card); border-radius: 1.2rem; padding: 1rem; box-shadow: var(--shadow); text-align: center; font-weight: 700; animation: pop 0.2s ease; }
.promo div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 0.6rem; }
.promo button { aspect-ratio: 1; border: 2px solid var(--line); border-radius: 0.9rem; background: var(--sq-light); cursor: pointer; padding: 6%; }
.promo button:hover, .promo button:focus-visible { border-color: var(--xp); outline: none; }
.promo img { width: 100%; height: 100%; }

/* board */
.board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: min(100%, 30rem); aspect-ratio: 1; border-radius: 0.9rem; overflow: hidden; box-shadow: 0 5px 0 #c7a679; touch-action: none; user-select: none; -webkit-user-select: none; }
.sq { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq.last::after, .sq.selected::after, .sq.hint::after, .sq.mark::after, .sq.danger::after, .sq.check::after, .sq.bad::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sq.danger::after { box-shadow: inset 0 0 0 4px var(--bad); background: rgba(255, 107, 107, 0.3); animation: pulse 1s infinite alternate; }
.sq.mark::after { box-shadow: inset 0 0 0 4px var(--go); background: rgba(59, 178, 115, 0.28); }
.sq.last::after { background: rgba(255, 214, 64, 0.42); }
.sq.selected::after { background: rgba(59, 178, 115, 0.5); }
.sq.hint::after { box-shadow: inset 0 0 0 4px var(--xp); background: rgba(139, 107, 255, 0.25); animation: pulse 1s infinite alternate; }
.sq.check::after { background: radial-gradient(circle, rgba(255, 60, 60, 0.85) 0%, rgba(255, 60, 60, 0.3) 60%, transparent 75%); }
.sq.bad::after { background: rgba(255, 80, 80, 0.55); }
.sq.target::before { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(42, 143, 90, 0.55); z-index: 2; pointer-events: none; }
.sq.capture::before { width: 86%; height: 86%; background: transparent; border: 5px solid rgba(42, 143, 90, 0.6); }
@keyframes pulse { to { background: rgba(139, 107, 255, 0.45); } }
.piece { position: absolute; left: 4%; top: 4%; width: 92%; height: 92%; z-index: 1; cursor: grab; transition: transform 0.15s; filter: drop-shadow(0 2px 0 rgba(90, 62, 28, 0.18)); }
.piece.dragging { z-index: 10; pointer-events: none; cursor: grabbing; transition: none; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
.star { position: absolute; font-size: clamp(1rem, 6vw, 2rem); animation: twinkle 1.4s infinite alternate; pointer-events: none; }
@keyframes twinkle { to { transform: scale(1.15) rotate(10deg); } }
.coord { position: absolute; font: 700 0.62rem var(--text); opacity: 0.7; pointer-events: none; }
.coord.rank { top: 2px; left: 3px; }
.coord.file { bottom: 1px; right: 4px; }
.sq.light .coord { color: #b8976b; } .sq.dark .coord { color: var(--sq-light); }
/* on phones the board runs edge to edge, as big as the screen allows */
@media (max-width: 600px) {
  .play .board-wrap:not(.small) { margin-inline: calc(-1 * max(16px, env(safe-area-inset-left))); }
  .play .board-wrap:not(.small) .board { width: 100%; border-radius: 0; box-shadow: none; }
}

/* finished card */
.done-card { animation: pop 0.3s ease; }
.done-card h3 { font-size: 1.05rem; }
.earned { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.chip { font: 700 0.95rem var(--text); padding: 0.3rem 0.8rem; border-radius: 999px; line-height: 1.3; }
.stars i { font-style: normal; color: var(--line); }
.stars i.on { color: var(--star); }
.stars.big { font-size: 2.6rem; letter-spacing: 0.1em; }
.stars.big i.on { display: inline-block; animation: starpop 0.5s backwards; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } }
.chip.xp { color: var(--xp); background: rgba(139, 107, 255, 0.14); }
.chip.rating-change { color: var(--accent); background: rgba(255, 159, 67, 0.14); }
.levelup { text-align: center; font-weight: 700; background: rgba(139, 107, 255, 0.12); border-radius: 1rem; padding: 0.6rem; }
.source { font-size: 0.85rem; color: var(--muted); text-align: center; }
.lesson { background: rgba(59, 178, 115, 0.12); border-left: 5px solid var(--go); padding: 0.7rem 0.9rem; border-radius: 0.6rem; }
.reveal { text-align: center; font-weight: 700; color: var(--muted); }
.reveal b { color: var(--fg); }

/* "find all checks" step */
.found { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; align-items: center; }
.chip.check-chip { color: var(--go-dark); background: rgba(59, 178, 115, 0.16); }
.chip.missed { color: var(--bad); background: rgba(255, 107, 107, 0.14); }

/* daily training */
.btn.train small { font: 700 0.85rem var(--text); opacity: 0.9; }
.btn.train { background: var(--xp); color: #fff; box-shadow: 0 4px 0 #6a4fd6; flex-direction: column; gap: 0.1rem; }
.btn.battle { background: var(--accent); color: #fff; box-shadow: 0 4px 0 #d27a1f; flex-direction: column; gap: 0.1rem; }
.btn.battle small { font: 700 0.85rem var(--text); opacity: 0.9; }
.btn.duo { background: var(--card); color: var(--fg); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); flex-direction: column; gap: 0.1rem; }
.btn.duo small { font: 700 0.85rem var(--text); color: var(--muted); }
.choices.row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choices.row .choice { flex: 1 1 8rem; padding: 0.7rem; }
.choice.on { outline: 3px solid var(--go); }
.moments { display: flex; flex-direction: column; gap: 0.5rem; }
.moment { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem; text-align: left; font: 700 0.95rem var(--text); color: var(--fg); background: var(--bg); border: 0; border-radius: 1rem; padding: 0.7rem 0.9rem; cursor: pointer; }
.moment small { color: var(--xp); white-space: nowrap; }
.overview { display: flex; flex-direction: column; gap: 0.6rem; }
.overview h3 { margin: 0.4rem 0 0; }
.overview ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.overview .lesson ul { list-style: disc; padding-left: 1.2rem; margin-top: 0.3rem; }
.bars li { display: grid; grid-template-columns: 1fr; gap: 0.15rem; }
.bars li.focus span:first-child { color: var(--bad); }
.bars .bar { height: 0.55rem; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bars small, .games small { color: var(--muted); font-weight: 700; }
.mission { display: flex; flex-direction: column; gap: 0.5rem; background: var(--bg); border-radius: 1rem; padding: 0.8rem 1rem; }
.mission summary { cursor: pointer; font-weight: 700; text-align: center; }
.mission p { margin: 0; }
.mission .btn { align-self: center; margin-top: 0.3rem; }
.mission ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mission li { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 700; background: var(--card); border-radius: 0.6rem; padding: 0.15rem 0.5rem 0.15rem 0.2rem; }
.mission li img { width: 1.8rem; height: 1.8rem; }

/* map */
.map { gap: 1.2rem; }
.continue { position: sticky; top: 0.5rem; z-index: 5; }
.unit { background: var(--card); border-radius: 1.4rem; padding: 1rem; box-shadow: var(--shadow); }
.unit.current { outline: 3px solid var(--go); }
.unit.locked { opacity: 0.55; }
.unit-head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; }
.unit-emoji { font-size: 2rem; }
.unit-head small { color: var(--muted); font-weight: 700; }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: 0.6rem; }
.node { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.6rem 0.3rem; border-radius: 1rem; background: var(--bg); text-decoration: none; color: var(--fg); text-align: center; }
a.node:hover { outline: 2px solid var(--xp); }
.node .num { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--line); font: 700 1.1rem var(--round); }
.node.done .num { background: var(--go); color: #fff; }
.node.next .num { background: var(--accent); color: #fff; animation: pulse-node 1.2s infinite alternate; }
@keyframes pulse-node { to { transform: scale(1.12); } }
.node .name { font-size: 0.8rem; font-weight: 700; line-height: 1.2; }
.node .stars { font-size: 0.85rem; }

/* profile */
.profile-head { display: flex; align-items: center; gap: 0.9rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; text-align: center; }
.stats div { background: var(--bg); border-radius: 1rem; padding: 0.6rem 0.2rem; display: flex; flex-direction: column; }
.stats b { font-family: var(--round); font-size: 1.15rem; }
.stats small { color: var(--muted); font-weight: 700; font-size: 0.75rem; }
.spark { color: var(--xp); }
.spark svg { width: 100%; height: 4rem; display: block; }
.spark small { color: var(--muted); font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.toggle input { width: 1.3rem; height: 1.3rem; accent-color: var(--go); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }

@media (max-width: 420px) {
  .me-text small { display: none; }
  .logo span { display: none; }
  .mascot { width: 4.4rem; height: 4.4rem; }
  .avatars { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- voice: tap Hoppy or the speaker to hear it again ---------- */
button.mascot { border: 0; padding: 0; background: none; cursor: pointer; }
.bubble .speak { float: right; margin: -0.3rem -0.4rem 0 0.4rem; border: 0; background: none; font-size: 1.1rem; cursor: pointer; opacity: 0.6; }
.bubble .speak:hover { opacity: 1; }

/* ---------- picture cues above the board ---------- */
.goal { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.goal .chip { background: var(--card); box-shadow: inset 0 0 0 2px var(--line); display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.goal .side img { width: 1.3rem; height: 1.3rem; }

/* ---------- hint arrow ---------- */
.board { position: relative; }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; color: rgba(139, 107, 255, 0.85); }
.arrows line { stroke: currentColor; stroke-width: 0.2; stroke-linecap: round; animation: pulse-arrow 1s infinite alternate; }
@keyframes pulse-arrow { to { opacity: 0.55; } }

/* ---------- shorter done card ---------- */
.why summary { cursor: pointer; font-weight: 700; color: var(--xp); }
.why p { margin-top: 0.5rem; }

/* ---------- map: daily card, quick links, unit chips, teasers ---------- */
.daily { flex-direction: row; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--fg); padding: 0.9rem 1rem; outline: 3px solid var(--accent); }
.daily.done { outline-color: var(--go); opacity: 0.85; }
.daily-icon { font-size: 2rem; }
.daily-text { display: flex; flex-direction: column; flex: 1; }
.daily-text b { font-family: var(--round); font-size: 1.15rem; }
.daily-text small { color: var(--muted); font-weight: 700; }
.streak { font: 700 1.3rem var(--round); color: var(--accent); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.quick .btn:only-child { grid-column: span 2; }
.unit-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.unit-chip { background: var(--card); color: var(--fg); text-decoration: none; box-shadow: inset 0 0 0 2px var(--line); }
.unit-chip.all { color: var(--go-dark); }
.unit.teaser { padding: 0.8rem 1rem; opacity: 0.7; }
.unit.teaser .unit-head { margin: 0; }

/* ---------- award toast ---------- */
.toast { position: fixed; left: 0; right: 0; margin: 0 auto; bottom: 1rem; width: min(92vw, 26rem); z-index: 60; background: var(--card); border-radius: 1.2rem; padding: 1rem 1.1rem; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); outline: 3px solid var(--star); animation: pop 0.3s ease; display: flex; flex-direction: column; gap: 0.6rem; }
.toast p { margin: 0; }
.toast .sticker { font-size: 1.8rem; vertical-align: middle; }
.toast small { color: var(--muted); font-weight: 700; }

/* ---------- rewards ---------- */
.hats { display: grid; grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); gap: 0.6rem; }
.hat-pick { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.4rem; border-radius: 1rem; border: 3px solid transparent; background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; text-align: center; }
.hat-pick svg { width: 4.5rem; height: 4.5rem; }
.hat-pick.on { border-color: var(--xp); }
.hat-pick small, .swatch small { font-size: 0.72rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
.locked { cursor: default; }
.hat-pick.locked svg { filter: grayscale(1) opacity(0.35); }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.5rem; border-radius: 1rem; border: 3px solid transparent; background: var(--bg); font: inherit; color: var(--fg); cursor: pointer; text-align: center; }
.swatch.on { border-color: var(--xp); }
.swatch.locked .mini { filter: grayscale(1) opacity(0.4); }
.mini { display: grid; grid-template-columns: 1fr 1fr; width: 3rem; height: 3rem; border-radius: 0.5rem; overflow: hidden; }
.mini i:nth-child(1), .mini i:nth-child(4) { background: var(--l); }
.mini i:nth-child(2), .mini i:nth-child(3) { background: var(--d); }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem; }
.sticker-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.2rem; padding: 0.7rem 0.4rem; border-radius: 1rem; background: var(--bg); }
.sticker-card .sticker { font-size: 2.2rem; line-height: 1.1; }
.sticker-card b { font-size: 0.85rem; }
.sticker-card small { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.sticker-card.locked .sticker { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--line); color: var(--muted); font: 700 1.3rem var(--round); }
.sticker-card.locked b { color: var(--muted); }

/* ---------- groups ---------- */
.tabs.big .tab { font-size: 1rem; padding: 0.6rem 1.1rem; }
.row-form { display: flex; gap: 0.5rem; }
.row-form input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 0.7rem 0.9rem; border-radius: 0.9rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }
.row-form input[name=code] { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; }
.code { font: 700 1.3rem var(--round); letter-spacing: 0.15em; color: var(--xp); }
.invite { text-align: center; }

/* ---------- diploma (also printable) ---------- */
.diploma { position: relative; background: #fffdf7; color: #2d2a32; border-radius: 1.2rem; padding: 2rem 1.5rem; text-align: center; border: 10px double #d9b46a; box-shadow: var(--shadow); }
.diploma-mascot { width: 7rem; height: 7rem; margin: 0 auto; }
.diploma-mascot svg { width: 100%; height: 100%; }
.diploma-kicker { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; font-size: 0.8rem; color: #a07a2c; margin-top: 0.5rem; }
.diploma h1 { font-size: 2.6rem; font-weight: 700; margin: 0.4rem 0; }
.diploma-line { font-size: 1.1rem; }
.diploma-title { font: 700 2rem var(--round); color: #7c5cff; margin: 0.2rem 0 1rem; }
.diploma-stats { display: flex; gap: 0.6rem 1.2rem; justify-content: center; flex-wrap: wrap; font-size: 1rem; }
.diploma-stickers { font-size: 1.8rem; margin-top: 0.8rem; letter-spacing: 0.1em; }
.diploma-sign { display: flex; justify-content: space-between; margin-top: 1.6rem; padding-top: 0.6rem; border-top: 1px solid #e8dcc0; font-size: 0.95rem; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; padding: 0; }
  .top, .noprint, .toast, .confetti { display: none !important; }
  main { max-width: none; padding: 0; }
  .diploma { box-shadow: none; min-height: 170mm; display: flex; flex-direction: column; justify-content: center; }
}

/* ---------- simpler home: one Play button + a bottom icon bar ---------- */
body { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.play-big { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1.2rem 1.4rem; width: 100%; text-align: left; }
.play-icon { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; background: rgba(255, 255, 255, 0.22); font-size: 1.7rem; padding-left: 0.25rem; }
.play-text { display: flex; flex-direction: column; }
.play-text b { font-size: 2rem; line-height: 1; }
.play-text small { font: 600 1rem var(--text); opacity: 0.95; margin-top: 0.3rem; }
.home .unit { opacity: 0.95; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: center; gap: 0.2rem; padding: 0.4rem max(8px, env(safe-area-inset-left)) calc(0.4rem + env(safe-area-inset-bottom)); background: var(--card); box-shadow: 0 -4px 20px rgba(91, 64, 30, 0.12); }
.tab-item { flex: 1; max-width: 6.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.35rem 0.2rem; border-radius: 1rem; text-decoration: none; color: var(--muted); font-weight: 800; font-size: 0.75rem; }
.tab-item.on { color: var(--xp); background: rgba(139, 107, 255, 0.12); }
.tab-icon { position: relative; font-size: 1.6rem; line-height: 1.1; }
.new-dot { position: absolute; top: 0; right: -0.3rem; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--card); animation: pulse-node 1s infinite alternate; }
.toast { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }

/* ---------- calmer play screen ---------- */
.btn.icon { flex-direction: column; gap: 0; padding: 0.4rem 0.9rem; min-width: 4.4rem; }
.btn.icon span { font-size: 1.4rem; line-height: 1.1; }
.btn.icon small { font-size: 0.72rem; font-weight: 800; }
.done-actions { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.done-actions > .btn.go { width: 100%; }
.small-actions { display: flex; gap: 0.6rem; justify-content: center; }
.grownups .gate { display: flex; flex-direction: column; gap: 0.6rem; }
.grownups .gate input { font-size: 1.2rem; }

/* ---------- welcome: one big start button, everything else small and further down ---------- */
.welcome { padding-top: 0; gap: 0; }
.welcome-first { min-height: calc(100svh - 7rem); display: flex; flex-direction: column; justify-content: center; gap: 2rem; padding: 2rem 0 1rem; }
.welcome .lead { font-size: 1.3rem; }
.play-big.start { padding: 1.4rem; }
.play-big.start .play-text b { font-size: 1.8rem; }
.welcome-more { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-top: 1rem; }
.welcome-more .restore { width: 100%; text-align: center; }
.welcome-more .restore summary { list-style: none; display: inline-block; padding: 0.4rem 0.8rem; font-size: 0.95rem; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 0.25em; }
.welcome-more .restore summary::-webkit-details-marker { display: none; }
.welcome-more .restore[open] { background: var(--card); border-radius: 1.2rem; padding: 0.8rem 1rem 1rem; box-shadow: var(--shadow); text-align: left; }
.welcome-more .restore[open] summary { display: block; text-align: center; }
.welcome .foot { margin-top: 2rem; font-size: 0.8rem; }

/* ---------- language switcher ---------- */
.lang-switch { text-align: right; margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted); }
.card .lang-switch { text-align: center; }
.lang-switch button { border: 0; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; padding: 0.2rem 0.3rem; }
.lang-switch button.on { color: var(--xp); text-decoration: underline; text-underline-offset: 0.25em; }
.code-form { display: flex; flex-direction: column; gap: 0.6rem; }
.code-form input { font: 700 1.6rem var(--round); letter-spacing: 0.3em; text-align: center; padding: 0.6rem; border-radius: 0.9rem; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }

/* feedback to the author (grown-ups section) */
.feedback { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.8rem; }
.feedback textarea { font-family: inherit; font-size: 1rem; word-break: normal; resize: vertical; }
.feedback .btn { align-self: flex-start; }
.ok-msg { color: var(--go); font-weight: 700; }
#feedback { margin: 1rem 0; }
#feedback summary { cursor: pointer; }

/* no "Save to Photos / Copy" menu when a child's finger rests on a piece, a picture or a button (iPad, iPhone) */
img, svg, .board, .mascot, button, .btn, .tabbar a { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* lesson packs: the progress bar, quick tasks, the summary */
.packbar { display: inline-flex; gap: 0.3rem; width: min(15rem, 52vw); }
.packbar i, .pack-score i { flex: 1; height: 0.75rem; border-radius: 999px; background: var(--line); }
.packbar i.ok, .pack-score i.ok { background: var(--go); }
.packbar i.oops, .pack-score i.oops { background: var(--accent); }
.packbar i.now { background: var(--xp); animation: pulse 1s infinite alternate; }
.pack-fix { color: var(--accent); }
.btn.yn { font-size: 1.3rem; min-width: 8.5rem; padding: 0.9rem 1.4rem; }
.btn.yn.no { background: var(--accent); color: #fff; box-shadow: 0 4px 0 #d27a1f; }
.pack-score { display: flex; gap: 0.4rem; width: min(16rem, 80%); margin: 0.4rem auto; }
.pack-score i { height: 1rem; }
.pack-done .chips { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.chip.stars-chip { color: #b7860b; background: rgba(255, 200, 61, 0.2); }
.chip.fixed { color: var(--go-dark); background: rgba(59, 178, 115, 0.16); }
.learned { text-align: left; width: 100%; }
.learned ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }

/* first run: board first, five-star path, who plays, buddy and age without typing */
.start-run .progress .lang-switch { margin: 0; }
.starpath { display: flex; justify-content: center; gap: 0.5rem; font-size: 2rem; line-height: 1; }
.starpath i { font-style: normal; color: var(--line); transition: color 0.3s, transform 0.3s; }
.starpath i.on { color: var(--star); transform: scale(1.15); animation: pop 0.4s ease; }
.choices.who .choice span { font-size: 2.4rem; }
.ages { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.age { flex: 1 1 3rem; font: 700 1.3rem var(--round); padding: 0.6rem 0; border-radius: 1rem; border: 3px solid transparent; background: var(--bg); color: var(--fg); cursor: pointer; }
.age.on { border-color: var(--xp); }
.piece-row { display: flex; justify-content: center; gap: 0.3rem; }
.piece-row img { width: 2.6rem; height: 2.6rem; }
.place { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; font-family: var(--round); font-size: 1.5rem; }
.place span { font-size: 3rem; }
/* home: "Play together" as big as "Play" */
.btn.play-big.together { background: var(--xp); color: #fff; box-shadow: 0 4px 0 #6a4fd6; }
.btn.play-big.together .play-icon { font-size: 1.6rem; padding-left: 0; }
/* parents */
.parents h1 { font-size: 1.8rem; }
.parents .lead { color: var(--fg); font-size: 1.1rem; }
.parents ul, .parents ol { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.parents .trust { list-style: none; padding-left: 0; }
.parent-card { display: flex; gap: 0.8rem; align-items: center; text-decoration: none; color: var(--fg); border: 2px dashed var(--xp); }
.parent-card > span:first-child { font-size: 2rem; }
.parent-card small { display: block; color: var(--muted); font-weight: 600; }

/* skills on the lesson map: ○ new, ◐ learning or shaky, ● mastered */
.skill-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.25rem 0; }
.skill { font: 700 0.75rem var(--text); padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg); color: var(--muted); }
.skill.learning, .skill.shaky { color: var(--accent); background: rgba(255, 159, 67, 0.12); }
.skill.mastered { color: var(--go-dark); background: rgba(59, 178, 115, 0.16); }

/* training session: the game at the end of the bar, reflection, tomorrow, card for a grown-up */
.packbar i.game { flex: 0 0 auto; height: auto; background: none; font-style: normal; font-size: 0.8rem; line-height: 0.75rem; opacity: 0.5; }
.packbar i.game.now { opacity: 1; animation: pulse 1s infinite alternate; }
.choices.reflect .choice span { font-size: 2.2rem; }
.choice.no { outline: 3px solid var(--accent); }
.choice:disabled { cursor: default; }
.tomorrow { font-family: var(--round); font-size: 1.05rem; }
.grownup-card summary { cursor: pointer; font-size: 1.05rem; }
.grownup-card p { margin: 0.5rem 0 0; }

/* play together: a question card for the grown-up; missions at home */
.coach-card { background: var(--card); border: 2px dashed var(--xp); border-radius: 1rem; padding: 0.6rem 0.9rem; font-size: 0.95rem; }
.mission-card { display: flex; gap: 0.8rem; align-items: center; text-decoration: none; color: var(--fg); border: 2px solid var(--accent); }
.mission-card > span:first-child { font-size: 2rem; }
.mission-card small { display: block; color: var(--muted); font-weight: 600; }
.board-wrap.small { max-width: 16rem; margin: 0 auto; }
