/* =========================================================================
   KAIROS MATH ADVENTURES — styles
   Palette: meadow leaf, forest ink, sky, sunshine, bark, petal.
   Touch-first for iPad: 60px+ targets, no zoom, safe areas respected.
   ========================================================================= */
:root {
  --leaf: #5DBB46; --leaf-d: #2F7D3A; --leaf-l: #DDF3D2;
  --ink: #1F3B2A; --ink-2: #4A6152; --muted: #6B7F70;
  --sky: #8ED1F2; --sky-d: #2F7DB8; --sky-l: #E3F5FF;
  --sun: #FFD23F; --sun-d: #D9A400; --sun-l: #FFF4C7;
  --bark: #9A6334; --bark-d: #6E4422; --bark-l: #F3E2CC;
  --petal: #FF8FA3; --petal-d: #C2415E;
  --card: #FFFFFF; --line: #E3EEDF;
  --r-lg: 26px; --r-md: 18px; --r-sm: 12px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --top: calc(64px + env(safe-area-inset-top, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font); color: var(--ink); font-size: 19px; line-height: 1.45;
  background: linear-gradient(180deg, #D7F0FF 0%, #EAF8FF 38%, #F1FAE8 100%) fixed;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; overscroll-behavior: none;
  padding: 0 env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid var(--sky-d); outline-offset: 3px; }
svg.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: 1.15rem; max-width: 34em; margin: .4em auto; text-align: center; }
.msg { min-height: 1.5em; color: var(--petal-d); font-weight: 700; text-align: center; margin: .4em 0; }
.h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: .2em 0; font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
.h3 { font-size: 1.35rem; font-weight: 800; margin: .3em 0 .6em; display: block; }

/* ---------- top bar ---------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; min-height: var(--top);
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--leaf-l);
}
.brand { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand-name { font-weight: 900; font-size: 1rem; letter-spacing: .04em; color: var(--leaf-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--leaf-l); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 13px; min-height: 44px; border-radius: 999px; font-weight: 800; font-size: .92rem; color: var(--leaf-d); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 0 rgba(47, 125, 58, .25); }
.seg.big button { padding: 12px 20px; min-height: 56px; font-size: 1.05rem; }
.icon-btn { border: 0; background: #fff; width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center; color: var(--ink); box-shadow: 0 3px 0 var(--line), 0 0 0 2px var(--line) inset; flex: none; }
.icon-btn svg.ico { width: 26px; height: 26px; }
.icon-btn.off { color: #B5C2B9; }
.icon-btn.on { background: var(--sun-l); box-shadow: 0 3px 0 var(--sun-d), 0 0 0 2px var(--sun) inset; }
.icon-btn:active { transform: translateY(2px); }
@media (max-width: 720px) { .brand-name { display: none; } }

/* ---------- buttons ---------- */
.btn {
  --b: #fff; --s: var(--line); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 12px 26px; border: 0; border-radius: var(--r-md);
  background: var(--b); color: var(--c); font-weight: 900; font-size: 1.1rem;
  box-shadow: 0 6px 0 var(--s); transition: transform .08s ease, box-shadow .08s ease;
  position: relative; margin-bottom: 6px;
}
.btn:active:not([disabled]) { transform: translateY(5px); box-shadow: 0 1px 0 var(--s); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.leaf { --b: var(--leaf); --s: var(--leaf-d); --c: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.btn.wood { --b: linear-gradient(180deg, #C08A55, #A56E3D); --s: var(--bark-d); --c: #FFF7EA; background: var(--b); }
.btn.ghost { --b: transparent; --s: transparent; box-shadow: none; color: var(--leaf-d); padding: 10px 14px; }
.btn.danger { --b: #E0475F; --s: #9E2338; --c: #fff; }
.btn.big { min-height: 72px; font-size: 1.3rem; padding: 14px 36px; border-radius: 22px; }
.btn.small { min-height: 50px; padding: 8px 16px; font-size: .98rem; }
.btn .budgie { margin: -10px 0; }
.btn svg.ico { width: 1.3em; height: 1.3em; }
@media (hover: hover) { .btn:hover:not([disabled]) { filter: brightness(1.04); } }

/* ---------- generic layouts ---------- */
.screen-wrap { flex: 1; display: flex; flex-direction: column; }
.page { width: min(1100px, 100%); margin: 0 auto; padding: 18px 20px 40px; }
.page.narrow { width: min(760px, 100%); }
.page-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head .h2 { text-align: center; }
.center-col { width: min(720px, 100%); margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.trio { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: 0 6px 0 var(--line); }
.card.pad { padding: 24px; margin: 30px auto; max-width: 560px; }

/* ---------- start screen ---------- */
.start { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px 20px 16px; text-align: center; }
.hero-birds { width: min(440px, 80vw); margin: 0 auto 8px; }
.title { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: .9; }
.title .t1 {
  font-size: clamp(64px, 13vw, 132px); font-weight: 900; letter-spacing: .06em; color: var(--leaf);
  -webkit-text-stroke: 4px var(--leaf-d); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--leaf-d), 0 12px 22px rgba(47, 125, 58, .25);
}
.title .t2 {
  margin-top: 16px; font-size: clamp(20px, 3.6vw, 34px); font-weight: 900; letter-spacing: .14em; color: #FFF7EA;
  background: linear-gradient(180deg, #C08A55, #9A6334); padding: 10px 26px 12px; border-radius: 14px;
  box-shadow: 0 6px 0 var(--bark-d), inset 0 2px 0 rgba(255, 255, 255, .25); transform: rotate(-1.5deg);
}
.tagline { color: var(--ink-2); font-size: 1.15rem; margin: .4em 0 0; }
.start-actions { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.start-actions .btn { min-width: 250px; }
.lang-big { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; font-size: .95rem; }
.credit { margin-top: auto; color: var(--muted); font-size: .92rem; padding-top: 10px; }

/* ---------- profiles / wizard ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.profile-card { border: 0; background: #fff; border-radius: var(--r-lg); padding: 18px 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 6px 0 var(--line), inset 0 0 0 4px color-mix(in srgb, var(--c, #5DBB46) 40%, transparent); min-height: 200px; }
.profile-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line), inset 0 0 0 4px var(--c, #5DBB46); }
.profile-card b { font-size: 1.25rem; }
.profile-card small { color: var(--muted); font-weight: 700; }
.pc-avatar, .pc-big { width: 110px; height: 110px; border-radius: 50%; background: color-mix(in srgb, var(--c) 28%, #fff); display: grid; place-items: center; overflow: hidden; }
.pc-avatar .budgie { margin-top: 22px; } .pc-avatar .kid-face { width: 100%; height: 100%; }
.pc-big { width: 130px; height: 130px; } .pc-big .budgie { margin-top: 30px; } .pc-big .kid-face { width: 100%; height: 100%; }
.profile-card.new { border: 4px dashed var(--leaf); box-shadow: none; background: rgba(255, 255, 255, .6); justify-content: center; }
.pc-plus { font-size: 3.4rem; font-weight: 900; color: var(--leaf); line-height: 1; }
.wiz-dots { display: flex; gap: 8px; justify-content: flex-end; }
.wiz-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.wiz-dots span.on { background: var(--leaf); }
.wiz { display: flex; gap: 16px; align-items: flex-start; background: #fff; border-radius: var(--r-lg); padding: 24px; box-shadow: 0 6px 0 var(--line); }
.wiz-body { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.big-input { width: min(440px, 100%); font-size: 2rem; font-weight: 800; padding: 14px 18px; border-radius: var(--r-md); border: 4px solid var(--leaf-l); text-align: center; color: var(--ink); background: #FBFFF8; }
.big-input:focus { border-color: var(--leaf); outline: none; }
.choice-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.choice-card { border: 0; background: #F7FBF5; border-radius: var(--r-lg); padding: 16px 18px; min-width: 170px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 5px 0 var(--line), inset 0 0 0 3px var(--line); }
.choice-card.on { background: var(--leaf-l); box-shadow: 0 5px 0 var(--leaf-d), inset 0 0 0 4px var(--leaf); }
.choice-card small { color: var(--muted); max-width: 13em; }
.big-num { font-size: 3.6rem; font-weight: 900; color: var(--leaf-d); line-height: 1; }
.budgie-card { min-width: 190px; }
.swatches { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.swatch { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--c); box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.swatch.on { outline: 5px solid var(--ink); outline-offset: 4px; }
.avatar-preview { display: flex; flex-direction: column; align-items: center; background: color-mix(in srgb, var(--c) 25%, #fff); border-radius: var(--r-lg); padding: 10px 26px 12px; }

/* ---------- keypads & PIN ---------- */
.kp { width: 100%; max-width: 380px; margin: 0 auto; }
.kp-display { height: 76px; border-radius: var(--r-md); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 900; letter-spacing: .03em; box-shadow: inset 0 0 0 4px var(--sky); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.kp-caret { width: 4px; height: 44px; background: var(--sky-d); border-radius: 2px; margin-left: 4px; animation: blink 1s steps(2) infinite; }
.kp:not(.empty) .kp-caret { display: none; }
.kp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kp-key { min-height: 66px; border: 0; border-radius: var(--r-md); background: #fff; font-size: 1.9rem; font-weight: 900; box-shadow: 0 5px 0 #CFDCCF; display: grid; place-items: center; }
.kp-key:active { transform: translateY(4px); box-shadow: 0 1px 0 #CFDCCF; background: var(--sky-l); }
.kp-back { color: var(--petal-d); } .kp-back svg.ico { width: 34px; height: 34px; }
.kp-ok { background: var(--leaf); color: #fff; box-shadow: 0 5px 0 var(--leaf-d); font-size: 1.15rem; display: flex; gap: 6px; }
.kp-ok svg.ico { width: 28px; height: 28px; }
.kp-ok:active { background: var(--leaf-d); box-shadow: 0 1px 0 var(--leaf-d); }
.pin { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(340px, 100%); }
.pin-host { width: min(340px, 100%); }
.pin-dots { display: flex; gap: 14px; }
.pin-dots span { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 4px var(--leaf); }
.pin-dots span.on { background: var(--leaf); }
.pin-grid { width: 100%; }
.pin.shake { animation: shake .4s; }

/* ---------- budgies & speech ---------- */
.buddy { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bubble { position: relative; background: #fff; border-radius: 22px; padding: 12px 18px; font-weight: 700; max-width: 22em; box-shadow: 0 4px 0 var(--line); animation: pop .3s ease; text-align: center; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -12px; border: 12px solid transparent; border-top-color: #fff; border-bottom: 0; transform: translateX(-50%); }
/* sprite budgies: frames stacked, mood = animation */
.budgie { position: relative; display: inline-block; flex: none; vertical-align: bottom; }
.bd-stage { position: absolute; inset: 0; transform-origin: 50% 100%; }
.bd-f { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); }
.flip .bd-f { transform: translateX(-50%) scaleX(-1); }
.bd-f img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; filter: drop-shadow(0 4px 3px rgba(31, 59, 42, .16)); }
.bd-acc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pose-idle .bd-stage { animation: bdBreathe 3.4s ease-in-out infinite; }
.pose-happy .bd-stage { animation: bdHop 1.1s ease-in-out infinite; }
.pose-think .bd-stage { animation: bdThink 2.8s ease-in-out infinite; }
.pose-eat .bd-stage { animation: bdPeck 1.3s ease-in-out infinite; }
.pose-encourage .bd-stage { animation: bdBob 2.4s ease-in-out infinite; }
.pose-encourage .f-fly, .pose-celebrate .f-glide, .pose-map .f-fly { opacity: 0; }
.pose-encourage .f-fly { animation: frWave 2.4s steps(1) infinite; } .pose-encourage .f-sit { animation: frWaveOff 2.4s steps(1) infinite; }
.pose-celebrate .bd-stage { animation: bdJump .72s ease-in-out infinite; }
.pose-celebrate .f-fly { animation: frA .36s steps(1) infinite; } .pose-celebrate .f-glide { animation: frB .36s steps(1) infinite; }
.pose-map.hopping .f-fly { opacity: 1; } .pose-map.hopping .f-sit { opacity: 0; }
.bd-think { position: absolute; right: -6%; top: -4%; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 2px; }
.bd-think i { display: block; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #B9C7D3; animation: fadein .6s ease both; }
.bd-think i:nth-child(1) { width: 7px; height: 7px; } .bd-think i:nth-child(2) { width: 10px; height: 10px; margin-left: 6px; animation-delay: .2s; } .bd-think i:nth-child(3) { width: 14px; height: 14px; margin-left: 12px; animation-delay: .4s; }
@keyframes bdBreathe { 0%, 100% { transform: scale(1, 1) rotate(0); } 30% { transform: scale(1.015, .985); } 62% { transform: scale(1, 1) rotate(0); } 72%, 84% { transform: rotate(-4deg); } }
@keyframes bdHop { 0%, 100% { transform: translateY(0) scale(1, 1); } 22% { transform: translateY(0) scale(1.05, .94); } 45% { transform: translateY(-14%) scale(.97, 1.04); } 70% { transform: translateY(0) scale(1.04, .96); } }
@keyframes bdThink { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(-9deg) translateY(-2%); } }
@keyframes bdPeck { 0%, 40%, 100% { transform: rotate(0); } 55% { transform: rotate(8deg) translateY(3%); } 70% { transform: rotate(0); } }
@keyframes bdBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4%); } }
@keyframes bdJump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16%) rotate(-3deg); } }
@keyframes frA { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes frB { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes frWave { 0% { opacity: 0; } 70% { opacity: 1; } 90% { opacity: 0; } }
@keyframes frWaveOff { 0% { opacity: 1; } 70% { opacity: 0; } 90% { opacity: 1; } }
.kid-face { border-radius: 50%; object-fit: cover; display: block; background: #fff; }
.logo-tutors { width: 100%; display: block; border-radius: 28px; box-shadow: 0 10px 0 rgba(47, 125, 58, .18), 0 18px 34px rgba(31, 59, 42, .18); }
.prop { display: block; height: auto; filter: drop-shadow(0 6px 6px rgba(31, 59, 42, .15)); }
/* ---------- verse ---------- */
.verse-card { background: #fff; border-radius: 30px; padding: 22px 26px 26px; box-shadow: 0 8px 0 var(--line); text-align: center; }
.verse-kicker { margin: 0 0 10px; font-weight: 900; color: var(--bark); font-size: 1.05rem; }
.verse-art { border-radius: 20px; overflow: hidden; max-width: 520px; margin: 0 auto; }
.verse-text { font-size: clamp(1.3rem, 2.8vw, 1.7rem); font-weight: 800; line-height: 1.4; margin: 18px auto 8px; max-width: 30em; color: var(--ink); quotes: "“" "”"; }
.verse-text::before { content: open-quote; color: var(--leaf); } .verse-text::after { content: close-quote; color: var(--leaf); }
.verse-ref { font-weight: 900; color: var(--leaf-d); margin: 0; }
.verse-ref span { display: block; font-weight: 600; color: var(--muted); font-size: .85rem; }
.verse-why { background: var(--sun-l); border-radius: var(--r-md); padding: 12px 16px; font-weight: 700; margin: 16px auto 18px; max-width: 32em; }
.verse-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- world map ---------- */
.map { flex: 1; display: flex; flex-direction: column; min-height: calc(100dvh - var(--top)); }
.hud { display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--c) 30%, #fff); display: grid; place-items: center; overflow: hidden; box-shadow: 0 0 0 3px var(--c); }
.avatar .budgie { margin-top: 14px; } .avatar .kid-face { width: 100%; height: 100%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; box-shadow: 0 3px 0 var(--line); min-height: 44px; }
.chip svg.ico { width: 24px; height: 24px; color: var(--sun-d); }
.chip.goal { padding: 3px 14px 3px 4px; }
.chip.goal small { display: block; font-size: .7rem; color: var(--muted); line-height: 1; }
.chip.goal b { font-size: .95rem; line-height: 1.1; }
.hud-actions { display: flex; gap: 8px; align-items: center; }
.hud-actions .btn { margin-bottom: 0; }
.world-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.world-tabs::-webkit-scrollbar { display: none; }
.wtab { flex: none; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 8px 16px 8px 8px; background: rgba(255, 255, 255, .75); font-weight: 800; min-height: 50px; box-shadow: 0 3px 0 var(--line); }
.wtab-n { width: 34px; height: 34px; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font-weight: 900; }
.wtab.on { background: #fff; box-shadow: 0 3px 0 var(--leaf-d), inset 0 0 0 3px var(--leaf); }
.wtab.soon, .wtab.locked { color: var(--muted); } .wtab.soon .wtab-n, .wtab.locked .wtab-n { background: #B9C7BD; }
.wtab svg.ico { color: var(--muted); }
.world-head { padding: 0 20px; }
.world-head p { margin: 0 0 6px; color: var(--ink-2); font-weight: 600; }
.soon-banner { margin: 6px 20px; padding: 12px 16px; background: var(--sun-l); border-radius: var(--r-md); font-weight: 800; display: flex; gap: 10px; align-items: center; }
.map-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; position: relative; display: flex; align-items: flex-start; min-height: 0; scrollbar-width: thin; padding-bottom: 8px; }
.map-sizer { position: relative; flex: none; margin: 0 auto; }
.map-track { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.layer { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.theme-forest .map-scroll { background: linear-gradient(180deg, rgba(166, 214, 150, .0), rgba(120, 180, 110, .15)); }
.theme-reef .map-scroll { background: linear-gradient(180deg, #BFEFF5, #7FD3E0); }
.theme-desert .map-scroll { background: linear-gradient(180deg, #FFF3D6, #FCE3B0); }
.theme-mountains .map-scroll { background: linear-gradient(180deg, #E6EEF3, #CFDCE3); }
.theme-sky .map-scroll { background: linear-gradient(180deg, #BFE8FF, #8ED1F2); }
.theme-starlight .map-scroll { background: linear-gradient(180deg, #1F2B57, #3A4F8A); }
.theme-starlight .world-head h2, .theme-starlight .world-head p { color: inherit; }
.theme-rainforest .map-scroll { background: linear-gradient(180deg, #DDF3D2, #BDE8A8); }
.theme-sunflower .map-scroll { background: linear-gradient(180deg, #FFF7D6, #E8F5C8); }
.node { position: absolute; width: 88px; margin-left: -44px; margin-top: -44px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; z-index: 2; }
.node-disc { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-size: 2.1rem; font-weight: 900; color: #fff; background: radial-gradient(circle at 35% 30%, #86D86B, var(--leaf) 60%); box-shadow: 0 7px 0 var(--leaf-d), 0 10px 20px rgba(0, 0, 0, .18); border: 5px solid #fff; }
.node-disc svg.ico { width: 40px; height: 40px; }
.node.st-done .node-disc { background: radial-gradient(circle at 35% 30%, #FFE680, var(--sun) 60%); color: var(--bark-d); box-shadow: 0 7px 0 var(--sun-d), 0 10px 20px rgba(0, 0, 0, .15); }
.node.st-locked .node-disc { background: #C8D3CB; box-shadow: 0 7px 0 #98A69C; color: #7F8E84; }
.node.boss .node-disc { width: 104px; height: 104px; margin-top: -8px; }
.node.current .node-disc { animation: pulse 1.6s ease-in-out infinite; }
.node-stars { display: flex; gap: 1px; margin-top: 4px; }
.node-stars i, .lc-stars i, .big-stars i { color: #D4DDD6; font-style: normal; }
.node-stars i.on, .lc-stars i.on, .big-stars i.on { color: var(--sun-d); }
.node-stars svg.ico { width: 22px; height: 22px; }
.node-name { margin-top: 8px; position: relative; z-index: 1; background: rgba(255, 255, 255, .9); border-radius: 10px; padding: 2px 8px; font-size: .78rem; font-weight: 800; width: 150px; text-align: center; line-height: 1.2; }
.sprite { position: absolute; margin-left: -31px; margin-top: -132px; z-index: 3; pointer-events: none; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .18)); }

/* ---------- modal ---------- */
#modal-root { position: relative; z-index: 60; }
.modal-back { position: fixed; inset: 0; background: rgba(31, 59, 42, .45); animation: fadein .2s; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 30px)); max-height: calc(100dvh - 40px); overflow: auto; background: #fff; border-radius: 30px; padding: 26px 24px 22px; box-shadow: 0 10px 0 rgba(0, 0, 0, .12); animation: popin .25s ease; }
.modal-x { position: absolute; right: 12px; top: 12px; }
.level-card { text-align: center; }
.lc-birds { display: flex; justify-content: center; align-items: flex-end; }
.lc-kicker { margin: 4px 0 0; color: var(--muted); font-weight: 800; }
.lc-stars { display: flex; justify-content: center; gap: 4px; margin: 8px 0; } .lc-stars svg.ico { width: 40px; height: 40px; }
.lc-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.lc-actions.left { justify-content: flex-start; }
.strategy-chip { display: inline-flex; gap: 8px; align-items: center; background: var(--sun-l); color: var(--bark-d); font-weight: 900; border-radius: 999px; padding: 8px 16px; margin: 6px 0; }
.strategy-chip.big { font-size: 1.2rem; padding: 10px 20px; }
.settings .set-row, .set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 2px solid var(--line); flex-wrap: wrap; font-weight: 700; }
.set-row.dim { color: var(--muted); }

.toggle { width: 74px; height: 44px; border-radius: 999px; border: 0; background: #C8D3CB; position: relative; flex: none; }
.toggle i { position: absolute; left: 4px; top: 4px; width: 36px; height: 36px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); }
.toggle.on { background: var(--leaf); } .toggle.on i { left: 34px; }
.about { display: flex; flex-direction: column; gap: 2px; padding-top: 14px; text-align: center; color: var(--ink-2); }
.about small { color: var(--muted); }
.break .stretch-list { text-align: left; font-weight: 700; font-size: 1.1rem; }

/* ---------- practice ---------- */
.practice, .lesson { flex: 1; display: flex; flex-direction: column; padding: 10px 16px 18px; gap: 12px; max-width: 1280px; width: 100%; margin: 0 auto; }
.pr-top { display: flex; align-items: center; gap: 12px; }
.pr-top .btn { margin-bottom: 0; }
.pr-title { font-weight: 900; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34%; }
.progress { flex: 1; height: 18px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 3px var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), #9BE07F); border-radius: 999px; transition: width .4s ease; }
.pr-count { font-weight: 900; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pr-main { flex: 1; display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (orientation: portrait), (max-width: 860px) { .pr-main { grid-template-columns: 1fr; } }
.qcard { background: #fff; border-radius: 28px; padding: 22px 24px; box-shadow: 0 7px 0 var(--line); display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; min-height: 240px; justify-content: center; }
.qcard.inset { box-shadow: inset 0 0 0 3px var(--line); padding: 16px; min-height: 0; }
.qcard.solved { box-shadow: 0 7px 0 var(--leaf-d), inset 0 0 0 4px var(--leaf); }
.qcard.pop { animation: popin .35s ease; }
.q-text { display: flex; gap: 10px; align-items: flex-start; width: 100%; justify-content: center; }
.q-text p { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.55rem); font-weight: 800; line-height: 1.4; text-align: center; max-width: 30em; }
.q-text .read { width: 46px; height: 46px; }
.q-expr { font-size: clamp(2.3rem, 5.6vw, 3.6rem); font-weight: 900; letter-spacing: .02em; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ul { text-decoration: underline; text-decoration-thickness: 6px; text-underline-offset: 8px; text-decoration-color: var(--petal); }
.qbox { display: inline-block; min-width: 1.15em; padding: 0 .12em; border-radius: .2em; border: 4px dashed var(--sky-d); color: var(--sky-d); text-align: center; line-height: 1.05; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin: 0 .08em; }
.frac .fn { padding: 0 .14em .06em; border-bottom: .09em solid currentColor; }
.frac .fd { padding-top: .06em; }
.frac .qbox { font-size: .8em; }
.visual { width: 100%; display: flex; justify-content: center; overflow: visible; padding-bottom: 8px; }
.visual svg.vis { height: auto; }
.tag.review { position: absolute; top: 12px; left: 14px; background: var(--sky-l); color: var(--sky-d); font-weight: 900; border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.hint-box { display: flex; gap: 10px; align-items: center; background: var(--sun-l); border-radius: var(--r-md); padding: 12px 16px; font-weight: 800; animation: popin .3s ease; max-width: 36em; }
.hint-box svg.ico { width: 32px; height: 32px; }
.acol { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.pr-tools { display: flex; justify-content: center; gap: 10px; min-height: 0; }
.buddy-host { display: flex; justify-content: center; }
.mc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mc.long { grid-template-columns: 1fr; }
.mc-btn { min-height: 92px; border: 0; border-radius: 22px; background: #fff; font-size: 1.7rem; font-weight: 900; box-shadow: 0 6px 0 #CFDCCF, inset 0 0 0 3px var(--line); padding: 10px; }
.mc.long .mc-btn { font-size: 1.2rem; min-height: 72px; }
.mc-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #CFDCCF; }
.mc-btn.wrong, .cmp-btn.wrong { animation: shake .4s; background: #FFE6EA; }
.mc-btn.right, .cmp-btn.right { background: var(--leaf-l); box-shadow: 0 6px 0 var(--leaf-d), inset 0 0 0 4px var(--leaf); }
.cmp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cmp-btn { min-height: 120px; border: 0; border-radius: 22px; background: #fff; box-shadow: 0 6px 0 #CFDCCF, inset 0 0 0 3px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.cmp-btn b { font-size: 3.4rem; line-height: 1; }
.cmp-btn small { font-weight: 700; color: var(--muted); font-size: .85rem; }
.cmp-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #CFDCCF; }
.nl-wrap { background: #fff; border-radius: 22px; padding: 10px 12px 14px; box-shadow: 0 6px 0 var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nl-interactive { touch-action: none; cursor: grab; }
.nl-help { margin: 0; color: var(--muted); font-weight: 700; font-size: .95rem; text-align: center; }
.feedback { background: #fff; border-radius: 26px; padding: 18px; text-align: center; box-shadow: 0 6px 0 var(--line); animation: popin .3s ease; }
.fb-badge { width: 70px; height: 70px; margin: 0 auto; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; box-shadow: 0 5px 0 var(--leaf-d); }
.fb-badge svg.ico { width: 42px; height: 42px; }
.fb-badge.big { width: 96px; height: 96px; } .fb-badge.big svg.ico { width: 58px; height: 58px; }
.fb-title { font-size: 1.6rem; font-weight: 900; margin: 8px 0 12px; color: var(--leaf-d); }
.practice.is-boss .qcard { box-shadow: 0 7px 0 var(--bark-d), inset 0 0 0 4px var(--sun); }

/* ---------- tutor overlay ---------- */
.tutor-back { position: fixed; inset: 0; background: rgba(31, 59, 42, .5); z-index: 50; animation: fadein .2s; }
.tutor { position: fixed; z-index: 51; left: 50%; top: calc(var(--top) + 10px); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(900px, calc(100vw - 24px)); background: #FBFFF8; border-radius: 30px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 0 rgba(0, 0, 0, .15); animation: slideup .35s ease; }
.tu-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; background: linear-gradient(180deg, var(--leaf-l), #FBFFF8); }
.tu-headtext { flex: 1; }
.tu-kicker { margin: 0; font-weight: 800; color: var(--leaf-d); }
.tu-head h3 { margin: 0; font-size: 1.5rem; font-weight: 900; }
.tu-body { flex: 1; overflow-y: auto; padding: 8px 22px 16px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.tu-body.center { align-items: center; justify-content: center; text-align: center; }
.tu-body.your { align-items: center; }
.tu-problem { background: #fff; border-radius: 20px; padding: 12px; box-shadow: inset 0 0 0 3px var(--line); }
.tu-problem .q-text p { font-size: 1.15rem; } .tu-problem .q-expr { font-size: 2.2rem; }
.tu-intro { margin: 0; font-weight: 800; color: var(--ink-2); text-align: center; }
.tu-steps { margin: 0; padding-left: 28px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); font-weight: 700; }
.tu-steps li.done { opacity: .7; }
.tu-current { background: #fff; border-radius: 22px; padding: 16px 18px; box-shadow: 0 5px 0 var(--line), inset 0 0 0 3px var(--sky); display: flex; flex-direction: column; gap: 12px; animation: popin .3s ease; }
.tu-stepno { font-weight: 900; color: var(--sky-d); font-size: .9rem; }
.tu-text { margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.45; }
.ans-chip { display: inline-block; background: var(--leaf-l); color: var(--leaf-d); border-radius: 10px; padding: 0 10px; margin-left: 4px; }
.tu-ask { background: var(--sun-l); border-radius: 20px; padding: 12px; }
.tu-yourstep { margin: 0 0 8px; font-weight: 900; color: var(--bark-d); text-align: center; }
.tu-ask .kp { max-width: 340px; } .tu-ask .kp-key { min-height: 58px; }
.tu-actions { padding: 12px 18px 16px; display: flex; justify-content: flex-end; border-top: 2px solid var(--line); background: #fff; }
.tu-actions .btn { margin-bottom: 0; }
.tutor .answer-host { width: min(420px, 100%); }

/* ---------- lessons ---------- */
.lesson-stage { flex: 1; background: #fff; border-radius: 30px; padding: 22px; box-shadow: 0 7px 0 var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; animation: slidein .35s ease; }
.lesson-intro, .lesson-ex, .lesson-ready { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.lesson-ex .tu-steps { font-size: 1.25rem; color: var(--ink); align-self: stretch; max-width: 38em; margin: 0 auto; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; }
.lesson-nav .btn { margin-bottom: 0; }

/* ---------- results ---------- */
.big-stars { display: flex; gap: 6px; justify-content: center; }
.big-stars i { animation: starpop .5s ease both; } .big-stars svg.ico { width: 70px; height: 70px; }
.seeds-earned { font-weight: 900; font-size: 1.3rem; color: var(--bark); }
.badge-earned { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 900; color: var(--bark-d); animation: popin .5s ease .4s both; }
.saved { display: inline-flex; gap: 8px; align-items: center; background: var(--leaf-l); color: var(--leaf-d); font-weight: 900; padding: 10px 18px; border-radius: 999px; }
.stat-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.stat { background: #fff; border-radius: 20px; padding: 12px 22px; box-shadow: 0 5px 0 var(--line); display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.stat b { font-size: 2.2rem; line-height: 1.1; color: var(--leaf-d); } .stat span { color: var(--muted); font-weight: 700; }

/* ---------- visual models ---------- */
.cols { display: grid; grid-template-columns: repeat(var(--n), 58px); justify-content: center; font-size: 2.3rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.25; }
.cols > div { text-align: center; }
.c-h { font-size: .85rem; color: var(--muted); font-weight: 900; }
.c-carry { font-size: 1.15rem; color: var(--petal-d); min-height: 1.4rem; }
.c-d.struck { text-decoration: line-through; text-decoration-color: var(--petal-d); text-decoration-thickness: 4px; color: #9AA89F; }
.c-rule { grid-column: 1 / -1; border-top: 5px solid var(--ink); margin: 4px 0; }
.c-res.blank { margin: 4px 6px; border: 3px dashed #B7C8BC; border-radius: 10px; min-height: 2.4rem; }
.c-op { color: var(--sky-d); }
.seq { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px 2px; padding: 4px 0 10px; }
.stone { flex: none; width: 64px; height: 64px; padding: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F1E3CF, #D8BC97); display: grid; place-items: center; font-size: 1.35rem; font-weight: 900; box-shadow: 0 5px 0 #B48F62; margin-bottom: 5px; }
.stone.blank { background: #fff; color: var(--sky-d); box-shadow: 0 5px 0 var(--sky-d), inset 0 0 0 4px var(--sky); }
.seq-arrow { color: var(--leaf); font-size: 1.5rem; font-weight: 900; width: 16px; text-align: center; }
.pvwrap { overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
.pvchart { border-collapse: separate; border-spacing: 4px; margin: 0 auto; }
.pvchart th { font-size: .78rem; font-weight: 900; color: var(--ink-2); background: var(--leaf-l); border-radius: 10px; padding: 6px 6px; max-width: 92px; line-height: 1.15; }
.pvchart td { font-size: 2.1rem; font-weight: 900; text-align: center; background: #fff; border-radius: 12px; box-shadow: inset 0 0 0 3px var(--line); min-width: 62px; height: 62px; }
.pvchart .hl { background: var(--sun-l); box-shadow: inset 0 0 0 4px var(--sun); }
.pvchart .hl2 { background: var(--sky-l); box-shadow: inset 0 0 0 4px var(--sky); }

/* ---------- celebration & trail ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.cf { position: absolute; top: -30px; width: 16px; height: 24px; animation: fall 3s linear forwards; }
.cf.leaf { background: var(--leaf); border-radius: 0 100% 0 100%; }
.cf.feather { background: linear-gradient(90deg, #BFE8FF, #4FA8EC); border-radius: 50% 50% 40% 40% / 90% 90% 10% 10%; width: 10px; height: 30px; }
.cf.petal { background: var(--petal); border-radius: 60% 40% 60% 40%; }
.cf.seed { background: #B9773A; border-radius: 50%; width: 10px; height: 14px; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }
.trail { position: fixed; z-index: 95; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: radial-gradient(circle, #fff 0 30%, var(--sun) 31% 60%, transparent 62%); pointer-events: none; animation: sparkle .85s ease-out forwards; }
.trail.feather { width: 8px; height: 18px; border-radius: 50% 50% 40% 40% / 90% 90% 10% 10%; background: linear-gradient(#fff, var(--sky)); }
.trail.burst { animation-duration: .7s; }
@keyframes sparkle { from { opacity: 1; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(var(--dx), -34px) scale(.4) rotate(70deg); } }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 18px; font-weight: 800; z-index: 99; transition: transform .3s ease, opacity .3s ease, visibility .3s; max-width: calc(100vw - 40px); text-align: center; opacity: 0; visibility: hidden; }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ---------- scratch pad ---------- */
/* bottom sheet in every orientation: the problem stays visible above it */
.scratch { --sp-h: 44dvh; position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; height: var(--sp-h); background: #FFFEF6; border-top: 4px solid var(--bark-l); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 0 rgba(31, 59, 42, .12); transform: translateY(105%); transition: transform .3s ease; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px); background-image: linear-gradient(#E8EEF7 1.5px, transparent 1.5px); background-size: 100% 40px; }
.scratch.open { transform: translateY(0); }
.scratch:not(.open) { visibility: hidden; pointer-events: none; transition: transform .3s ease, visibility 0s linear .3s; }
.scratch.tall { --sp-h: 60dvh; }
@media (orientation: portrait) { .scratch { --sp-h: 48dvh; } .scratch.tall { --sp-h: 62dvh; } }
body.scratch-open .practice, body.scratch-open .lesson { padding-bottom: calc(44dvh + 16px); }
body.scratch-open .tutor { bottom: calc(44dvh + 10px); }
@media (orientation: portrait) { body.scratch-open .practice, body.scratch-open .lesson { padding-bottom: calc(48dvh + 16px); } body.scratch-open .tutor { bottom: calc(48dvh + 10px); } }
.sp-grip { width: 64px; height: 6px; border-radius: 3px; background: #D5C4AE; margin: 8px auto -2px; }
.sp-tools { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: rgba(255, 255, 255, .95); border-bottom: 2px solid var(--line); flex-wrap: wrap; border-radius: 22px 22px 0 0; }
.sp-color { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 4px #fff, 0 0 0 2px var(--line); }
.sp-color.on, .sp-btn.on { box-shadow: inset 0 0 0 4px #fff, 0 0 0 4px var(--ink); }
.sp-btn { min-width: 52px; height: 52px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--line), inset 0 0 0 2px var(--line); display: grid; place-items: center; }
.sp-btn svg.ico { width: 28px; height: 28px; }
.sp-btn.wide { padding: 0 16px; font-weight: 800; }
.sp-flex { flex: 1; }
.sp-canvas { flex: 1; width: 100%; touch-action: none; cursor: crosshair; }

/* ---------- professor dashboard ---------- */
.dash { width: min(1180px, 100%); margin: 0 auto; padding: 14px 18px 40px; -webkit-user-select: text; user-select: text; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dtabs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 12px; }
.dtab { flex: none; display: flex; gap: 6px; align-items: center; border: 0; border-radius: 999px; padding: 8px 18px; min-height: 50px; background: rgba(255, 255, 255, .7); font-weight: 800; box-shadow: 0 3px 0 var(--line); }
.dtab.on { background: #fff; box-shadow: 0 3px 0 var(--leaf-d), inset 0 0 0 3px var(--c, var(--leaf)); }
.dcard { background: #fff; border-radius: 24px; padding: 16px 20px 18px; box-shadow: 0 5px 0 var(--line); margin-bottom: 16px; }
.dcard h3 { margin: 0 0 12px; font-size: 1.2rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dcard h3 small { color: var(--muted); font-weight: 700; font-size: .9rem; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.dgrid .dcard { margin-bottom: 0; }
.dgrid + .dcard { margin-top: 16px; }
.ocards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.ocard { background: #F6FBF3; border-radius: 16px; padding: 10px 14px; display: flex; flex-direction: column; }
.ocard span { font-size: .8rem; color: var(--muted); font-weight: 800; }
.ocard b { font-size: 1.35rem; line-height: 1.25; }
.ocard small { color: var(--ink-2); font-size: .8rem; }
.insights { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.insights li { padding: 10px 14px; border-radius: 14px; font-weight: 700; background: #F3F7F4; border-left: 6px solid #B9C7BD; }
.insights .ins-struggle { background: #FFF0EC; border-color: #FF9A6B; }
.insights .ins-slow { background: var(--sun-l); border-color: var(--sun); }
.insights .ins-good { background: var(--leaf-l); border-color: var(--leaf); }
.insights .ins-review { background: var(--sky-l); border-color: var(--sky); }
.chart { display: block; }
.legend, .legend-row { font-size: .85rem; color: var(--muted); margin: 6px 0 0; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend-row { margin: 0 0 10px; } .legend-row i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 4px; vertical-align: -2px; }
.lg.goal { display: inline-block; width: 22px; border-top: 3px dashed var(--sun); margin-right: 6px; }
.sbar { display: grid; grid-template-columns: minmax(170px, 1.1fr) 2fr auto; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sbar-l b { display: block; font-size: .98rem; } .sbar-l small { color: var(--muted); }
.sbar-track { height: 16px; border-radius: 999px; background: #EEF3EF; overflow: hidden; }
.sbar-track i { display: block; height: 100%; border-radius: 999px; }
.status { font-size: .8rem; font-weight: 900; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.st-none { background: #EEF3EF; color: var(--muted); } .st-placed { background: var(--sky-l); color: var(--sky-d); } .st-learning { background: #FFE3D6; color: #B4502A; } .st-practicing { background: var(--sun-l); color: #8A6A00; } .st-mastered { background: var(--leaf-l); color: var(--leaf-d); }
.dtable { width: 100%; border-collapse: collapse; font-size: .95rem; }
.dtable th { text-align: left; color: var(--muted); font-size: .8rem; padding: 6px 8px; border-bottom: 2px solid var(--line); }
.dtable td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable .qcell { max-width: 380px; }
.tscroll { overflow-x: auto; max-height: 520px; overflow-y: auto; }
.flag { background: var(--sun-l); color: #8A6A00; font-weight: 800; padding: 3px 8px; border-radius: 8px; font-size: .8rem; }
.yes { color: var(--leaf-d); font-weight: 900; } .no { color: var(--muted); font-weight: 700; }
.filter { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 10px; font-weight: 700; }
select { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); padding: 4px 10px; background: #fff; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { display: inline-flex; gap: 8px; align-items: center; background: #F6FBF3; border-radius: 12px; padding: 8px 12px; font-weight: 700; min-height: 48px; }
.pick input { width: 24px; height: 24px; accent-color: var(--leaf); }
.pick.dim { opacity: .55; }
.file-btn { cursor: pointer; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.manage .set-row.danger span { color: var(--petal-d); }
.report h1 { margin: 0; font-size: 1.6rem; color: var(--leaf-d); } .rep-sub { margin: 0 0 10px; color: var(--muted); }
.rep-student { break-inside: avoid; margin-bottom: 18px; } .rep-student h2 { margin: 8px 0; } .rep-foot { color: var(--muted); font-size: .85rem; }

/* ---------- animations ---------- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes popin { 0% { transform: scale(.92); opacity: 0; } 70% { transform: scale(1.02); opacity: 1; } 100% { transform: scale(1); } }
.modal { animation-name: popmodal; } @keyframes popmodal { from { transform: translate(-50%, -46%) scale(.94); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes slideup { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes starpop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1); } }
.btn:active, .kp-key:active, .mc-btn:active, .cmp-btn:active, .node:active .node-disc { animation: none; }
.node:active .node-disc { transform: scale(.94); }

/* ---------- reduced motion ---------- */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- print (reports) ---------- */
@media print {
  body { background: #fff; padding: 0; font-size: 12pt; }
  .topbar, .dtabs, .dash-head, .dash-body > .dcard:not(.print-area), #toast, .scratch, .trail, .confetti { display: none !important; }
  .print-area { box-shadow: none !important; padding: 0 !important; }
  .dash { padding: 0; width: 100%; }
  .ocard { border: 1px solid #ddd; }
}

/* ---------- animated home button (My Results) ---------- */
.home-fab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: #fff; border-radius: 999px; padding: 4px 14px 4px 5px; min-height: 52px; font-weight: 900; color: var(--leaf-d); box-shadow: 0 4px 0 var(--leaf-d), inset 0 0 0 3px var(--leaf); }
.home-fab.here { background: var(--leaf-l); }
.home-fab:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--leaf-d), inset 0 0 0 3px var(--leaf); }
.hf-icon { position: relative; width: 44px; height: 44px; display: grid; place-items: center; animation: hfHop 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.hf-icon > svg { width: 40px; height: 40px; }
.hf-bird { position: absolute; left: 13px; top: 13px; animation: hfPeek 3.2s ease-in-out infinite; }

.hf-star { animation: hfTwinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hfHop { 0%, 70%, 100% { transform: translateY(0) scale(1); } 76% { transform: translateY(0) scale(1.08, .9); } 84% { transform: translateY(-8px) scale(.95, 1.06); } 92% { transform: translateY(0) scale(1.04, .96); } }
@keyframes hfPeek { 0%, 40%, 100% { transform: translateY(6px); opacity: 0; } 50%, 85% { transform: translateY(-2px); opacity: 1; } }
@keyframes hfTwinkle { 0%, 100% { transform: scale(.8) rotate(0); opacity: .7; } 50% { transform: scale(1.15) rotate(25deg); opacity: 1; } }
@media (max-width: 760px) { .hf-label { display: none; } .home-fab { padding: 4px; } }
.results .res-hero { display: flex; align-items: center; gap: 16px; background: color-mix(in srgb, var(--c) 18%, #fff); border-radius: 28px; padding: 14px 22px; box-shadow: 0 6px 0 var(--line); }
.results .res-hero .lead { text-align: left; margin: 0; }
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.rcard { background: #fff; border-radius: 22px; padding: 14px 12px; display: flex; flex-direction: column; align-items: center; text-align: center; box-shadow: 0 5px 0 var(--line); animation: popin .4s ease both; }
.rcard:nth-child(2) { animation-delay: .06s; } .rcard:nth-child(3) { animation-delay: .12s; } .rcard:nth-child(4) { animation-delay: .18s; } .rcard:nth-child(5) { animation-delay: .24s; } .rcard:nth-child(6) { animation-delay: .3s; }
.rcard b { font-size: 1.7rem; line-height: 1.2; } .rcard span:last-child { color: var(--muted); font-weight: 700; font-size: .9rem; }
.rc-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 4px; }
.rc-ico svg.ico { width: 28px; height: 28px; }
.rcard.sun .rc-ico { background: var(--sun-l); color: var(--sun-d); } .rcard.bark .rc-ico { background: var(--bark-l); } .rcard.leaf .rc-ico { background: var(--leaf-l); color: var(--leaf-d); } .rcard.petal .rc-ico { background: #FFE6EA; } .rcard.sky .rc-ico { background: var(--sky-l); color: var(--sky-d); }
.rsec { background: #fff; border-radius: 24px; padding: 14px 20px 16px; box-shadow: 0 5px 0 var(--line); margin-bottom: 14px; }
.rsec h3 { margin: 0 0 8px; font-size: 1.2rem; }
.res-spot { font-weight: 800; margin: 0 0 10px; }
.res-worlds { display: grid; gap: 10px; } .rw { display: grid; grid-template-columns: minmax(170px, 1fr) 2fr auto; gap: 12px; align-items: center; font-weight: 700; } .rw small { color: var(--muted); }
.res-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.rs { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; background: #F6FBF3; border-radius: 14px; padding: 8px 12px; }
.rs small { grid-column: 2; color: var(--muted); font-weight: 700; }
.leaves { grid-row: span 2; display: flex; gap: 2px; }
.leaves i { width: 14px; height: 20px; border-radius: 0 100% 0 100%; background: #DCE6DF; display: block; }
.leaves i.on { background: var(--leaf); }
.res-sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.res-sessions li { display: flex; gap: 12px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Korean: never break inside a word (standard Korean typography) */
html:lang(ko) body { word-break: keep-all; overflow-wrap: anywhere; }

/* ---------- Phase 2: decimal key, clock control, rewards ---------- */
.kp-dot { font-size: 2.4rem; color: var(--sky-d); }
.kp-ok.wide { grid-column: 1 / -1; min-height: 60px; }
.clk-wrap { background: #fff; border-radius: 24px; padding: 14px; box-shadow: 0 6px 0 var(--line); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.clk-face svg { width: 200px; height: 200px; }
.clk-read { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--sky-d); }
.clk-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.clk-lab { font-weight: 800; min-width: 4.5em; text-align: right; }
.clk-btn { min-width: 70px; min-height: 60px; border: 0; border-radius: 18px; background: var(--sky-l); font-size: 1.4rem; font-weight: 900; color: var(--sky-d); box-shadow: 0 5px 0 #9CC9E6; }
.clk-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #9CC9E6; }
.clk-check { margin-top: 4px; }
.hud-actions .btn.small { min-height: 48px; }

.iotable { border-collapse: separate; border-spacing: 6px; margin: 0 auto; }
.iotable th { background: var(--leaf-l); border-radius: 10px; padding: 8px 12px; }
.iotable td { background: #fff; box-shadow: inset 0 0 0 3px var(--line); border-radius: 12px; min-width: 60px; height: 56px; text-align: center; font-size: 1.6rem; font-weight: 900; }
.iotable td.blank { color: var(--sky-d); box-shadow: inset 0 0 0 3px var(--sky); }
.nest-page .page-head .btn, .shop-page .page-head .chip { margin-bottom: 0; }
.nest-scene { position: relative; max-width: 640px; margin: 0 auto 14px; }
.nest-bg { display: block; border-radius: 30px; box-shadow: 0 8px 0 var(--bark-d); }
.nest-bird { position: absolute; left: 50%; top: 75%; transform: translate(-50%, -86%); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge-cell { background: #fff; border-radius: 20px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; box-shadow: 0 5px 0 var(--line); opacity: .75; }
.badge-cell.on { opacity: 1; box-shadow: 0 5px 0 var(--sun-d), inset 0 0 0 3px var(--sun); }
.badge-cell b { font-size: .9rem; margin-top: 4px; } .badge-cell small { color: var(--muted); font-weight: 700; }
.shop-top { display: flex; align-items: center; gap: 14px; justify-content: center; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 8px; }
.shop-card { background: #fff; border-radius: 22px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: 0 5px 0 var(--line); }
.shop-card.on { box-shadow: 0 5px 0 var(--leaf-d), inset 0 0 0 4px var(--leaf); }
.shop-prev { height: 120px; display: grid; place-items: center; overflow: visible; }
.owned { color: var(--leaf-d); font-weight: 800; display: inline-flex; gap: 4px; align-items: center; }
.btn[aria-disabled="true"] { opacity: .55; }
.res-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.rb { display: flex; flex-direction: column; align-items: center; opacity: .6; } .rb.on { opacity: 1; } .rb small { color: var(--muted); font-weight: 700; }
.badge-earned .btn { margin-top: 6px; }

/* tutor & lesson panels scroll instead of squeezing cards (so pictures never cover the keypad) */
.tu-body > *, .lesson-stage > *, .acol > * { flex-shrink: 0; }
.qcard .visual svg.vis { max-height: 46vh; }

/* instant key feedback */
.kp-key.hit { animation: keyHit .16s ease-out; }
@keyframes keyHit { 0% { transform: translateY(4px) scale(.96); background: var(--sky-l); box-shadow: 0 1px 0 #CFDCCF; } 100% { transform: none; } }
.kp-ok.hit { animation-name: keyHitOk; } @keyframes keyHitOk { 0% { transform: translateY(4px) scale(.97); background: var(--leaf-d); box-shadow: 0 1px 0 var(--leaf-d); } 100% { transform: none; } }
.kp-key { -webkit-user-select: none; user-select: none; touch-action: manipulation; }

/* ---------- 3D map: glossy level buttons with ground shadows ---------- */
.node-disc { position: relative; background: radial-gradient(circle at 32% 26%, #C8F2B5 0 8%, #86D86B 24%, var(--leaf) 58%, #3E9448 100%); box-shadow: inset 0 -9px 0 rgba(0, 0, 0, .14), inset 0 7px 12px rgba(255, 255, 255, .55), 0 8px 0 var(--leaf-d), 0 22px 20px rgba(31, 59, 42, .3); text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.node.st-done .node-disc { background: radial-gradient(circle at 32% 26%, #FFF6C9 0 8%, #FFE680 24%, var(--sun) 58%, #E0AC00 100%); box-shadow: inset 0 -9px 0 rgba(0, 0, 0, .1), inset 0 7px 12px rgba(255, 255, 255, .6), 0 8px 0 var(--sun-d), 0 22px 20px rgba(31, 59, 42, .26); text-shadow: 0 2px 0 rgba(255, 255, 255, .4); }
.node.st-locked .node-disc { background: radial-gradient(circle at 32% 26%, #F1F5F2 0 8%, #D5DED8 30%, #B9C5BD 100%); box-shadow: inset 0 -9px 0 rgba(0, 0, 0, .1), inset 0 7px 12px rgba(255, 255, 255, .6), 0 8px 0 #98A69C, 0 20px 18px rgba(31, 59, 42, .22); }
.node::before { content: ""; position: absolute; left: 50%; top: 86px; width: 92px; height: 22px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(31, 59, 42, .35), rgba(31, 59, 42, 0) 70%); z-index: -1; }
.node.boss::before { top: 96px; width: 120px; }
.sprite-shadow { position: absolute; left: 50%; bottom: -8px; width: 54px; height: 14px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(31, 59, 42, .35), transparent 70%); }
.sprite { filter: none; }
.map-scroll { background: linear-gradient(180deg, #CBEBFB 0%, #E9F7FF 55%, transparent 100%); }
.theme-starlight .map-scroll { background: linear-gradient(180deg, #16204A, #3A4F8A); }

/* ---------- opening animation ---------- */
#intro { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 38%, #E9F8FF 0%, #9FDAF6 38%, #4FA8EC 78%, #2F7DB8 100%); }
#intro.out { animation: inOut .55s ease forwards; }
.in-rays { position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .22) 0 6deg, transparent 6deg 18deg); animation: inSpin 14s linear infinite; }
.in-zoom { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; transform-origin: 50% 13%; animation: inZoom 3.8s cubic-bezier(.16, .84, .24, 1) both; }
.in-title { margin: 0; display: flex; font-size: clamp(72px, 15vw, 160px); font-weight: 900; letter-spacing: .05em; line-height: 1; color: var(--leaf); -webkit-text-stroke: 5px var(--leaf-d); paint-order: stroke fill; text-shadow: 0 9px 0 var(--leaf-d), 0 18px 30px rgba(0, 0, 0, .25); }
.in-l { display: inline-block; opacity: 0; animation: inLand .58s cubic-bezier(.2, 1.55, .4, 1) both; animation-delay: calc(.45s + var(--i) * .23s); }
.in-sub { opacity: 0; font-size: clamp(22px, 4vw, 40px); font-weight: 900; letter-spacing: .14em; color: #FFF7EA; background: linear-gradient(180deg, #C08A55, #9A6334); padding: 10px 28px 12px; border-radius: 14px; box-shadow: 0 7px 0 var(--bark-d), 0 16px 26px rgba(0, 0, 0, .2); animation: inDrop .65s cubic-bezier(.2, 1.5, .4, 1) 2s both; }
.in-birds { width: min(500px, 66vw); border-radius: 26px; opacity: 0; box-shadow: 0 16px 34px rgba(0, 0, 0, .22); animation: inRise .8s cubic-bezier(.2, 1.2, .4, 1) 2.45s both; }
.in-skip { position: absolute; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 999px; padding: 12px 22px; min-height: 52px; font-weight: 900; color: #fff; background: rgba(31, 59, 42, .35); }
@keyframes inZoom { 0% { transform: scale(3.4); } 100% { transform: scale(1); } }
@keyframes inLand { 0% { opacity: 0; transform: scale(4.5) translateY(-70px) rotate(-14deg); filter: blur(12px); } 55% { opacity: 1; transform: scale(.86) translateY(8px); filter: blur(0); } 78% { transform: scale(1.06) translateY(-3px); } 100% { opacity: 1; transform: none; } }
@keyframes inDrop { 0% { opacity: 0; transform: translateY(-90px) rotate(-8deg); } 100% { opacity: 1; transform: rotate(-1.5deg); } }
@keyframes inRise { 0% { opacity: 0; transform: translateY(70px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes inSpin { to { transform: rotate(360deg); } }
@keyframes inOut { to { opacity: 0; transform: scale(1.06); } }

/* ---------- Continue my adventure: big, bouncing, impossible to miss ---------- */
.btn-adventure { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; max-width: 720px; margin: 16px auto; border: 0; border-radius: 30px; padding: 12px 22px 12px 14px; min-height: 96px; text-align: left; color: #fff;
  background: linear-gradient(180deg, #7FD65F, var(--leaf) 55%, #46A532); box-shadow: 0 8px 0 var(--leaf-d), 0 16px 28px rgba(47, 125, 58, .35); animation: advGlow 2.2s ease-in-out infinite; }
.btn-adventure:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--leaf-d); animation: none; }
.ba-bird { flex: none; width: 84px; display: grid; place-items: center; }
.ba-text { flex: 1; display: flex; flex-direction: column; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.ba-text b { font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 900; line-height: 1.15; }
.ba-text small { font-size: 1rem; font-weight: 700; opacity: .95; }
.ba-arrow { flex: none; width: 62px; height: 62px; border-radius: 50%; background: #fff; color: var(--leaf-d); display: grid; place-items: center; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); animation: advArrow 1.1s ease-in-out infinite; }
.ba-arrow svg { width: 36px; height: 36px; }
.adventure-dock { display: none; position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 20; padding: 0 4px; }
.adventure-dock .btn-adventure { margin: 10px auto 4px; }
@keyframes advGlow { 0%, 100% { box-shadow: 0 8px 0 var(--leaf-d), 0 16px 28px rgba(47, 125, 58, .35); } 50% { box-shadow: 0 8px 0 var(--leaf-d), 0 16px 40px rgba(93, 187, 70, .7), 0 0 0 6px rgba(255, 225, 90, .55); } }
@keyframes advArrow { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

/* ---------- start screen resume card, log out, avatars, break scene, settings ---------- */
.resume-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(560px, 100%); }
.resume-card { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; border-radius: 26px; padding: 12px 18px; background: #fff; text-align: left; box-shadow: 0 7px 0 var(--sun-d), 0 0 0 4px var(--sun) inset, 0 14px 26px rgba(0, 0, 0, .12); animation: advGlow 2.2s ease-in-out infinite, popin .5s ease; }
.resume-card .rc-txt { flex: 1; display: flex; flex-direction: column; } .resume-card b { font-size: 1.35rem; } .resume-card small { color: var(--muted); font-weight: 700; }
.resume-card .rc-go { width: 54px; height: 54px; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; transform: scaleX(-1); animation: advArrow 1.1s ease-in-out infinite; }
.resume-card .rc-go svg.ico { width: 30px; height: 30px; }
.logout-btn { margin-bottom: 0; min-height: 50px; } .logout-btn svg.ico { width: 1.25em; height: 1.25em; }
@media (max-width: 1180px) { .brand-name { display: none; } .hud-nest span, .hud-shop span, .hud-results span { display: none; } .hud-actions .btn.small { padding: 8px 12px; } }
@media (max-width: 860px) { .logout-btn span { display: none; } .logout-btn { padding: 8px 12px; } }
.hud { flex-wrap: nowrap; } .hud .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .hud .chips::-webkit-scrollbar { display: none; }
@media (orientation: portrait) { .hud { flex-wrap: wrap; } }
.avatar-row .av-pick { min-width: 120px; } .avatar-row .kid-face { width: 84px; height: 84px; }
.break-scene { display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.set-row select { min-height: 48px; max-width: 260px; } .set-tip { margin: 2px 0 8px; font-size: .85rem; color: var(--muted); }

.adventure-dock.show { display: block; animation: slidein .3s ease; }
.hud-nest svg.ico, .hud-shop svg.ico { width: 30px; height: 30px; }

/* ======================= Phase 3 ======================= */
.art { display: block; height: auto; flex: none; filter: drop-shadow(0 6px 6px rgba(31, 59, 42, .14)); -webkit-user-drag: none; }
/* home button uses the birdhouse graphic */
.hf-icon img { width: 42px; height: auto; display: block; }
/* weather budgie */
.hero-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.wx { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wx-bird { position: relative; z-index: 2; animation: wxFloat 4s ease-in-out infinite; }
.wx-say { position: relative; z-index: 2; background: #fff; border-radius: 16px; padding: 6px 12px; box-shadow: 0 4px 0 var(--line); text-align: center; display: flex; flex-direction: column; line-height: 1.2; }
.wx-say b { font-size: .95rem; } .wx-say span { font-size: .82rem; color: var(--ink-2); font-weight: 700; }
.wx-fx { position: absolute; inset: -10% -14% 30%; overflow: hidden; pointer-events: none; z-index: 1; border-radius: 50%; }
.wx-fx i { position: absolute; display: block; }
.wx-fx .drop { top: -10%; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(#BFE8FF, #4FA8EC); animation: wxRain .9s linear infinite; }
.wx-fx .flake { top: -10%; color: #fff; font-size: 14px; text-shadow: 0 0 3px #8ED1F2; animation: wxSnow 4s linear infinite; }
.wx-fx .leaf { left: -10%; width: 14px; height: 9px; border-radius: 0 100% 0 100%; background: #FF9A3D; animation: wxWind 3s linear infinite; }
.wx-fx .twinkle { width: 6px; height: 6px; border-radius: 50%; background: #FFE77A; box-shadow: 0 0 6px #FFE77A; animation: wxTwinkle 2s ease-in-out infinite; }
.wx-fx .flash { inset: 0; background: rgba(255, 255, 255, .9); opacity: 0; animation: wxFlash 6s infinite; }
.wx-fx .mist { left: -30%; width: 160%; height: 30%; border-radius: 50%; background: rgba(255, 255, 255, .55); filter: blur(6px); animation: wxMist 7s ease-in-out infinite alternate; } .wx-fx .m1 { top: 30%; } .wx-fx .m2 { top: 60%; animation-delay: -3s; }
.wx-fx .rays { left: 10%; top: 0; width: 60%; aspect-ratio: 1; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 225, 90, .35) 0 10deg, transparent 10deg 30deg); animation: inSpin 16s linear infinite; }
.wx-fx .drift { left: 0; top: 10%; width: 40%; height: 20%; border-radius: 50%; background: rgba(255, 255, 255, .7); filter: blur(4px); animation: wxDrift 9s ease-in-out infinite alternate; }
.wx-moon .wx-bird { animation-duration: 6s; } .wx-storm .wx-bird { animation: wxShiver 3s ease-in-out infinite; }
@keyframes wxFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px) rotate(-1deg); } }
@keyframes wxRain { to { transform: translateY(260px); } }
@keyframes wxSnow { 0% { transform: translateY(0) translateX(0) rotate(0); } 100% { transform: translateY(240px) translateX(20px) rotate(240deg); } }
@keyframes wxWind { 0% { transform: translateX(0) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateX(320px) translateY(30px) rotate(540deg); opacity: 0; } }
@keyframes wxTwinkle { 0%, 100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes wxFlash { 0%, 92%, 100% { opacity: 0; } 93% { opacity: .85; } 95% { opacity: 0; } 96% { opacity: .6; } }
@keyframes wxMist { to { transform: translateX(18%); } }
@keyframes wxDrift { to { transform: translateX(140%); } }
@keyframes wxShiver { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-2px) translateY(-3px); } }
.world-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.world-head .wx { flex-direction: row; } .world-head .wx-fx { inset: -10% 40% 0 -20%; }
@media (max-width: 760px) { .world-head .wx-say { display: none; } }
/* art in context */
.vk-art { display: inline-block; vertical-align: middle; margin-right: 8px; }
.resume-card .rc-sleep { margin: -16px 0 -10px -6px; }
.ys-art { display: inline-block; vertical-align: middle; margin-right: 4px; }
.sp-art { width: 40px; height: auto; margin-right: 2px; }
.done-star { margin-bottom: -10px; animation: popin .5s ease .2s both; }
.rc-art { width: 52px; } .rcard .rc-ico:has(.rc-art) { width: 64px; height: 64px; background: transparent; }
.hud-art { width: 30px; height: auto; margin: -6px 0; }
.hud-garden { background: linear-gradient(180deg, #FFB3C1, #FF8FA3); --s: #C2415E; box-shadow: 0 6px 0 #C2415E; color: #fff; }
@media (max-width: 1180px) { .hud-garden span { display: none; } }
.set-h { margin: 14px 0 2px; font-size: 1.05rem; color: var(--leaf-d); }
/* Speed Garden */
.g-hero { display: flex; align-items: center; gap: 16px; justify-content: center; background: #fff; border-radius: 28px; padding: 12px 20px; box-shadow: 0 6px 0 var(--line); }
.g-hero .lead { text-align: left; margin: 0; }
.g-timer { display: flex; width: fit-content; margin: 16px auto; }
.g-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.g-mode { border: 0; border-radius: 26px; background: #fff; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 7px 0 #F2B6C2, inset 0 0 0 4px #FFD6DE; min-height: 170px; }
.g-mode:active { transform: translateY(5px); box-shadow: 0 2px 0 #F2B6C2, inset 0 0 0 4px #FFD6DE; }
.g-op { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 900; color: #fff; background: radial-gradient(circle at 32% 28%, #FFC2CE, #FF8FA3 60%, #E0607A); box-shadow: 0 5px 0 #C2415E; }
.g-mode b { font-size: 1.2rem; } .g-mode small { color: var(--muted); font-weight: 700; }
.garden-play { flex: 1; display: flex; flex-direction: column; padding: 10px 16px 18px; gap: 12px; max-width: 1280px; width: 100%; margin: 0 auto; position: relative; }
.g-main { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (orientation: portrait), (max-width: 860px) { .g-main { grid-template-columns: 1fr; } }
.g-clock i { background: linear-gradient(90deg, #FF8FA3, #FFE15A); transition: width .2s linear; }
.g-fact { min-height: 300px; }
.g-correction { text-align: center; color: var(--petal-d); font-weight: 800; animation: popin .3s ease; } .g-correction .q-expr { color: var(--ink); }
.g-bed { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 60px; width: 100%; padding: 8px; border-radius: 18px; background: linear-gradient(180deg, transparent 55%, #CDEBBE 55%, #A8D98E); }
.g-bed.big { max-width: 640px; }
.g-flower { width: 40px; height: 46px; animation: grow .45s cubic-bezier(.2, 1.5, .4, 1) both; transform-origin: 50% 100%; }
@keyframes grow { from { transform: scale(0); } to { transform: scale(1); } }
.g-count { margin: 0; font-weight: 900; color: var(--leaf-d); }
.g-mascot { align-self: center; animation: wxFloat 3s ease-in-out infinite; }
.g-pausebox { position: absolute; inset: 70px 16px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(234, 248, 255, .94); border-radius: 30px; font-size: 1.5rem; z-index: 5; }
/* reports */
.rep-head { display: flex; align-items: center; gap: 14px; } .rep-art { width: 70px; height: auto; }
.rep-student h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .rep-student h2 .budgie, .rep-student h2 .kid-face { width: 44px !important; }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .rep-cols ul { margin: 0; padding-left: 20px; font-weight: 700; }
.dl { font-size: .8rem; font-weight: 900; } .dl.up { color: var(--leaf-d); } .dl.down { color: var(--petal-d); } .dl.eq { color: var(--muted); }
@media print { .rep-cols { grid-template-columns: 1fr 1fr; } .rep-student { page-break-inside: avoid; } }
/* accessibility modes */
body { font-size: 1.19rem; }
html.text-l { font-size: 112.5%; } html.text-xl { font-size: 125%; }
html.text-l .q-expr, html.text-xl .q-expr { font-size: clamp(2.6rem, 6.2vw, 4rem); }
html.contrast { --ink: #000; --ink-2: #111; --muted: #2B3A30; --line: #6B7F70; }
html.contrast body { background: #fff; }
html.contrast .qcard, html.contrast .mc-btn, html.contrast .cmp-btn, html.contrast .kp-key, html.contrast .card, html.contrast .dcard, html.contrast .bubble, html.contrast .rcard, html.contrast .rsec { box-shadow: 0 0 0 3px #000 !important; }
html.contrast .btn.leaf { --b: #1E6B2A; } html.contrast .muted, html.contrast small { color: #222 !important; }
html.dyslexia body { letter-spacing: .05em; word-spacing: .16em; line-height: 1.7; }
html.dyslexia .q-text p, html.dyslexia .tu-text, html.dyslexia .verse-text { line-height: 1.8; }

/* big, finger-friendly sliders */
.slider { display: flex; align-items: center; gap: 10px; }
.slider output { min-width: 3.2em; text-align: right; font-weight: 900; color: var(--leaf-d); font-variant-numeric: tabular-nums; }
.set-row input[type=range] { -webkit-appearance: none; appearance: none; width: min(240px, 46vw); height: 44px; background: transparent; margin: 0; touch-action: pan-y; cursor: pointer; }
.set-row input[type=range]::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--leaf), var(--sky)); box-shadow: inset 0 2px 0 rgba(0, 0, 0, .12); }
.set-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; margin-top: -12px; border-radius: 50%; background: #fff; border: 4px solid var(--leaf-d); box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.set-row input[type=range]::-moz-range-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--leaf), var(--sky)); }
.set-row input[type=range]::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 4px solid var(--leaf-d); }
.icon-btn.snd.off { background: #FFE6EA; color: var(--petal-d); box-shadow: 0 4px 0 #F2B6C2; }
.modal { overscroll-behavior: contain; }

/* the top bar (mute, My Results, language, Log out) stays tappable even when a pop-up or the tutor is open */
.modal-back, .tutor-back { top: calc(var(--top) + 8px); }
.modal { top: calc(50% + var(--top) / 2); max-height: calc(100dvh - var(--top) - 28px); }

/* ---------- official logo ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.brand-logo { height: 48px; width: auto; display: block; filter: drop-shadow(0 2px 2px rgba(31, 59, 42, .12)); }
.hero-logo { margin: 0; flex: 1 1 520px; max-width: 680px; }
.kairos-logo { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 14px rgba(31, 59, 42, .16)); -webkit-user-drag: none; }
.kairos-logo.bob { animation: logoBob 5s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes logoBob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-.6deg); } }
.about-logo { width: 190px; height: auto; margin: 0 auto 4px; display: block; }
.rep-logo { width: 150px; height: auto; } .rep-head .rep-sub { font-size: 1.1rem; font-weight: 800; margin: 0; }
/* intro: letters land in the logo's own colors, then the logo takes over */
.in-title { font-family: "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif; letter-spacing: .02em; -webkit-text-stroke: 0; paint-order: stroke fill; text-shadow: none; }
.in-l.b { color: #3FC8F0; -webkit-text-stroke: 7px #123B7A; text-shadow: 0 8px 0 #123B7A, 0 0 0 transparent; }
.in-l.y { color: #FFD43B; -webkit-text-stroke: 7px #123B7A; text-shadow: 0 8px 0 #123B7A; }
.in-zoom { animation: inZoom 2.2s cubic-bezier(.16, .84, .24, 1) both, inGone .45s ease 2.05s forwards; }
@keyframes inGone { to { opacity: 0; transform: scale(1.35); filter: blur(6px); } }
.in-logo { position: absolute; width: min(760px, 88vw); opacity: 0; animation: inLogo .9s cubic-bezier(.2, 1.35, .4, 1) 2.15s both; }
.in-logo .kairos-logo { filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .28)); }
@keyframes inLogo { 0% { opacity: 0; transform: scale(2.6); filter: blur(10px); } 60% { opacity: 1; transform: scale(.94); filter: blur(0); } 100% { opacity: 1; transform: scale(1); } }
.in-spark { position: absolute; width: 26px; height: 26px; opacity: 0; background: radial-gradient(circle, #fff 0 18%, #FFE15A 20% 45%, transparent 48%); animation: inSpark 1.1s ease-out both; }
.in-spark::before, .in-spark::after { content: ""; position: absolute; left: 50%; top: -60%; width: 3px; height: 220%; margin-left: -1.5px; background: linear-gradient(transparent, #fff, transparent); }
.in-spark::after { transform: rotate(90deg); }
.s1 { left: 6%; top: 52%; animation-delay: 2.8s; } .s2 { right: 6%; top: 50%; animation-delay: 2.95s; } .s3 { left: 46%; top: 6%; animation-delay: 3.1s; } .s4 { right: 22%; bottom: 4%; animation-delay: 3.25s; }
@keyframes inSpark { 0% { opacity: 0; transform: scale(.2) rotate(0); } 40% { opacity: 1; transform: scale(1.4) rotate(45deg); } 100% { opacity: 0; transform: scale(.6) rotate(90deg); } }
@media (orientation: portrait) { .hero-logo { flex-basis: 100%; } }

/* ---------- top bar: logo | home button (centered) | settings ---------- */
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.topbar .brand { justify-self: start; }
.topbar .top-actions { justify-self: end; }
.seg .ls { display: none; }
@media (max-width: 1240px) { .top-lang .lf { display: none; } .top-lang .ls { display: inline; } .top-lang button { min-width: 44px; padding: 8px 10px; } }

/* ---------- interactive adventure map ---------- */
.adv-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 4px 0 12px; scrollbar-width: thin; }
.adv-canvas { position: relative; aspect-ratio: 3 / 1; width: max(100%, 1050px); margin: 0 auto; border-radius: 26px; overflow: hidden; box-shadow: 0 10px 0 rgba(31, 59, 42, .14), 0 18px 34px rgba(31, 59, 42, .18); background: #CDEBFA; }
.adv-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.adv-canvas.night .adv-art { filter: brightness(.72) saturate(.9) hue-rotate(-8deg); }
.adv-nightsky i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #FFF6C2; box-shadow: 0 0 8px #FFE77A; animation: wxTwinkle 2.4s ease-in-out infinite; pointer-events: none; }
/* soft clouds drifting on their own layer */
.adv-clouds { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.adv-clouds i { position: absolute; width: 22%; height: 14%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 70%); filter: blur(4px); animation: advDrift 46s linear infinite; }
.adv-clouds .c1 { top: 6%; left: -25%; } .adv-clouds .c2 { top: 28%; left: -25%; animation-duration: 64s; animation-delay: -22s; opacity: .7; } .adv-clouds .c3 { top: 74%; left: -25%; animation-duration: 54s; animation-delay: -40s; opacity: .6; }
@keyframes advDrift { from { transform: translateX(0); } to { transform: translateX(560%); } }
/* level medallions sit on the painted platforms */
.adv-node { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; z-index: 3; cursor: pointer; }
.adv-node .med { position: relative; width: clamp(56px, 6.2%, 84px); aspect-ratio: 1; min-width: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; font-weight: 900; color: #fff; transition: transform .15s; }
.adv-node .med svg.ico { width: 46%; height: 46%; }
.adv-node:active .med { transform: translateY(4px) scale(.95); }
.adv-node:focus-visible { outline: none; } .adv-node:focus-visible .med { box-shadow: 0 0 0 5px #fff, 0 0 0 9px #123B7A !important; }
.adv-node.st-done .med { background: radial-gradient(circle at 32% 26%, #FFF6C9 0 9%, #FFE680 26%, #F5C02A 60%, #C98F00 100%); color: #6B4A00; box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .12), inset 0 6px 10px rgba(255, 255, 255, .6), 0 6px 0 #9A6C00, 0 14px 18px rgba(0, 0, 0, .3); }
.adv-node.st-open .med { background: radial-gradient(circle at 32% 26%, #C9FFF0 0 9%, #4FE0B8 28%, #14A889 62%, #0B7464 100%); box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .14), inset 0 6px 10px rgba(255, 255, 255, .5), 0 6px 0 #075A4E, 0 14px 18px rgba(0, 0, 0, .3); text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.adv-node.st-locked .med { background: radial-gradient(circle at 32% 26%, #E6EEF8 0 9%, #A9BCD6 32%, #7C93B4 70%, #5E7596 100%); color: #EEF3FA; box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .12), inset 0 6px 10px rgba(255, 255, 255, .45), 0 6px 0 #48607F, 0 12px 14px rgba(0, 0, 0, .25); }
.adv-node.boss .med { width: clamp(68px, 7.4%, 98px); min-width: 68px; }
.adv-node.current .med { animation: advPulse 1.8s ease-in-out infinite; }
.adv-node .halo { position: absolute; inset: -12px; border-radius: 50%; border: 4px solid rgba(255, 245, 160, .95); box-shadow: 0 0 22px 6px rgba(79, 224, 184, .7); animation: advHalo 1.8s ease-out infinite; pointer-events: none; }
@keyframes advPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes advHalo { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.play-tag { position: absolute; top: -34px; background: #FFD43B; color: #123B7A; font-weight: 900; font-size: .95rem; padding: 4px 12px; border-radius: 999px; box-shadow: 0 3px 0 #C99A00, 0 6px 10px rgba(0, 0, 0, .2); white-space: nowrap; animation: advBob 1.4s ease-in-out infinite; }
@keyframes advBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.adv-label { margin-top: 8px; max-width: 170px; background: rgba(255, 255, 255, .96); color: #14284A; border-radius: 12px; padding: 4px 10px 5px; box-shadow: 0 3px 0 rgba(18, 59, 122, .28), 0 6px 12px rgba(0, 0, 0, .18); display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.15; }
.adv-label small { font-size: .7rem; font-weight: 800; color: #3D5B85; text-transform: uppercase; letter-spacing: .04em; } .adv-label b { font-size: .82rem; font-weight: 900; }
.adv-label em { font-style: normal; font-size: .7rem; font-weight: 800; color: #5E4A00; background: #FFF1B8; border-radius: 8px; padding: 1px 6px; margin-top: 3px; display: inline-flex; gap: 3px; align-items: center; } .adv-label em svg.ico { width: 12px; height: 12px; }
.adv-stars { display: flex; gap: 1px; margin-top: 2px; } .adv-stars i { width: 15px; height: 15px; color: #D6DCE4; } .adv-stars i.on { color: #F5B700; } .adv-stars svg.ico { width: 100%; height: 100%; }
.adv-node.st-locked .adv-label { opacity: .95; }
.adv-node.nope .med { animation: advNope .4s ease; } @keyframes advNope { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.adv-node.celebrate::after { content: ""; position: absolute; left: 50%; top: 30%; width: 140px; height: 140px; margin: -70px 0 0 -70px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .95) 0 6%, transparent 7%), conic-gradient(from 0deg, transparent 0 8deg, #FFE15A 8deg 14deg, transparent 14deg 45deg, #fff 45deg 50deg, transparent 50deg 90deg);
  -webkit-mask: radial-gradient(circle, #000 40%, transparent 70%); mask: radial-gradient(circle, #000 40%, transparent 70%); animation: advBurst 1.6s ease-out forwards; }
@keyframes advBurst { 0% { transform: scale(.2) rotate(0); opacity: 1; } 100% { transform: scale(1.6) rotate(120deg); opacity: 0; } }
/* the student's budgie waits above the current level */
.adv-bird { position: absolute; transform: translate(-50%, -100%); margin-top: -34px; z-index: 4; pointer-events: none; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .25)); }
/* tappable painted budgies and castle */
.adv-hot { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; z-index: 2; cursor: pointer; min-width: 48px; }
.adv-hot:focus-visible { outline: 4px solid #fff; box-shadow: 0 0 0 8px #123B7A; }
.adv-hot.boing { animation: advBoing .5s ease; background: radial-gradient(circle, rgba(255, 255, 255, .45), transparent 65%); }
@keyframes advBoing { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.18); } }
.adv-bubble { position: absolute; transform: translate(-50%, -100%); z-index: 6; max-width: 300px; background: #fff; color: #14284A; font-weight: 800; font-size: .95rem; padding: 10px 14px; border-radius: 18px; box-shadow: 0 5px 0 rgba(18, 59, 122, .2), 0 10px 20px rgba(0, 0, 0, .2); pointer-events: none; }
.adv-bubble.pop { animation: popin .3s ease; }
html.contrast .adv-label { background: #fff; color: #000; box-shadow: 0 0 0 3px #000; }
@media (prefers-reduced-motion: reduce) { .adv-clouds i, .adv-node.current .med, .adv-node .halo, .play-tag, .adv-nightsky i { animation: none !important; } }
body.reduce-motion .adv-clouds i, body.reduce-motion .adv-node.current .med, body.reduce-motion .adv-node .halo, body.reduce-motion .play-tag { animation: none !important; }

/* medallion centred exactly on its platform; the label hangs underneath */
.adv-node { display: block; }
.adv-label { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); margin: 0; width: max-content; max-width: 132px; padding: 3px 8px 4px; border-radius: 10px; }
.adv-label small { font-size: .62rem; } .adv-label b { font-size: .74rem; }
.adv-label em { font-size: .62rem; padding: 1px 5px; margin-top: 2px; }
.adv-stars i { width: 13px; height: 13px; }
.play-tag { position: static; display: block; font-size: .8rem; padding: 2px 10px; margin: -14px auto 3px; }
.adv-node.st-locked .adv-label { background: rgba(236, 242, 250, .95); }
.adv-bird { margin-top: -26px; }

/* =========== medallions set INTO the painted platforms (v3.1.1) ===========
   The button is exactly the stone top's ellipse, so everything inside follows the platform's perspective. */
.adv-node { transform: translate(-50%, -50%); }
.adv-node::after { content: ""; position: absolute; left: -6%; right: -6%; top: -230%; bottom: -60%; }   /* big touch area */
.adv-node .med, .adv-node .halo { display: none; }
.adv-node .plate { position: absolute; inset: 0; border-radius: 50%; overflow: visible; }
/* inlay: recessed into the stone, lit from above, with a thin bright lip */
.adv-node .inlay { position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 3px 4px rgba(40, 24, 0, .45), inset 0 -2px 2px rgba(255, 255, 255, .55), 0 1px 0 rgba(255, 255, 255, .7); }
.adv-node .inlay::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); }
.adv-node.st-done .inlay { background: radial-gradient(ellipse at 45% 35%, #FFF3B8 0 12%, #F6CD47 40%, #D9A21A 75%, #B07D05 100%); }
.adv-node.st-open .inlay { background: radial-gradient(ellipse at 45% 35%, #D6FFF2 0 10%, #5BE6C0 38%, #17AE8D 72%, #0B7A68 100%); box-shadow: inset 0 3px 4px rgba(0, 40, 30, .45), inset 0 -2px 2px rgba(255, 255, 255, .55), 0 0 14px 3px rgba(91, 230, 192, .65); }
.adv-node.st-locked .inlay { background: radial-gradient(ellipse at 45% 35%, #E9EEF6 0 10%, #B3C2D8 42%, #8EA2BF 78%, #73879F 100%); opacity: .92; }
/* glowing rings spread across the platform for the level to play next (ellipses, so they keep the perspective) */
.adv-node .ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(255, 244, 170, .95); box-shadow: 0 0 10px rgba(91, 230, 192, .9); animation: advRing 2s ease-out infinite; pointer-events: none; }
.adv-node .ring.r2 { animation-delay: 1s; }
@keyframes advRing { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.55); opacity: 0; } }
/* the coin stands on the middle of the platform */
.adv-node .coin { position: absolute; left: 50%; bottom: 50%; width: 56%; aspect-ratio: 1; transform: translate(-50%, 18%); z-index: 2; }
.adv-node.boss .coin { width: 64%; }
.adv-node .coin-face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: clamp(1rem, 2.2vw, 1.6rem); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.adv-node .coin-face svg.ico { width: 48%; height: 48%; }
.adv-node .coin-face b { font-size: 1.15em; }
.adv-node.st-done .coin-face { background: radial-gradient(circle at 34% 28%, #FFF8D0 0 10%, #FFE16B 30%, #F2B81E 64%, #C48A00 100%); color: #6B4A00; text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  box-shadow: inset 0 0 0 3px #FFE58A, inset 0 -4px 0 rgba(0, 0, 0, .12), 4px 3px 0 #9A6C00, 0 6px 8px rgba(0, 0, 0, .25); }
.adv-node.st-open .coin-face { background: radial-gradient(circle at 34% 28%, #DAFFF4 0 10%, #5BE6C0 32%, #13A587 66%, #0A6E5E 100%);
  box-shadow: inset 0 0 0 3px #9FF5DC, inset 0 -4px 0 rgba(0, 0, 0, .14), 4px 3px 0 #075A4E, 0 6px 8px rgba(0, 0, 0, .25); }
.adv-node.st-locked .coin-face { background: radial-gradient(circle at 34% 28%, #F1F5FA 0 10%, #B9C7DA 36%, #8397B4 72%, #62789A 100%); color: #F4F7FB;
  box-shadow: inset 0 0 0 3px #D3DDEA, inset 0 -4px 0 rgba(0, 0, 0, .1), 4px 3px 0 #4D6382, 0 5px 7px rgba(0, 0, 0, .22); }
.adv-node.current .coin { animation: advFloat 2s ease-in-out infinite; }
@keyframes advFloat { 0%, 100% { transform: translate(-50%, 18%); } 50% { transform: translate(-50%, 4%); } }
/* contact shadow where the coin touches the stone */
.adv-node .coin-shadow { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; transform: translate(-50%, -30%); border-radius: 50%; background: radial-gradient(ellipse, rgba(30, 20, 0, .5), rgba(30, 20, 0, 0) 70%); z-index: 1; }
.adv-node.current .coin-shadow { animation: advShadow 2s ease-in-out infinite; }
@keyframes advShadow { 0%, 100% { transform: translate(-50%, -30%) scale(1); opacity: 1; } 50% { transform: translate(-50%, -30%) scale(.8); opacity: .7; } }
.adv-node:active .coin-face { transform: translateY(3px); }
.adv-node:focus-visible .coin-face { box-shadow: 0 0 0 4px #fff, 0 0 0 8px #123B7A !important; }
.adv-node.nope .coin { animation: advNope2 .4s ease; } @keyframes advNope2 { 0%, 100% { transform: translate(-50%, 18%); } 25% { transform: translate(-58%, 18%); } 75% { transform: translate(-42%, 18%); } }
/* label hangs below the platform's gold drum */
.adv-node .adv-label { top: calc(100% + 26px); }
.adv-node.celebrate::after { top: -120%; bottom: auto; height: 260%; left: -10%; right: -10%; width: auto; margin: 0; }
/* the companion stands on the platform's edge */
.adv-bird { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .adv-node .ring, .adv-node.current .coin, .adv-node.current .coin-shadow { animation: none !important; } }
body.reduce-motion .adv-node .ring, body.reduce-motion .adv-node.current .coin, body.reduce-motion .adv-node.current .coin-shadow { animation: none !important; }

/* ---------- PIN screens on short landscape iPads: greeting left, keypad right (whole keypad on screen) ---------- */
@media (orientation: landscape) and (max-height: 860px) {
  body[data-screen="pin"] .center-col, body[data-screen="profSetup"] .center-col, body[data-screen="profLogin"] .center-col {
    width: min(1000px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); column-gap: 48px; row-gap: 8px;
    align-items: center; justify-items: center; align-content: center; padding: 12px 24px; min-height: calc(100dvh - var(--top) - 8px); grid-auto-flow: dense; }
  body[data-screen="pin"] .center-col > *, body[data-screen="profSetup"] .center-col > *, body[data-screen="profLogin"] .center-col > * { grid-column: 1; }
  body[data-screen="pin"] .center-col > .pin-host, body[data-screen="profSetup"] .center-col > .pin-host, body[data-screen="profLogin"] .center-col > .pin-host { grid-column: 2; grid-row: 1 / span 8; align-self: center; width: 100%; }
  body[data-screen="pin"] .pin-host .pin, body[data-screen="profSetup"] .pin-host .pin, body[data-screen="profLogin"] .pin-host .pin { width: 100%; }
}

/* ---------- main forward buttons always on screen (they stay pinned to the bottom edge while content scrolls) ---------- */
.verse-actions, .level-done .lc-actions, .wiz-body > [data-next], .lesson-nav {
  position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 15; }
.verse-actions, .level-done .lc-actions {
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 28px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(31, 59, 42, .16); width: fit-content; margin-left: auto; margin-right: auto; }
.wiz-body > [data-next] { box-shadow: 0 6px 0 var(--leaf-d), 0 10px 24px rgba(31, 59, 42, .22); }
.lesson-nav { background: linear-gradient(180deg, rgba(234, 248, 255, 0), rgba(234, 248, 255, .92) 35%); padding-top: 18px; }

/* messages never block taps, and appear under the top bar instead of on top of the main buttons */
#toast { pointer-events: none; top: calc(var(--top) + 12px); bottom: auto; transform: translate(-50%, -30px); box-shadow: 0 10px 26px rgba(0, 0, 0, .22); }
#toast.show { transform: translate(-50%, 0); }

/* ---------- "Your Turn": question left, answer right, so the answer controls are always in view ---------- */
.tu-your-grid { width: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.tu-answer { display: flex; flex-direction: column; align-items: center; gap: 10px; position: sticky; top: 0; }
.tu-answer .answer-host { width: 100%; }
.tutor .tu-your-grid .visual svg.vis { max-height: 40vh; }
.tutor .tu-answer .kp-key { min-height: 54px; }
.tutor .tu-answer .kp-val { min-height: 56px; font-size: 1.8rem; }
@media (max-width: 700px) { .tu-your-grid { grid-template-columns: 1fr; } }
/* compact clock control on short screens and inside the tutor */
@media (max-height: 820px) { .clk-face svg { width: 150px; height: 150px; } .clk-wrap { gap: 6px; padding: 10px; } .clk-btn { min-height: 50px; min-width: 62px; } .clk-read { font-size: 1.6rem; } .clk-check { min-height: 54px; } }
.tutor .clk-face svg { width: 140px; height: 140px; }
.tutor .clk-wrap { gap: 6px; padding: 10px; } .tutor .clk-btn { min-height: 48px; min-width: 58px; } .tutor .clk-read { font-size: 1.5rem; }
/* portrait iPads are wide enough for question + answer side by side: keeps the keypad on screen */
@media (orientation: portrait) and (min-width: 740px) { .pr-main { grid-template-columns: minmax(0, 1.15fr) minmax(290px, 1fr); } .pr-main .qcard .visual svg.vis { max-height: 44vh; } }
/* answer buttons share the column evenly and wrap long words instead of pushing off screen */
.mc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mc.long { grid-template-columns: minmax(0, 1fr); }
.mc-btn { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }

/* ---------- logo = home button ---------- */
.brand-home { flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: none; padding: 2px 8px 2px 4px; margin-left: -4px; border-radius: 14px; cursor: pointer; color: var(--leaf-d); -webkit-tap-highlight-color: transparent; }
.brand-home:hover, .brand-home:focus-visible { background: var(--leaf-l); }
.brand-home:focus-visible { outline: 3px solid var(--leaf-d); outline-offset: 2px; }
.brand-home:active { transform: translateY(2px); }
.brand-home-label { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; line-height: 1; padding-left: 4px; }
.brand-home-label svg { width: 13px; height: 13px; flex: none; }
.brand-home.here .brand-home-label { color: var(--ink); }
.hud-results svg.ico { width: 28px; height: 28px; }
.credit-link { display: inline-block; margin-top: 8px; padding: 10px 14px; min-height: 44px; font-weight: 800; color: var(--leaf-d); text-decoration: underline; }
.credit small { display: inline-block; max-width: 62ch; line-height: 1.5; }

/* ---------- map HUD on phones: show every chip and button instead of hiding some off-screen ---------- */
.hud-actions { flex-wrap: wrap; }
@media (max-width: 700px) {
  .hud { gap: 10px; }
  .hud .chips { flex-wrap: wrap; overflow: visible; flex: 1 1 100%; }
  .hud-actions { flex: 1 1 100%; justify-content: flex-start; }
  .hud-actions .btn.small[data-finish] { margin-left: auto; white-space: nowrap; }
}

/* ---------- very small phones: keep logo, language tabs, sound and logout on one row without touching ---------- */
@media (max-width: 420px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .brand-logo { height: 38px; }
  .brand-home { padding: 2px 4px 2px 2px; margin-left: -2px; }
  .brand-home-label { font-size: .66rem; padding-left: 2px; }
  .top-actions { gap: 6px; }
  .top-lang { padding: 3px; }
  .top-lang button { min-width: 38px; padding: 6px 4px; }
  .topbar .icon-btn { width: 44px; height: 44px; border-radius: 14px; }
  .topbar .top-actions .btn.small { padding: 8px 10px; min-height: 44px; }
}
