:root {
  --bg: #fff7ec; --card: #fff; --ink: #2a2140; --muted: #786f8c; --line: #efe3cf; --sh: 0 6px 0 #ecdfc8;
  --primary: #6d4cff; --primary-d: #4b2fd0; --good: #1fa463; --good-d: #137a47; --warn: #ff9f1c; --warn-d: #cc7600; --bad: #f04e6e;
  --c: #ff7a45; --r: 26px; --font: "Baloo Bhaijaan 2", system-ui, sans-serif; --en: "Fredoka", "Baloo Bhaijaan 2", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); min-height: 100dvh; -webkit-user-select: none; user-select: none; touch-action: manipulation; overflow-x: hidden;
  background-image: radial-gradient(circle at 8% 4%, #ffe4c2 0 120px, transparent 260px), radial-gradient(circle at 96% 22%, #ece4ff 0 90px, transparent 230px), radial-gradient(circle at 80% 96%, #dff6ea 0 110px, transparent 260px); background-attachment: fixed; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
.en { font-family: var(--en); direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.col { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
#app { max-width: 860px; margin: 0 auto; }
.screen { padding: max(14px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.center-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 16px; }
.card { background: var(--card); border-radius: 30px; box-shadow: var(--sh); padding: 22px; }
.center { text-align: center; }
.loading { font-size: 22px; color: var(--muted); text-align: center; padding: 40px; }
.ping { animation: ping .45s ease-out; }
@keyframes ping { 40% { transform: scale(.94); } 70% { transform: scale(1.04); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 19px; font-weight: 800; padding: 12px 22px; min-height: 54px; border-radius: 20px; transition: transform .08s; }
.btn:active { transform: translateY(3px); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 6px 0 var(--primary-d); }
.btn.warn { background: var(--warn); color: #fff; box-shadow: 0 6px 0 var(--warn-d); }
.btn.ghost { background: #fff; box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.xl { width: 100%; font-size: 22px; min-height: 64px; }
.btn.sm { min-height: 42px; font-size: 16px; padding: 8px 14px; }
.bouncy { animation: bouncy 2.2s ease-in-out infinite; }
@keyframes bouncy { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-5px); } 90% { transform: translateY(1px); } }
.ib { width: 46px; height: 46px; border-radius: 15px; background: #fff; box-shadow: 0 3px 0 var(--line); font-size: 20px; display: grid; place-items: center; flex: none; }
.ib.glass { background: rgba(255,255,255,.28); box-shadow: none; color: #fff; }

/* owl */
.owl { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0; }
.owl-face { font-size: 50px; line-height: 1; flex: none; animation: owlbob 3s ease-in-out infinite; transform-origin: bottom center; }
@keyframes owlbob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.owl-say { position: relative; flex: 1; background: #fff; border-radius: 22px 22px 22px 6px; padding: 10px 14px; box-shadow: var(--sh); font-size: 18px; line-height: 1.6; display: flex; align-items: center; gap: 8px; }
.owl-txt { flex: 1; } .owl-say b { color: var(--primary); }
.replay { width: 40px; height: 40px; border-radius: 50%; background: #f1ecff; flex: none; font-size: 18px; }
.replay:active { background: #ddd2ff; }
.owl.small .owl-face { font-size: 40px; } .owl.small .owl-say { font-size: 17px; padding: 8px 12px; }
.owl.happy .owl-face { animation: hop .5s ease-out 2; } @keyframes hop { 50% { transform: translateY(-14px) rotate(8deg); } }
.owl.think .owl-face { animation: tilt .6s ease-in-out 2; } @keyframes tilt { 50% { transform: rotate(-14deg); } }

/* login / welcome */
.login { width: 100%; max-width: 420px; text-align: center; }
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; } .brand .logo { font-size: 56px; } .brand b { display: block; font-size: 26px; } .brand small { font-family: var(--en); color: var(--muted); }
.pins { display: flex; gap: 10px; justify-content: center; margin: 16px 0; direction: ltr; }
.pins i { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: .15s; } .pins i.on { background: var(--primary); transform: scale(1.15); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; direction: ltr; }
.pad button { height: 62px; border-radius: 18px; background: var(--bg); font-size: 26px; font-weight: 700; box-shadow: 0 4px 0 var(--line); font-family: var(--en); }
.pad button:active { transform: translateY(3px); box-shadow: none; }
.err { min-height: 28px; color: var(--bad); font-weight: 700; margin-top: 10px; }
.gwrap { flex-direction: column; align-items: center; gap: 6px; margin-top: 12px; padding-top: 14px; border-top: 2px dashed var(--line); }
.shake { animation: shake .4s; } @keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.welcome { max-width: 520px; text-align: center; } .welcome h1 { margin: 10px 0 0; font-size: 34px; }
.big-photo { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; overflow: hidden; border: 6px solid #fff; box-shadow: 0 0 0 5px var(--warn), var(--sh); font-size: 80px; display: grid; place-items: center; background: #ffeacc; }
.big-photo img { width: 100%; height: 100%; object-fit: cover; }

/* home */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--warn); background: #ffeacc; display: grid; place-items: center; font-size: 32px; flex: none; }
.avatar img, .mini img { width: 100%; height: 100%; object-fit: cover; }
.hi { flex: 1; min-width: 0; } .hi small { display: block; color: var(--muted); font-size: 15px; } .hi b { font-size: 24px; }
.pills { display: flex; gap: 6px; } .pill { background: #fff; border-radius: 14px; padding: 6px 10px; font-weight: 800; box-shadow: 0 3px 0 var(--line); font-size: 17px; white-space: nowrap; }
.hero-card { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 32px; color: #fff; text-align: right; overflow: hidden;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #6d4cff)); box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 60%, #000); }
.hero-card::before { content: ""; position: absolute; inset: auto -40px -60px auto; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero-card:active { transform: translateY(4px); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 60%, #000); }
.hc-art { width: 92px; height: 92px; border-radius: 28px; background: rgba(255,255,255,.25); display: grid; place-items: center; flex: none; } .hc-art span { font-size: 58px; animation: owlbob 3s infinite; }
.hc-txt { flex: 1; z-index: 1; } .hc-txt small { opacity: .92; } .hc-txt b { display: block; font-size: 25px; line-height: 1.25; } .hc-txt span { opacity: .9; font-size: 15px; }
.hc-play { width: 58px; height: 58px; border-radius: 50%; background: #fff; color: var(--c); display: grid; place-items: center; font-size: 24px; flex: none; transform: scaleX(-1); z-index: 1; animation: bouncy 2s infinite; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { background: #fff; border-radius: 24px; padding: 12px; box-shadow: var(--sh); display: flex; align-items: center; gap: 10px; text-align: right; }
.tile b { display: block; font-size: 17px; } .tile small { color: var(--muted); font-size: 14px; }
.ab-ico { font-size: 36px; }
.ring { width: 58px; height: 58px; border-radius: 50%; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex: none; }
.ring span { width: 46px; height: 46px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; line-height: 1; } .ring small { font-size: 11px; }
.sec { font-size: 21px; margin: 22px 4px 10px; }
.subjects { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; } .subjects::-webkit-scrollbar { display: none; }
.subject { flex: none; width: 100px; padding: 12px 6px; border-radius: 22px; background: #fff; box-shadow: var(--sh); display: flex; flex-direction: column; align-items: center; border: 3px solid transparent; }
.subject span { font-size: 34px; } .subject b { font-size: 16px; } .subject small { font-size: 12px; color: var(--muted); }
.subject.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); } .subject.soon { opacity: .6; }
.units { display: grid; gap: 12px; }
.unitcard { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 26px; background: #fff; box-shadow: var(--sh); text-align: right; width: 100%; }
.u-em { width: 64px; height: 64px; border-radius: 22px; background: color-mix(in srgb, var(--c) 18%, #fff); font-size: 36px; display: grid; place-items: center; flex: none; }
.u-t { flex: 1; } .u-t small { color: var(--c); font-weight: 800; } .u-t b { font-size: 20px; display: block; } .u-t em { font-style: normal; font-size: 13px; color: var(--muted); }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 2px; } .bar i { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.unitcard.locked { opacity: .55; }

/* adventure map */
.mapscreen { padding-top: 0; }
.unithead { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; color: #fff; margin: 0 -16px 6px; padding: max(16px, env(safe-area-inset-top)) 16px 30px; border-radius: 0 0 36px 36px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #6d4cff)); }
.uh-t small { display: block; opacity: .9; font-family: var(--en); font-size: 13px; } .uh-t b { font-size: 26px; } .uh-em { font-size: 52px; animation: owlbob 3s infinite; }
.uh-bar { grid-column: 1 / -1; height: 14px; background: rgba(255,255,255,.3); border-radius: 10px; position: relative; overflow: hidden; }
.uh-bar i { display: block; height: 100%; background: #fff; border-radius: 10px; } .uh-bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 14px; font-weight: 800; color: var(--c); font-family: var(--en); }
.adventure { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 0 6px; }
.trail { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.trail-bg { fill: none; stroke: #f1e3cb; stroke-width: 18; stroke-linecap: round; } .trail-dash { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 2 14; stroke-linecap: round; }
.island { position: relative; display: flex; flex-direction: column; align-items: center; width: 50%; z-index: 1; padding: 6px 0; }
.island.pos-c { align-self: center; } .island.pos-r { align-self: flex-start; } .island.pos-l { align-self: flex-end; }
.isl { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); box-shadow: 0 9px 0 color-mix(in srgb, var(--c) 55%, #000), 0 14px 18px rgba(0,0,0,.08); }
.isl-top { font-size: 40px; color: #fff; } .isl-top b { font-family: var(--en); font-size: 38px; }
.island:not(.done):not(.current):not(.finale) .isl { background: #e8dfcf; box-shadow: 0 9px 0 #d2c6b1; } .island:not(.done):not(.current):not(.finale) .isl-top b { color: #b2a792; }
.island.done .isl { background: #fff; box-shadow: 0 9px 0 var(--line), 0 0 0 6px color-mix(in srgb, var(--c) 45%, #fff); }
.island.current .isl { width: 108px; height: 108px; animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 9px 0 color-mix(in srgb, var(--c) 55%, #000), 0 0 0 14px color-mix(in srgb, var(--c) 22%, transparent); } }
.island.finale .isl { width: 112px; height: 112px; background: radial-gradient(circle at 50% 35%, #ffe58a, #ffc83d); box-shadow: 0 9px 0 #c99500; } .island.finale .isl-top { font-size: 54px; }
.isl-label { margin-top: 10px; background: #fff; border-radius: 16px; padding: 4px 12px; box-shadow: 0 3px 0 var(--line); text-align: center; max-width: 100%; }
.isl-label b { display: block; font-size: 16px; line-height: 1.35; } .isl-label small { color: var(--muted); font-size: 13px; }
.here { position: absolute; top: -8px; inset-inline-start: calc(50% + 36px); display: flex; flex-direction: column; align-items: center; z-index: 2; animation: owlbob 2s infinite; }
.here em { font-style: normal; font-size: 11px; font-weight: 800; background: var(--primary); color: #fff; border-radius: 8px; padding: 0 6px; margin-top: -4px; }
.mini { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--primary); background: #ffeacc; display: grid; place-items: center; font-size: 24px; }
.stars i { font-style: normal; color: #e3d8c4; font-size: 16px; } .stars i.on { color: #ffb800; }
.review-card { width: 100%; display: flex; align-items: center; gap: 12px; background: #e6f6ff; border: 3px solid #b7e3fa; border-radius: 22px; padding: 12px 16px; margin-top: 16px; text-align: right; }
.review-card > span { font-size: 34px; } .review-card div { flex: 1; } .review-card b { display: block; } .review-card small { color: var(--muted); }
.bookrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bookbtn { background: #fff; border-radius: 20px; padding: 12px 4px; box-shadow: var(--sh); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bookbtn span { font-size: 28px; } .bookbtn b { font-size: 13px; text-align: center; }

/* modal & sheet */
.modal-back { position: fixed; inset: 0; background: rgba(42,33,64,.45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 32px; padding: 22px; text-align: center; animation: pop .3s cubic-bezier(.2,1.5,.4,1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal h2 { margin: 4px 0; font-size: 26px; }
.sheet-art { width: 116px; height: 116px; margin: -4px auto 10px; border-radius: 36px; background: var(--c); display: grid; place-items: center; box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 55%, #000); }
.sheet-art span { font-size: 64px; animation: owlbob 3s infinite; }
.steps2 { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.steps2 div { background: #fff; border-radius: 18px; padding: 8px 10px; box-shadow: 0 3px 0 var(--line); display: flex; flex-direction: column; align-items: center; min-width: 76px; }
.steps2 span { font-size: 26px; } .steps2 b { font-size: 15px; } .steps2 small { font-size: 11px; color: var(--muted); } .steps2 i { font-style: normal; color: var(--muted); }
.row-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: 18px; padding: 14px 16px; margin-top: 10px; box-shadow: 0 3px 0 var(--line); font-size: 17px; font-weight: 700; text-align: right; }
.tog { width: 54px; height: 30px; border-radius: 20px; background: #ddd; position: relative; flex: none; } .tog::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.tog.on { background: var(--good); } .tog.on::after { right: 27px; }
.bookmodal { max-width: 900px; padding: 12px; text-align: right; }
.bookhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; } .bookhead b { font-size: 18px; } .spacer { flex: 1; }
.bookscroll { max-height: 74dvh; overflow: auto; background: #fff; border-radius: 16px; } .bookscroll img { display: block; }
.booknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* LEARN screen */
.lesson-screen { min-height: 100dvh; display: flex; flex-direction: column; }
.ls-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 12px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 60%, #6d4cff)); border-radius: 0 0 28px 28px; box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 30%, transparent); }
.ls-top .ib { background: rgba(255,255,255,.28); box-shadow: none; color: #fff; }
.ls-title { flex: 1; } .ls-title small { opacity: .9; display: block; font-size: 13px; } .ls-title b { font-size: 22px; line-height: 1.2; }
.ls-body { flex: 1; padding: 8px 16px 110px; display: flex; flex-direction: column; gap: 14px; animation: rise .35s; }
.ls-foot { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); z-index: 6; max-width: 860px; margin: 0 auto; }
.wgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wgrid.small .wtile { padding: 8px 4px; } .wgrid.small .wt-e { font-size: 34px; } .wgrid.small .wt-w { font-size: 17px; }
.wtile { background: #fff; border-radius: 22px; padding: 12px 6px; box-shadow: var(--sh); display: flex; flex-direction: column; align-items: center; border: 3px solid transparent; position: relative; animation: rise .4s backwards; }
.wtile:nth-child(2) { animation-delay: .05s; } .wtile:nth-child(3) { animation-delay: .1s; } .wtile:nth-child(4) { animation-delay: .15s; } .wtile:nth-child(5) { animation-delay: .2s; } .wtile:nth-child(6) { animation-delay: .25s; }
.wt-e { font-size: 44px; line-height: 1.15; } .wt-w { font-size: 20px; font-weight: 600; } .wt-a { font-size: 15px; color: var(--c); font-weight: 800; }
.wtile.seen, .panel.seen, .excard.seen, .fchip.seen { border-color: color-mix(in srgb, var(--good) 55%, #fff); }
.wtile.seen::after, .panel.seen::after { content: "✓"; position: absolute; top: 6px; left: 8px; color: var(--good); font-weight: 800; font-size: 14px; }
.flagbox { background: #fff; border-radius: 26px; padding: 14px; box-shadow: var(--sh); }
.kwflag { display: block; width: 100%; max-height: 30vh; margin: 0 auto; } .kwflag [data-part] { cursor: pointer; transition: fill .35s; }
.flaglegend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.fchip { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 16px; padding: 8px 10px; border: 3px solid transparent; text-align: right; }
.fchip i { width: 26px; height: 26px; border-radius: 8px; box-shadow: 0 0 0 2px #ddd; flex: none; } .fchip b { font-size: 16px; } .fchip small { margin-inline-start: auto; color: var(--muted); font-size: 13px; }
.tipcard { background: #fff6dc; border-radius: 20px; padding: 12px 16px; display: flex; flex-direction: column; align-items: center; border: 2px dashed #f5d58c; }
.tipcard b { font-size: 24px; } .tipcard small { color: #8a6a14; }
.formula { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; direction: ltr; background: #fff; border-radius: 24px; padding: 16px; box-shadow: var(--sh); }
.blk { border-radius: 14px; padding: 10px 14px; font-size: 22px; font-weight: 600; animation: rise .4s backwards; }
.blk:nth-child(2) { animation-delay: .15s; } .blk:nth-child(3) { animation-delay: .3s; } .blk:nth-child(4) { animation-delay: .45s; }
.blk.sub { background: #e7f0ff; color: #2456c4; } .blk.neg { background: #ffe1e7; color: #c4234a; } .blk.verb { background: #dcf7e8; color: var(--good-d); } .blk.rest { background: #f3eee5; color: #6e6352; }
.examples { display: grid; gap: 10px; }
.excard { background: #fff; border-radius: 20px; padding: 12px 16px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 2px; text-align: left; border: 3px solid transparent; }
.excard b { font-size: 21px; font-weight: 600; } .excard small { direction: rtl; text-align: right; color: var(--muted); font-size: 15px; }
.chipsbox { background: #fff; border-radius: 22px; padding: 12px; box-shadow: var(--sh); } .chipsbox small { display: block; color: var(--muted); margin-bottom: 6px; }
.chipsbox div { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; }
.chip { background: #fff3d6; border-radius: 14px; padding: 6px 12px; font-size: 18px; font-weight: 600; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.chip b { font-weight: 600; } .chip small { font-size: 13px; color: #8a6a14; font-weight: 700; direction: rtl; }
.comic { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel { position: relative; background: #fff; border-radius: 22px; padding: 12px 10px; box-shadow: var(--sh); display: flex; flex-direction: column; align-items: center; gap: 4px; border: 3px solid transparent; animation: rise .4s backwards; animation-delay: var(--d); }
.panel .pn { position: absolute; top: 6px; right: 10px; font-family: var(--en); font-size: 12px; color: var(--muted); font-weight: 700; }
.panel .pe { font-size: 44px; } .panel b { font-size: 16px; font-weight: 600; text-align: center; line-height: 1.35; } .panel small { color: var(--muted); font-size: 13px; text-align: center; }
.panel.lit { border-color: var(--warn); background: #fff8e6; }
#readall { align-self: center; }
.soundcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scol { background: #fff; border-radius: 22px; padding: 12px 6px; box-shadow: var(--sh); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.smasc { font-size: 46px; } .scol > b { font-size: 26px; color: var(--primary); } .scol .chip { width: 100%; font-size: 17px; padding: 6px 4px; }

/* GAME screen */
.game-screen { height: 100dvh; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; overflow: hidden; }
.g-top { display: flex; align-items: center; gap: 10px; }
.g-dots { flex: 1; display: flex; gap: 6px; justify-content: center; }
.g-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--line); transition: .3s; }
.g-dots i.now { background: var(--c); transform: scale(1.3); } .g-dots i.ok { background: var(--good); } .g-dots i.meh { background: var(--warn); }
.g-stars { font-weight: 800; font-size: 20px; background: #fff; border-radius: 14px; padding: 4px 12px; box-shadow: 0 3px 0 var(--line); }
.g-owl { min-height: 70px; }
.g-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 14px; animation: rise .3s ease-out; }
.flystar { position: fixed; top: -14px; left: -14px; font-size: 30px; z-index: 90; pointer-events: none; font-style: normal; }
.spark { position: fixed; width: 10px; height: 10px; border-radius: 50%; z-index: 80; pointer-events: none; margin: -5px; }
.wobble { animation: wobble .45s; } @keyframes wobble { 20% { transform: rotate(-6deg) translateX(-6px); } 50% { transform: rotate(5deg) translateX(6px); } 80% { transform: rotate(-2deg); } }
.hintglow { animation: hintglow 1s ease-in-out 3; } @keyframes hintglow { 50% { filter: drop-shadow(0 0 14px #ffc83d) brightness(1.08); transform: scale(1.04); } }
/* paint */
.ask { display: flex; justify-content: center; }
.askword { background: #fff; border-radius: 22px; padding: 12px 26px; font-size: 34px; font-weight: 600; box-shadow: var(--sh); }
.flagbox.game .kwflag { max-height: 38vh; } .flagbox.game [data-part] { stroke: #cfc6b6; stroke-width: 1.5; }
.kwflag .filled { animation: fillin .5s; } @keyframes fillin { from { opacity: .3; } }
/* memory */
.memgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; perspective: 800px; max-height: 100%; }
@media (max-width: 520px) { .memgrid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
.mcard { position: relative; aspect-ratio: 3 / 4; max-height: 22vh; border-radius: 18px; transform-style: preserve-3d; transition: transform .4s; }
.mcard .mback, .mcard .mfront { position: absolute; inset: 0; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--sh); }
.mback { background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #6d4cff)); font-size: 34px; }
.mfront { background: #fff; transform: rotateY(180deg); padding: 4px; }
.mfront b { font-size: clamp(14px, 3.8vw, 22px); font-weight: 600; } .mfront .me { font-size: clamp(28px, 8vw, 46px); } .mfront small { font-size: 12px; color: var(--muted); }
.mcard.up { transform: rotateY(180deg); }
.mcard.match .mfront { background: #dcf7e8; box-shadow: 0 5px 0 #a8e6c6; }
/* pop */
.bigspk { width: 104px; height: 104px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 46px; align-self: center; box-shadow: 0 8px 0 var(--primary-d); animation: bouncy 2s infinite; }
.bigspk:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--primary-d); }
.bubbles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; justify-items: center; }
.bubble { width: min(40vw, 150px); aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 25%, #fff 0 12%, #dff4ff 35%, #b6e3fb 100%); box-shadow: inset -8px -10px 18px rgba(14,165,217,.25), 0 8px 16px rgba(14,165,217,.15); animation: float 3.2s ease-in-out infinite; animation-delay: var(--d); }
.bubble span { font-size: clamp(40px, 11vw, 58px); } .bubble small { font-size: 14px; color: #2f6f8f; font-weight: 700; }
@keyframes float { 50% { transform: translateY(-10px); } }
.bubble.popped { animation: popout .45s forwards; } @keyframes popout { 50% { transform: scale(1.25); } 100% { transform: scale(0); opacity: 0; } }
.bubble.dim { opacity: .45; }
/* blank */
.sentence { position: relative; background: #fff; border-radius: 26px; padding: 18px 18px 14px; box-shadow: var(--sh); }
.sentence .en { font-size: clamp(22px, 5.5vw, 30px); font-weight: 600; margin: 0; line-height: 1.5; text-align: left; padding-left: 46px; }
.sentence .ar { margin: 10px 0 0; padding-top: 10px; border-top: 2px dashed var(--line); font-size: 19px; color: var(--muted); font-weight: 600; } .sentence .ar.hid { display: none; }
.sp-mini { position: absolute; left: 12px; top: 16px; width: 40px; height: 40px; border-radius: 50%; background: #f1ecff; font-size: 18px; }
.blank { display: inline-block; min-width: 86px; text-align: center; border-bottom: 4px dashed var(--c); color: var(--c); margin: 0 4px; }
.blank::before { content: "?"; } .blank.filled::before { content: ""; } .blank.filled { border-bottom-style: solid; color: var(--good-d); }
.trbtn { margin-top: 10px; background: #fff3d6; border-radius: 12px; padding: 6px 12px; font-weight: 700; color: var(--warn-d); }
.pills { display: grid; gap: 10px; }
.pillopt { background: #fff; border-radius: 22px; padding: 14px; font-size: 24px; font-weight: 600; box-shadow: 0 6px 0 var(--line); border: 3px solid var(--line); }
.pillopt:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.good { border-color: var(--good) !important; background: #dcf7e8 !important; color: var(--good-d) !important; box-shadow: 0 6px 0 #a8e6c6 !important; }
.bad { border-color: var(--bad) !important; background: #ffe2e8 !important; color: #c4234a !important; opacity: .7; }
/* train */
.train-ar { text-align: center; font-size: 21px; font-weight: 700; margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px; } .train-ar .sp-mini { position: static; }
.train { display: flex; align-items: flex-end; justify-content: center; gap: 6px; direction: ltr; flex-direction: row-reverse; padding: 10px 0; border-bottom: 6px solid #c9b79a; position: relative; }
.train::after { content: ""; position: absolute; bottom: -12px; left: 0; right: 0; height: 4px; background: repeating-linear-gradient(90deg, #c9b79a 0 14px, transparent 14px 24px); }
.wagons { display: flex; flex-wrap: wrap; gap: 14px 6px; justify-content: center; }
.wagon { min-width: 64px; height: 52px; padding: 0 10px; border-radius: 12px 12px 6px 6px; background: #fff; border: 3px dashed #d8c9ae; display: grid; place-items: center; font-family: var(--en); font-size: 19px; font-weight: 600; position: relative; }
.wagon.full { background: color-mix(in srgb, var(--c) 18%, #fff); border-style: solid; border-color: var(--c); animation: pop .25s; }
.wagon::after { content: "● ●"; position: absolute; bottom: -14px; font-size: 12px; color: #6b5d48; letter-spacing: 8px; }
.engine { font-size: 54px; line-height: 1; }
.train.go { animation: chug 1.4s ease-in forwards; } @keyframes chug { 20% { transform: translateX(6px); } 100% { transform: translateX(-110vw); } }
.bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; direction: ltr; }
.wchip { background: #fff; border-radius: 16px; padding: 10px 16px; font-size: 22px; font-weight: 600; box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.wchip.used { visibility: hidden; }
/* sort */
.wordbig { align-self: center; background: #fff; border-radius: 26px; padding: 18px 30px; font-size: 44px; font-weight: 600; box-shadow: var(--sh); }
.portals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.portal { background: #fff; border-radius: 26px; padding: 14px 4px; box-shadow: 0 6px 0 var(--line); border: 3px solid var(--line); display: flex; flex-direction: column; align-items: center; }
.portal span { font-size: 44px; } .portal b { font-size: 26px; } .portal small { color: var(--muted); }
/* spell */
.spellask { align-self: center; display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 24px; padding: 10px 20px; box-shadow: var(--sh); font-size: 22px; }
.spellask span { font-size: 52px; }
.slots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.slots i { width: clamp(36px, 9vw, 50px); height: clamp(46px, 11vw, 60px); border-radius: 14px; border: 3px dashed #d8c9ae; display: grid; place-items: center; font-style: normal; font-size: clamp(22px, 6vw, 30px); font-weight: 600; background: #fff; }
.slots i.on { border-style: solid; border-color: var(--good); color: var(--good-d); animation: pop .2s; }
.letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 520px; margin: 0 auto; }
.letters button { width: clamp(48px, 13vw, 62px); height: clamp(52px, 14vw, 66px); border-radius: 16px; background: #fff; font-size: clamp(24px, 7vw, 30px); font-weight: 600; box-shadow: 0 5px 0 var(--line); border: 3px solid var(--line); }
.letters button.used { visibility: hidden; }
.hintbtn { align-self: center; background: #fff; border-radius: 14px; padding: 8px 14px; box-shadow: 0 3px 0 var(--line); font-weight: 700; }
/* done */
.g-stage.done { justify-content: flex-start; align-items: center; text-align: center; overflow-y: auto; padding-bottom: 12px; }
.trophy { font-size: 96px; animation: pop .5s; }
.sticker-reveal { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.sticker-reveal .stk { width: 150px; height: 150px; border-radius: 42px; background: #fff; display: grid; place-items: center; font-size: 88px; box-shadow: 0 0 0 7px #ffc83d, 0 12px 30px rgba(255,180,0,.4); animation: spinIn .9s cubic-bezier(.2,1.4,.4,1); }
@keyframes spinIn { from { transform: rotate(-220deg) scale(0); } }
.sticker-reveal b { margin-top: 12px; font-size: 21px; }
.big-stars { display: flex; gap: 6px; } .big-stars i { font-style: normal; font-size: 54px; color: #e3d8c4; } .big-stars i.on { color: #ffb800; animation: pop .5s backwards; }
.scoreline { margin: 0; font-size: 18px; color: var(--muted); } .scoreline b { color: var(--ink); font-family: var(--en); font-size: 22px; }
.g-stage.done .col { width: 100%; }
.confetti { position: fixed; top: -20px; width: 10px; height: 16px; z-index: 80; border-radius: 3px; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* stickers album */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.slot-stk { background: #fff; border-radius: 24px; padding: 14px 8px; text-align: center; box-shadow: var(--sh); border: 3px dashed var(--line); }
.slot-stk span { font-size: 54px; display: block; filter: grayscale(1); opacity: .3; } .slot-stk.has { border-style: solid; border-color: #ffc83d; } .slot-stk.has span { filter: none; opacity: 1; }
.slot-stk b { display: block; font-size: 15px; } .slot-stk small { color: var(--muted); font-size: 13px; }

/* family dashboard */
.seg { display: flex; gap: 6px; background: #fff; border-radius: 18px; padding: 6px; box-shadow: 0 3px 0 var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 10px; border-radius: 14px; font-weight: 800; font-size: 16px; } .seg button.on { background: var(--primary); color: #fff; }
.seg.sm { box-shadow: none; background: var(--bg); }
.kid-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; } .kid-head b { font-size: 24px; display: block; } .kid-head small { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpis div { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--sh); } .kpis b { font-size: 30px; display: block; font-family: var(--en); } .kpis small, .kpis span { font-size: 15px; color: var(--muted); }
.g { color: var(--good-d); } .y { color: var(--warn-d); } .r { color: var(--bad); }
.panel-x, .panel:not(button) { }
div.panel { background: #fff; border-radius: 22px; padding: 16px; box-shadow: var(--sh); margin-top: 12px; display: block; animation: none; }
div.panel h3 { margin: 0 0 10px; font-size: 19px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; } .bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars i { width: 100%; background: var(--primary); border-radius: 8px 8px 0 0; min-height: 3px; } .bars small, .bars span { font-size: 12px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; } .tbl td, .tbl th { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: right; } .tbl th { color: var(--muted); font-weight: 700; }
.ev { padding: 10px 0; border-bottom: 1px solid var(--line); } .ev-h { display: flex; justify-content: space-between; gap: 8px; } .ev-h small { color: var(--muted); } .ev-m { color: var(--muted); font-size: 15px; } .ev-x { font-size: 14px; color: #c4234a; text-align: left; margin-top: 4px; } .ev-x b { color: var(--good-d); }
.rowi { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .rowi span { flex: 1; } .rowi small { color: var(--muted); } .rowi.off { opacity: .45; }
.inp { width: 100%; font-family: inherit; font-size: 18px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); margin: 8px 0; }
.code-big { font-family: var(--en); font-size: 46px; font-weight: 700; letter-spacing: 6px; margin: 10px 0; -webkit-user-select: text; user-select: text; }

@media (min-width: 700px) {
  .wgrid { grid-template-columns: repeat(6, 1fr); } .comic { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); } .bubbles { grid-template-columns: repeat(4, 1fr); }
  .examples { grid-template-columns: 1fr 1fr; } .pills { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 700px) { .g-owl { min-height: 56px; } .owl.small .owl-face { font-size: 32px; } .askword { font-size: 28px; padding: 8px 18px; } .bigspk { width: 84px; height: 84px; font-size: 38px; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; } }
