:root {
  --bg: #eef0ff;
  --bg-2: #f8f3ff;
  --ink: #1f2352;
  --muted: #6d72a3;
  --brand: #3b4fd8;
  --brand-2: #5b6cff;
  --c: var(--brand-2);
  --card: #ffffff;
  --line: #e1e4f7;
  --tile: #ffffff;
  --tile-shadow: #d5d9f2;
  --green: #4fa843;
  --green-dark: #3a8531;
  --green-soft: #eaf6e6;
  --red: #e5484d;
  --red-soft: #fdecec;
  --gold: #ffb800;
  --mark: #fff0b3;
  --radius: 18px;
  --font: 'Baloo Bhaijaan 2', 'Nunito', system-ui, sans-serif;
  --font-ar: 'Noto Naskh Arabic', 'Geeza Pro', serif;
  --font-en: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.ar { font-family: var(--font-ar); }
.muted { color: var(--muted); }
.center { text-align: center; }
mark { background: var(--mark); border-radius: 6px; padding: 0 4px; color: inherit; }

/* English help: hidden unless the EN toggle is on */
.i-en { display: none; font-family: var(--font-en); font-size: 0.78em; font-weight: 600; color: var(--muted); line-height: 1.35; }
.show-en .i-en { display: block; }
.i-ar { display: inline; }

.screen { max-width: 620px; margin: 0 auto; padding: 14px 16px 56px; }
.page-title { font-size: 1.6rem; font-weight: 800; margin: 12px 0 16px; color: var(--ink); }
.page-title .i-en { font-size: 0.6em; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.brand { flex: 1; font-family: var(--font-en); font-size: 1.45rem; font-weight: 800; color: var(--brand); text-decoration: none; letter-spacing: -0.02em; }
.back, .me, .en-toggle {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px;
  border-radius: 12px; border: none; background: var(--card); color: var(--brand);
  text-decoration: none; box-shadow: 0 2px 0 var(--tile-shadow); cursor: pointer;
}
.me { font-size: 1.4rem; }
.en-toggle { font-family: var(--font-en); font-weight: 800; font-size: 0.85rem; color: var(--muted); }
.show-en .en-toggle { background: var(--brand-2); color: #fff; box-shadow: 0 2px 0 var(--brand); }
.level-tag, .star-total {
  font-weight: 700; font-size: 0.9rem; color: var(--muted); background: var(--card);
  padding: 6px 12px; border-radius: 999px; box-shadow: 0 2px 0 var(--tile-shadow);
  max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.star-total { color: var(--gold); font-family: var(--font-en); font-weight: 800; }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%; border: none; border-radius: 18px; padding: 14px 18px;
  font-size: 1.2rem; font-weight: 800; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--brand-2); color: #fff; box-shadow: 0 5px 0 var(--brand); }
.btn.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--brand); }
.btn.primary:disabled { background: #b8bfee; box-shadow: 0 5px 0 #9ea6e0; cursor: default; }
.btn.ghost { background: var(--card); color: var(--brand); border: 2px solid var(--line); }
.btn.small { display: inline-block; width: auto; padding: 8px 22px; font-size: 1rem; border-radius: 14px; }
.btn .i-en { color: inherit; opacity: 0.85; }
.link { background: none; border: none; color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 4px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 12px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.chip:hover { background: #e3e6ff; }
.badge { font-size: 0.75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #fff1d6; color: #9a5b00; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card {
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--line); border-radius: 24px;
  padding: 16px; box-shadow: 0 10px 30px rgba(59, 79, 216, 0.08); margin-bottom: 14px;
}
.card-hint { text-align: center; color: var(--muted); font-weight: 600; font-size: 0.95rem; margin: 0 0 12px; }

/* ---------- Who / profiles ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.profile-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--card);
  box-shadow: 0 4px 0 var(--tile-shadow); cursor: pointer;
}
.profile-card .avatar { font-size: 3rem; line-height: 1.1; }
.profile-name { font-weight: 800; font-size: 1.15rem; }
.profile-stars { color: var(--gold); font-family: var(--font-en); font-weight: 800; }
.profile-card.add { border-style: dashed; color: var(--muted); box-shadow: none; }
.new-profile { display: grid; gap: 12px; }
.new-profile label { display: grid; gap: 4px; font-weight: 700; }
.new-profile input, .new-profile select, .pin-form input {
  padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 1.1rem;
}
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick input { position: absolute; opacity: 0; }
.avatar-pick span { display: grid; place-items: center; width: 46px; height: 46px; font-size: 1.6rem; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.avatar-pick input:checked + span { border-color: var(--brand-2); background: #eef0ff; }
.avatar-pick input:focus-visible + span { outline: 3px solid var(--brand-2); }

/* ---------- Home ---------- */
.hero { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 24px; padding: 10px 16px; box-shadow: 0 10px 30px rgba(59, 79, 216, 0.08); margin-bottom: 14px; }
.hero .bubble { display: none; }
.hero-mascot .mascot-body { width: 84px; height: 88px; }
.hero-hi { font-size: 1.6rem; font-weight: 700; margin: 0; color: var(--brand); line-height: 1.4; }
.hero-sub { margin: 0; color: var(--muted); font-weight: 600; }
.continue { display: flex; align-items: center; gap: 12px; text-decoration: none; border: 2px solid var(--brand-2); }
.continue-icon { font-size: 2rem; }
.continue strong { display: block; font-size: 1.05rem; }
.continue .muted { font-size: 0.95rem; }
.track-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.track-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; min-height: 130px;
  border-radius: 22px; text-decoration: none; color: #fff;
  background: var(--c); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 70%, #000);
}
.track-card:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 70%, #000); }
.track-icon { font-size: 2.2rem; line-height: 1.2; }
.track-name { font-weight: 800; font-size: 1.2rem; line-height: 1.3; }
.track-name .i-en { color: rgba(255, 255, 255, 0.85); }
.track-meta { margin-top: auto; font-size: 0.85rem; opacity: 0.9; font-weight: 600; }
.show-en .track-meta .i-en { display: inline; color: inherit; font-size: inherit; margin-inline-start: 6px; }
.track-card.soon { opacity: 0.5; box-shadow: none; }
.mine-link { display: block; text-decoration: none; font-weight: 700; text-align: center; }

/* ---------- Track (unit list) ---------- */
.unit-list { display: grid; gap: 10px; }
.unit-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 3px 0 var(--tile-shadow); text-decoration: none;
}
.unit-card.done { border-color: #b8dcae; background: var(--green-soft); }
.unit-card.soon { opacity: 0.55; box-shadow: none; }
.unit-icon { font-size: 1.8rem; width: 44px; text-align: center; }
.unit-text { flex: 1; display: grid; }
.unit-name { font-weight: 800; font-size: 1.1rem; line-height: 1.35; }
.unit-meta { font-size: 0.85rem; color: var(--muted); }
.unit-check { color: var(--green); font-size: 1.4rem; font-weight: 800; }

/* ---------- Unit (step path) ---------- */
.path { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.step {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--tile-shadow);
}
.step.done { border-color: #b8dcae; }
.step.locked { opacity: 0.5; box-shadow: none; }
.step-num {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 800; font-family: var(--font-en);
}
.step.done .step-num { background: var(--green); }
.step.locked .step-num { background: #dfe2f5; color: var(--muted); }
.step-text { flex: 1; display: grid; }
.step-name { font-weight: 800; font-size: 1.1rem; }
.step-kind { font-size: 0.85rem; color: var(--muted); }
.show-en .step-kind .i-en { display: inline; margin-inline-start: 6px; }
.lock { font-size: 1.1rem; }

/* ---------- Activity shell ---------- */
.progress { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 10px; background: #dfe2f7; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--c); border-radius: inherit; transition: width 0.4s ease; }
.count { font-size: 0.85rem; color: var(--muted); font-weight: 700; font-family: var(--font-en); min-width: 2.5em; text-align: end; }
.instruction { text-align: center; color: var(--c); font-size: 1.35rem; font-weight: 800; margin: 14px 0 0; }
.instruction-sub { text-align: center; color: var(--muted); font-size: 0.95rem; margin: 0 0 6px; }

/* ---------- Mascot ---------- */
.mascot-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.mascot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mascot-body { width: 90px; height: 94px; }
.mascot-body svg { width: 100%; height: 100%; overflow: visible; }
.mascot .m-eyes-happy, .mascot .m-eyes-sad { display: none; }
.mascot[data-mood='happy'] .m-eyes-open, .mascot[data-mood='sad'] .m-eyes-open { display: none; }
.mascot[data-mood='happy'] .m-eyes-happy { display: inline; }
.mascot[data-mood='sad'] .m-eyes-sad { display: inline; }
.mascot[data-mood='happy'] .mascot-body { animation: hop 0.5s ease; }
.mascot[data-mood='sad'] .mascot-body { animation: wobble 0.45s ease; }
.mascot[data-mood='thinking'] .mascot-body { animation: think 1.2s ease-in-out infinite; }
.mascot[data-mood='thinking'] .m-bulb { animation: glow 0.5s ease-in-out infinite; }
.m-eye { transform-box: fill-box; transform-origin: center; animation: blink 4s infinite; }
.m-bulb { animation: glow 2s ease-in-out infinite; }
.bubble {
  order: -1; max-width: 320px; min-height: 1.6em; padding: 6px 14px; border-radius: 14px;
  background: var(--card); box-shadow: 0 2px 0 var(--tile-shadow); font-weight: 700; font-size: 1rem;
  text-align: center; opacity: 0; position: relative;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px;
  background: var(--card); transform: translateX(-50%) rotate(45deg); border-radius: 2px;
}
.bubble.show { opacity: 1; }
.bubble.pop { animation: pop 0.3s ease; }

/* ---------- Lesson ---------- */
.lesson-text { font-size: 1.45rem; line-height: 2; margin: 4px 0 8px; }
.lesson-en { font-size: 0.95rem; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.example { font-size: 1.5rem; padding: 4px 14px; background: #f1f3ff; border-radius: 12px; border: 1px solid var(--line); }
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.lesson-count { color: var(--muted); font-family: var(--font-en); font-weight: 700; }

/* ---------- Sort ---------- */
.sort-current { display: grid; place-items: center; min-height: 110px; margin-bottom: 4px; }
.sort-word {
  font-size: 2.6rem; font-weight: 700; padding: 6px 28px 14px; border-radius: 18px;
  background: var(--tile); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--tile-shadow);
}
.sort-word.pop { animation: pop 0.3s ease; }
.sort-current.done .sort-word { background: var(--green); color: #fff; border-color: var(--green-dark); }
.sort-note { min-height: 1.6em; text-align: center; font-weight: 700; margin: 4px 0 10px; font-family: var(--font-ar); }
.sort-note.good { color: var(--green-dark); }
.sort-note.bad { color: var(--red); }
.bins { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 10px; }
.bin {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 150px; padding: 10px 8px;
  border: 2px dashed color-mix(in srgb, var(--c) 45%, #fff); border-radius: 18px; background: #fbfbff; cursor: pointer;
}
.bin:hover { background: #f1f3ff; }
.bin-title { font-weight: 800; font-size: 1.05rem; color: var(--c); }
.bin-items { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.bin-chip { background: var(--green-soft); border: 1px solid #b8dcae; border-radius: 10px; padding: 0 8px; font-size: 1.05rem; animation: pop 0.3s ease; }
.bin.wrong { animation: shake 0.4s ease; border-color: var(--red); }

/* ---------- Word tiles (order + fix) ---------- */
.sentence { border: 2px solid transparent; border-radius: var(--radius); padding: 8px; margin-bottom: 10px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.sentence.active { border-color: var(--c); background: var(--card); box-shadow: 0 6px 20px rgba(91, 108, 255, 0.18); }
.sentence.solved { border-color: #b8dcae; background: var(--green-soft); }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.tile {
  flex: 1 0 auto; min-width: 60px; padding: 6px 14px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--tile); box-shadow: 0 3px 0 var(--tile-shadow); font-size: 1.45rem; font-weight: 600; line-height: 1.5;
  cursor: default; user-select: none; -webkit-user-select: none; transition: background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.15s;
}
.sentence.active .tile { cursor: grab; touch-action: none; }
.sentence:not(.active):not(.solved) .tile { opacity: 0.8; }
.tile.selected { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.35), 0 3px 0 var(--tile-shadow); transform: translateY(-2px); }
.tile.placeholder { opacity: 0.25; border-style: dashed; box-shadow: none; }
.tile.hinted { animation: flash 0.7s ease; }
.tile.ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; transform: scale(1.08) rotate(-2deg); box-shadow: 0 12px 24px rgba(31, 35, 82, 0.25); border-color: var(--brand-2); }
.sentence.solved .tile, .tile.fixed { background: var(--green); border-color: var(--green-dark); box-shadow: 0 3px 0 var(--green-dark); color: #fff; }
.sentence-meta { display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 0 2px; }
.sentence.active .sentence-meta, .sentence.solved .sentence-meta { display: flex; }
.sentence.solved .row-actions { display: none; }
.meaning { color: var(--muted); font-weight: 700; font-size: 1rem; }
.row-actions { display: flex; gap: 6px; }
.fix-row { justify-content: flex-start; }
.fix-row .tile { cursor: pointer; flex: 0 1 auto; }
.tile.found { background: var(--red-soft); border-color: var(--red); color: var(--red); text-decoration: line-through; }
.tile.shake { animation: shake 0.4s ease; }
.fix-options { margin-top: 14px; }

/* ---------- Match ---------- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-label { text-align: center; font-weight: 800; color: var(--c); }
.match-item {
  border: 1px solid var(--line); border-radius: 14px; background: var(--tile); box-shadow: 0 3px 0 var(--tile-shadow);
  min-height: 58px; padding: 6px 10px 10px; font-size: 1.3rem; line-height: 1.4; cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.match-item.long { font-size: 1.05rem; }
.match-item.selected { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.35), 0 3px 0 var(--tile-shadow); }
.match-item.matched { background: var(--green); border-color: var(--green-dark); box-shadow: 0 3px 0 var(--green-dark); color: #fff; cursor: default; }
.match-item.wrong { animation: shake 0.4s ease; border-color: var(--red); }

/* ---------- Choice ---------- */
.prompt { text-align: center; margin-bottom: 14px; }
.lead { display: block; color: var(--muted); font-weight: 700; }
.prompt-sentence { font-size: 1.7rem; line-height: 2.1; margin: 6px 0 4px; }
.blank { display: inline-block; min-width: 70px; margin: 0 4px; border-bottom: 3px dashed var(--c); padding: 0 6px; color: var(--green-dark); font-weight: 700; }
.blank.filled { border-bottom-style: solid; border-color: var(--green); }
.options { display: grid; grid-template-columns: 1fr; gap: 10px; }
.options.compact { grid-template-columns: repeat(3, 1fr); }
.option {
  border: 1px solid var(--line); border-radius: 14px; background: var(--tile); box-shadow: 0 3px 0 var(--tile-shadow);
  min-height: 58px; padding: 6px 12px 10px; font-size: 1.35rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.options.compact .option { font-size: 1.8rem; }
.option:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--tile-shadow); }
.option:disabled { cursor: default; }
.option.correct { background: var(--green); border-color: var(--green-dark); box-shadow: 0 3px 0 var(--green-dark); color: #fff; }
.option.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); animation: shake 0.4s ease; opacity: 0.8; }
.tip { margin-top: 14px; padding: 12px; border-radius: 14px; background: #fff8e1; border: 1px solid #ffe08a; text-align: center; }
.tip p { margin: 0 0 10px; font-weight: 600; font-size: 1.1rem; line-height: 1.8; }

/* ---------- Read ---------- */
.read-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.read-emoji { font-size: 2rem; }
.read-title { flex: 1; margin: 0; font-size: 1.6rem; color: var(--c); }
.story { font-size: 1.45rem; line-height: 2.2; }
.story p { margin: 0 0 14px; }
.gloss { font: inherit; background: var(--mark); border: none; border-bottom: 2px solid #e8b400; border-radius: 6px; padding: 0 3px; cursor: pointer; }
.gloss.on { background: #ffd65c; }
.gloss-pop {
  position: sticky; bottom: 12px; display: grid; gap: 2px; padding: 10px 14px; margin-bottom: 12px;
  background: #1f2352; color: #fff; border-radius: 14px; font-size: 1.15rem; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.gloss-pop strong { font-size: 1.3rem; color: #ffd65c; }
.gloss-pop .i-en { color: #c9cdf5; }
.read-questions { margin-top: 4px; }

/* ---------- Write ---------- */
.write-prompt { text-align: center; }
.write-emoji { font-size: 2.6rem; }
.write-task { font-size: 1.35rem; line-height: 1.9; margin: 4px 0; font-weight: 600; }
.reqs { list-style: none; padding: 10px 14px; margin: 12px 0; background: #f4f6ff; border-radius: 14px; display: grid; gap: 4px; }
.reqs li { font-size: 1.05rem; }
.reqs li::before { content: '◻︎ '; color: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips.starters .chip { background: #fff8e1; border-color: #ffe08a; }
.chips .chip { font-size: 1.05rem; }
.dice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; align-items: stretch; }
.die { display: grid; gap: 2px; text-align: center; padding: 8px 4px; border-radius: 14px; background: #fff; border: 2px solid var(--line); }
.die-label { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.die-value { font-size: 1.1rem; font-weight: 700; color: var(--c); }
.dice .btn { grid-column: 1 / -1; justify-self: center; }
.boxes { display: grid; gap: 10px; margin-top: 8px; }
.box { display: grid; gap: 4px; }
.box-label { font-weight: 800; color: var(--c); }
.box textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
  font-size: 1.3rem; line-height: 1.9; resize: vertical;
}
.box textarea:focus { outline: none; border-color: var(--c); }
.write-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.word-count { color: var(--muted); font-weight: 700; }
.write-foot .btn { flex: 1; min-width: 200px; }
.write-error { color: var(--red); font-weight: 700; text-align: center; }

.fb-card h3, .fb-card h4 { margin: 6px 0; color: var(--c); }
.fb-title { font-size: 1.2rem; }
.fb-praise { font-size: 1.2rem; line-height: 1.9; background: var(--green-soft); border-radius: 14px; padding: 10px 14px; margin: 8px 0; }
.fb-fixes, .fb-reqs { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.fb-fix { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.fb-type { font-size: 0.75rem; font-weight: 800; color: #9a5b00; background: #fff1d6; border-radius: 999px; padding: 0 8px; justify-self: start; }
.fb-change { font-size: 1.3rem; }
.fb-change del { color: var(--red); }
.fb-change ins { color: var(--green-dark); text-decoration: none; font-weight: 700; }
.fb-why { color: var(--muted); font-size: 1.05rem; }
.fb-reqs li { font-size: 1.05rem; }
.fb-reqs small { display: block; color: var(--muted); padding-inline-start: 1.6em; }
.fb-corrected { background: #f4f6ff; border-radius: 14px; padding: 8px 12px; margin: 8px 0; }
.fb-corrected summary { cursor: pointer; font-weight: 700; }
.fb-corrected p { font-size: 1.2rem; line-height: 2; }
.fb-next { font-size: 1.15rem; font-weight: 600; background: #fff8e1; border-radius: 14px; padding: 10px 14px; }

/* ---------- Speak ---------- */
.recorder { display: grid; justify-items: center; gap: 8px; margin: 14px 0; }
.rec-btn {
  width: 96px; height: 96px; border-radius: 50%; border: none; font-size: 2.6rem; cursor: pointer;
  background: var(--c); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 70%, #000);
}
.rec-btn.on { background: var(--red); box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); animation: pulse 1.2s infinite; }
.rec-btn:disabled { opacity: 0.4; cursor: default; }
.rec-label { font-weight: 700; color: var(--muted); }
.rec-audio, .sub-card audio { width: 100%; max-width: 420px; }
.sub-card audio { margin: 6px 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); } 70% { box-shadow: 0 0 0 18px rgba(229, 72, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); } }

/* ---------- Finish ---------- */
.finish { text-align: center; margin-top: 18px; animation: pop 0.35s ease; }
.finish-msg { color: var(--muted); font-weight: 800; margin: 8px 0; }
.finish-links { display: flex; justify-content: center; gap: 18px; margin-top: 12px; }
.stars { color: #d3d6ea; letter-spacing: 2px; font-size: 1rem; white-space: nowrap; }
.stars .on { color: var(--gold); }
.stars.big { font-size: 2.6rem; margin: 4px 0 14px; }
.stars.big span { display: inline-block; animation: pop 0.4s ease backwards; }
.stars.big span:nth-child(2) { animation-delay: 0.12s; }
.stars.big span:nth-child(3) { animation-delay: 0.24s; }

/* ---------- My writing / parent ---------- */
.sub-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.sub-card header strong { flex: 1; }
.sub-card time { color: var(--muted); font-size: 0.85rem; }
.sub-card .stars { color: var(--gold); }
.sub-text { font-size: 1.2rem; line-height: 2; background: #fbfbff; border-radius: 12px; padding: 8px 12px; }
.parent-comment { background: #eef0ff; border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.parent-flag { background: var(--red-soft); color: #9b1c20; border: 1px solid #f3b4b6; border-radius: 12px; padding: 8px 12px; font-family: var(--font-en); font-weight: 700; }
.comment-box { display: grid; gap: 4px; margin: 10px 0 6px; font-weight: 700; }
.comment-box textarea { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 8px; font-family: var(--font-ar); font-size: 1.1rem; }
.kid-tabs { display: grid; gap: 8px; margin-bottom: 14px; }
.kid-tab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--line); background: #fff; cursor: pointer; text-align: start; }
.kid-tab.on { border-color: var(--brand-2); background: #eef0ff; }
.kid-tab .avatar { font-size: 1.6rem; }
.kid-stats { flex-basis: 100%; color: var(--muted); font-size: 0.9rem; }
.pin-form { display: grid; gap: 12px; }
.pin-form label { display: grid; gap: 6px; font-weight: 700; }
pre { background: #1f2352; color: #fff; padding: 10px; border-radius: 10px; }

/* ---------- Animations ---------- */
@keyframes pop { 0% { transform: scale(0.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 70% { transform: rotate(6deg); } }
@keyframes think { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes flash { 0%, 100% { background: var(--tile); } 40% { background: #fff1b8; } }

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

@media (max-width: 380px) {
  .tile { font-size: 1.25rem; min-width: 50px; padding: 4px 10px 8px; }
  .bin-title { font-size: 0.95rem; }
  .track-name { font-size: 1.05rem; }
}
