/* ============================================================
   تلوك — دفتر مدرسي دافئ
   ============================================================ */

:root{
  --paper:#FDF6E9;
  --paper-2:#F8EFDD;
  --paper-3:#F1E5CE;
  --ink:#2E2A24;
  --ink-soft:#6B6156;
  --terra:#E2725B;
  --teal:#2FA8A0;
  --mustard:#F2C14E;
  --plum:#6B4E8F;
  --accent:var(--terra);
  --r-lg:26px;
  --r-md:18px;
  --r-sm:13px;
  --bd:3px solid var(--ink);
  --sh:0 3px 0 rgba(46,42,36,.13), 0 8px 18px rgba(46,42,36,.06);
  --sh-sm:0 2px 0 rgba(46,42,36,.14);
  --font-head:'Baloo Bhaijaan 2','Tajawal',system-ui,sans-serif;
  --font-body:'Tajawal',system-ui,sans-serif;
}

*,*::before,*::after{box-sizing:border-box}

html,body{
  height:100%;
  margin:0;
  padding:0;
}

body{
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:17px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  overscroll-behavior:none;
  overflow:hidden;
}

button,input{
  font-family:inherit;
  color:inherit;
}

button{
  border:0;
  background:none;
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
  touch-action:manipulation;
}

button:focus-visible,
input:focus-visible{
  outline:3px solid var(--plum);
  outline-offset:3px;
}

.sprite{position:absolute;width:0;height:0;overflow:hidden}

.ic{width:1em;height:1em;display:block;fill:currentColor;flex:none}
.ic-star{fill:var(--mustard);stroke:var(--ink);stroke-width:1.3;stroke-linejoin:round}

.hidden{display:none !important}

/* paper grain */
.paper-grain{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:0;
  opacity:.55;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
}

#fx{
  position:fixed;
  inset:0;
  z-index:90;
  pointer-events:none;
}

/* ---------------- screens ---------------- */
.screen{
  position:fixed;
  inset:0;
  display:flex;
  flex-direction:column;
  z-index:1;
  overflow:hidden;
}

.stage-0{--accent:var(--terra)}
.stage-1{--accent:var(--teal)}
.stage-2{--accent:#DCA92F}
.stage-3{--accent:var(--plum)}

/* ---------------- topbar ---------------- */
.topbar{
  flex:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 16px 10px;
  background:linear-gradient(var(--paper) 72%, rgba(253,246,233,0));
}

.brand-badge{
  display:inline-block;
  font-family:var(--font-head);
  font-weight:800;
  font-size:25px;
  line-height:1;
  padding:8px 20px 10px;
  background:var(--mustard);
  color:var(--ink);
  border:var(--bd);
  border-radius:20px 26px 20px 26px / 24px 20px 26px 20px;
  box-shadow:var(--sh-sm);
  transform:rotate(-1.6deg);
}

.topbar-end{display:flex;align-items:center;gap:8px}

.topbar-spacer{width:48px;flex:none}

.starbank{
  display:flex;
  align-items:center;
  gap:5px;
  background:#fff;
  border:var(--bd);
  border-radius:999px;
  padding:6px 12px 6px 10px;
  font-family:var(--font-head);
  font-weight:700;
  font-size:17px;
  box-shadow:var(--sh-sm);
  font-variant-numeric:tabular-nums;
}
.starbank .ic{width:20px;height:20px}
.starbank-max{font-size:12px;color:var(--ink-soft);font-weight:500}

.icon-btn{
  width:48px;
  height:48px;
  min-width:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  background:#fff;
  border:var(--bd);
  border-radius:16px 20px 16px 20px / 20px 16px 20px 16px;
  box-shadow:var(--sh-sm);
  transition:transform .12s ease, box-shadow .12s ease;
}
.icon-btn:active{transform:translateY(2px);box-shadow:none}

.page-title{
  font-family:var(--font-head);
  font-weight:800;
  font-size:23px;
  margin:0;
}

/* ---------------- home ---------------- */
.home-main{
  flex:1;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:0 16px 150px;
  position:relative;
}

.hero{padding:6px 2px 22px}
.hero h1{
  font-family:var(--font-head);
  font-weight:800;
  font-size:30px;
  line-height:1.25;
  margin:0 0 6px;
  letter-spacing:0;
}
.hero p{
  margin:0;
  font-size:15px;
  color:var(--ink-soft);
}

.path{display:flex;flex-direction:column;gap:8px}

.stage{
  position:relative;
  padding:6px 0 26px;
}

.stage-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:16px;
}
.stage-num{
  width:34px;
  height:34px;
  flex:none;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-head);
  font-weight:800;
  font-size:16px;
  background:var(--accent);
  color:#fff;
  border:var(--bd);
  border-radius:50%;
  box-shadow:var(--sh-sm);
}
.stage-head h2{
  font-family:var(--font-head);
  font-weight:800;
  font-size:21px;
  margin:0;
}
.stage-count{
  font-size:13px;
  color:var(--ink-soft);
  background:#fff;
  border:2px solid rgba(46,42,36,.22);
  border-radius:999px;
  padding:2px 10px;
  margin-inline-start:auto;
  font-variant-numeric:tabular-nums;
}

.stage-track{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:8px;
  position:relative;
  padding:4px 2px;
}

.stage-track::before{
  content:'';
  position:absolute;
  inset-inline:18px;
  top:44px;
  height:0;
  border-top:4px dashed rgba(46,42,36,.18);
  border-radius:2px;
  z-index:0;
}

.node{
  position:relative;
  z-index:1;
  flex:1 1 0;
  max-width:96px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:7px;
  padding:0;
}

.node-face{
  width:74px;
  height:74px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-head);
  font-weight:800;
  font-size:26px;
  border:var(--bd);
  border-radius:24px 28px 24px 28px / 28px 24px 28px 24px;
  background:#fff;
  color:var(--ink);
  box-shadow:var(--sh);
  transition:transform .14s ease, box-shadow .14s ease;
  font-variant-numeric:tabular-nums;
}
.node-face .ic{width:28px;height:28px}

.node.open .node-face{background:var(--accent);color:#fff}
.node.done .node-face{background:#fff}
.node.done .node-face .ic{color:var(--teal)}
.node.locked .node-face{
  background:var(--paper-3);
  color:rgba(46,42,36,.34);
  border-color:rgba(46,42,36,.30);
  box-shadow:none;
}
.node:active .node-face{transform:translateY(3px);box-shadow:none}

.node.open .node-face{animation:nodePulse 2.6s ease-in-out infinite}
@keyframes nodePulse{
  0%,100%{box-shadow:0 3px 0 rgba(46,42,36,.13), 0 0 0 0 rgba(226,114,91,.0)}
  50%{box-shadow:0 3px 0 rgba(46,42,36,.13), 0 0 0 7px rgba(226,114,91,.14)}
}

.node-stars{display:flex;gap:1px}
.nstar{width:15px;height:15px;fill:rgba(46,42,36,.16)}
.nstar.on{fill:var(--mustard);stroke:var(--ink);stroke-width:1.6;stroke-linejoin:round}

.stage-connector{
  display:flex;
  justify-content:center;
  margin:-14px 0 -6px;
  opacity:.32;
  color:var(--ink);
}
.stage-connector svg{width:64px;height:34px}

.tiny{
  font-size:12.5px;
  color:var(--ink-soft);
  text-align:center;
  margin:0;
}
.home-tiny{padding-top:22px}
.settings-tiny{padding-top:26px}

/* ---------------- lesson ---------------- */
.lesson-bar{
  flex:none;
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px 6px;
}
.dots{display:flex;gap:7px;flex:1;align-items:center}
.dot{
  height:9px;
  flex:1;
  max-width:44px;
  border-radius:999px;
  background:rgba(46,42,36,.15);
  transition:background .25s ease;
}
.dot.done{background:var(--accent)}
.dot.now{background:var(--accent);box-shadow:0 0 0 3px rgba(46,42,36,.08)}

.stage-pill{
  font-family:var(--font-head);
  font-weight:700;
  font-size:13.5px;
  padding:5px 13px;
  border-radius:999px;
  background:#fff;
  border:2.5px solid var(--ink);
  box-shadow:var(--sh-sm);
  white-space:nowrap;
}

.card-stage{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:10px 16px;
}

.card{
  flex:1;
  width:100%;
  max-width:560px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding:18px 16px 12px;
  background:var(--paper-2);
  border:var(--bd);
  border-radius:28px 22px 26px 24px / 24px 28px 22px 26px;
  box-shadow:var(--sh);
  position:relative;
}

.card-hint{
  margin:0;
  font-size:14.5px;
  color:var(--ink-soft);
  text-align:center;
  font-weight:500;
}

/* big letter */
.letter-big{
  font-family:var(--font-head);
  font-weight:700;
  line-height:1;
  font-size:clamp(120px, min(44vw, 26vh), 220px);
  padding:0 .06em .1em;
  color:var(--ink);
  background:none;
  border:none;
  position:relative;
  transform-origin:center;
  transition:transform .12s ease;
  letter-spacing:0;
}
.letter-big:active{transform:scale(.94)}
.letter-big.tapped{animation:letterPop .45s cubic-bezier(.34,1.56,.64,1)}
@keyframes letterPop{
  0%{transform:scale(1)}
  40%{transform:scale(1.09)}
  100%{transform:scale(1)}
}
.letter-big::after{
  content:'';
  position:absolute;
  inset:-6% -2% -2%;
  border-radius:50%;
  border:3px dashed rgba(226,114,91,.55);
  opacity:0;
  pointer-events:none;
}
.letter-big.pulse::after{animation:haloPulse 2.4s ease-out infinite}
@keyframes haloPulse{
  0%{opacity:.85;transform:scale(.86)}
  70%{opacity:0;transform:scale(1.12)}
  100%{opacity:0;transform:scale(1.12)}
}

.example{
  display:flex;
  align-items:center;
  gap:14px;
  background:#fff;
  border:var(--bd);
  border-radius:20px 24px 20px 24px / 24px 20px 24px 20px;
  padding:8px 16px 8px 10px;
  box-shadow:var(--sh-sm);
}
.art{width:76px;height:76px;flex:none}
.art svg{width:100%;height:100%;display:block;overflow:visible}
.ex-word{
  font-family:var(--font-head);
  font-weight:700;
  font-size:30px;
  line-height:1.3;
  padding-bottom:2px;
}

/* blend */
.blend-clue{display:flex;flex-direction:column;align-items:center;gap:6px}
.blend-clue .art{width:104px;height:104px}
.blend-word{
  font-family:var(--font-head);
  font-weight:700;
  font-size:44px;
  line-height:1.35;
  padding:0 12px;
}

.slots{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;direction:rtl}
.slot{
  width:56px;
  height:66px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-head);
  font-weight:700;
  font-size:30px;
  line-height:1;
  padding-bottom:6px;
  border-radius:14px;
  border:3px dashed rgba(46,42,36,.3);
  background:rgba(255,255,255,.5);
  color:var(--ink);
  transition:transform .18s ease, background .18s ease, border-color .18s ease;
}
.slot.filled{
  border-style:solid;
  border-color:var(--ink);
  background:#fff;
  box-shadow:var(--sh-sm);
  animation:slotPop .32s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slotPop{
  0%{transform:scale(.5);opacity:.2}
  70%{transform:scale(1.1)}
  100%{transform:scale(1);opacity:1}
}
.slots.ok .slot.filled{background:#D7F2EE;border-color:var(--teal)}

.tray{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:center;
  padding:4px 0 2px;
  direction:rtl;
}
.tile{
  min-width:64px;
  height:70px;
  padding:0 12px 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-head);
  font-weight:700;
  font-size:30px;
  line-height:1;
  background:#fff;
  border:var(--bd);
  border-radius:16px 20px 16px 20px / 20px 16px 20px 16px;
  box-shadow:var(--sh);
  transition:transform .12s ease, box-shadow .12s ease, opacity .2s ease, background .2s ease;
}
.tile:active{transform:translateY(3px);box-shadow:none}
.tile.used{opacity:.22;pointer-events:none;background:var(--paper-3)}
.tile.wrong{animation:tileShake .38s ease;background:#FBE0DA;border-color:var(--terra)}
@keyframes tileShake{
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-7px)}
  45%{transform:translateX(6px)}
  70%{transform:translateX(-4px)}
}

.blend-hint{
  font-size:13.5px;
  color:var(--ink-soft);
  background:#fff;
  border:2px dashed rgba(46,42,36,.28);
  border-radius:999px;
  padding:4px 14px;
  margin:0;
}
.blend-hint b{font-family:var(--font-head);font-size:17px;color:var(--ink)}

/* read card */
.read-text{
  font-family:var(--font-head);
  font-weight:700;
  text-align:center;
  line-height:1.5;
  font-size:clamp(34px, 9.5vw, 58px);
  padding:6px 4px 10px;
  max-width:100%;
  overflow-wrap:break-word;
}
.read-text.long{font-size:clamp(26px, 7vw, 40px);line-height:1.65}
.read-art{width:104px;height:104px}
.read-status{
  text-align:center;
  font-size:14.5px;
  min-height:22px;
  color:var(--ink-soft);
  font-weight:500;
  margin:0;
}
.read-status.ok{color:#1F7F79;font-weight:700}
.read-status.err{color:#C0543D;font-weight:700}

.rec-ring{
  display:inline-flex;
  align-items:center;
  gap:7px;
  font-family:var(--font-head);
  font-weight:700;
  color:var(--terra);
}
.rec-dot{
  width:11px;height:11px;border-radius:50%;
  background:var(--terra);
  animation:recBlink 1s steps(2,end) infinite;
}
@keyframes recBlink{0%,100%{opacity:1}50%{opacity:.15}}

/* ---------------- footer ---------------- */
.lesson-foot{
  flex:none;
  padding:10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:9px;
}
@supports not (padding: env(safe-area-inset-bottom)){
  .lesson-foot{padding-bottom:14px}
}

.btn{
  font-family:var(--font-head);
  font-weight:700;
  font-size:19px;
  line-height:1;
  min-height:60px;
  padding:0 32px;
  border-radius:18px 22px 18px 22px / 22px 18px 22px 18px;
  border:var(--bd);
  box-shadow:var(--sh);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  transition:transform .12s ease, box-shadow .12s ease, background .18s ease;
  background:#fff;
  color:var(--ink);
  max-width:100%;
}
.btn:active{transform:translateY(3px);box-shadow:none}
.btn .ic{width:22px;height:22px}
.btn-primary{background:var(--accent);color:#fff;border-color:var(--ink);text-shadow:0 1px 0 rgba(0,0,0,.08)}
.btn-wide{width:100%;max-width:340px}
.btn-ghost{background:#fff;color:var(--ink)}
.btn-teal{background:var(--teal);color:#fff}
.btn:disabled{opacity:.42;pointer-events:none;box-shadow:none}

.mic-btn{
  width:96px;
  height:96px;
  min-height:96px;
  border-radius:50%;
  background:var(--terra);
  color:#fff;
  border:var(--bd);
  box-shadow:0 5px 0 rgba(46,42,36,.2), 0 10px 22px rgba(226,114,91,.3);
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform .12s ease, box-shadow .12s ease, background .2s ease;
}
.mic-btn .ic{width:42px;height:42px}
.mic-btn:active{transform:translateY(4px);box-shadow:0 1px 0 rgba(46,42,36,.2)}
.mic-btn.on{background:var(--plum);animation:micPulse 1.4s ease-in-out infinite}
@keyframes micPulse{
  0%,100%{box-shadow:0 5px 0 rgba(46,42,36,.2), 0 0 0 0 rgba(107,78,143,.35)}
  50%{box-shadow:0 5px 0 rgba(46,42,36,.2), 0 0 0 16px rgba(107,78,143,0)}
}
.mic-wrap{display:flex;flex-direction:column;align-items:center;gap:8px}

.price-tag{
  font-family:var(--font-head);
  font-weight:700;
  font-size:12.5px;
  padding:2px 9px;
  border-radius:999px;
  background:rgba(255,255,255,.9);
  border:2px solid var(--ink);
  color:var(--ink);
  white-space:nowrap;
}

.foot-row{display:flex;gap:10px;align-items:center;justify-content:center;width:100%;flex-wrap:wrap}

/* ---------------- overlays ---------------- */
.overlay{
  position:fixed;
  inset:0;
  z-index:60;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(46,42,36,.42);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  animation:fadeIn .2s ease;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

.sheet{
  position:relative;
  width:100%;
  max-width:400px;
  max-height:88vh;
  overflow-y:auto;
  background:var(--paper);
  border:var(--bd);
  border-radius:30px 26px 30px 26px / 26px 30px 26px 30px;
  padding:26px 22px 22px;
  box-shadow:0 14px 0 rgba(46,42,36,.14), 0 22px 44px rgba(46,42,36,.24);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  animation:sheetIn .3s cubic-bezier(.34,1.4,.64,1);
}
@keyframes sheetIn{
  from{transform:translateY(26px) scale(.96);opacity:0}
  to{transform:translateY(0) scale(1);opacity:1}
}

.sheet-close{position:absolute;top:12px;inset-inline-start:12px;width:40px;height:40px;min-width:40px;font-size:16px}

.sheet h2{
  font-family:var(--font-head);
  font-weight:800;
  font-size:26px;
  margin:0;
  text-align:center;
}

.result-stars{display:flex;gap:6px;justify-content:center;padding:6px 0 2px}
.rstar{
  width:54px;height:54px;
  fill:rgba(46,42,36,.12);
  stroke:rgba(46,42,36,.18);
  stroke-width:1.4;
  transform:scale(.6);
  opacity:0;
  transition:transform .4s cubic-bezier(.34,1.6,.64,1), opacity .3s ease;
}
.rstar.on{fill:var(--mustard);stroke:var(--ink);stroke-width:1.6}
.rstar.show{transform:scale(1);opacity:1}

.result-msg{
  margin:0;
  text-align:center;
  font-size:15.5px;
  color:var(--ink-soft);
}

.sheet-parent{max-width:430px}

.parent-q{
  font-family:var(--font-head);
  font-weight:800;
  font-size:32px;
  text-align:center;
  padding:6px 0;
  letter-spacing:1px;
}
.parent-input{
  width:130px;
  height:58px;
  text-align:center;
  font-family:var(--font-head);
  font-weight:700;
  font-size:26px;
  border:var(--bd);
  border-radius:16px;
  background:#fff;
  color:var(--ink);
}
.parent-err{color:#C0543D;font-weight:700;font-size:14px;margin:0}
.p-actions{display:flex;gap:10px;width:100%}
.p-actions .btn{flex:1;padding:0 12px;font-size:17px;min-height:54px}

.p-stats{
  display:flex;
  gap:10px;
  width:100%;
  justify-content:center;
  flex-wrap:wrap;
  padding:4px 0 8px;
}
.p-stat{
  flex:1 1 100px;
  background:#fff;
  border:var(--bd);
  border-radius:16px;
  padding:10px 8px;
  text-align:center;
  box-shadow:var(--sh-sm);
}
.p-stat b{
  display:block;
  font-family:var(--font-head);
  font-size:24px;
  line-height:1.2;
}
.p-stat span{font-size:12px;color:var(--ink-soft)}

.p-link{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  min-height:56px;
  border:var(--bd);
  border-radius:16px;
  background:#fff;
  box-shadow:var(--sh-sm);
  text-decoration:none;
  color:var(--ink);
  font-family:var(--font-head);
  font-weight:700;
  font-size:17px;
}
.p-link:active{transform:translateY(2px);box-shadow:none}

.p-danger{background:#FBE0DA}

/* ---------------- settings ---------------- */
.settings-main{
  flex:1;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:10px 16px 150px;
  max-width:560px;
  width:100%;
  margin:0 auto;
}

.section-label{
  font-family:var(--font-head);
  font-weight:700;
  font-size:13.5px;
  color:var(--ink-soft);
  margin:18px 4px 8px;
  letter-spacing:0;
}

.setting{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  background:#fff;
  border:var(--bd);
  border-radius:20px 24px 20px 24px / 24px 20px 24px 20px;
  padding:14px 16px;
  margin-bottom:12px;
  box-shadow:var(--sh-sm);
}
.setting-txt{display:flex;flex-direction:column;gap:1px}
.s-title{font-family:var(--font-head);font-weight:700;font-size:18px;line-height:1.3}
.s-sub{font-size:12.5px;color:var(--ink-soft)}

.switch{
  width:66px;
  height:40px;
  min-width:66px;
  border-radius:999px;
  border:var(--bd);
  background:var(--paper-3);
  position:relative;
  transition:background .2s ease;
  box-shadow:inset 0 2px 3px rgba(46,42,36,.1);
}
.switch span{
  position:absolute;
  top:3px;
  inset-inline-start:3px;
  width:28px;
  height:28px;
  border-radius:50%;
  background:#fff;
  border:2.5px solid var(--ink);
  transition:transform .22s cubic-bezier(.34,1.4,.64,1);
}
.switch[aria-checked="true"]{background:var(--teal)}
.switch[aria-checked="true"] span{transform:translateX(-26px)}
html[dir="rtl"] .switch[aria-checked="true"] span{transform:translateX(-26px)}

.parent-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  min-height:60px;
  background:var(--plum);
  color:#fff;
  border:var(--bd);
  border-radius:20px 24px 20px 24px / 24px 20px 24px 20px;
  font-family:var(--font-head);
  font-weight:700;
  font-size:18px;
  box-shadow:var(--sh);
  transition:transform .12s ease, box-shadow .12s ease;
}
.parent-btn:active{transform:translateY(3px);box-shadow:none}
.parent-btn .ic{width:22px;height:22px}

/* ---------------- owl ---------------- */
.owl-dock{
  position:fixed;
  inset-inline-end:12px;
  bottom:10px;
  z-index:40;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
  pointer-events:none;
}

.owl-btn{
  pointer-events:auto;
  width:84px;
  height:92px;
  padding:0;
  position:relative;
  filter:drop-shadow(0 5px 7px rgba(46,42,36,.18));
  transition:transform .18s ease;
}
.owl-btn:active{transform:scale(.94)}
.owl-svg{width:100%;height:100%;display:block;overflow:visible}

.owl-inner{transform-box:fill-box;transform-origin:50% 96%;animation:owlBob 3.4s ease-in-out infinite}
@keyframes owlBob{
  0%,100%{transform:translateY(0) rotate(0deg)}
  50%{transform:translateY(-3.5px) rotate(-1.2deg)}
}

.owl-btn.state-listen .owl-inner{animation:owlListen 1.5s ease-in-out infinite}
@keyframes owlListen{
  0%,100%{transform:rotate(-7deg) scale(1.05)}
  50%{transform:rotate(-4deg) scale(1.08)}
}

.owl-btn.state-think .owl-inner{animation:owlThink 2s ease-in-out infinite}
@keyframes owlThink{
  0%,100%{transform:rotate(7deg) translateY(0)}
  50%{transform:rotate(4deg) translateY(-2px)}
}

.owl-btn.state-happy .owl-inner{animation:owlHappy .62s cubic-bezier(.34,1.56,.64,1) infinite}
@keyframes owlHappy{
  0%,100%{transform:translateY(0) scale(1)}
  30%{transform:translateY(-13px) scale(1.06)}
  60%{transform:translateY(0) scale(.97)}
  80%{transform:translateY(-3px) scale(1.01)}
}

.wing{transform-box:fill-box;stroke:#2E2A24;stroke-width:3.4;stroke-linejoin:round}
.wing-l{fill:#2FA8A0;transform-origin:100% 8%}
.wing-r{fill:#2FA8A0;transform-origin:0% 8%}
.owl-btn.state-happy .wing-l{animation:flapL .62s ease-in-out infinite}
.owl-btn.state-happy .wing-r{animation:flapR .62s ease-in-out infinite}
@keyframes flapL{0%,100%{transform:rotate(0)}50%{transform:rotate(-20deg)}}
@keyframes flapR{0%,100%{transform:rotate(0)}50%{transform:rotate(20deg)}}

.feather{fill:#FDF6E9;stroke:#2E2A24;stroke-width:3.4;stroke-linejoin:round}
.beak{fill:#F2C14E;stroke:#2E2A24;stroke-width:3.4;stroke-linejoin:round}
.ink{stroke:#2E2A24}

.eye{transform-box:fill-box;transform-origin:center;transition:transform .1s linear}
.owl-btn.blink .eye{transform:scaleY(.08)}
.owl-btn.state-listen .eye{transform:scaleY(1.06)}

.owl-q{
  position:absolute;
  top:2px;
  inset-inline-start:-6px;
  width:34px;
  height:34px;
  display:none;
  align-items:center;
  justify-content:center;
  font-family:var(--font-head);
  font-weight:800;
  font-size:20px;
  line-height:1;
  background:var(--mustard);
  color:var(--ink);
  border:2.5px solid var(--ink);
  border-radius:50%;
  box-shadow:var(--sh-sm);
  animation:qFloat 1.8s ease-in-out infinite;
}
.owl-btn.state-think .owl-q{display:flex}
@keyframes qFloat{
  0%,100%{transform:translateY(0) rotate(-6deg)}
  50%{transform:translateY(-5px) rotate(6deg)}
}

.owl-bubble{
  pointer-events:none;
  background:#fff;
  border:var(--bd);
  border-radius:16px 18px 16px 18px / 18px 16px 18px 16px;
  padding:6px 13px 7px;
  font-family:var(--font-head);
  font-weight:700;
  font-size:14.5px;
  color:var(--ink);
  white-space:nowrap;
  box-shadow:var(--sh-sm);
  position:relative;
  margin-inline-end:8px;
  animation:bubbleIn .22s cubic-bezier(.34,1.5,.64,1);
  max-width:74vw;
  overflow:hidden;
  text-overflow:ellipsis;
}
.owl-bubble::after{
  content:'';
  position:absolute;
  bottom:-9px;
  inset-inline-end:22px;
  width:14px;
  height:14px;
  background:#fff;
  border-inline-end:3px solid var(--ink);
  border-bottom:3px solid var(--ink);
  transform:rotate(45deg);
  border-radius:0 0 4px 0;
}
@keyframes bubbleIn{
  from{transform:translateY(6px) scale(.9);opacity:0}
  to{transform:translateY(0) scale(1);opacity:1}
}

/* ---------------- art fills ---------------- */
.art-svg{width:100%;height:100%;display:block}
.art-svg *{stroke:#2E2A24;stroke-width:3.2;stroke-linejoin:round;stroke-linecap:round}
.f-terra{fill:#E2725B}
.f-teal{fill:#2FA8A0}
.f-mustard{fill:#F2C14E}
.f-plum{fill:#6B4E8F}
.f-cream{fill:#FDF6E9}
.f-white{fill:#FFFDF7}
.f-ink{fill:#2E2A24}
.f-none{fill:none}

/* ---------------- responsive ---------------- */
@media (max-width:430px){
  .hero h1{font-size:26px}
  .stage-head h2{font-size:19px}
  .node-face{width:66px;height:66px;font-size:23px;border-radius:22px}
  .stage-track::before{top:40px}
  .brand-badge{font-size:22px;padding:7px 16px 9px}
  .owl-btn{width:72px;height:80px}
  .owl-bubble{font-size:13.5px;padding:5px 11px 6px}
  .btn{font-size:18px;min-height:56px;padding:0 26px}
  .mic-btn{width:86px;height:86px;min-height:86px}
  .mic-btn .ic{width:36px;height:36px}
  .slot{width:50px;height:60px;font-size:27px}
  .tile{min-width:60px;height:66px;font-size:28px}
  .ex-word{font-size:26px}
  .art{width:66px;height:66px}
}

@media (max-width:360px){
  .node-face{width:60px;height:60px;font-size:21px}
  .stage-track::before{top:36px}
  .starbank{font-size:15px;padding:5px 10px 5px 8px}
  .icon-btn{width:44px;height:44px;min-width:44px;font-size:20px}
  .hero h1{font-size:24px}
}

@media (min-width:721px){
  .home-main,.settings-main{padding-inline:32px}
  .hero h1{font-size:38px}
  .node-face{width:84px;height:84px;font-size:29px}
  .stage-track::before{top:50px}
  .owl-btn{width:104px;height:114px}
  .owl-dock{bottom:18px;inset-inline-end:20px}
  .card-stage{padding:16px 24px}
}

@media (max-height:640px){
  .card{padding:12px 12px 8px;gap:9px}
  .letter-big{font-size:clamp(96px, min(36vw, 20vh), 160px)}
  .mic-btn{width:74px;height:74px;min-height:74px}
  .mic-btn .ic{width:30px;height:30px}
  .lesson-foot{padding-top:6px}
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
}