/* ALPHABET ANIMAL RESCUE! — ENGLISH YO! */
:root {
  --ink: #17305c;
  --ink-soft: #4a5f86;
  --card: #ffffff;
  --cream: #fff8e6;
  --line: #dfe8f5;
  --green: #36b437; --green-d: #1f8424;
  --orange: #ff9d1a; --orange-d: #d86d00;
  --blue: #1f8be6; --blue-d: #0f5fb4;
  --sky: #2bb3f0; --sky-d: #0f86c4;
  --purple: #8c4ee8; --purple-d: #5d27b4;
  --red: #f0414b; --red-d: #b51e2b;
  --teal: #18b5a0; --teal-d: #0c8273;
  --grey: #9aa6b8; --grey-d: #6d7a8e;
  --gold: #ffcf2e;
  --radius: 22px;
  --shadow: 0 10px 26px rgba(23, 48, 92, .16);
  --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-body); font-weight: 700; color: var(--ink);
  background: linear-gradient(180deg, #8fd9ff 0%, #c9f0ff 45%, #bfe9a8 100%);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; user-select: none; -webkit-user-drag: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid #ffcf2e; outline-offset: 3px; border-radius: 12px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.1; }
h1:focus, h2:focus { outline: none; }
mark { background: #ffe14d; color: inherit; border-radius: 6px; padding: 0 .1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app { position: relative; min-height: 100vh; min-height: 100dvh; }
.screen { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; animation: screenIn .35s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 32px; position: relative; z-index: 2; }
.img-fallback { display: inline-grid; place-items: center; min-width: 64px; min-height: 64px; padding: 8px; border-radius: 16px; background: #eef4ff; color: var(--ink-soft); font: 800 14px var(--font-head); text-align: center; }

/* ── Buttons ── */
.gbtn {
  --c1: var(--green); --c2: var(--green-d);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 56px; padding: 10px 22px; border-radius: 18px;
  font: 800 clamp(1rem, 1.6vw, 1.2rem)/1.1 var(--font-head); letter-spacing: .02em; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .22);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c1) 72%, #fff) 0%, var(--c1) 48%, color-mix(in srgb, var(--c1) 85%, #000) 100%);
  background-color: var(--c1);
  border: 3px solid var(--c2);
  box-shadow: 0 5px 0 var(--c2), 0 9px 16px rgba(0, 0, 0, .18), inset 0 3px 0 rgba(255, 255, 255, .45);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.gbtn::after { content: ''; position: absolute; left: 10px; right: 10px; top: 4px; height: 38%; border-radius: 14px 14px 30px 30px; background: linear-gradient(rgba(255, 255, 255, .42), rgba(255, 255, 255, 0)); pointer-events: none; }
.gbtn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.gbtn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--c2), 0 3px 8px rgba(0, 0, 0, .16), inset 0 3px 0 rgba(255, 255, 255, .4); }
.gbtn:disabled { filter: grayscale(.85) opacity(.55); }
.gbtn.orange { --c1: var(--orange); --c2: var(--orange-d); }
.gbtn.blue { --c1: var(--blue); --c2: var(--blue-d); }
.gbtn.sky { --c1: var(--sky); --c2: var(--sky-d); }
.gbtn.purple { --c1: var(--purple); --c2: var(--purple-d); }
.gbtn.red { --c1: var(--red); --c2: var(--red-d); }
.gbtn.teal { --c1: var(--teal); --c2: var(--teal-d); }
.gbtn.grey { --c1: var(--grey); --c2: var(--grey-d); }
.gbtn.big { min-height: 66px; font-size: clamp(1.15rem, 2vw, 1.45rem); border-radius: 22px; padding: 12px 28px; }
.gbtn.sm { min-height: 48px; padding: 8px 16px; font-size: 1rem; border-radius: 15px; }
.gbtn .bi { width: 1.7em; height: 1.7em; object-fit: contain; flex: none; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .15)); }
.gbtn svg.bi, .gbtn .gear svg, .gbtn > svg { width: 1.4em; height: 1.4em; flex: none; }
.gbtn .gear { display: inline-grid; place-items: center; }
.imgbtn { position: relative; display: inline-grid; place-items: center; width: 52px; height: 48px; border-radius: 14px; transition: transform .12s; flex: none; }
.imgbtn img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .15)); }
.imgbtn:hover { transform: translateY(-2px) scale(1.04); }
.imgbtn:active { transform: translateY(2px) scale(.97); }
.imgbtn.muted img { filter: grayscale(1) opacity(.7); }
.imgbtn.muted::after { content: ''; position: absolute; left: 10%; right: 10%; top: 50%; height: 5px; border-radius: 4px; background: var(--red); transform: rotate(-35deg); box-shadow: 0 0 0 2px #fff; }
.sqbtn { display: inline-grid; place-items: center; width: 48px; height: 46px; border-radius: 13px; color: #fff; flex: none;
  background: linear-gradient(180deg, #b083ff, var(--purple)); border: 3px solid var(--purple-d); box-shadow: 0 4px 0 var(--purple-d), inset 0 3px 0 rgba(255, 255, 255, .4); }
.sqbtn svg { width: 26px; height: 26px; }
.sqbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--purple-d); }
.rbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 6px 14px 6px 8px; border-radius: 999px; background: #fff; color: var(--ink); font: 800 1rem var(--font-head); box-shadow: 0 4px 0 #c8d5ea, 0 6px 14px rgba(0, 0, 0, .1); max-width: 46vw; }
.rbtn svg { width: 24px; height: 24px; flex: none; color: var(--blue); }
.rbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c8d5ea; }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px clamp(10px, 2vw, 22px); padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(23, 48, 92, .12); border-radius: 0 0 22px 22px; }
.tb-title { text-align: center; min-width: 0; }
.tb-title h2 { font-size: clamp(1.1rem, 2.6vw, 1.8rem); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title h2 small { font-size: .65em; color: var(--ink-soft); }
.tb-title .learn { display: block; font-size: .78rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 12px 0 6px; border-radius: 999px; background: #fff7d6; border: 2px solid #ffe08a; font: 800 1.05rem var(--font-head); }
.pill img { width: 28px; height: 28px; object-fit: contain; }
.bookbtn { width: 46px; }
@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr; row-gap: 6px; }
  .tb-right { grid-column: 1 / -1; justify-content: center; flex-wrap: wrap; gap: 6px; }
  .tb-title { text-align: right; }
  .imgbtn { width: 46px; height: 42px; }
  .sqbtn { width: 42px; height: 40px; }
  .pill { height: 36px; font-size: .95rem; }
  .pill img { width: 24px; height: 24px; }
  .mtop .tb-title { text-align: center; grid-column: 1 / -1; grid-row: 1; padding: 0 4px; }
  .mtop .tb-left { grid-row: 2; }
  .mtop .tb-right { grid-row: 2; grid-column: 2; justify-content: flex-end; }
}

/* ── HOME ── */
.home { overflow: hidden; }
.home-sky { position: absolute; inset: 0; overflow: hidden; z-index: 0;
  background: radial-gradient(ellipse at 50% 110%, #9bdc6a 0 30%, transparent 31%), linear-gradient(180deg, #5cc6ff 0%, #a9e6ff 55%, #d9f7c7 100%); }
.home-sky .sun { position: absolute; top: -60px; right: -40px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, #fff6b0 0 35%, rgba(255, 230, 120, .55) 36% 55%, transparent 56%); animation: pulse 5s ease-in-out infinite; }
.home-sky .cloud { position: absolute; width: clamp(90px, 14vw, 170px); opacity: .92; animation: drift 38s linear infinite; }
.cloud.c1 { top: 8%; left: -12%; }
.cloud.c2 { top: 22%; left: -20%; animation-duration: 52s; animation-delay: -20s; width: clamp(70px, 10vw, 120px); }
.cloud.c3 { top: 4%; left: -15%; animation-duration: 64s; animation-delay: -44s; }
@keyframes drift { to { transform: translateX(135vw); } }
.hill { position: absolute; border-radius: 50%; }
.hill.h1 { left: -20%; right: 35%; bottom: -24vh; height: 50vh; background: #7cd04f; }
.hill.h2 { left: 30%; right: -25%; bottom: -28vh; height: 52vh; background: #5fbd3e; }
.home-sky .bush { position: absolute; bottom: -12px; width: clamp(140px, 22vw, 300px); transform-origin: bottom center; animation: sway 4s ease-in-out infinite; }
.bush.b1 { left: -30px; } .bush.b2 { right: -30px; transform: scaleX(-1); animation-delay: -2s; }
.twinkle { position: absolute; width: 30px; animation: twinkle 2.4s ease-in-out infinite; }
.t1 { top: 18%; left: 12%; } .t2 { top: 30%; right: 14%; animation-delay: -.8s; } .t3 { top: 52%; left: 6%; animation-delay: -1.6s; width: 24px; }
@keyframes twinkle { 0%, 100% { transform: scale(.7) rotate(0); opacity: .6; } 50% { transform: scale(1.1) rotate(20deg); opacity: 1; } }
@keyframes sway { 0%, 100% { rotate: -2deg; } 50% { rotate: 2deg; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.home-inner { position: relative; z-index: 2; flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 8px;
  display: grid; justify-items: center; align-content: center; gap: 8px; }
.home-logo { margin: 0; width: min(560px, 92vw); filter: drop-shadow(0 10px 16px rgba(0, 40, 80, .22)); animation: logoIn .8s cubic-bezier(.2, 1.4, .4, 1) both, float 5s ease-in-out .8s infinite; }
.home-logo img { width: 100%; display: block; border-radius: 26px; }
@keyframes logoIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.tagline { margin: 0; padding: 4px 18px; border-radius: 999px; background: rgba(15, 70, 140, .72); font: 800 clamp(1rem, 2.4vw, 1.4rem) var(--font-head); color: #fff; letter-spacing: .04em; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.tagline i { font-style: normal; color: var(--gold); }
.home-stage { position: relative; width: min(640px, 100%); }
/* Rangers: sized by HEIGHT so the full body always shows (images are trimmed to the character). */
.home-rangers { --rh: clamp(150px, 30vh, 270px); display: flex; justify-content: center; align-items: flex-end; padding-top: 14px; }
.home-rangers .hr { position: relative; flex: none; margin: 0 calc(var(--rh) * -.06); animation: idle 2.8s ease-in-out infinite; transform-origin: bottom center; }
.home-rangers .hr img { display: block; height: var(--rh); width: auto; max-width: none; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .2)); }
/* a natural group: middle two slightly behind and raised, outer two in front */
.hr.r0 { z-index: 2; } .hr.r3 { z-index: 2; }
.hr.r1 { z-index: 1; margin-bottom: calc(var(--rh) * .05); animation-delay: -.7s; }
.hr.r2 { z-index: 1; margin-bottom: calc(var(--rh) * .03); animation-delay: -1.4s; }
.hr.r3 { animation-delay: -2.1s; }
@keyframes idle { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-5px) scaleY(1.015); } }
.home-animals .peek { position: absolute; width: clamp(48px, 10vw, 86px); animation: bob 2.2s ease-in-out infinite; z-index: -1; }
.home-animals .peek img { display: block; width: 100%; animation: blink 5s infinite; }
.peek.p0 { left: -6%; bottom: 8%; } .peek.p1 { right: -4%; bottom: 6%; animation-delay: -.7s; }
.peek.p2 { left: -12%; bottom: 46%; animation-delay: -1.1s; } .peek.p3 { right: -3%; bottom: 52%; animation-delay: -1.6s; }
.peek.p4 { left: 9%; bottom: 72%; display: none; } .peek.p5 { right: 9%; bottom: 72%; display: none; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes blink { 0%, 92%, 100% { filter: none; } 95% { filter: brightness(.94); transform: scaleY(.97); } }
.home-menu { display: grid; gap: 12px; width: min(460px, 100%); margin-top: 6px; }
.home-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.home-row .gbtn { padding: 8px 6px; font-size: .92rem; flex-direction: column; gap: 2px; min-height: 64px; }
.home-row .gbtn .bi { width: 1.6em; height: 1.6em; }
.backlink { justify-self: center; display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--ink); font: 800 .95rem var(--font-head); text-decoration: none; box-shadow: 0 3px 0 #c8d5ea; }
.backlink svg { width: 18px; height: 18px; color: var(--blue); }
/* Footer: ENGLISH YO! | (i) About Developer */
.credit { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; padding: 8px 16px max(12px, env(safe-area-inset-bottom)); font: 800 .95rem var(--font-head); }
.cr-brand { color: #fff; background: var(--red); padding: 2px 12px; border-radius: 999px; text-decoration: none; box-shadow: 0 2px 0 var(--red-d); }
.cr-sep { color: rgba(23, 48, 92, .45); }
.about-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px 4px 8px; border-radius: 999px; background: rgba(255, 255, 255, .88); color: var(--ink); font: 800 .95rem var(--font-head); box-shadow: 0 2px 0 #c8d5ea; transition: transform .12s, background .12s; }
.about-btn svg { width: 20px; height: 20px; color: var(--blue); }
.about-btn:hover { background: #fff; transform: translateY(-1px); }
.about-btn:active { transform: translateY(2px); box-shadow: none; }
/* Official ENGLISH YO! logo (shared site asset, never altered) */
.ey-brand { justify-self: end; display: block; width: clamp(108px, 26vw, 170px); margin: 0 0 -6px; border-radius: 12px; transition: transform .15s; filter: drop-shadow(0 4px 6px rgba(0, 40, 80, .18)); }
.ey-brand img { display: block; width: 100%; height: auto; }
.ey-brand:hover { transform: translateY(-2px) scale(1.03); }
@media (max-width: 1100px) {
  .peek.p2, .peek.p3 { display: none; }
  .peek.p0 { left: 0; } .peek.p1 { right: 0; }
}
@media (max-width: 640px) {
  .home-animals { display: none; }   /* the rangers fill the width on phones */
  .home-rangers { --rh: min(158px, 41vw); padding: 6px 0 0; }
}
@media (min-width: 960px) and (min-aspect-ratio: 5/4) {
  .home-inner { grid-template-columns: 1.15fr .85fr; grid-template-rows: auto auto 1fr; column-gap: 36px; align-items: center; }
  .home-logo, .tagline, .home-stage { grid-column: 1; }
  .ey-brand { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px; width: clamp(150px, 13vw, 230px); margin: 0; }
  .home-menu { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}
@media (max-height: 700px) and (min-width: 960px) { .home-logo { width: min(440px, 40vw); } .home-rangers { --rh: clamp(140px, 27vh, 190px); } }

/* ── Panels ── */
.panel { background: var(--card); border-radius: 26px; box-shadow: var(--shadow); padding: clamp(16px, 2.5vw, 26px); margin-bottom: 16px; }
.step-h { display: flex; align-items: center; gap: 10px; font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin-bottom: 14px; }
.step-h span { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--orange); color: #fff; box-shadow: 0 3px 0 var(--orange-d); }
.ranger-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ranger-card { position: relative; display: grid; justify-items: center; gap: 6px; padding: 12px 8px 10px; border-radius: 22px; background: linear-gradient(180deg, #f2fbff, #dff3ff); border: 4px solid #cfe6fa; transition: transform .15s, border-color .15s; }
.ranger-card img { width: 100%; max-width: 150px; aspect-ratio: 3 / 4; object-fit: contain; transition: transform .2s; }
.ranger-card span { font: 800 clamp(.9rem, 1.6vw, 1.15rem) var(--font-head); }
.ranger-card:hover img { transform: translateY(-4px) rotate(-2deg); }
.ranger-card.sel { border-color: var(--green); background: linear-gradient(180deg, #f0ffe8, #d3f5c1); transform: translateY(-3px); box-shadow: 0 8px 18px rgba(54, 180, 55, .3); }
.ranger-card.sel::after { content: '✓'; position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 900; }
.name-field { display: grid; gap: 6px; margin-top: 16px; font: 800 1.05rem var(--font-head); }
.name-field small { color: var(--ink-soft); font-weight: 700; }
.name-field input { font: 800 1.15rem var(--font-body); padding: 12px 16px; border-radius: 16px; border: 3px solid var(--line); color: var(--ink); max-width: 360px; }
.name-field input:focus { border-color: var(--blue); outline: none; }
.phase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.phase-card { position: relative; text-align: left; display: grid; gap: 6px; padding: 18px 18px 16px; border-radius: 22px; border: 4px solid var(--line); background: #fff; transition: transform .15s, border-color .15s; }
.phase-card.pb { background: linear-gradient(160deg, #fffbe8, #fff1c4); }
.phase-card.pc { background: linear-gradient(160deg, #eef6ff, #d8e9ff); }
.ph-tag { justify-self: start; padding: 3px 12px; border-radius: 999px; color: #fff; font: 800 .9rem var(--font-head); background: var(--orange); }
.pc .ph-tag { background: var(--blue); }
.ph-title { font: 800 clamp(1.2rem, 2.4vw, 1.6rem) var(--font-head); }
.ph-grades { color: var(--ink-soft); font-size: .95rem; }
.phase-card ul { margin: 4px 0 0; padding-left: 20px; font-size: .95rem; line-height: 1.45; font-weight: 700; }
.ph-check { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; display: none; place-items: center; background: var(--green); color: #fff; font-weight: 900; }
.phase-card.sel { border-color: var(--green); transform: translateY(-3px); box-shadow: 0 8px 18px rgba(54, 180, 55, .28); }
.phase-card.sel .ph-check { display: grid; }
.setup-go { display: grid; justify-items: center; gap: 6px; }
.setup-msg { margin: 0; min-height: 1.3em; color: var(--red-d); font-weight: 800; }
@media (max-width: 640px) { .ranger-grid { grid-template-columns: repeat(2, 1fr); } .phase-grid { grid-template-columns: 1fr; } }

/* ── Guide bubble ── */
.guide { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.guide-r { height: clamp(110px, 16vw, 170px); width: auto; flex: none; animation: idle 2.6s ease-in-out infinite; transform-origin: bottom; }
.bubble { position: relative; margin: 0; padding: 12px 18px; background: #fff; border-radius: 20px; border: 3px solid #cfe2f7; box-shadow: var(--shadow); font: 800 clamp(1rem, 2vw, 1.25rem)/1.3 var(--font-head); }
.bubble small { display: block; font: 700 .85rem var(--font-body); color: var(--ink-soft); margin-top: 2px; }
.guide .bubble::before, .helper .bubble::before { content: ''; position: absolute; left: -13px; bottom: 16px; border: 10px solid transparent; border-right-color: #cfe2f7; border-left: 0; }
.note { display: flex; gap: 10px; align-items: center; margin: 18px auto 0; max-width: 820px; padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, .85); font-size: .95rem; line-height: 1.4; box-shadow: var(--shadow); }
.note .ni { width: 40px; flex: none; }

/* ── World map ── */
.world-map { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 4px;
  padding: clamp(14px, 3vw, 28px); border-radius: 30px; background: linear-gradient(160deg, #f8edc8, #f1dca0); border: 5px solid #d6b56a; box-shadow: var(--shadow), inset 0 0 0 4px rgba(255, 255, 255, .5); }
.wnode-wrap { flex: 0 1 172px; }
.wnode { display: grid; gap: 6px; width: 100%; padding: 10px; border-radius: 24px; background: #fff; box-shadow: 0 6px 0 #d8c58e, 0 10px 18px rgba(0, 0, 0, .12); transition: transform .15s; text-align: center; }
.wnode:hover:not(.locked) { transform: translateY(-4px) rotate(-1deg); }
.wthumb { position: relative; display: block; border-radius: 18px; overflow: visible; border: 4px solid var(--wc); aspect-ratio: 1; }
.wthumb > img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; display: block; }
.wnode.locked .wthumb > img { filter: grayscale(.9) brightness(.85); }
.wthumb .lock { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.wthumb .lock svg { width: 46%; height: 46%; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.wthumb .here { position: absolute; right: -10px; bottom: -14px; height: 70%; animation: bob 2s ease-in-out infinite; }
.wthumb .here img { height: 100%; width: auto;  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, .3)); }
.wsign { display: grid; padding: 4px 8px; border-radius: 12px; background: linear-gradient(#a8693a, #7d4a24); color: #fff; font-family: var(--font-head); text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.wsign b { font-size: 1.05rem; } .wsign em { font-style: normal; font-size: 1.35rem; color: var(--gold); line-height: 1; }
.wmeta { display: flex; align-items: center; gap: 8px; }
.wbadge { width: 40px; flex: none; } .wbadge.dim, .dim { filter: grayscale(1) opacity(.45); }
.wbar { flex: 1; height: 12px; border-radius: 99px; background: #e6edf7; overflow: hidden; display: block; }
.wbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), #9be15d); transition: width .5s; }
.wbar.big { height: 16px; margin: 6px 0; }
.wmeta small { font: 800 .9rem var(--font-head); }
.wpath { width: 40px; flex: none; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@media (max-width: 560px) {
  .world-map { flex-direction: column; flex-wrap: nowrap; }
  .wnode-wrap { flex: none; width: min(300px, 100%); }
  .wnode { grid-template-columns: 110px 1fr; grid-template-rows: auto auto; text-align: left; align-items: center; }
  .wthumb { grid-row: 1 / span 2; }
  .wpath { transform: rotate(90deg); animation: none; width: 40px; }
}

/* ── World screen ── */
.world-bg { position: fixed; inset: 0; z-index: 0; background-size: cover; background-position: center; filter: blur(3px) saturate(1.1); }
.world-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .05) 40%, rgba(0, 30, 60, .25)); }
.world-bg.dim { filter: blur(6px) saturate(1.05) brightness(1.05); }
.wtitle { color: var(--ink); }
.world-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 24px; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); margin-bottom: 16px; }
.whead-badge { width: clamp(56px, 8vw, 80px); flex: none; }
.whead-prog { flex: 1; display: grid; }
.whead-prog small { color: var(--ink-soft); font-size: .92rem; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 44vw), 1fr)); gap: 14px; }
.mcard { position: relative; display: grid; justify-items: center; gap: 6px; padding: 12px 10px 14px; border-radius: 24px; background: rgba(255, 255, 255, .95); border: 4px solid #fff; box-shadow: 0 6px 0 rgba(23, 48, 92, .18), 0 10px 18px rgba(0, 0, 0, .12); transition: transform .15s; }
.mcard:hover:not(.locked) { transform: translateY(-4px); }
.mcard.done { border-color: #bde9a6; }
.mcard.boss { background: linear-gradient(180deg, #fff6d6, #ffe7a0); border-color: #ffcf4d; }
.m-mode { display: flex; align-items: center; gap: 6px; font: 800 .88rem var(--font-head); color: var(--ink-soft); }
.m-mode img { width: 28px; height: 28px; object-fit: contain; }
.m-art { position: relative; display: grid; place-items: center; width: 100%; height: clamp(96px, 14vw, 130px); }
.m-ani { max-height: 100%; width: auto; max-width: 80%; object-fit: contain; animation: bob 2.6s ease-in-out infinite; }
.mcard:nth-child(2n) .m-ani { animation-delay: -1s; }
.sil { filter: brightness(0) opacity(.28); animation: none !important; }
.ltimg { display: inline-block; width: 44px; height: 44px; object-fit: contain; }
.ltimg.m-ltr { position: absolute; left: 4px; top: 0; width: 48px; height: 48px; }
.trail-art { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.trail-art .ltimg { width: 38px; height: 38px; }
.m-name { font: 800 1.1rem var(--font-head); }
.m-play { padding: 4px 14px; border-radius: 999px; background: var(--green); color: #fff; font: 800 .95rem var(--font-head); box-shadow: 0 3px 0 var(--green-d); text-align: center; }
.mcard.locked .m-play { background: #9aa6b8; box-shadow: 0 3px 0 #6d7a8e; font-size: .8rem; }
.mcard.locked .m-ani { filter: brightness(0) opacity(.3); }
.barrier { position: absolute; inset: 4px 12%; border-radius: 20px; background: repeating-linear-gradient(90deg, rgba(140, 78, 232, .55) 0 6px, transparent 6px 18px); box-shadow: 0 0 18px rgba(140, 78, 232, .6) inset; animation: glow 1.6s ease-in-out infinite alternate; }
.m-art .lock { position: absolute; color: var(--purple-d); }
.m-art .lock svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 0 #fff); }
@keyframes glow { from { opacity: .6; } to { opacity: 1; } }
.stars { display: inline-flex; gap: 2px; }
.stars img { width: 26px; height: 26px; object-fit: contain; }
.stars img.off { filter: grayscale(1) opacity(.3); }
.stars.mini img { width: 20px; height: 20px; vertical-align: middle; }

/* ── FX layer ── */
.fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.fx i { position: absolute; left: var(--x); top: -40px; animation: fall var(--d) linear var(--delay) infinite; scale: var(--s); }
.fx-leaves i img { width: 34px; }
.fx-snow i { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, .9); }
.fx-dust i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 220, 140, .8); }
.fx-bubbles i, .fx-fireflies i { top: auto; bottom: -30px; animation-name: rise; }
.fx-bubbles i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .8) 0 18%, rgba(255, 255, 255, .12) 20%); }
.fx-fireflies i { width: 8px; height: 8px; border-radius: 50%; background: #fff59a; box-shadow: 0 0 10px 4px rgba(255, 240, 120, .7); animation-name: rise, flicker; animation-duration: var(--d), 1.4s; }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(30px, 55vh) rotate(180deg); } 100% { transform: translate(-10px, 110vh) rotate(360deg); } }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 50% { transform: translate(18px, -55vh); } 100% { transform: translate(-12px, -110vh); opacity: 0; } }
@keyframes flicker { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ── Mission ── */
.mission-screen .topbar { z-index: 20; }
.rdots { display: inline-flex; gap: 6px; padding: 0 4px; }
.rdots i { width: 16px; height: 16px; border-radius: 50%; background: #dce5f2; border: 2px solid #c3d0e4; }
.rdots i.now { background: var(--gold); border-color: #e0a800; transform: scale(1.2); }
.rdots i.done { background: var(--green); border-color: var(--green-d); }
.helper { position: relative; z-index: 3; display: flex; align-items: flex-end; gap: 8px; width: 100%; max-width: 1000px; margin: 10px auto 0; padding: 0 clamp(12px, 3vw, 24px); }
.helper-r { height: clamp(78px, 11vw, 120px); width: auto; flex: none; animation: idle 2.6s ease-in-out infinite; transform-origin: bottom; }
.helper .bubble { flex: 1; font-size: clamp(.98rem, 1.9vw, 1.2rem); min-height: 50px; transition: background .2s, border-color .2s; }
.helper .bubble .ltile { vertical-align: middle; }
.bubble.yay { background: #ecffe2; border-color: #9fdf7f; }
.bubble.oops { background: #fff3e6; border-color: #ffc98a; }
.bubble.hint { background: #eaf5ff; border-color: #9fcdf5; }
.stage { position: relative; z-index: 2; width: 100%; max-width: 1000px; margin: 0 auto; padding: 12px clamp(12px, 3vw, 24px) 28px; display: grid; gap: 14px; align-content: start; }
.stage.in { animation: screenIn .35s ease both; }
.prompt-card, .clue-card { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding: 16px 18px; border-radius: var(--radius); background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); text-align: center; }
.prompt { margin: 0; font: 800 clamp(1.15rem, 2.6vw, 1.7rem)/1.25 var(--font-head); }
.rlabel { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); padding: 3px 14px; border-radius: 999px; background: var(--purple); color: #fff; font: 800 .85rem var(--font-head); white-space: nowrap; box-shadow: 0 3px 0 var(--purple-d); }
.listen svg { width: 1.5em; height: 1.5em; }
.ear { display: grid; place-items: center; width: clamp(72px, 12vw, 104px); height: clamp(72px, 12vw, 104px); border-radius: 50%; color: #fff; background: radial-gradient(circle at 35% 30%, #6cc2ff, var(--blue)); border: 4px solid var(--blue-d); box-shadow: 0 6px 0 var(--blue-d), 0 0 0 0 rgba(31, 139, 230, .5); animation: ring 2s ease-out infinite; }
.ear svg { width: 56%; height: 56%; }
.ear:active { transform: translateY(4px); }
@keyframes ring { 0% { box-shadow: 0 6px 0 var(--blue-d), 0 0 0 0 rgba(31, 139, 230, .45); } 100% { box-shadow: 0 6px 0 var(--blue-d), 0 0 0 22px rgba(31, 139, 230, 0); } }
.word-fallback { flex-basis: 100%; margin: 0; font: 800 2rem var(--font-head); color: var(--blue-d); }
.word-fallback.sm { font-size: 1.4rem; }
.novoice, .hint-line { flex-basis: 100%; margin: 0; font-size: .92rem; color: var(--ink-soft); }
.hint-line:empty { display: none; }
.hint-line { display: flex; align-items: center; justify-content: center; gap: 8px; font: 800 1.1rem var(--font-head); color: var(--ink); }

/* Letter tiles */
.ltile { --tc: #1f8be6; position: relative; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 16px;
  font: 800 2.2rem/1 var(--font-head); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  background: var(--tc); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 62%, #fff) 0%, var(--tc) 52%, color-mix(in srgb, var(--tc) 85%, #000) 100%);
  border: 3px solid color-mix(in srgb, var(--tc) 70%, #000); box-shadow: 0 4px 0 color-mix(in srgb, var(--tc) 60%, #000), inset 0 3px 0 rgba(255, 255, 255, .45); user-select: none; }
.ltile.big { width: auto; min-width: 84px; height: 84px; padding: 0 14px; font-size: 3rem; border-radius: 20px; letter-spacing: .08em; }
.ltile.sm { width: 40px; height: 40px; font-size: 1.4rem; border-radius: 11px; }
.ltile.huge { width: clamp(84px, 16vw, 130px); height: clamp(84px, 16vw, 130px); font-size: clamp(3rem, 7vw, 4.6rem); border-radius: 26px; }
button.ltile { transition: transform .12s; }
button.ltile:hover:not(:disabled) { transform: translateY(-3px); }
button.ltile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--tc) 60%, #000); }
.ltile.used { opacity: .25; transform: scale(.9); box-shadow: none; }

/* Find Me scene */
.scene { position: relative; border-radius: 26px; overflow: hidden; background-size: cover; background-position: center bottom; aspect-ratio: 16 / 8; min-height: 240px; max-height: max(260px, calc(100dvh - 250px)); width: 100%; box-shadow: var(--shadow), inset 0 0 0 5px rgba(255, 255, 255, .7); }
.scene::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(transparent, rgba(60, 120, 30, .35)); }
.scene-row { position: absolute; inset: 6% 3% 4%; display: flex; flex-wrap: wrap; justify-content: space-around; align-items: flex-end; align-content: flex-end; gap: 6px; }
.critter { position: relative; display: grid; justify-items: center; width: clamp(84px, 17vw, 175px); padding: 4px; border-radius: 22px; transition: transform .2s; }
.critter img { width: 100%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .28)); animation: bob 2.4s ease-in-out infinite; }
.critter.c1 { margin-bottom: 9%; } .critter.c1 img { animation-delay: -.6s; }
.critter.c2 img { animation-delay: -1.2s; } .critter.c3 { margin-bottom: 12%; } .critter.c3 img { animation-delay: -1.7s; }
.critter.c4 img { animation-delay: -.3s; }
.critter:hover img { transform: scale(1.06); }
.clabel { display: inline-block; margin-top: 4px; padding: 2px 12px; border-radius: 999px; background: #fff; color: var(--ink); font: 800 clamp(.9rem, 1.6vw, 1.15rem) var(--font-head); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); white-space: nowrap; }
.sc-bush { position: absolute; bottom: -10px; width: 22%; pointer-events: none; z-index: 1; }
.sc-bush.l { left: -4%; } .sc-bush.r { right: -4%; transform: scaleX(-1); }
.critter { z-index: 2; }
.critter.jump img { animation: happy .7s ease 2; }
.critter.fade { opacity: .35; filter: grayscale(.6); }
@keyframes happy { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-34px) scale(1.1) rotate(-6deg); } 70% { transform: translateY(0) scale(.95, 1.05); } }
@media (max-width: 640px) and (orientation: portrait) {
  .scene { aspect-ratio: 4 / 5; }
  .scene-row { inset: 4% 2% 3%; }
  .critter { width: 31%; }
  .scene-row.n3 .critter { width: 46%; }
  .critter.c1, .critter.c3 { margin-bottom: 0; }
}

/* Choices */
.choices { display: grid; gap: 12px; justify-content: center; }
.choices.pics { grid-template-columns: repeat(var(--cols, 3), minmax(0, 220px)); }
.choices.pics.n4 { --cols: 4; }
.choice.pic { position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 8px; border-radius: 22px; background: #fff; border: 4px solid #e1eaf6; box-shadow: 0 6px 0 #c8d5ea; transition: transform .15s, border-color .15s; }
.choice.pic img { width: 100%; max-width: 170px; aspect-ratio: 1; object-fit: contain; }
.choice.pic:hover { transform: translateY(-3px); border-color: #9fcdf5; }
.choice .num { position: absolute; top: 6px; left: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef4ff; font: 800 .85rem var(--font-head); color: var(--ink-soft); }
.choices.words { grid-template-columns: repeat(2, minmax(0, 320px)); }
.choices.words.n3 { grid-template-columns: repeat(3, minmax(0, 260px)); }
.choice.word { position: relative; min-height: 72px; padding: 12px 18px 12px 44px; border-radius: 20px; background: #fff; border: 4px solid #e1eaf6; box-shadow: 0 6px 0 #c8d5ea; font: 800 clamp(1.2rem, 2.4vw, 1.6rem) var(--font-head); }
.choice.word .num { top: 50%; transform: translateY(-50%); left: 10px; }
.choice.word:hover { border-color: #9fcdf5; }
.choices.letters { display: flex; flex-wrap: wrap; gap: clamp(10px, 2vw, 18px); }
.choices.letters .ltile { width: clamp(68px, 12vw, 100px); height: clamp(68px, 12vw, 100px); font-size: clamp(2.2rem, 5vw, 3.4rem); border-radius: 22px; }
.choices.letters .ltile.huge { width: clamp(84px, 16vw, 130px); height: clamp(84px, 16vw, 130px); }
.right { border-color: var(--green) !important; box-shadow: 0 6px 0 var(--green-d), 0 0 0 6px rgba(54, 180, 55, .25) !important; }
.ltile.right { box-shadow: 0 0 0 6px rgba(54, 180, 55, .5) !important; transform: scale(1.08); }
.glow { animation: glowPulse 1.1s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 46, .9); } 50% { box-shadow: 0 0 0 10px rgba(255, 207, 46, .35); } }
.shake { animation: shake .45s ease; }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -9px; } 40% { translate: 8px; } 60% { translate: -6px; } 80% { translate: 4px; } }
@media (max-width: 640px) {
  .choices.pics, .choices.pics.n4 { --cols: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choices.pics.n3 > :last-child { grid-column: 1 / -1; justify-self: center; width: 50%; }
  .choices.words, .choices.words.n3 { grid-template-columns: 1fr; width: 100%; }
}

/* Who am I */
.clue-card { flex-direction: column; background: linear-gradient(180deg, #fffdf3, #fff3cc); border: 4px solid #f1d27b; }
.clue-card h3 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--orange-d); }
.clue { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 800 clamp(1.1rem, 2.4vw, 1.5rem)/1.3 var(--font-head); }
.clue li { padding: 4px 14px; border-radius: 12px; transition: background .2s; }
.clue li.reading { background: #ffe49a; }
.clue-end { margin: 0; font: 800 clamp(1.1rem, 2.4vw, 1.5rem) var(--font-head); color: var(--purple-d); }

/* Spelling */
.spell-top { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px 24px; flex-wrap: wrap; padding: 16px; border-radius: var(--radius); background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); }
.spell-pic img { width: clamp(110px, 18vw, 170px); aspect-ratio: 1; object-fit: contain; animation: bob 2.6s ease-in-out infinite; }
.spell-side { display: grid; gap: 10px; justify-items: center; }
.spell-side h3 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(5px, 1.2vw, 10px); padding: 14px; border-radius: var(--radius); background: rgba(255, 255, 255, .7); }
.slot { --tc: transparent; display: grid; place-items: center; width: clamp(42px, 8.5vw, 72px); height: clamp(48px, 9.5vw, 80px); border-radius: 14px; border: 3px dashed #9fb3d1; background: #fff; font: 800 clamp(1.6rem, 4vw, 2.6rem) var(--font-head); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); transition: background .15s; }
.slot.filled { border: 3px solid color-mix(in srgb, var(--tc) 70%, #000); background: var(--tc); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 62%, #fff), var(--tc) 55%); box-shadow: 0 4px 0 color-mix(in srgb, var(--tc) 60%, #000); }
.slot.locked { outline: 3px solid var(--gold); outline-offset: 2px; }
.slot.over { border-color: var(--green); background: #eaffdf; transform: scale(1.06); }
.slot.ok { box-shadow: 0 0 0 5px rgba(54, 180, 55, .45); }
.slot.pop { animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.6) translateY(-20px); } 70% { transform: scale(1.12); } 100% { transform: none; } }
.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 1.6vw, 14px); padding: 6px; touch-action: none; }
.tray .tt { width: clamp(54px, 10vw, 82px); height: clamp(54px, 10vw, 82px); font-size: clamp(1.9rem, 4.4vw, 2.8rem); border-radius: 18px; touch-action: none; }
.tray .tt.lifting { opacity: .3; }
.ltile.ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) scale(1.12) rotate(-4deg); box-shadow: 0 14px 22px rgba(0, 0, 0, .3); display: grid; font-size: 2.6rem; }
.spell-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* First letter / gaps */
.gapword { flex-basis: 100%; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; font: 800 clamp(2rem, 6vw, 3.4rem)/1 var(--font-head); letter-spacing: .02em; }
.gapword .gl { min-width: .8em; text-align: center; }
.gapword .gap { display: inline-grid; place-items: center; min-width: 1.1em; padding: 0 .1em; border-radius: 12px; border: 4px dashed var(--orange); color: var(--orange-d); background: #fff6e0; }
.gapword .gap.fill { border-style: solid; border-color: var(--green); color: var(--green-d); background: #eaffdf; animation: pop .35s ease; }
.gapword.trail .gl, .gapword.trail .gap { min-width: 1.3em; padding: 4px; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 #d6e1f0; }
.abc-guide { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; font: 800 1rem var(--font-head); color: #9fb0c8; }
.abc-guide span { width: 26px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: #f2f6fb; }
.abc-guide span.hl { background: #fff1b8; color: var(--ink); }
.trail-path { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 14px; border-radius: var(--radius); background: linear-gradient(180deg, #f8e3b0, #ecca7e); border: 4px solid #d6b56a; }
.tstone { display: grid; place-items: center; width: clamp(50px, 9vw, 70px); height: clamp(50px, 9vw, 70px); border-radius: 50%; background: #c99a52; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2); }
.tstone.set { background: #fff3cf; animation: pop .3s ease; }
.tstone .ltile.sm { width: 44px; height: 44px; }
.tdot { width: 10px; height: 10px; border-radius: 50%; background: #a8783c; }

/* X special */
.xrow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; }
.xfox { width: clamp(110px, 20vw, 180px); animation: bob 2.4s ease-in-out infinite; }
.xrow.sm .xfox { width: clamp(80px, 14vw, 120px); }

/* Boss */
.boss-bar { position: relative; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; width: 100%; max-width: 1000px; margin: 10px auto 0; padding: 8px clamp(12px, 3vw, 24px); }
.boss-bar p { margin: 0; padding: 8px 14px; border-radius: 16px; background: rgba(255, 255, 255, .9); font: 800 1rem var(--font-head); }
.boss-cage { position: relative; display: grid; place-items: center; width: clamp(110px, 16vw, 150px); height: clamp(110px, 16vw, 150px); border-radius: 26px; background: rgba(255, 255, 255, .5); }
.boss-ani { width: 80%; }
.boss-ani.sil { filter: brightness(0) opacity(.4); }
.cage-glow { position: absolute; inset: 0; border-radius: 26px; border: 4px solid #b98cff; background: repeating-linear-gradient(90deg, rgba(140, 78, 232, .5) 0 7px, transparent 7px 20px); box-shadow: 0 0 22px rgba(140, 78, 232, .8), inset 0 0 18px rgba(140, 78, 232, .6); animation: glow 1.2s ease-in-out infinite alternate; transition: opacity .8s, transform .8s; }
.locks { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.blk { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--purple); color: #fff; border: 2px solid #fff; transition: transform .3s, background .3s; }
.blk svg { width: 18px; height: 18px; }
.blk.broken { background: var(--green); transform: scale(1.15) rotate(20deg); }
.boss-bar.freed .cage-glow { opacity: 0; transform: scale(1.3); }
.boss-bar.freed .boss-ani { filter: none; animation: happy .8s ease 3; }
.boss-bar.freed p { display: none; }

/* Reward */
.reward-stage { justify-items: center; }
.reward { position: relative; display: grid; justify-items: center; gap: 10px; width: min(640px, 100%); padding: 26px 18px 22px; border-radius: 30px; background: linear-gradient(180deg, #fffdf2, #fff1c2); border: 5px solid #ffd45a; box-shadow: 0 14px 30px rgba(0, 0, 0, .2); overflow: hidden; text-align: center; }
.rw-rays { position: absolute; top: -40%; left: 50%; width: 900px; height: 900px; margin-left: -450px; background: repeating-conic-gradient(rgba(255, 210, 63, .22) 0 10deg, transparent 10deg 20deg); animation: spin 30s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.reward > * { position: relative; }
.reward > .rw-rays { position: absolute; }
.rw-title { font-size: clamp(2rem, 6vw, 3.2rem); color: #fff; padding: 4px 26px; border-radius: 18px; background: linear-gradient(#b0703f, #7d4a24); border: 4px solid #5d3416; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); transform: rotate(-2deg); animation: logoIn .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.rw-ani img { width: clamp(140px, 30vw, 220px); animation: happy 1s ease .3s 3; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .25)); }
.rw-name { margin: 0; display: flex; align-items: center; gap: 10px; font: 800 clamp(1.4rem, 3.4vw, 2rem) var(--font-head); }
.rw-trail { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rw-stars { display: flex; gap: 8px; }
.rw-stars .rs { width: clamp(52px, 10vw, 72px); animation: starIn .5s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: calc(.4s + var(--i) * .25s); }
.rw-stars .rs.off { filter: grayscale(1) opacity(.3); }
.rw-stars .rs:nth-child(2) { translate: 0 -10px; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.rw-coins, .rw-book { display: flex; align-items: center; gap: 8px; margin: 0; font: 800 1.15rem var(--font-head); }
.rw-coins img, .rw-book img { width: 36px; }
.rw-coins.muted { color: var(--ink-soft); font-size: 1rem; }
.rw-badge, .rw-ach { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 20px; background: #fff; box-shadow: 0 4px 0 #f1d27b; text-align: left; }
.rw-badge img { width: 74px; animation: starIn .7s cubic-bezier(.2, 1.6, .4, 1) .8s both; }
.rw-badge p, .rw-ach p { margin: 0; font-size: 1rem; }
.rw-badge b { font: 800 1.2rem var(--font-head); color: var(--green-d); }
.rw-ach img { width: 52px; }
.rw-ach small { display: block; color: var(--orange-d); font-weight: 900; }
.rw-ach b { display: block; font: 800 1.15rem var(--font-head); }
@media (max-height: 820px) { .rw-ani img { width: clamp(100px, 18vh, 150px); } .reward { gap: 6px; padding-top: 18px; } .rw-stars .rs { width: 48px; } }
.rw-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.spark { position: fixed; z-index: 90; width: 26px; pointer-events: none; transform: translate(-50%, -50%); animation: spark .75s ease-out forwards; }
@keyframes spark { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.3) rotate(180deg); opacity: 0; } }
.fx-canvas { position: fixed; inset: 0; z-index: 80; pointer-events: none; width: 100%; height: 100%; }

/* ── Book ── */
.book-head { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); margin-bottom: 12px; }
.book-icon { width: clamp(64px, 9vw, 96px); flex: none; transform: rotate(-6deg); }
.bh-prog { flex: 1; display: grid; }
.bh-prog > b { font: 800 1.3rem var(--font-head); }
.ach-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ach { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 999px; background: #f0f3f8; filter: grayscale(1) opacity(.55); }
.ach.on { background: #fff4c2; filter: none; }
.ach img { width: 26px; height: 26px; object-fit: contain; }
.ach small { font: 800 .75rem var(--font-head); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px 6px 8px; border-radius: 999px; background: #fff; border: 3px solid #dfe8f5; font: 800 .95rem var(--font-head); }
.chip img { width: 26px; }
.chip small { color: var(--ink-soft); }
.chip.on { border-color: var(--wc, var(--green)); background: color-mix(in srgb, var(--wc, var(--green)) 15%, #fff); }
.abc-jump { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; margin-bottom: 14px; }
.abc-jump button { min-height: 38px; border-radius: 9px; background: #e9eef6; color: #9aa6b8; font: 800 1.05rem var(--font-head); }
.abc-jump button.got { background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 42vw), 1fr)); gap: 12px; }
.bcard { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 8px 12px; border-radius: 22px; background: #fff; border: 4px solid #e4ebf5; box-shadow: 0 5px 0 #cfdaea; transition: transform .15s; }
.bcard.got { background: linear-gradient(180deg, #fffdf3, #fff3cc); border-color: #ffd45a; box-shadow: 0 5px 0 #e9bd3c; }
.bcard:hover { transform: translateY(-3px) rotate(-1deg); }
.bcard > img { width: 80%; aspect-ratio: 1; object-fit: contain; }
.bcard .bl { position: absolute; top: 6px; left: 6px; width: 40px; height: 40px; }
.bname { font: 800 1.05rem var(--font-head); }
.bq { font-size: .78rem; color: var(--ink-soft); }
@media (max-width: 560px) { .abc-jump { grid-template-columns: repeat(9, 1fr); } }
@media (max-width: 400px) { .abc-jump { grid-template-columns: repeat(7, 1fr); } .abc-jump button { min-height: 42px; } }

/* ── Modal ── */
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(14, 30, 60, .55); backdrop-filter: blur(3px); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { position: relative; width: min(600px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px clamp(16px, 4vw, 30px) 22px; border-radius: 28px; background: #fff; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: modalIn .3s cubic-bezier(.2, 1.3, .4, 1); text-align: center; }
@keyframes modalIn { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.modal h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 12px; color: var(--ink); }
.modal p { line-height: 1.45; }
.mclose { position: absolute; top: 10px; right: 10px; width: 48px; height: 44px; z-index: 2; }
.howto { text-align: left; padding-left: 22px; line-height: 1.5; display: grid; gap: 8px; }
.howto .modes { list-style: none; padding: 6px 0; margin: 0; display: grid; gap: 6px; }
.howto .modes li { display: grid; grid-template-columns: 34px 1fr; align-items: center; column-gap: 10px; font-size: .95rem; }
.howto .modes li img { grid-row: span 2; }
.howto .modes img { width: 32px; flex: none; }
.howto .modes b { font-family: var(--font-head); }
.starrule { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; padding: 10px; border-radius: 16px; background: #fff8de; font-size: .9rem; }
.starrule .stars img { width: 20px; height: 20px; }
.small { font-size: .9rem; color: var(--ink-soft); }
.teacher { text-align: left; margin: 10px 0 14px; padding: 10px 14px; border-radius: 16px; background: #f1f6fd; font-size: .92rem; }
.teacher summary { cursor: pointer; font: 800 1rem var(--font-head); }
.set-grid { display: grid; gap: 12px; text-align: left; }
.tog { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; cursor: pointer; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog .sw { position: relative; width: 58px; height: 32px; border-radius: 99px; background: #c7d1df; transition: background .2s; flex: none; }
.tog .sw::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.tog input:checked + .sw { background: var(--green); }
.tog input:checked + .sw::after { transform: translateX(26px); }
.tog input:focus-visible + .sw { outline: 4px solid var(--gold); outline-offset: 2px; }
.rng { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; }
.rng input { flex: 1; accent-color: var(--blue); height: 32px; }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seg legend { float: left; margin-right: 10px; font-size: 1.05rem; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 999px; background: #eef3fa; border: 2px solid #dbe4f1; font-family: var(--font-head); }
.seg input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue-d); }
.seg input:focus-visible + span { outline: 4px solid var(--gold); }
.voice-info { margin: 14px 0 6px; padding: 10px; border-radius: 14px; background: #f1f6fd; font-size: .9rem; text-align: left; }
.set-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.card-modal { background: linear-gradient(180deg, #fffdf3, #fff1c2); border: 5px solid #ffd45a; width: min(440px, 100%); }
.flip { perspective: 1000px; }
.card-face { display: grid; justify-items: center; gap: 8px; animation: flipIn .55s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes flipIn { from { transform: rotateY(90deg); opacity: .4; } to { transform: none; opacity: 1; } }
.cf-top { display: flex; align-items: center; gap: 10px; }
.cf-top .lower { font: 800 3rem var(--font-head); color: var(--ink-soft); }
.stamp { padding: 4px 12px; border: 3px solid var(--green); border-radius: 10px; color: var(--green-d); font: 800 1rem var(--font-head); transform: rotate(8deg); }
.cf-img img { width: clamp(150px, 46vw, 210px); animation: bob 2.4s ease-in-out infinite; }
.cf-name { font-size: 2.2rem; letter-spacing: .04em; }
.cf-x { margin: 0; font-size: 1rem; }
.cf-fact, .cf-home, .cf-id { margin: 0; width: 100%; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, .8); font-size: 1rem; text-align: left; }
.cf-foot { display: grid; justify-items: center; gap: 2px; color: var(--ink-soft); font-size: .85rem; }
.confirm-modal { width: min(460px, 100%); }

/* Caption shown when speech can't play */
.caption { position: fixed; left: 50%; bottom: max(84px, calc(env(safe-area-inset-bottom) + 72px)); z-index: 75; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 18px; border-radius: 18px; background: #fff; border: 3px solid var(--blue); color: var(--ink); font: 800 clamp(1.1rem, 2.6vw, 1.5rem) var(--font-head); box-shadow: var(--shadow); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.caption.in { opacity: 1; transform: translate(-50%, 0); }
.caption svg { width: 28px; height: 28px; flex: none; color: var(--blue); }
.voice-info p { margin: 0 0 4px; }
.voice-pick { display: grid; gap: 6px; margin-top: 14px; text-align: left; font-size: 1.05rem; }
.voice-pick select { font: 700 1rem var(--font-body); padding: 10px 12px; border-radius: 14px; border: 3px solid var(--line); color: var(--ink); background: #fff; max-width: 100%; }
.critter.tried, .choice.tried, .ltile.tried { opacity: .35; filter: grayscale(.8); cursor: default; }
.critter.tried img { animation: none; }
.voice-info .warn { color: var(--red-d); font-weight: 800; }
.replay-top { min-height: 42px; padding: 4px 12px; font-size: .9rem; }
.replay-top svg { width: 1.3em; height: 1.3em; }
@media (max-width: 760px) { .replay-top span { display: none; } .replay-top { padding: 4px 10px; } }

/* About Developer popup */
.about-modal { width: min(460px, 100%); padding-top: 30px; background: linear-gradient(180deg, #ffffff 0%, #f1f8ff 55%, #fff6dc 100%); border: 5px solid #ffd45a; }
.about { display: grid; justify-items: center; gap: 10px; }
.about-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: 999px; background: var(--purple); color: #fff; font: 800 .85rem var(--font-head); letter-spacing: .04em; box-shadow: 0 3px 0 var(--purple-d); }
.about-tag svg { width: 18px; height: 18px; }
.about-avatar { width: clamp(104px, 30vw, 128px); height: auto; aspect-ratio: 1; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 0 4px var(--blue), 0 10px 22px rgba(0, 40, 80, .2); object-fit: cover; }
.about h2 { margin: 4px 0 0; font-size: clamp(1.5rem, 5vw, 1.9rem); }
.about-role { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; }
.about-role span { padding: 4px 12px; border-radius: 999px; background: #eaf5ff; color: var(--blue-d); font: 800 .95rem var(--font-head); }
.about-role span + span { background: #fff1c2; color: #8a5a00; }
.about-text { margin: 4px 0 0; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .85); font-size: 1rem; line-height: 1.5; color: var(--ink); }
.about-logo { display: block; width: min(190px, 60%); margin-top: 2px; }
.about-logo img { display: block; width: 100%; height: auto; }
.about-close { min-width: 160px; margin-top: 4px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 70; display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 18px; background: #17305c; color: #fff; font-size: 1rem; box-shadow: 0 10px 26px rgba(0, 0, 0, .3); transform: translate(-50%, 140%); transition: transform .3s cubic-bezier(.2, 1.3, .4, 1); }
.toast.in { transform: translate(-50%, 0); }
.toast .ti { width: 34px; height: 34px; flex: none; color: #ffcf2e; }

/* Final certificate */
.final { display: grid; justify-items: center; gap: 16px; }
.cert { position: relative; display: grid; justify-items: center; gap: 6px; width: min(680px, 100%); padding: 40px 24px 26px; border-radius: 30px; background: linear-gradient(180deg, #fffdf3, #fff0bd); border: 8px double #e0a800; box-shadow: var(--shadow); text-align: center; }
.cert-crown { position: absolute; top: -34px; width: 90px; }
.cert-small { margin: 0; color: var(--ink-soft); }
.cert h3 { font-size: clamp(1.6rem, 5vw, 2.6rem); color: var(--orange-d); }
.cert-r { display: flex; align-items: flex-end; gap: 8px; }
.cert-r img { height: clamp(150px, 28vw, 220px); width: auto; }
.cert-r .cert-trophy { height: auto; width: clamp(60px, 12vw, 90px); }
.cert-name { margin: 0; font: 800 clamp(1.8rem, 5vw, 2.6rem) var(--font-head); color: var(--blue-d); border-bottom: 3px solid #e0a800; padding: 0 20px; }
.cert-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cert-stats img { width: 26px; }
.cert-badges { display: flex; gap: 6px; }
.cert-badges img { width: clamp(44px, 9vw, 60px); }
.cert-date { margin: 0; color: var(--ink-soft); }

/* ── Large displays / interactive flat panels ── */
@media (min-width: 1600px) {
  html { font-size: 19px; }
  .wrap, .stage, .helper, .boss-bar { max-width: 1400px; }
  .stage { max-width: 1240px; }
  .imgbtn { width: 62px; height: 56px; } .sqbtn { width: 58px; height: 54px; }
  .pill { height: 48px; }
}

/* ── Reduced motion ── */
.rm *, .rm *::before, .rm *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
.rm .fx, .rm .rw-rays { display: none; }

/* ── Print (certificate only) ── */
@media print {
  body { background: #fff; }
  .topbar, .rw-actions, .fx, .fx-canvas, .toast, #modal-root, .world-bg { display: none !important; }
  .cert { box-shadow: none; break-inside: avoid; }
}
