@font-face { font-family: 'Handicrafts'; src: url('../fonts/handicrafts-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Handicrafts'; src: url('../fonts/handicrafts-bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* Noto Naskh Arabic (OFL, variable weight): school-book letter shapes with full tashkeel, for every letter, syllable
   and word Jana reads. Handicrafts stays the interface face, as in Nour's app. */
@font-face { font-family: 'Naskh'; src: url('../fonts/naskh.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

/* Night-Neon tokens from Nour's app, with Mulan's lavender as the accent. Harakat colours are fixed across units 1–9. */
:root {
  --navy-deep: #081126; --navy: #0B1026; --surface: #121D3B; --surface-raised: #192542; --border: #344363;
  --white: #F4F6FF; --muted: #AEB9D2; --lavender: #B794F6; --violet: #7C4DFF; --pink: #FF4D8D; --orange: #FF9F1C;
  --success: #00D98B; --danger: #FF6B7F;
  --fatha: #FF9F1C; --kasra: #2386FF; --damma: #00D98B; --sukun: #FF4D8D;
  --gradient-action: linear-gradient(115deg, #E0640A 0%, #FF4D8D 46%, #A855F7 77%, #601CFF 100%);
  --gradient-backdrop: radial-gradient(circle at 25% 15%, #221A4E, #0B1026 55%, #081126);
  --radius: 24px;
  --font: 'Handicrafts', 'Geeza Pro', sans-serif;
  --read: 'Naskh', 'Geeza Pro', serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--gradient-backdrop) fixed, var(--navy); color: var(--white); font-family: var(--font); user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
.app { max-width: 980px; margin: 0 auto; padding: 16px 16px 48px; }
.read { font-family: var(--read); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(11, 16, 38, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar h1 { flex: 1; margin: 0; font-size: 22px; text-align: center; }
.icon-btn { width: 56px; height: 56px; border-radius: 18px; background: var(--surface-raised); display: grid; place-items: center; font-size: 28px; }
.pill { background: var(--surface-raised); border-radius: 999px; padding: 8px 14px; font-size: 20px; }
.star { color: var(--border); } .star.on { color: #FFD43B; }

/* Mulan and her speech bubble: tapping either plays the line again. */
.guide { display: flex; align-items: flex-end; gap: 12px; margin: 8px 0 20px; }
.guide img { width: 120px; height: 120px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.guide.big img { width: 200px; height: 240px; }
.bubble { position: relative; background: var(--white); color: #2A1E5C; border-radius: 22px; padding: 14px 18px; font-size: 22px; line-height: 1.5; flex: 1; }
.bubble::after { content: ''; position: absolute; bottom: 18px; right: -10px; border: 10px solid transparent; border-left-color: var(--white); border-right: 0; }
.bubble .again { float: left; font-size: 24px; margin-inline-start: 8px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 26px; font-weight: 700; transition: transform .12s; }
.tile:active { transform: scale(.97); }
a.tile { color: inherit; text-decoration: none; }
.tile .tile-face { font-size: 72px; line-height: 1; }
.tile .tile-face.read { font-size: 84px; }
.tile.soon { opacity: .45; }
.tile small { font-size: 16px; font-weight: 400; color: var(--muted); }

/* Letter board: all 28 letters, any order. */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; direction: rtl; }
.letter-tile { position: relative; aspect-ratio: 1; background: var(--surface); border: 2px solid var(--border); border-radius: 22px; font-family: var(--read); font-size: 56px; display: grid; place-items: center; }
.letter-tile.done { border-color: var(--success); background: #0F2A33; }
.letter-tile .badge { position: absolute; top: 4px; left: 8px; font-size: 18px; color: #FFD43B; font-family: var(--font); }

.num-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; direction: rtl; }
.num-tile { aspect-ratio: 1; background: var(--surface); border: 2px solid var(--border); border-radius: 14px; font-size: clamp(16px, 3.6vw, 30px); font-weight: 700; display: grid; place-items: center; }
.num-tile.hundred { grid-column: span 10; aspect-ratio: auto; padding: 14px; }
.num-tile.on { border-color: var(--lavender); background: #2A2160; }
.num-show { text-align: center; margin: 4px 0 18px; }
.num-show .big { font-size: 110px; font-weight: 700; line-height: 1.1; }
.num-show .word { font-family: var(--read); font-size: 34px; color: var(--lavender); }

/* Letter lesson */
.steps { display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; }
.steps span { width: 14px; height: 14px; border-radius: 50%; background: var(--border); }
.steps span.on { background: var(--lavender); }
.hero-letter { font-family: var(--read); font-size: 190px; line-height: 1.25; text-align: center; margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice { background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius); padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 24px; font-weight: 700; }
.choice .face { font-family: var(--read); font-size: 96px; line-height: 1.3; }
.choice .emo { font-size: 64px; line-height: 1.2; }
.choice.right { border-color: var(--success); background: #0F2A33; }
.choice.wrong { border-color: var(--danger); animation: shake .35s; }
.choice.hint { border-color: var(--lavender); box-shadow: 0 0 0 6px rgba(183, 148, 246, .25); }
.forms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.forms.two { grid-template-columns: repeat(2, 1fr); }
.form-card { background: var(--surface); border: 2px solid var(--border); border-radius: 20px; padding: 10px 6px 14px; display: flex; flex-direction: column; align-items: center; }
.form-card .face { font-family: var(--read); font-size: 88px; line-height: 1.35; }
.form-card small { font-size: 17px; color: var(--muted); }
.note { background: #2A2160; border-radius: 18px; padding: 12px 16px; font-size: 19px; margin-top: 14px; }
.words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.word-card { background: var(--surface); border: 2px solid var(--border); border-radius: 20px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.word-card .emo { font-size: 56px; }
.word-card .read { font-size: 40px; line-height: 1.6; }
.hl { color: var(--lavender); }
.fatha-c { color: var(--fatha); }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.next { display: flex; justify-content: center; margin-top: 22px; }
.btn { background: var(--gradient-action); color: #fff; border-radius: 22px; padding: 16px 34px; font-size: 26px; font-weight: 700; min-width: 180px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.btn.soft { background: var(--surface-raised); }

/* Sound catcher */
.pond { position: relative; height: 380px; border-radius: var(--radius); background: linear-gradient(#1B2C5E, #10183A); overflow: hidden; }
.bubble-btn { position: absolute; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), rgba(183,148,246,.35) 45%, rgba(124,77,255,.25)); border: 2px solid rgba(255,255,255,.5); font-family: var(--read); font-size: 60px; display: grid; place-items: center; animation: float 3.2s ease-in-out infinite; }
.bubble-btn.popped { animation: pop .35s forwards; }
.bubble-btn.wrong { animation: shake .35s; }
.bubble-btn.hint { box-shadow: 0 0 0 8px rgba(255, 212, 59, .5); }
.listen { display: flex; justify-content: center; margin: 14px 0; }
.listen .icon-btn { width: 84px; height: 84px; font-size: 40px; border-radius: 50%; background: var(--violet); }
.dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.dots span { width: 16px; height: 16px; border-radius: 50%; background: var(--border); }
.dots span.ok { background: var(--success); } .dots span.miss { background: var(--orange); }

.celebrate { text-align: center; padding-top: 10px; }
.celebrate img { width: 240px; height: 260px; object-fit: contain; }
.celebrate .big-stars { font-size: 64px; letter-spacing: 6px; }

@keyframes float { 50% { transform: translateY(-14px); } }
@keyframes pop { to { transform: scale(1.5); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (max-width: 560px) {
  .forms { grid-template-columns: repeat(2, 1fr); }
  .hero-letter { font-size: 150px; }
  .guide img { width: 90px; height: 90px; }
  .guide.big img { width: 140px; height: 170px; }
  .bubble { font-size: 19px; }
  .num-board { gap: 5px; }
}

/* Finger writing pad */
:root { --guide: #5B4E9A; }
.pad-wrap { max-width: 460px; margin: 0 auto; }
.pad { width: 100%; aspect-ratio: 1; display: block; touch-action: none; }
.pad-bg { fill: var(--surface); stroke: var(--border); stroke-width: .6; }
.pad-base { stroke: var(--border); stroke-width: .4; stroke-dasharray: 2 2; }
.pad .ink { fill: none; stroke: var(--white); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.hint-path { fill: none; stroke: var(--lavender); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.hint-start { fill: var(--success); animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hint-runner { fill: #FFD43B; }
.hint-dot { fill: none; stroke: var(--success); stroke-width: 1.4; animation: pulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.done-path { fill: none; stroke: var(--success); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.done-dot { fill: var(--success); }
.pad.miss { animation: shake .35s; }
.pad.finished .glyph text { fill: var(--success); transition: fill .4s; }
.pad.finished .done { opacity: 0; transition: opacity .4s; }
.digit-row { display: flex; direction: ltr; gap: 10px; justify-content: center; }
.digit-row .pad-wrap { flex: 1; max-width: 300px; }
@keyframes pulse { 50% { transform: scale(1.35); } }

/* Number Garden (garden.js): KG2 math. Every target is at least 80px. The ten frame's top row is lavender and the
   bottom row orange, so "5 and some more" is visible at a glance. */
[hidden] { display: none !important; }
.g-tiles { grid-template-columns: repeat(2, 1fr); }
.g-flowers { display: flex; justify-content: center; gap: 10px; margin: 0 0 12px; font-size: 34px; }
.g-flowers span { opacity: .45; } .g-flowers span.grown { opacity: 1; animation: grow .5s; }
.g-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.g-tools { display: flex; justify-content: center; gap: 14px; }
.g-wobble { animation: shake .35s; }
.g-parent { display: flex; justify-content: flex-start; margin-top: 26px; }
.g-hold { --p: 0%; font-size: 22px; width: 48px; height: 48px; opacity: .6; background: conic-gradient(var(--lavender) var(--p), var(--surface-raised) 0); }

/* Dots, dice, ten frames */
.g-card { position: relative; width: min(320px, 80vw); aspect-ratio: 1; }
.g-dots { position: absolute; inset: 0; background: var(--white); border-radius: var(--radius); display: grid; place-items: center; }
.g-pip { position: absolute; width: 17%; aspect-ratio: 1; border-radius: 50%; background: var(--violet); transform: translate(50%, -50%); }
.g-cover { position: absolute; inset: 0; border-radius: var(--radius); background: linear-gradient(160deg, #2E9E5B, #1E6B3F); display: grid; place-items: center; font-size: 110px; transition: opacity .25s, transform .25s; }
.g-cover.open { opacity: 0; transform: scale(.9); pointer-events: none; }
.g-mini { position: relative; display: block; width: 46px; height: 46px; margin: 6px auto 0; background: var(--white); border-radius: 10px; }
.g-mini .g-pip { width: 22%; }
.g-frame { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px; background: #E8E2FF; border-radius: 18px; direction: rtl; }
.g-frame .g-cell { aspect-ratio: 1; background: var(--white); border-radius: 12px; display: grid; place-items: center; border: 0; padding: 0; }
.g-frame .g-cell i { display: block; width: 72%; aspect-ratio: 1; border-radius: 50%; background: var(--violet); animation: grow .25s; }
.g-frame .g-cell.row2 i { background: var(--orange); }
.g-frame.small { width: 86%; }
.g-frame.big { width: min(560px, 92vw); gap: 8px; padding: 10px; }
.g-frame.big .g-cell { min-height: 80px; }
.g-frame.solved { box-shadow: 0 0 0 6px var(--success); }

/* Choices and big targets */
.g-choices { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.g-choice { min-width: 110px; min-height: 110px; padding: 10px 14px; background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius); font-size: 64px; font-weight: 700; line-height: 1; }
.g-choice.right { border-color: var(--success); background: #0F2A33; }
.g-choice.hint { border-color: #FFD43B; box-shadow: 0 0 0 8px rgba(255, 212, 59, .35); }
.g-done { width: 96px; height: 96px; border-radius: 50%; background: var(--success); color: #062; font-size: 54px; font-weight: 700; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.g-target { font-size: 96px; font-weight: 700; line-height: 1; color: #FFD43B; }

/* Feed the bird */
.g-birdrow { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.g-bird { display: flex; flex-direction: column; align-items: center; font-size: 96px; line-height: 1; }
.g-bird.happy span { animation: hop .5s 2; display: inline-block; }
.g-sign { font-size: 56px; background: var(--surface-raised); border-radius: 18px; padding: 6px 18px; margin-top: 4px; color: #FFD43B; }
.g-bowl { width: min(380px, 84vw); min-height: 170px; padding: 14px; border-radius: 0 0 140px 140px; background: linear-gradient(#C98B4B, #8A5523); display: grid; grid-template-columns: repeat(5, 1fr); align-content: start; gap: 4px; direction: rtl; }
.g-bowl.over { box-shadow: 0 0 0 6px #FFD43B; }
.g-pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; }
.g-seed { width: 80px; height: 80px; font-size: 52px; border-radius: 50%; background: var(--surface); touch-action: none; }
.g-seed.in { width: auto; height: 56px; font-size: 44px; background: none; }
.g-seed.in.given { opacity: .75; filter: saturate(.6); cursor: default; }
.g-ghost { position: fixed; z-index: 50; pointer-events: none; transform: scale(1.15); }

/* Which has more */
.g-baskets { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 760px; }
.g-basket { min-height: 260px; padding: 16px; border-radius: 30px 30px 60px 60px; background: linear-gradient(#B07A3E, #7A4E22); border: 4px solid transparent; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px; }
.g-basket.right { border-color: var(--success); }
.g-fruit { font-size: 44px; line-height: 1.1; }
.g-fruit.big { font-size: 76px; }
.g-basket.paired { display: grid; grid-template-columns: repeat(5, 1fr); align-content: start; direction: rtl; }
.g-fruit.single { border-radius: 50%; background: rgba(255, 212, 59, .3); box-shadow: 0 0 0 3px #FFD43B; animation: shine 1s ease-in-out infinite; }
.g-same { min-height: 84px; padding: 12px 30px; border-radius: 24px; background: var(--surface-raised); border: 3px solid var(--border); font-size: 28px; font-weight: 700; }
.g-same b { font-size: 40px; margin-inline-end: 6px; }
.g-same.right { border-color: var(--success); }

/* Parent panel */
.g-panel { position: fixed; inset: 0; z-index: 20; background: rgba(8, 17, 38, .8); display: grid; place-items: center; padding: 16px; }
.g-panel-box { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; width: min(520px, 100%); display: grid; gap: 14px; }
.g-panel-box h2 { margin: 0; text-align: center; }
.g-panel-box label { display: grid; gap: 6px; font-size: 19px; }
.g-panel-box small { color: var(--muted); }
.g-panel-box select { font: inherit; font-size: 18px; padding: 10px; border-radius: 12px; background: var(--surface-raised); color: var(--white); border: 1px solid var(--border); }

@keyframes grow { from { transform: scale(0); } }
@keyframes hop { 50% { transform: translateY(-18px); } }
@keyframes shine { 50% { background: rgba(255, 212, 59, .55); box-shadow: 0 0 16px 6px rgba(255, 212, 59, .55); } }
@media (max-width: 560px) {
  .g-fruit { font-size: 32px; } .g-fruit.big { font-size: 54px; }
  .g-choice { min-width: 92px; min-height: 96px; font-size: 52px; }
}

/* Wardrobe, hands, train, factory, read to me, library */
.word-show { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 10px; }
.word-show .emo { font-size: 64px; line-height: 1.1; }
.word-show .read { font-size: 64px; line-height: 1.7; }
.word-show.big .read { font-size: 96px; }
.word-show small { color: var(--muted); font-size: 18px; }
.word-show.hidden { visibility: hidden; }
.slot { color: transparent; text-shadow: none; outline: 3px dashed var(--lavender); outline-offset: 4px; border-radius: 10px; }
.slot.filled { color: var(--lavender); outline-color: transparent; transition: color .3s; }
.hands-word { text-align: center; font-size: 72px; line-height: 1.8; margin: 8px 0 14px; }
.hands-word .apart { display: inline-block; margin: 0 14px; opacity: .8; }
.hands-word .joined.asking { color: var(--lavender); }
.hands-word .joined.done { color: var(--success); }
.train { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; margin: 10px 0 18px; }
.car { width: 108px; height: 108px; background: var(--surface-raised); border: 3px solid var(--border); border-radius: 18px 18px 26px 26px; display: grid; place-items: center; }
.car .read { font-size: 62px; line-height: 1.4; }
.car.set { border-color: var(--fatha); }
.hitch { width: 18px; height: 6px; background: var(--border); }
.engine { font-size: 76px; margin-inline-start: 6px; transform: scaleX(-1); }
.train.joined .hitch, .train.joined .car { opacity: .35; transition: opacity .4s; }
.tray { display: flex; justify-content: center; margin-bottom: 8px; }
.token { font-size: 64px; width: 90px; height: 90px; border-radius: 50%; background: var(--surface); border: 3px solid var(--fatha); display: grid; place-items: center; line-height: 1; }
.slots { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.slot-box { width: 104px; height: 104px; border: 3px dashed var(--border); border-radius: 20px; display: grid; place-items: center; font-family: var(--read); font-size: 58px; }
.slot-box.full { border-style: solid; border-color: var(--lavender); }
.factory-out { min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.factory-out .read { font-size: 54px; line-height: 1.5; }
.pop-pic { font-size: 72px; animation: rise .5s; }
.puff { font-size: 84px; animation: pop 1s forwards; }
.tiles-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile-syl { min-width: 92px; height: 92px; padding: 0 12px; background: var(--surface); border: 2px solid var(--border); border-radius: 20px; font-size: 54px; }
.rec-row { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 8px 0; }
.rec-btn { width: 110px; height: 110px; border-radius: 50%; background: var(--pink); font-size: 52px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.rec-btn.on { animation: pulse 1s ease-in-out infinite; background: var(--danger); }
#model img { width: 48px; height: 48px; object-fit: contain; }
.rec-note { text-align: center; color: var(--muted); min-height: 1.5em; font-size: 18px; }
.parent { background: #1B2550; border: 1px dashed var(--border); border-radius: 18px; padding: 10px 14px 14px; }
.parent p { margin: 0 0 8px; color: var(--muted); font-size: 16px; }
.lib { display: grid; gap: 10px; }
.lib-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 18px; padding: 8px 12px; }
.lib-text { flex: 1; font-size: 40px; line-height: 1.6; }
.lib-mark { font-size: 26px; }
.lib-row small { color: var(--muted); }
@keyframes rise { from { transform: translateY(30px) scale(.4); opacity: 0; } }
.digit-row .pad-wrap:empty { aspect-ratio: 1; border: 2px dashed var(--border); border-radius: 14px; }
/* Write the word: done letters green, the one she is writing lavender, the rest dim (colour only, so they stay joined) */
.ww-done { color: var(--success); }
.ww-now { color: var(--lavender); }
.ww-todo { color: #5A6788; }
/* Writing screens fit without scrolling: the pad follows the screen height; word, picture and listen share a row. */
.pad-wrap { max-width: min(460px, 52vh); }
.writing .guide { margin-bottom: 8px; }
.writing .guide img { width: 84px; height: 84px; }
.writing .bubble { font-size: 19px; }
.writing .word-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.writing .word-row .word-show { flex-direction: row; gap: 10px; margin: 0; }
.writing .word-row .emo { font-size: 46px; }
.writing .word-row .read { font-size: 54px; }
.writing .word-row .listen { margin: 0; }
.writing .word-row .listen .icon-btn { width: 64px; height: 64px; font-size: 30px; }
