/* Learn tab: winding lesson path, lesson screens, feedback bar. Right-to-left, so sides are logical (inline-start = right). */
body.lesson header.top, body.lesson nav.tabs, body.lesson #picker { display: none; }
.learn-hero { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.learn-hero .sub { margin: 0; max-width: 460px; }
.trouble-nudge { flex-basis: 100%; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--shu-soft); border: 2px solid var(--edge); border-radius: 18px; padding: 12px 14px; margin-top: 4px; }
.trouble-nudge b { display: block; color: var(--shu-ink); } .trouble-nudge span { display: block; font-size: 15px; color: var(--muted); }

.unit { margin: 26px 0 10px; }
.unit-banner { position: relative; display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; padding: 14px 20px; border: 2px solid var(--edge); border-radius: 18px; box-shadow: 4px 4px 0 var(--edge); color: #fff; background: var(--ub); transform: rotate(.6deg); }
.unit-banner::before, .unit-banner::after { content: ""; position: absolute; top: -10px; width: 64px; height: 20px; background: color-mix(in srgb, #ffd1e6 70%, transparent); }
.unit-banner::before { right: 18px; transform: rotate(6deg); } .unit-banner::after { left: 18px; transform: rotate(-5deg); }
.unit-banner.u0 { --ub: var(--ai); } .unit-banner.u1 { --ub: var(--shu); } .unit-banner.u2 { --ub: var(--matcha); } .unit-banner.u3 { --ub: var(--kin); color: var(--edge); }
.unit-banner h3 { margin: 0; font-size: 22px; font-weight: 700; } .unit-no { font-size: 14px; font-weight: 600; opacity: .85; }
.unit-prog { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; direction: ltr; }
.unit-prog .pbar { width: 110px; height: 12px; flex: none; } .unit-prog .pbar > i { background: var(--kin); border-inline-end-width: 1.5px; }
.unit-practise { margin-inline-start: auto; }
.unit-banner.u3 .unit-practise { --bgc: var(--edge); --fg: #fff; }

.path { position: relative; margin: 8px auto 0; max-width: 620px; direction: ltr; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trail path { fill: none; stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 0.1 14; }
.trail .t-todo { stroke: var(--faint); opacity: .7; } .trail .t-done { stroke: var(--ai); }
.pnode { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 5px; width: 140px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--text); z-index: 1; }
.pn-ring { position: relative; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; border: 2.5px solid var(--edge); background: var(--card); box-shadow: 3px 3px 0 var(--edge); transition: transform .12s; }
.pnode:hover .pn-ring { transform: translate(-1px, -2px) rotate(3deg); }
.pn-t { font-size: 34px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--ui); }
.review .pn-ring { width: 92px; height: 92px; border-radius: 26px; border-width: 3px; box-shadow: 4px 4px 0 var(--edge), inset 0 0 0 4px var(--card), inset 0 0 0 6px var(--edge); }
.pn-l { font-size: 13.5px; font-weight: 600; color: var(--muted); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--paper); border-radius: 6px; padding: 0 4px; }
.pnode.done .pn-ring { border-color: var(--ai); background: var(--ai-soft); transform: rotate(8deg); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4.5px var(--ai); }
.pnode.done.review .pn-ring { border-radius: 26px; }
.pnode .seal { position: absolute; right: -6px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--kin); color: var(--edge); font: 700 15px/22px var(--ui); text-align: center; transform: rotate(10deg); border: 2px solid var(--edge); }
.pnode.next .pn-ring { background: var(--kin-soft); width: 88px; height: 88px; animation: nextBob 1.6s ease-in-out infinite; }
.pnode.next.review .pn-ring { width: 98px; height: 98px; }
@keyframes nextBob { 50% { transform: translateY(-5px); } }
.pn-go { position: absolute; top: -36px; font-size: 14px; font-weight: 700; color: #fff; background: var(--ai); border: 2px solid var(--edge); border-radius: 10px; padding: 2px 10px; box-shadow: 2px 2px 0 var(--edge); animation: nextBob 1.6s ease-in-out infinite; white-space: nowrap; }
.pn-go::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; background: var(--ai); border-right: 2px solid var(--edge); border-bottom: 2px solid var(--edge); transform: translateX(-50%) rotate(45deg); }
.pnode.locked .pn-ring { background: var(--paper-2); border-style: dashed; border-color: var(--faint); box-shadow: none; }
.pnode.locked .pn-t { filter: grayscale(.8); opacity: .55; }
.pnode.locked .pn-l { color: var(--faint); } .pnode .lock { position: absolute; right: -4px; bottom: -4px; font-size: 14px; filter: grayscale(1); }
.pnode.open .pn-ring { border-style: dashed; }
.pnode.spell .pn-ring { background: var(--shu-soft); }
.pop { position: absolute; width: 280px; transform: translateX(-50%); z-index: 5; background: var(--card); border: 2px solid var(--edge); border-radius: 18px; box-shadow: 5px 5px 0 var(--edge); padding: 14px 16px 16px; animation: popIn .18s ease-out; text-align: right; direction: rtl; }
.pop::before { content: ""; position: absolute; top: -9px; left: var(--ax, 50%); width: 14px; height: 14px; background: var(--card); border-left: 2px solid var(--edge); border-top: 2px solid var(--edge); transform: translateX(-50%) rotate(45deg); }
.pop-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; } .pop-t { font-size: 26px; } .pop-h span:last-child { color: var(--muted); font-weight: 600; font-size: 15px; }
.pop p { margin: 6px 0; font-size: 15px; } .pop .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.pop .chip { background: var(--paper); border: 1.5px solid var(--edge); border-radius: 999px; padding: 1px 10px; font: 500 15px var(--ui); } .pop .btn { margin-top: 6px; width: 100%; }
@keyframes popIn { from { transform: translate(-50%, 8px) rotate(1deg); opacity: 0; } }

/* lesson screen */
.lesson-top { display: flex; align-items: center; gap: 16px; padding: 22px 0 18px; max-width: 720px; margin: 0 auto; }
.x-btn { border: 2px solid var(--edge); background: var(--card); color: var(--text); width: 40px; height: 40px; border-radius: 50%; font-size: 17px; font-weight: 700; cursor: pointer; line-height: 1; box-shadow: 2px 2px 0 var(--edge); flex: none; }
.x-btn:hover { background: var(--ai-soft); }
.lesson-count { font-weight: 700; color: var(--muted); font-size: 15px; min-width: 48px; text-align: left; direction: ltr; }
.lesson-body { max-width: 720px; margin: 0 auto; padding-bottom: 220px; }
.ask { font-size: 25px; font-weight: 700; margin: 6px 0 18px; }
.say-ask { border: 2px solid var(--edge); background: var(--card); border-radius: 50%; width: 36px; height: 36px; font-size: 16px; cursor: pointer; vertical-align: middle; box-shadow: 2px 2px 0 var(--edge); }
.say-ask:active { transform: translate(2px, 2px); box-shadow: none; }
.tag { display: inline-block; font-size: 14px; font-weight: 600; color: var(--ai-ink); background: var(--ai-soft); border: 1.5px solid var(--edge); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; vertical-align: middle; }
.tag.new { background: var(--kin-soft); color: var(--kin-ink); } .tag.bad { background: var(--shu-soft); color: var(--shu-ink); } .tag.old { background: var(--matcha-soft); color: var(--matcha-ink); }
.tile-card { border-radius: 22px; background: var(--card); border: 2px solid var(--edge); box-shadow: 5px 5px 0 var(--edge); }
.intro { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 20px; animation: popIn2 .3s ease-out both; }
@keyframes popIn2 { from { transform: translateY(8px) rotate(1deg); opacity: 0; } }
.intro .pic, .qcard .pic { font-size: clamp(72px, 20vw, 110px); animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.intro .w, .qcard .w { font-weight: 700; font-size: clamp(44px, 12vw, 76px); line-height: 1.15; }
.intro .w.sm { font-size: clamp(32px, 8vw, 48px); }
.intro .snd { font-size: 24px; } .intro .mn, .qcard .mn { font-size: 26px; font-weight: 600; }
.qcard { padding: 20px; text-align: center; margin-bottom: 18px; display: grid; gap: 10px; justify-items: center; }
.qchoices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qchoice { font: 600 22px/1.25 var(--ui); text-align: center; color: var(--text); background: var(--card); border: 2px solid var(--edge); border-radius: 18px; padding: 14px 40px; min-height: 72px; cursor: pointer; position: relative; box-shadow: 3px 3px 0 var(--edge); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.qchoices.pics .qchoice { min-height: 120px; } .qchoice .pic { font-size: 44px; }
.qchoice:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge); background: var(--paper); }
.qchoice:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); }
.qchoice .num { position: absolute; right: 10px; top: 10px; width: 24px; height: 24px; display: grid; place-items: center; font: 700 12px var(--ui); border: 2px solid var(--edge); border-radius: 50%; background: var(--paper); }
.qchoice.right { background: var(--matcha-soft); color: var(--matcha-ink); animation: pop .3s; } .qchoice.right .num { background: var(--matcha); color: #fff; }
.qchoice.right::after { content: "💖"; position: absolute; left: 10px; top: 8px; font-size: 24px; }
.qchoice.wrong { background: var(--bad-soft); color: var(--bad-ink); animation: shake .35s; } .qchoice.wrong .num { background: var(--bad); color: #fff; }
.qchoice.wrong::after { content: "✕"; position: absolute; left: 14px; top: 10px; font-size: 20px; font-weight: 700; }
.qchoice.dim { opacity: .45; box-shadow: none; } .qchoice:disabled { cursor: default; }
@keyframes shake { 20%, 60% { translate: -6px 0; } 40%, 80% { translate: 6px 0; } }
@keyframes pop { 50% { transform: scale(1.06); } }

/* spelling: letter slots and tiles (left-to-right, like the word) */
.spell { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 22px; padding: 14px; border-radius: 20px; }
.spell.right { background: var(--matcha-soft); } .spell.wrong { background: var(--bad-soft); animation: shake .35s; }
.slot { width: 50px; height: 60px; border: 0; border-bottom: 4px solid var(--faint); background: transparent; color: var(--text); font: 700 36px var(--ui); cursor: pointer; border-radius: 6px 6px 0 0; padding: 0; }
.slot.cur { border-bottom-color: var(--ai); animation: blink 1s steps(2) infinite; } .slot.full { border-bottom-color: var(--edge); background: var(--card); }
@keyframes blink { 50% { border-bottom-color: transparent; } }
.spell .gap { width: 22px; } .spell .fixed { font: 700 36px var(--ui); align-self: end; padding-bottom: 6px; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ltile { width: 58px; height: 58px; border: 2px solid var(--edge); border-radius: 14px; background: var(--ai-soft); color: var(--text); font: 700 30px var(--ui); cursor: pointer; box-shadow: 3px 3px 0 var(--edge); transition: transform .08s; }
.ltile:nth-child(3n+1) { background: var(--kin-soft); } .ltile:nth-child(3n+2) { background: var(--shu-soft); }
.ltile:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.ltile:disabled { opacity: .2; box-shadow: none; cursor: default; }

.footbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-top: 2px solid var(--edge); background: var(--card); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.footbar .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.footbar.ok { background: var(--matcha-soft); animation: slideUp .22s ease-out; } .footbar.no { background: var(--shu-soft); animation: slideUp .22s ease-out; }
@keyframes slideUp { from { transform: translateY(100%); } }
.verdict { flex: 1; min-width: 200px; } .verdict h3 { margin: 0 0 2px; font-size: 25px; font-weight: 700; }
.footbar.ok h3, .footbar.ok .vd { color: var(--matcha-ink); } .footbar.no h3, .footbar.no .vd { color: var(--shu-ink); }
.vd { font-size: 18px; }

.done { text-align: center; padding: 30px 0 60px; max-width: 640px; margin: 0 auto; }
.stars.big { font-size: 64px; } .stars.big span { display: inline-block; animation: starIn .5s cubic-bezier(.3,1.6,.5,1) both; }
.stars.big span:nth-child(2) { animation-delay: .15s; } .stars.big span:nth-child(3) { animation-delay: .3s; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.done h1 { font-size: 32px; font-weight: 700; margin: 14px 0 26px; }
.tiles-wrap, .done .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.tile { border: 2px solid var(--edge); border-radius: 18px; background: var(--card); overflow: hidden; box-shadow: 4px 4px 0 var(--edge); }
.tile .h { color: var(--edge); background: var(--c); font-size: 15px; font-weight: 600; padding: 5px 4px; border-bottom: 2px solid var(--edge); }
.tile .v { padding: 14px 4px; font-size: 26px; font-weight: 700; direction: ltr; }
.tile.y { --c: var(--kin); } .tile.g { --c: #ffa8d2; } .tile.b { --c: #c9b0ff; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -40px; font-size: 26px; font-style: normal; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

@media (max-width: 560px) { .done .tiles { grid-template-columns: 1fr; } .slot { width: 40px; height: 52px; font-size: 30px; } .ltile { width: 50px; height: 50px; font-size: 26px; } }
@media (prefers-reduced-motion: reduce) { .intro .pic, .qcard .pic, .pnode.next .pn-ring, .pn-go { animation: none; } .confetti { display: none; } }
