/* Self-hosted fonts (SIL Open Font License 1.1): Baloo 2 (EkType), Nunito (Vernon Adams et al.). Licences in /assets/fonts/. */
@font-face { font-family: 'Baloo 2'; font-style: normal; font-display: swap; font-weight: 700; src: url(/assets/fonts/baloo-2-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-style: normal; font-display: swap; font-weight: 700; src: url(/assets/fonts/baloo-2-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-style: normal; font-display: swap; font-weight: 800; src: url(/assets/fonts/baloo-2-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-style: normal; font-display: swap; font-weight: 800; src: url(/assets/fonts/baloo-2-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 400; src: url(/assets/fonts/nunito-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 400; src: url(/assets/fonts/nunito-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 700; src: url(/assets/fonts/nunito-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 700; src: url(/assets/fonts/nunito-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 800; src: url(/assets/fonts/nunito-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 800; src: url(/assets/fonts/nunito-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 900; src: url(/assets/fonts/nunito-latin-900-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 900; src: url(/assets/fonts/nunito-latin-ext-900-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
:root {
  --ink: #22313f; --soft: #5b6b79; --bg: #fdf6e9; --card: #fff;
  --green: #3fae5a; --green-d: #2c8a43; --red: #e2574c; --blue: #2f80c9; --sun: #ffc93c;
  --radius: 22px; --shadow: 0 6px 0 rgba(0,0,0,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 20px/1.4 "Nunito", "Trebuchet MS", system-ui, sans-serif; }
a { color: var(--blue); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.game-page { height: 100%; height: 100dvh; overflow: hidden; user-select: none; -webkit-user-select: none; }
.game-page body { height: 100%; height: 100dvh; overflow: hidden; }
.big-btn { display: inline-block; background: var(--green); color: #fff; font-weight: 800; font-size: 26px; padding: 12px 32px;
  border-radius: 999px; box-shadow: 0 6px 0 var(--green-d); transition: transform .08s; text-decoration: none; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--green-d); }
.big-btn.grey { background: #e7e1d4; color: var(--ink); box-shadow: 0 6px 0 #c9c0ad; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 50%;
  width: 56px; height: 56px; font-size: 28px; box-shadow: var(--shadow); text-decoration: none; }
.icon-btn:active { transform: translateY(3px); }
.topbar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 12px; align-items: center; z-index: 20; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.spacer { flex: 1; }
.pill { background: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap; }

/* ---------- portal ---------- */
.portal { max-width: 1120px; margin: 0 auto; padding: 22px 22px 40px; }
.portal header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { font-size: 40px; font-weight: 900; text-decoration: none; color: var(--ink); letter-spacing: .3px; }
.logo span { color: var(--green); }
.langs { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.langs a { text-decoration: none; padding: 4px 12px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.langs a[aria-current] { background: var(--ink); color: #fff; }
.hero { text-align: center; margin: 26px 0 8px; }
.hero h1 { font-size: 40px; line-height: 1.15; margin: 0 0 6px; }
.hero p { margin: 0; color: var(--soft); font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; margin: 26px 0 40px; }
.tile { display: block; background: var(--card); border-radius: 30px; padding: 24px 22px 22px; text-align: center; color: var(--ink);
  text-decoration: none; box-shadow: 0 8px 0 rgba(0,0,0,.10); transition: transform .12s; }
.tile:hover, .tile:focus-visible { transform: translateY(-4px) rotate(-.5deg); }
.tile .emoji { font-size: 84px; line-height: 1.1; }
.tile h2 { margin: 8px 0 4px; font-size: 27px; }
.tile p { margin: 0; color: var(--soft); font-size: 18px; }
.tile .lvl { display: inline-block; margin-top: 12px; background: #eef7ef; color: var(--green-d); font-weight: 800; border-radius: 999px; padding: 4px 14px; font-size: 16px; }
.why h2, .doc h2 { font-size: 30px; margin: 10px 0 14px; }
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.why-grid div { background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 4px 0 rgba(0,0,0,.06); }
.why-grid b { display: block; font-size: 21px; margin: 4px 0; }
.why-grid i { font-style: normal; font-size: 34px; }
.why-grid span { color: var(--soft); font-size: 17px; }
.site-footer { margin-top: 40px; text-align: center; color: var(--soft); font-size: 16px; }
.doc { max-width: 820px; margin: 0 auto; }
.doc h1 { font-size: 38px; margin: 26px 0 8px; }
.doc p, .doc li { font-size: 19px; }
.doc ul { padding-left: 24px; }
.doc dl dt { font-weight: 800; margin-top: 10px; }
.doc dl dd { margin: 2px 0 0; color: var(--soft); }
.doc table { width: 100%; border-collapse: collapse; font-size: 16px; text-align: left; background: #fff; border-radius: 14px; overflow: hidden; margin: 8px 0; }
.doc td, .doc th { padding: 5px 10px; border-bottom: 1px solid #eee; }
.note { color: var(--soft); font-size: 16px; }
.chooser { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.chooser .langs { margin: 0; justify-content: center; }
.chooser .langs a { font-size: 22px; padding: 8px 20px; }

/* ---------- count (feed) ---------- */
#feed { height: 100%; display: flex; flex-direction: column; align-items: center; position: relative; overflow: hidden;
  background: linear-gradient(#bfe6ff 0 55%, #9ad77c 55% 100%); }
#feed .stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(16px, 6vw, 70px); padding-top: 70px; }
.tray { width: 100%; display: flex; flex-direction: column; align-items: center; }
.animal { font-size: clamp(64px, 19vmin, 170px); line-height: 1; transition: transform .25s; filter: drop-shadow(0 8px 0 rgba(0,0,0,.12)); }
.animal.happy { animation: hop .5s 3; }
.animal.hungry { animation: wobble .5s 1; }
@keyframes hop { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-40px) scale(1.06) } }
@keyframes wobble { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-8deg) } 75% { transform: rotate(8deg) } }
.target-card { --dot: clamp(14px, 3.6vmin, 34px); background: #fff; border-radius: 24px; padding: clamp(8px, 2vmin, 16px) clamp(12px, 3vmin, 26px); min-width: clamp(90px, 20vmin, 190px); text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.12); }
.target-card .num { font-size: clamp(44px, 12vmin, 110px); font-weight: 900; line-height: 1; color: var(--blue); }
.dots { display: grid; grid-template-columns: repeat(3, var(--dot)); grid-template-rows: repeat(3, var(--dot)); gap: calc(var(--dot) / 6); justify-content: center; margin: 6px auto 0; }
.dots i { width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--red); }
.dots i.off { background: transparent; }
.dots-wrap { display: flex; gap: calc(var(--dot) / 2); justify-content: center; }
.bowl { width: min(760px, 92vw); min-height: clamp(56px, 13vmin, 120px); background: #fff7e3; border: 6px solid #e9b96e; border-radius: 0 0 140px 140px;
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 4px; padding: 6px 24px; font-size: clamp(28px, 6.5vmin, 56px); }
.bowl span { cursor: pointer; animation: drop-in .25s; }
@keyframes drop-in { from { transform: translateY(-80px) scale(.6); opacity: 0 } to { transform: none; opacity: 1 } }
.pile { --food: clamp(54px, 11vmin, 92px); display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(6px, 1.4vmin, 10px); width: min(900px, 94vw); margin: clamp(8px, 2vmin, 18px) 0; min-height: var(--food); }
.pile button { font-size: calc(var(--food) * .66); width: var(--food); height: var(--food); background: rgba(255,255,255,.55); border-radius: 22px; transition: transform .15s; }
.pile button:hover { transform: scale(1.12) rotate(-6deg); }
.feed-actions { display: flex; gap: 22px; margin-bottom: clamp(10px, 3vmin, 26px); }
#feed .done { font-size: clamp(24px, 5.5vmin, 42px); padding: clamp(8px, 1.6vmin, 14px) clamp(30px, 6vmin, 54px); }
.speech { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 22px; padding: 10px 24px;
  font-weight: 800; font-size: 26px; box-shadow: var(--shadow); max-width: 60vw; text-align: center; z-index: 21; }

/* ---------- pilot ---------- */
#pilot { position: relative; height: 100%; background: #8ecdf2; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#map .prov { stroke: #fff; stroke-linejoin: round; transition: fill .3s; }
#map .prov.hit-ok { fill: #7fd28f; }
#map .prov.hit-bad { fill: #f3a59d; }
#map .prov.show { animation: pulse .9s infinite alternate; }
@keyframes pulse { from { fill: #ffe27a } to { fill: #ffbf3c } }
#map .decor { fill: #e4ded2; stroke: #fff; }
#map .sea-label { fill: #3d82b5; font-style: italic; font-weight: 700; letter-spacing: 1px; opacity: .8; }
#map .city { fill: #22313f; stroke: #fff; }
#map .city.show { fill: #ff6b3d; animation: blink .6s infinite alternate; }
@keyframes blink { from { opacity: 1 } to { opacity: .35 } }
#map .label { font-weight: 800; fill: #22313f; paint-order: stroke; stroke: #fff; pointer-events: none; }
#map .cloud { opacity: .55; pointer-events: none; }
.mission { position: absolute; left: 18px; bottom: 18px; width: 330px; background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 8px 0 rgba(0,0,0,.12); z-index: 10; }
.mission .what { color: var(--soft); font-size: 17px; font-weight: 700; }
.mission .where { font-size: 32px; font-weight: 900; line-height: 1.1; margin: 2px 0 10px; }
.mission .drop { width: 100%; font-size: 22px; padding: 12px 10px; }
.mission .hint { margin-top: 10px; font-size: 16px; color: var(--soft); min-height: 22px; }
.over { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.92); border-radius: 999px;
  padding: 6px 20px; font-weight: 800; z-index: 10; pointer-events: none; }
.toast { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%) scale(.6); opacity: 0; background: #fff; border-radius: 26px;
  padding: 18px 30px; font-size: 32px; font-weight: 900; box-shadow: 0 8px 0 rgba(0,0,0,.12); z-index: 30; transition: all .25s; text-align: center; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.toast small { display: block; font-size: 20px; font-weight: 700; color: var(--soft); margin-top: 4px; }
.keys { margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; font-size: 14px; color: var(--soft); }
@media (min-width: 1000px) { #map { left: 360px; width: calc(100% - 360px); } .over { left: calc(50% + 180px); } }
kbd { background: #fff; border: 1px solid #ccc; border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; font: inherit; font-weight: 800; color: var(--ink); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(34,49,63,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.overlay.on { display: flex; }
.sheet { background: var(--bg); border-radius: 30px; padding: 26px 30px; width: min(860px, 96vw); max-height: 92vh; overflow: auto; text-align: center; }
.sheet h2 { margin: 0 0 6px; font-size: 32px; }
.sheet p { margin: 4px 0 14px; color: var(--soft); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 16px 0; }
.level { text-align: left; background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.level b { font-size: 21px; display: block; }
.level span { color: var(--soft); font-size: 16px; }
.level .bar { height: 10px; background: #eee; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.level .bar i { display: block; height: 100%; background: var(--green); }
.level .tag { position: absolute; top: -10px; right: 12px; background: var(--sun); border-radius: 999px; padding: 1px 10px; font-size: 14px; font-weight: 900; color: var(--ink); }
.stars { font-size: 46px; letter-spacing: 4px; margin: 6px 0; }
.faces { display: flex; gap: 18px; justify-content: center; margin: 10px 0 18px; }
.faces button { font-size: 64px; background: #fff; border-radius: 24px; width: 104px; height: 104px; box-shadow: var(--shadow); }
.faces button.picked { outline: 5px solid var(--green); }
.lists { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; text-align: left; margin: 6px 0 16px; }
.lists div { background: #fff; border-radius: 18px; padding: 10px 18px; min-width: 240px; }
.lists h3 { margin: 0 0 4px; font-size: 18px; }
.lists ul { margin: 0; padding-left: 20px; font-size: 18px; }
.end-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.confetti { position: fixed; top: -20px; font-size: 28px; pointer-events: none; z-index: 60; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .confetti, .animal.happy, .animal.hungry { animation: none; } }

/* ---------- phones and tablets ---------- */
@media (hover: none) { .keys { display: none; } }
@media (max-width: 700px) {
  .icon-btn { width: 46px; height: 46px; font-size: 23px; }
  .pill { padding: 6px 12px; font-size: 16px; }
  .topbar { top: 10px; left: 10px; right: 10px; gap: 8px; }
  .speech { top: 66px; font-size: 19px; padding: 6px 16px; max-width: 90vw; }
  #feed .stage { padding-top: 110px; }
  .over { top: 66px; font-size: 15px; max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .portal { padding: 14px 14px 30px; }
  .logo { font-size: 32px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 19px; }
  .tile .emoji { font-size: 64px; }
  .sheet { padding: 18px 16px; }
  .faces button { width: 80px; height: 80px; font-size: 48px; }
}
/* Pilot below desktop width: the map gets its own space above a compact mission bar. */
@media (max-width: 999px) {
  #pilot { display: flex; flex-direction: column; }
  #map { position: relative; inset: auto; flex: 1; min-height: 0; height: auto; }
  .mission { position: relative; left: auto; bottom: auto; width: auto; margin: 0 8px 8px; padding: 10px 14px;
    display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
  .mission .what { font-size: 14px; grid-column: 1; }
  .mission .where { font-size: clamp(22px, 6vw, 30px); margin: 0; grid-column: 1; }
  .mission .drop { grid-column: 2; grid-row: 1 / span 2; width: auto; font-size: 19px; padding: 12px 18px; }
  .mission .hint { grid-column: 1 / -1; font-size: 14px; margin-top: 6px; min-height: 0; }
  .mission .keys { grid-column: 1 / -1; }
}
/* Phone held sideways: little height, so the controls move into a column next to the scene. */
@media (orientation: landscape) and (max-height: 520px) {
  #feed { flex-direction: row; align-items: stretch; }
  #feed .stage { flex: 1; flex-direction: column; gap: 6px; padding-top: 56px; }
  .tray { flex: 1.4; justify-content: center; padding-top: 52px; }
  .speech { top: 10px; }
  .pile { --food: clamp(46px, 13vmin, 70px); width: 100%; }
  .bowl { width: 94%; border-radius: 0 0 90px 90px; }
  #pilot { flex-direction: row-reverse; }
  .mission { width: 240px; margin: 64px 0 8px 8px; display: block; align-self: stretch; overflow: auto; }
  .mission .where { margin: 2px 0 8px; }
  .mission .drop { width: 100%; }
  .over { top: auto; bottom: 10px; left: calc(50% + 124px); max-width: 44vw; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Phone held upright: plenty of height, so the animal and the number card can be large. */
@media (orientation: portrait) and (max-width: 700px) {
  .animal { font-size: 30vw; }
  .target-card { --dot: 7vw; min-width: 34vw; }
  .target-card .num { font-size: 22vw; }
}

/* ---------- portal: group tabs ---------- */
.group-tabs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 22px 0 6px; }
.groups > input[type=radio] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.group-tabs label { cursor: pointer; background: #fff; border-radius: 999px; padding: 10px 22px; font-weight: 900; font-size: 20px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.group-tabs label:hover { transform: translateY(-2px); }
.choose-label { text-align: center; color: var(--soft); font-weight: 800; margin-top: 18px; }
.group-panel { display: none; }
#g12:checked ~ .panels .gp-12, #g34:checked ~ .panels .gp-34, #g56:checked ~ .panels .gp-56, #g78:checked ~ .panels .gp-78 { display: grid; }
#g12:checked ~ .group-tabs label[for=g12], #g34:checked ~ .group-tabs label[for=g34], #g56:checked ~ .group-tabs label[for=g56], #g78:checked ~ .group-tabs label[for=g78] { background: var(--ink); color: #fff; }
input:focus-visible + .group-tabs label, .group-tabs label:focus-visible { outline: 3px solid var(--blue); }
.tiles.group-panel { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin: 18px 0 36px; }
.tile.small { padding: 16px 14px 14px; border-radius: 24px; }
.tile.small .emoji { font-size: 58px; }
.tile.small h2 { font-size: 21px; }
.tile.small p { font-size: 16px; }
.tile .skill { display: inline-block; margin-top: 8px; background: #eef7ef; color: var(--green-d); font-weight: 800; border-radius: 999px; padding: 3px 12px; font-size: 15px; }

/* ---------- arcade ---------- */
#arcade { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.arc-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
#prompt { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; text-align: center;
  background: #fff; border-radius: 22px; padding: 8px 16px; box-shadow: var(--shadow); min-height: 64px; }
#prompt-text { font-size: clamp(20px, 3.4vw, 32px); font-weight: 900; line-height: 1.15; }
#prompt-visual:empty, #prompt-feedback:empty { display: none; }
#prompt-feedback { width: 100%; font-weight: 800; font-size: 18px; display: flex; gap: 8px; justify-content: center; align-items: center; min-height: 0; }
.fb-ok { color: var(--green-d); } .fb-bad { color: #c62828; }
.fb-ans { display: inline-flex; align-items: center; } .fb-ans .ch-text { font-size: 20px; }
#arena { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; }
#arena canvas { display: block; }
.pv-emoji { display: inline-flex; flex-wrap: wrap; gap: 2px 6px; max-width: 520px; justify-content: center; font-size: clamp(30px, 5vw, 46px); }
.pv-emoji i, .pv-seq i { font-style: normal; }
.pv-seq { display: inline-flex; gap: 6px; font-size: clamp(28px, 5vw, 44px); align-items: center; }
.pv-seq b { display: inline-flex; width: 1.2em; height: 1.2em; align-items: center; justify-content: center; border: 3px dashed #bbb; border-radius: 12px; font-size: .8em; }
.pv-big { font-size: clamp(54px, 9vw, 84px); line-height: 1; }
.pv-say { font-size: 34px; background: #eef7ff; border-radius: 50%; width: 58px; height: 58px; }
.pv-clock { width: clamp(90px, 14vh, 140px); height: auto; }
.pv-map { height: clamp(120px, 30vh, 250px); width: auto; border-radius: 12px; }
.pv-rect { height: clamp(80px, 16vh, 130px); width: auto; }
.pv-coins { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: center; max-width: 520px; }
.coin { --s: 1; display: inline-flex; align-items: center; justify-content: center; width: calc(46px * var(--s)); height: calc(46px * var(--s)); border-radius: 50%;
  font-weight: 900; font-size: calc(15px * var(--s)); box-shadow: inset 0 0 0 3px rgba(0,0,0,.15); }
.coin.copper { background: #d08a55; color: #fff; } .coin.gold { background: #e9c25a; color: #5d4300; }
.coin.bi { background: radial-gradient(circle, #e9c25a 0 55%, #c0c4c8 56%); color: #3c3c3c; }
.note { display: inline-flex; align-items: center; justify-content: center; width: 92px; height: 50px; border-radius: 8px; font-weight: 900; color: #fff; font-size: 20px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.4); }
.note.n500 { background: #8d9aa5; } .note.n1000 { background: #d9534f; } .note.n2000 { background: #4a7fc1; } .note.n5000 { background: #e08a2e; }
.ch-color { display: inline-block; width: 1.6em; height: 1.6em; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.12); vertical-align: middle; }
.shape { width: 1.8em; height: 1.8em; vertical-align: middle; }
.ch-emoji { display: inline-block; line-height: 1; }
.ch-text { font-weight: 900; }
.ch-dots-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.ch-dots { display: inline-grid; gap: 4px; }
.ch-dots i { width: .5em; height: .5em; border-radius: 50%; background: var(--red); display: block; }
.start-sheet .big-emoji { font-size: 80px; line-height: 1.1; }
.start-sheet .skill { display: inline-block; background: #eef7ef; color: var(--green-d); font-weight: 800; border-radius: 999px; padding: 3px 14px; margin: 4px 0 8px; }

/* DOM play styles */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-btn { background: #fff; border-radius: 20px; min-height: 76px; padding: 10px; font-size: clamp(22px, 3.6vw, 32px); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.choice-btn:active { transform: translateY(3px); }
.choice-btn.right, .hs-item.right { background: #c8f7c5; outline: 4px solid var(--green); }
.choice-btn.wrong, .hs-item.wrong { background: #ffd0cc; animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.ttt { height: 100%; display: flex; gap: 22px; align-items: center; justify-content: center; padding: 12px; flex-wrap: wrap; }
.ttt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(42vh, 86vw, 380px); aspect-ratio: 1; }
.ttt-cell { background: #fff; border-radius: 16px; font-size: min(9vh, 17vw, 72px); box-shadow: var(--shadow); }
.ttt-board.placing .ttt-cell:not(.filled) { background: #fff8d6; outline: 3px dashed var(--sun); cursor: pointer; }
.ttt-side { width: min(420px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.ttt-msg { font-weight: 900; font-size: 22px; min-height: 30px; text-align: center; }
.hidden-scene { position: absolute; inset: 8px; border-radius: 24px; background: radial-gradient(circle at 30% 20%, #dcedc8, #aed581); overflow: hidden; }
.hs-deco { position: absolute; font-size: 34px; opacity: .55; pointer-events: none; }
.hs-item { position: absolute; transform: translate(-50%, -50%) rotate(var(--r)); background: #fff; border-radius: 18px; padding: 8px 14px; min-width: 64px; min-height: 58px;
  font-size: clamp(18px, 2.8vw, 26px); box-shadow: 0 5px 0 rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; }
@media (max-width: 600px) { .hs-item { font-size: 15px; padding: 6px 9px; min-width: 50px; min-height: 46px; white-space: nowrap; } }
.hs-item:hover { transform: translate(-50%, -50%) rotate(0) scale(1.08); z-index: 2; }
.memory { height: 100%; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 10px; padding: 10px; max-width: 760px; margin: 0 auto; align-content: center; }
.mem-card { position: relative; aspect-ratio: 1 / .78; border-radius: 18px; background: var(--blue); box-shadow: var(--shadow); font-size: clamp(18px, 3.2vw, 30px); max-height: 21vh; }
.mem-card .mem-face { display: none; } .mem-card .mem-back { font-size: 1.4em; }
.mem-card.open { background: #fff; } .mem-card.open .mem-face { display: flex; align-items: center; justify-content: center; } .mem-card.open .mem-back { display: none; }
.mem-card.done { background: #c8f7c5; }
.mem-card .ch-dots i { width: .45em; height: .45em; }
.shop { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 10px; background: linear-gradient(#fff3e0 0 60%, #d7a26b 60%); }
.shop-shelf { font-size: clamp(30px, 6vw, 52px); letter-spacing: 8px; background: #a1887f; border-radius: 12px; padding: 6px 16px; }
.shop-counter { display: flex; align-items: flex-end; gap: 40px; font-size: clamp(70px, 14vh, 120px); line-height: 1; }
.shop-customer.enter { animation: walkin .6s; } .shop-customer.happy { animation: hop .5s 2; } .shop-customer.puzzled { animation: wobble .5s 2; }
@keyframes walkin { from { transform: translateX(-60vw) } to { transform: none } }
.shop-choices { width: min(620px, 96vw); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.price-tag { border-radius: 14px 14px 30px 14px; background: #fffde7; }
@media (max-width: 700px) {
  .arc-top { flex-wrap: wrap; padding: 8px 8px 4px; }
  #prompt { order: 5; flex-basis: 100%; padding: 6px 10px; min-height: 52px; }
  .arc-top .spacer { display: block; flex: 1; }
  .shop-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttt { gap: 10px; padding: 8px; align-content: center; }
  .ttt-board { width: min(30vh, 64vw); }
  .ttt-side { gap: 8px; } .ttt-msg { font-size: 18px; min-height: 22px; }
  .choice-btn { min-height: 58px; }
  .pv-map { height: clamp(110px, 22vh, 190px); }
  .group-tabs label { font-size: 16px; padding: 8px 14px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #prompt { min-height: 46px; padding: 4px 12px; } #prompt-text { font-size: 20px; }
  #prompt-feedback { font-size: 15px; } .pv-say { width: 40px; height: 40px; font-size: 22px; } .arc-top { padding: 6px 10px 4px; } .icon-btn { width: 42px; height: 42px; font-size: 21px; }
  .pv-map { height: 118px; } .pv-clock { width: 70px; }
  .choice-btn { min-height: 44px; padding: 6px; font-size: 20px; } .ttt-side { gap: 6px; } .ttt-msg { min-height: 0; font-size: 16px; }
  .memory { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; align-content: center; } .mem-card { aspect-ratio: .8; max-height: 40vh; } .pv-emoji, .pv-seq { font-size: 26px; } .pv-big { font-size: 46px; }
}

/* =====================================================================
   Portal v2 — playful, chunky, 3D-ish. Fonts: Baloo 2 (headings), Nunito (text).
   ===================================================================== */
body { font-family: 'Nunito', system-ui, sans-serif; }
h1, h2, h3, .big-btn, .pill, .logo, .gtab, #prompt-text, .choice-btn, .ttt-msg { font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif; }
.portal-body { background: linear-gradient(180deg, #7fd4ff 0%, #b9ecff 38%, #fff6d8 72%, #ffe8b8 100%); min-height: 100vh; overflow-x: hidden; }
.sky-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky-deco i { position: absolute; display: block; animation: float 9s ease-in-out infinite; }
.sky-deco .cloud { width: 180px; height: 56px; background: #fff; border-radius: 60px; opacity: .85; box-shadow: 0 10px 0 rgba(255,255,255,.4); }
.sky-deco .cloud::before, .sky-deco .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.sky-deco .cloud::before { width: 80px; height: 80px; left: 26px; top: -40px; } .sky-deco .cloud::after { width: 60px; height: 60px; left: 92px; top: -26px; }
.sky-deco .ball { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--c) 38%, var(--d) 100%); box-shadow: 0 14px 18px rgba(0,0,0,.12); }
.sky-deco .cube { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--c), var(--d)); box-shadow: inset -6px -8px 0 rgba(0,0,0,.15), inset 6px 6px 0 rgba(255,255,255,.35), 0 14px 18px rgba(0,0,0,.12); transform: rotate(18deg); }
.sky-deco .tri { width: 0; height: 0; border-left: 28px solid transparent; border-right: 28px solid transparent; border-bottom: 48px solid var(--c); filter: drop-shadow(0 10px 8px rgba(0,0,0,.12)); }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -18px; } }
.portal { position: relative; z-index: 1; }
.portal header { padding-top: 4px; }
.logo-small { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 30px; text-decoration: none; color: #fff; text-shadow: 0 3px 0 #f0603a, 0 5px 8px rgba(0,0,0,.2); }
.install-btn { display: none; background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 18px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 17px; box-shadow: 0 5px 0 #d9c9a5; }
.install-btn.on { display: inline-block; }
.ios-hint { display: none; margin: 8px auto 0; max-width: 520px; text-align: center; background: #fff; border-radius: 16px; padding: 8px 14px; font-weight: 700; font-size: 16px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.ios-hint.on { display: block; }
.hero2 { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 30px; margin: 18px 0 6px; }
.logo3d { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(64px, 13vw, 150px); line-height: .95; letter-spacing: -1px; white-space: nowrap; }
.logo3d span { display: inline-block; color: var(--c); animation: bob 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * .12s);
  text-shadow: 0 2px 0 var(--d), 0 4px 0 var(--d), 0 6px 0 var(--d), 0 8px 0 var(--d), 0 10px 0 var(--d), 0 12px 2px rgba(0,0,0,.12), 0 18px 24px rgba(0,0,0,.18); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-3deg); } }
.tagline { margin: 14px 0 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(20px, 2.6vw, 30px); color: #1d3557; line-height: 1.15; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badges span { background: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.mascot { position: relative; width: clamp(150px, 22vw, 250px); }
.mascot img { width: 100%; height: auto; display: block; animation: hopm 2.4s ease-in-out infinite; filter: drop-shadow(0 16px 14px rgba(0,0,0,.18)); }
@keyframes hopm { 0%,100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-16px) scale(.98, 1.03); } 55% { transform: translateY(-16px) scale(.98, 1.03); } 90% { transform: translateY(0) scale(1.04, .96); } }
.bubble { position: absolute; right: 88%; top: 2%; width: max-content; max-width: 230px; background: #fff; border-radius: 22px; padding: 10px 16px;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 18px; line-height: 1.15; box-shadow: 0 6px 0 rgba(0,0,0,.08); }
.bubble::after { content: ''; position: absolute; right: -12px; top: 30px; border: 10px solid transparent; border-left-color: #fff; }
.choose-label { font-family: 'Baloo 2', sans-serif; font-size: 24px; color: #1d3557; margin: 22px 0 4px; }
.gtab-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 10px 0 8px; perspective: 600px; }
.gtab { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; background: var(--c); color: #fff; border-radius: 22px; padding: 10px 22px 12px;
  font-weight: 800; font-size: clamp(18px, 2.2vw, 24px); box-shadow: 0 8px 0 var(--d), 0 14px 20px rgba(0,0,0,.15); transition: transform .15s, box-shadow .15s;
  text-shadow: 0 2px 0 var(--d); }
.gtab b { font-size: 1.3em; filter: drop-shadow(0 2px 0 rgba(0,0,0,.2)); }
.gtab:hover { transform: translateY(-3px) rotateX(8deg); }
#g12:checked ~ .gtab-row label[for=g12], #g34:checked ~ .gtab-row label[for=g34], #g56:checked ~ .gtab-row label[for=g56], #g78:checked ~ .gtab-row label[for=g78] {
  transform: translateY(5px) scale(1.06); box-shadow: 0 3px 0 var(--d), 0 0 0 5px #fff, 0 8px 18px rgba(0,0,0,.18); }
.panels { margin-top: 14px; }
.gpanel { display: none; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; margin: 16px 0 40px; perspective: 900px; }
#g12:checked ~ .panels .gp-12, #g34:checked ~ .panels .gp-34, #g56:checked ~ .panels .gp-56, #g78:checked ~ .panels .gp-78 { display: grid; }
.gtile { position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: #fff; border-radius: 28px;
  box-shadow: 0 10px 0 color-mix(in srgb, var(--c) 55%, #000 10%), 0 18px 26px rgba(0,0,0,.14); transition: transform .18s, box-shadow .18s; transform-style: preserve-3d; overflow: visible; }
.gtile:hover, .gtile:focus-visible { transform: translateY(-6px) rotateX(6deg) rotateY(-4deg); box-shadow: 0 16px 0 color-mix(in srgb, var(--c) 55%, #000 10%), 0 26px 32px rgba(0,0,0,.18); outline: none; }
.gtile .scr { position: relative; height: 128px; border-radius: 28px 28px 50% 50% / 28px 28px 22px 22px; overflow: hidden;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.55) 0 12%, transparent 13%), radial-gradient(circle at 80% 70%, rgba(255,255,255,.25) 0 18%, transparent 19%),
    linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); display: flex; align-items: center; justify-content: center; }
.gtile .scr::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.08)); }
.gtile .emo { font-size: 74px; line-height: 1; filter: drop-shadow(0 8px 0 rgba(0,0,0,.16)) drop-shadow(0 14px 10px rgba(0,0,0,.15)); transform: translateZ(30px); transition: transform .2s; }
.gtile:hover .emo { transform: translateZ(40px) scale(1.12) rotate(-8deg); }
.gtile .txt { padding: 12px 16px 16px; text-align: center; }
.gtile h2 { margin: 0; font-size: 23px; line-height: 1.05; font-weight: 800; }
.gtile p { margin: 6px 0 0; color: var(--soft); font-size: 15px; line-height: 1.3; }
.gtile .chip { display: inline-block; margin-top: 8px; background: color-mix(in srgb, var(--c) 18%, #fff); color: color-mix(in srgb, var(--c) 70%, #000); font-weight: 900; border-radius: 999px; padding: 3px 12px; font-size: 14px; }
.gtile .play { position: absolute; right: 12px; top: 98px; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: 0 5px 0 rgba(0,0,0,.12); color: var(--c); }
.why2 { position: relative; background: #fff; border-radius: 36px; padding: 26px 26px 30px; box-shadow: 0 12px 0 #f0d9a8, 0 20px 30px rgba(0,0,0,.08); margin: 10px 0 30px; }
.why2 h2 { margin: 0 0 16px; font-size: 34px; text-align: center; }
.why2 .why-grid div { background: #fffaf0; border-radius: 22px; box-shadow: 0 5px 0 #f3e2bd; transform: rotate(var(--r)); }
.why2 .why-grid i { font-size: 40px; }
.hills { position: relative; z-index: 1; display: block; width: 100%; height: 90px; margin-top: 10px; }
.portal-footer { position: relative; z-index: 1; background: #57b947; color: #fff; text-align: center; padding: 6px 16px 26px; font-weight: 700; margin-top: -4px; }
.portal-footer a { color: #fff; }
@media (max-width: 700px) {
  .hero2 { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .mascot { width: 150px; order: -1; margin-top: 6px; }
  .bubble { right: auto; left: 92%; top: 10%; font-size: 15px; max-width: 150px; }
  .bubble::after { right: auto; left: -12px; border-left-color: transparent; border-right-color: #fff; }
  .badges { justify-content: center; }
  .gpanel { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .gtile .scr { height: 96px; } .gtile .emo { font-size: 54px; } .gtile h2 { font-size: 18px; } .gtile .play { top: 70px; width: 36px; height: 36px; font-size: 16px; }
  .gtile p { display: none; } .gtile .txt { padding: 10px 8px 12px; }
  .gtab { padding: 8px 14px 10px; font-size: 17px; border-radius: 18px; }
  .gtab-row { gap: 10px; }
  .logo-small { font-size: 24px; }
}
@media (max-width: 380px) { .bubble { display: none; } }
@media (prefers-reduced-motion: reduce) { .logo3d span, .mascot img, .sky-deco i { animation: none; } }
