/* Rapido Kids - one stylesheet for the whole site. Mobile first. */
:root {
  --bg: #fff8ee; --ink: #2b2a4c; --ink2: #5b5a7e; --brand: #ff6b35; --brand-d: #e5521c;
  --teal: #18a999; --sun: #ffc93c; --sky: #4cc9f0; --berry: #e85d9b; --grass: #6bc46d; --violet: #7c5cff;
  --card: #ffffff; --line: #eadfce; --r: 22px;
  --shadow: 0 5px 0 rgba(43, 42, 76, .14), 0 14px 26px rgba(43, 42, 76, .08);
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.5; font-size: 17px; -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(circle at 12% 8%, #ffe9c9 0, transparent 38%), radial-gradient(circle at 92% 2%, #d9f3ff 0, transparent 34%);
  background-repeat: no-repeat;
}
img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 900; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 6.2vw, 3.6rem); }
h2 { font-size: clamp(1.45rem, 4vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: 10px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 4px solid var(--violet); outline-offset: 3px; border-radius: 12px; }
[hidden] { display: none !important; }

/* ---------- header / footer ---------- */
.site-head { padding: 12px 0; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 1.35rem; }
.logo svg { width: 44px; height: 44px; flex: none; }
.logo small { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); line-height: 1; margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.nav a.link { white-space: nowrap; }
.nav .chip { white-space: nowrap; }
.nav a.link { text-decoration: none; font-weight: 800; padding: 10px 12px; border-radius: 999px; }
.nav a.link:hover { background: rgba(43, 42, 76, .07); }
.site-foot { margin-top: 56px; padding: 32px 0 40px; background: var(--ink); color: #fff; }
.site-foot a { color: #fff; }
.promises { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.promises li { background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: .95rem; }
.site-foot p { margin: 0 0 8px; color: #d8d6f0; font-size: .95rem; }
.site-foot nav a { margin-right: 14px; display: inline-block; padding: 4px 0; }

/* ---------- buttons, chips ---------- */
.btn {
  font: inherit; font-weight: 900; color: var(--ink); background: #fff; border: 3px solid var(--ink);
  border-radius: 999px; padding: .55em 1.2em; min-height: 48px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s; touch-action: manipulation; user-select: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.teal { background: var(--teal); color: #fff; }
.btn.big { font-size: 1.15rem; padding: .7em 1.6em; min-height: 56px; }
.btn.small { min-height: 40px; padding: .3em .9em; font-size: .95rem; box-shadow: 0 3px 0 var(--ink); }
.btn[disabled] { opacity: .45; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-weight: 800; border: 3px solid var(--ink); background: #fff; color: var(--ink);
  border-radius: 999px; padding: .35em 1em; min-height: 44px; cursor: pointer; touch-action: manipulation;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: .2em .9em; font-weight: 900; min-height: 40px; }
.pill.small { font-size: .85rem; font-weight: 800; color: var(--ink2); border-color: var(--line); }

/* ---------- hero ---------- */
.hero { padding: 12px 0 8px; }
.hero .wrap { display: grid; gap: 18px; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--ink2); max-width: 36em; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero-art { justify-self: center; width: min(300px, 70%); }
.who { margin-top: 18px; }
.who h2 { font-size: 1.1rem; margin-bottom: 10px; }
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who a.a3 { background: #e8e1ff; }
.who a.a3 { grid-column: 1 / -1; }
.who a {
  display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  background: #fff; border: 4px solid var(--ink); border-radius: 26px; padding: 14px 8px; box-shadow: var(--shadow); font-weight: 900;
  transition: transform .12s;
}
.who a:hover { transform: translateY(-3px) rotate(-1deg); }
.who a .big { font-size: 2.6rem; line-height: 1.1; }
.who a span.sub { font-weight: 700; color: var(--ink2); font-size: .85rem; }
.who a.a1 { background: #dff6f2; }
.who a.a2 { background: #ffe6d9; }

/* ---------- game cards ---------- */
.section { padding: 28px 0 4px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { margin: 0; color: var(--ink2); }
.filters { display: grid; gap: 10px; margin: 6px 0 18px; }
.filters .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters .row > b { min-width: 5.5em; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.gcard { display: block; text-decoration: none; background: #fff; border: 4px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); height: 100%; transition: transform .12s; }
.gcard:hover { transform: translateY(-4px); }
.gcard .tile { display: grid; place-items: center; aspect-ratio: 16 / 10; font-size: clamp(2.6rem, 11vw, 4.2rem); border-bottom: 4px solid var(--ink); background: var(--c, #ffe6d9); position: relative; }
.gcard .tile .age { position: absolute; top: 8px; left: 8px; font-size: .72rem; font-weight: 900; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 0 .6em; line-height: 1.5; }
.gcard .body { padding: 10px 12px 12px; }
.gcard h3 { margin: 0 0 2px; font-size: 1.05rem; }
.gcard p { margin: 0 0 6px; font-size: .88rem; color: var(--ink2); line-height: 1.35; }
.gcard .st { font-size: 1.1rem; letter-spacing: .12em; color: #c9c3b5; }
.gcard .st.has { color: #f5a300; }
.empty { text-align: center; color: var(--ink2); padding: 20px; }

/* ---------- content blocks ---------- */
.panel-list { display: grid; gap: 14px; margin: 16px 0; }
.info { background: #fff; border: 4px solid var(--ink); border-radius: 24px; padding: 18px; box-shadow: var(--shadow); }
.info h3 { display: flex; gap: 10px; align-items: center; }
.info p:last-child { margin-bottom: 0; }
.faq details { background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 900; cursor: pointer; min-height: 32px; }
.faq details p { margin: 8px 0 0; color: var(--ink2); }
.prose { max-width: 46em; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.crumbs { font-weight: 800; margin: 6px 0 10px; font-size: .95rem; }
.crumbs a { color: var(--ink2); }

/* ---------- game page ---------- */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.game-top h1 { font-size: clamp(1.5rem, 5vw, 2.3rem); margin: 0; display: flex; align-items: center; gap: 10px; }
.game-top .acts { display: flex; gap: 8px; }
.stage-wrap { position: relative; border: 4px solid var(--ink); border-radius: 28px; background: #fffdf7; overflow: hidden; box-shadow: var(--shadow); touch-action: manipulation; }
.stage { position: relative; height: clamp(440px, calc(100vh - 210px), 800px); }
@supports (height: 100dvh) { .stage { height: clamp(440px, calc(100dvh - 210px), 800px); } }
.loading { display: grid; place-items: center; height: 100%; font-weight: 900; color: var(--ink2); font-size: 1.2rem; }
.below { margin-top: 26px; display: grid; gap: 14px; }
.below ol { margin: 0; padding-left: 1.3em; }
.below li { margin: 4px 0; }

.overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(255, 248, 238, .95); overflow: auto; }
.overlay .panel { width: min(520px, 100%); text-align: center; background: #fff; border: 4px solid var(--ink); border-radius: 28px; padding: 20px 18px; box-shadow: var(--shadow); margin: auto; animation: pop-in .35s cubic-bezier(.3, 1.5, .5, 1); }
.overlay .panel ol { text-align: left; font-size: 1.05rem; padding-left: 1.4em; margin: 0 0 16px; }
.overlay .panel li { margin: 6px 0; }
.overlay .panel .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.mascot { font-size: 3.6rem; line-height: 1; margin-bottom: 4px; animation: bob 2.2s ease-in-out infinite; }
.bigstars { font-size: clamp(2.6rem, 14vw, 4.2rem); line-height: 1; letter-spacing: .04em; }
.bigstar { display: inline-block; color: #ddd5c4; opacity: 0; animation: star-in .5s forwards; }
.bigstar.on { color: #ffb400; text-shadow: 0 3px 0 #c98600; }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 40; width: 100%; height: 100%; }
.toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 35; background: var(--ink); color: #fff; font-weight: 900; padding: .5em 1.2em; border-radius: 999px; transition: opacity .35s; max-width: 90%; text-align: center; pointer-events: none; }
.toast.out { opacity: 0; }
.toast.top { bottom: auto; top: 74px; }
.err { padding: 24px; text-align: center; font-weight: 800; }

@keyframes pop-in { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes star-in { 0% { transform: scale(.2) rotate(-40deg); opacity: 0; } 70% { transform: scale(1.25) rotate(8deg); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(5px); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.shake { animation: shake .4s; }
.wobble { animation: wobble .4s; }

/* ---------- shared game layout ---------- */
.g { display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-weight: 900; border: 0; background: transparent; color: var(--ink); padding: .3em .95em; min-height: 40px; cursor: pointer; }
.seg button + button { border-left: 3px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.area { flex: 1; min-height: 0; position: relative; padding: 8px 12px 14px; }
.grid-center { display: grid; justify-content: center; align-content: center; width: 100%; height: 100%; }

/* memory match */
.mm-card { perspective: 700px; border: 0; padding: 0; background: none; cursor: pointer; touch-action: manipulation; font-size: calc(var(--cell, 90px) * .52); }
.mm-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mm-card.flip .mm-in, .mm-card.done .mm-in { transform: rotateY(180deg); }
.mm-face { position: absolute; inset: 0; display: grid; place-items: center; border: 4px solid var(--ink); border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.mm-back { background: repeating-linear-gradient(45deg, #ffb48f 0 10px, #ff9b6b 10px 20px); color: #fff; font-size: .55em; font-weight: 900; }
.mm-front { background: #fff; transform: rotateY(180deg); }
.mm-card.done .mm-front { background: #e4fbe6; border-color: var(--teal); }
.mm-card.done .mm-in { animation: pulse .5s; }

/* number pop */
.np-area { position: relative; flex: 1; min-height: 0; margin: 4px 10px 12px; border-radius: 22px; background: linear-gradient(#dff4ff, #f4fbff); overflow: hidden; }
.np-bubble {
  position: absolute; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .85); color: #fff; font-family: var(--font); font-weight: 900;
  cursor: pointer; display: grid; place-items: center; touch-action: manipulation;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .85) 0 12%, transparent 13%), var(--bc, #4cc9f0);
  box-shadow: inset -6px -8px 0 rgba(0, 0, 0, .12), 0 6px 14px rgba(43, 42, 76, .15);
  animation: float 3.2s ease-in-out infinite; text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.np-bubble.popped { animation: popped .35s forwards; pointer-events: none; }
@keyframes popped { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.35); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }

/* shape sorter */
.ss-area { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 12px 12px; gap: 10px; }
.ss-board, .ss-tray { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: var(--sg, 14px); border-radius: 22px; padding: 10px; }
.ss-board { background: #e9e4f7; border: 4px dashed #b9afe0; }
.ss-tray { background: #fff3da; border: 4px solid #f1d9a6; }
.ss-hole, .ss-piece { width: var(--ss, 90px); height: var(--ss, 90px); }
.ss-hole { display: grid; place-items: center; border-radius: 18px; background: #cfc7ee; position: relative; }
.ss-hole svg { width: 82%; height: 82%; fill: #aaa1d8; }
.ss-hole.filled svg { fill: var(--sc); }
.ss-hole.filled { animation: pulse .4s; }
.ss-piece { position: relative; touch-action: none; cursor: grab; display: grid; place-items: center; user-select: none; -webkit-user-select: none; }
.ss-piece svg { width: 86%; height: 86%; fill: var(--sc); stroke: rgba(43, 42, 76, .55); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 5px 0 rgba(43, 42, 76, .18)); pointer-events: none; }
.ss-piece.drag { z-index: 50; cursor: grabbing; }
.ss-piece.drag svg { filter: drop-shadow(0 12px 8px rgba(43, 42, 76, .25)); }
.ss-piece.back { transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.ss-piece.placed { visibility: hidden; }

/* tracing */
.tr-board { flex: 1; min-height: 0; position: relative; margin: 0 12px; border: 4px solid var(--ink); border-radius: 24px; background: #fff; background-image: linear-gradient(transparent 49.5%, #f3d9d9 49.5% 50.5%, transparent 50.5%); overflow: hidden; }
.tr-host { position: absolute; inset: 0; }
.tr-canvas { display: block; touch-action: none; cursor: crosshair; }
.tr-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 4px; }
.tr-word { flex: 1; text-align: center; font-weight: 900; font-size: clamp(1.05rem, 3.6vw, 1.7rem); min-height: 2.2em; display: flex; align-items: center; justify-content: center; gap: 10px; }
.tr-word .em { font-size: 1.9em; line-height: 1; animation: pop-in .4s cubic-bezier(.3, 1.5, .5, 1); }
.progress { height: 12px; margin: 6px 14px 12px; border-radius: 999px; background: #eee6d6; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 999px; transition: width .15s; }
.pick { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.pick button { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 3px solid var(--ink); background: #fff; font: inherit; font-weight: 900; cursor: pointer; position: relative; }
.pick button.on { background: var(--sun); }
.pick button.ok::after { content: "\2713"; position: absolute; right: -4px; top: -8px; font-size: .75rem; background: var(--grass); color: #fff; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; border: 2px solid #fff; }
.next-pulse { animation: pulse 1s infinite; }
.count-area { flex: 1; min-height: 0; margin: 0 12px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; padding: 8px; border: 4px solid var(--ink); border-radius: 24px; background: #fff; }
.count-item { font-size: clamp(2.2rem, 10vw, 4rem); line-height: 1; width: 1.5em; height: 1.5em; border: 3px dashed #d8cfba; border-radius: 18px; background: #fffdf5; cursor: pointer; display: grid; place-items: center; position: relative; touch-action: manipulation; }
.count-item.counted { border-style: solid; border-color: var(--teal); background: #e4fbe6; }
.count-item .n { position: absolute; right: -6px; bottom: -8px; background: var(--teal); color: #fff; font-size: .3em; font-weight: 900; width: 1.7em; height: 1.7em; border-radius: 50%; display: none; place-items: center; border: 3px solid #fff; }
.count-item.counted .n { display: grid; }

/* clock friends */
.cf-clock { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 12px; }
.cf-clock svg { height: 100%; max-height: 360px; width: auto; max-width: 100%; aspect-ratio: 1; filter: drop-shadow(0 6px 0 rgba(43, 42, 76, .12)); }
.cf-choices { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 10px; padding: 8px 12px 14px; }
.cf-choices .btn { font-size: clamp(1.3rem, 5vw, 2rem); min-height: 62px; padding-inline: .4em; }
.cf-choices .btn.right { background: var(--grass); color: #fff; border-color: var(--ink); }
.cf-hint { text-align: center; font-weight: 800; color: var(--ink2); font-size: .9rem; padding: 0 12px; }
.cf-hint b.h { color: var(--brand); } .cf-hint b.m { color: var(--teal); }

/* word garden */
.wg-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 4px 12px; }
.wg-pic { font-size: clamp(4rem, 20vw, 7.5rem); line-height: 1; }
.wg-pic.hop { animation: bob .6s 2; }
.wg-slots, .wg-tiles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.wg-slot, .wg-tile { width: clamp(46px, 13vw, 70px); height: clamp(52px, 15vw, 78px); border-radius: 16px; border: 4px solid var(--ink); display: grid; place-items: center; font: inherit; font-weight: 900; font-size: clamp(1.6rem, 6vw, 2.4rem); }
.wg-slot { background: #fff; border-style: dashed; color: var(--teal); }
.wg-slot.on { border-style: solid; background: #e4fbe6; }
.wg-tile { background: var(--sun); cursor: pointer; box-shadow: 0 5px 0 var(--ink); touch-action: manipulation; }
.wg-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.wg-tile.used { visibility: hidden; }
.wg-garden { display: flex; justify-content: center; gap: 6px; padding: 8px 10px 12px; background: linear-gradient(#e7f8d9, #bde89b); border-top: 4px solid var(--ink); font-size: clamp(1.7rem, 7vw, 2.6rem); line-height: 1.2; }
.wg-garden span { width: 1.3em; text-align: center; display: inline-block; }
.wg-garden span.grow { animation: pop-in .6s cubic-bezier(.3, 1.6, .5, 1); }

/* rhythm tap */
.rt-area { position: relative; flex: 1; min-height: 0; padding: 8px 12px 14px; }
.rt-grid { display: grid; justify-content: center; align-content: center; width: 100%; height: 100%; }
.rt-pad { border-radius: 50%; border: 5px solid var(--ink); background: var(--pc); cursor: pointer; box-shadow: inset -10px -12px 0 rgba(0, 0, 0, .14), 0 7px 0 var(--ink); position: relative; font-size: 0; transition: transform .08s, filter .08s; touch-action: manipulation; }
.rt-pad::after { content: attr(data-k); position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; color: rgba(255, 255, 255, .85); }
.rt-pad.lit { filter: brightness(1.35) saturate(1.2); transform: scale(1.07); box-shadow: 0 0 0 8px rgba(255, 255, 255, .8), 0 0 34px 12px var(--pc); }
.rt-pad:disabled { cursor: default; }

/* sky hopper */
.sh-hud { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.sh-box { flex: 1; min-height: 0; display: grid; place-items: center; background: linear-gradient(#8fd6ff, #e8f8ff); touch-action: none; user-select: none; -webkit-user-select: none; }
.sh-box canvas { display: block; touch-action: none; border-radius: 12px; }

.fd-foot { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 10px; border-top: 3px solid var(--line); background: #fffdf7; }
.fd-note { font-size: .8rem; font-weight: 800; color: var(--ink2); }

/* ---------- ages 9-12 games ---------- */
.sn-area { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; touch-action: none; user-select: none; -webkit-user-select: none; }
.sn-area canvas { display: block; border-radius: 14px; border: 3px solid var(--ink); touch-action: none; }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-areas: ". u ." "l . r" ". d ."; gap: 6px; justify-content: center; padding: 6px 0 12px; }
.dpad button { font: inherit; font-size: 1.2rem; width: 56px; height: 48px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; }
.dpad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.dpad [data-d="U"] { grid-area: u; } .dpad [data-d="L"] { grid-area: l; } .dpad [data-d="R"] { grid-area: r; } .dpad [data-d="D"] { grid-area: d; }
@media (min-width: 900px) and (pointer: fine) { .dpad { display: none; } }
@media (max-height: 520px) and (orientation: landscape) { .dpad { position: absolute; right: 8px; bottom: 8px; padding: 0; transform: scale(.8); transform-origin: right bottom; } }

.hg-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 4px 12px; text-align: center; }
.hg-art { width: min(300px, 70vw); max-height: 30vh; height: auto; overflow: visible; }
.hg-b { transition: transform .35s, opacity .35s; transform-box: fill-box; transform-origin: center; }
.hg-b.gone { transform: translateY(-40px) scale(.2); opacity: 0; }
#hgbunny { transition: y .4s; }
.hg-info { font-weight: 800; color: var(--ink2); min-height: 1.4em; }
.hg-word { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hg-l { width: 34px; height: 42px; display: grid; place-items: center; border-bottom: 4px solid var(--ink); font-weight: 900; font-size: 1.5rem; color: var(--ink); background: #fff; border-radius: 8px 8px 0 0; }
.hg-l.miss { color: #e5484d; }
.hg-keys { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; padding: 8px 10px 14px; max-width: 520px; width: 100%; margin: 0 auto; }
.hg-key { font: inherit; font-weight: 900; min-height: 40px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.hg-key.right { background: #b7ecc0; } .hg-key.wrong { background: #ffd0cc; opacity: .6; } .hg-key:disabled { cursor: default; }
@media (max-width: 420px) { .hg-keys { grid-template-columns: repeat(7, 1fr); } .hg-l { width: 28px; height: 38px; font-size: 1.25rem; } }
@media (max-height: 560px) { .hg-art { max-height: 22vh; } .hg-key { min-height: 34px; } }

.mc-main { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; text-align: center; }
.mc-q { font-size: clamp(2rem, 8vw, 3.4rem); font-weight: 900; color: var(--ink); }
.mc-ans { min-width: 150px; min-height: 64px; padding: 4px 22px; display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; background: #fff; border: 4px solid var(--ink); border-radius: 18px; white-space: pre; }
.mc-ans.empty { color: transparent; }
.mc-ans.good { background: #b7ecc0; }
.mc-ans.shake { animation: mcshake .4s; }
@keyframes mcshake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.mc-msg { min-height: 1.5em; font-weight: 800; color: var(--ink2); }
.mc-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 320px; width: 100%; margin: 0 auto; padding: 6px 12px 14px; }
.mc-key { font: inherit; font-size: 1.5rem; font-weight: 900; min-height: 52px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; }
.mc-key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.mc-key.ok { background: var(--teal, #18a999); color: #fff; }
@media (max-height: 640px) { .mc-key { min-height: 42px; font-size: 1.2rem; } .mc-ans { min-height: 50px; font-size: 1.9rem; } .mc-pad { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { .mc-ans.shake { animation: none; } .hg-b { transition: none; } }

/* ---------- breakpoints ---------- */
@media (min-width: 560px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .who-grid { gap: 18px; }
  .who-grid { grid-template-columns: repeat(3, 1fr); }
  .who a.a3 { grid-column: auto; }
  .panel-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 760px) {
  body { font-size: 18px; }
  .hero .wrap { grid-template-columns: 1.25fr .75fr; }
  .hero-art { width: min(380px, 100%); }
  .who-grid { max-width: 640px; grid-template-columns: repeat(3, 1fr); }
  .who a.a3 { grid-column: auto; }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .gcard .body { padding: 12px 16px 16px; }
  .gcard h3 { font-size: 1.2rem; }
  .gcard p { font-size: .95rem; }
  .below { grid-template-columns: 1fr 1fr; }
  .below .wide { grid-column: 1 / -1; }
  .stage { height: clamp(520px, calc(100vh - 230px), 860px); }
  @supports (height: 100dvh) { .stage { height: clamp(520px, calc(100dvh - 230px), 860px); } }
}
@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
  .panel-list { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .site-head { padding: 8px 0; }
  .logo { font-size: 1.1rem; white-space: nowrap; gap: 8px; }
  .logo svg { width: 34px; height: 34px; }
  .logo small { display: none; }
  body[data-game] .crumbs { display: none; }
  body[data-game] .section { padding-top: 0 !important; }
  .game-top { margin: 0 0 8px; flex-wrap: nowrap; }
  .game-top h1 { font-size: 1.25rem; gap: 6px; }
  .game-top .acts .btn { padding: .15em .75em; min-height: 38px; font-size: .88rem; }
  .game-top .hide-s { display: none; }
  .stage { height: clamp(420px, calc(100vh - 150px), 780px); }
  @supports (height: 100dvh) { .stage { height: clamp(420px, calc(100dvh - 150px), 780px); } }
  .topbar { padding: 8px 10px; }
  .cf-choices .btn { min-height: 56px; }
}
@media (max-width: 430px) {
  .logo small { display: none; }
  .nav a.link { padding: 8px; font-size: .9rem; }
  #snd .lbl { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .stage { height: calc(100vh - 20px); min-height: 300px; }
  .site-head { display: none; }
  .game-top h1 { font-size: 1.2rem; }
  .overlay .panel { padding: 12px; }
  .mascot { font-size: 2rem; }
  .overlay .panel ol { font-size: .95rem; margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print { .site-head, .site-foot, .stage-wrap { display: none; } }

/* hangman categories must fit on small phones */
#hgseg { max-width: 100%; }
#hgseg button { padding: .3em .6em; font-size: .9rem; }
@media (max-width: 430px) { #hgseg button { padding: .3em .5em; font-size: .85rem; } .topbar .seg { max-width: 100%; } }

/* ---------- Color Studio ---------- */
.cs { position: relative; background: linear-gradient(180deg, #fffaf1, #fff0e4); }
.cs-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.cs-sp { flex: 1; }
.cs-ib { font: inherit; font-size: 1.25rem; width: 42px; height: 42px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; line-height: 1; }
.cs-ib:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.cs-ib:disabled { opacity: .35; cursor: default; }
.cs-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cs-area { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.cs-paper { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 6px 0 rgba(43,42,76,.18), 0 14px 30px rgba(43,42,76,.18); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.cs-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.cs-tools { display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cs-tools::-webkit-scrollbar { display: none; }
.cs-tool { flex: 0 0 auto; width: 58px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font: inherit; border: 3px solid var(--ink); border-radius: 16px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; padding: 0; }
.cs-tool .e { font-size: 1.45rem; line-height: 1; }
.cs-tool .l { font-size: .62rem; font-weight: 900; letter-spacing: .02em; }
.cs-tool[aria-pressed="true"] { background: var(--ink); color: #fff; transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.cs-side { display: flex; flex-direction: column; }
.cs-colors { display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px 6px; scrollbar-width: none; }
.cs-colors::-webkit-scrollbar { display: none; }
.cs-sw { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(43,42,76,.35); cursor: pointer; padding: 0; position: relative; }
.cs-sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.14); }
.cs-custom { background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); overflow: hidden; }
.cs-custom input { position: absolute; inset: -10px; width: 60px; height: 60px; opacity: 0; cursor: pointer; }
.cs-opts { display: flex; align-items: center; gap: 10px; padding: 2px 10px 10px; flex-wrap: wrap; }
.cs-size { display: flex; align-items: center; gap: 8px; flex: 1 1 150px; min-width: 130px; }
.cs-size input { flex: 1; accent-color: var(--brand); min-height: 28px; }
.cs-dot { flex: 0 0 auto; display: inline-block; border-radius: 50%; width: 14px; height: 14px; }
.cs-sym button { padding: .2em .6em; min-height: 34px; font-size: .78rem; }
.cs-papers { display: flex; gap: 6px; }
.cs-pp { width: 26px; height: 26px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(43,42,76,.35); cursor: pointer; padding: 0; }
.cs-pp[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.cs-pop { position: absolute; left: 8px; right: 8px; bottom: 120px; z-index: 12; display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-width: 420px; margin: 0 auto; padding: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 8px 0 rgba(43,42,76,.2); }
.cs-pop[hidden] { display: none; }
.cs-st { font-size: 1.5rem; border: 0; background: transparent; border-radius: 10px; cursor: pointer; padding: 4px 0; }
.cs-st:hover { background: #fff0e4; }
.cs-gal { position: absolute; inset: 0; z-index: 20; display: none; align-items: flex-start; justify-content: center; overflow: auto; padding: 14px; background: rgba(255, 248, 238, .96); }
.cs-gal.on { display: flex; }
.cs-galin { width: min(760px, 100%); margin: auto; text-align: center; }
.cs-galin h2 { margin: 4px 0 12px; font-size: 1.4rem; }
.cs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cs-card { font: inherit; font-weight: 900; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 8px 8px 6px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); display: flex; flex-direction: column; gap: 4px; align-items: center; touch-action: manipulation; }
.cs-card canvas { width: 100%; height: auto; border-radius: 10px; background: #fff; }
.cs-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
@media (min-width: 560px) { .cs-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .cs-grid { grid-template-columns: repeat(4, 1fr); } }

/* wide / landscape: tools left, colours right */
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
  .cs-body { display: grid; grid-template-columns: 132px minmax(0, 1fr) 226px; }
  .cs-tools { display: grid; grid-template-columns: repeat(2, 58px); grid-auto-rows: 62px; gap: 8px; align-content: start; justify-content: center; overflow-y: auto; padding: 8px 6px; }
  .cs-side { overflow-y: auto; padding-top: 8px; }
  .cs-colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; padding: 6px 12px 10px; overflow: visible; justify-items: center; }
  .cs-sw { width: 28px; height: 28px; }
  .cs-opts { flex-direction: column; align-items: stretch; gap: 12px; padding: 4px 12px 14px; }
  .cs-size { flex: 0 0 auto; }
  .cs-sym { width: 100%; } .cs-sym button { flex: 1; padding: .2em .2em; }
  .cs-pop { left: 150px; right: auto; bottom: auto; top: 120px; width: 300px; grid-template-columns: repeat(4, 1fr); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .cs-body { grid-template-columns: 124px minmax(0, 1fr) 196px; }
  .cs-top { padding: 4px 8px; }
  .cs-tool { width: 52px; height: 52px; } .cs-tools { grid-template-columns: repeat(2, 52px); grid-auto-rows: 54px; gap: 5px; }
  .cs-tool .l { display: none; }
  .cs-colors { grid-template-columns: repeat(6, 1fr); gap: 5px; } .cs-sw { width: 24px; height: 24px; }
}
@media (max-width: 899px) and (orientation: portrait) {
  .cs-tool { width: 54px; height: 54px; }
}

/* Color Studio: compact phone layout */
.cs-top .btn { white-space: nowrap; }
@media (max-width: 899px) and (orientation: portrait) {
  body[data-game="color-studio"] .stage { height: clamp(560px, calc(100vh - 70px), 880px); }
  @supports (height: 100dvh) { body[data-game="color-studio"] .stage { height: clamp(560px, calc(100dvh - 70px), 880px); } }
  .cs-tool { width: 50px; height: 50px; border-radius: 14px; } .cs-tool .e { font-size: 1.3rem; }
  .cs-sw { width: 30px; height: 30px; }
  .cs-opts { gap: 8px; padding: 0 10px 10px; }
  .cs-size { flex: 1 1 100%; }
  .cs-sym { flex: 1 1 auto; } .cs-sym button { min-height: 32px; padding: .15em .4em; font-size: .72rem; }
  .cs-pp { width: 22px; height: 22px; } .cs-papers { gap: 4px; }
}
#cspname { max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
@media (max-width: 430px) { .cs-lbl { display: none; } .cs-top { gap: 6px; padding: 8px; } .cs-ib { width: 38px; height: 38px; } .cs-top .btn.small { padding: .3em .7em; } }
