/* Python by ear. Started from the café lesson's stylesheet (cafe/site/hq/hq.css); the Python parts are at the end. */
:root {
  --cream: #FFF6E6; --paper: #FFFBF3; --ink: #3A2A22; --ink-2: #7B6456; --line: #EAD7BD;
  --clay: #D9623B; --clay-d: #B94C2A; --green: #2F5D50; --green-l: #3F7A68; --sage: #86A97F; --butter: #F6C453; --blush: #F2A7A0;
  --head: "Fredoka", "Nunito", system-ui, sans-serif; --body: "Nunito", system-ui, sans-serif;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* The page never scrolls or drags: the app fills the screen exactly, and only the sheet scrolls if it must. */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; background: var(--cream); }
@media (min-width: 520px) { html { background: #E9CFA9; } }
body { margin: 0; height: 100%; overflow: hidden; position: fixed; inset: 0; color: var(--ink); font: 600 17px/1.45 var(--body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #6F8FD8; outline-offset: 3px; }

#app { position: relative; max-width: 480px; height: 100%; margin: 0 auto; background: var(--cream); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 60px rgba(90, 50, 20, .18); }

/* ---------- the scene */
#scene { position: relative; height: clamp(290px, 50dvh, 470px); flex: none; overflow: hidden; background: #F8C39B; border-radius: 0 0 30px 30px; }
#scene .scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: transform .95s cubic-bezier(.6, 0, .8, .3), opacity .5s ease .5s; }
#app.counter #scene { height: clamp(250px, 41dvh, 380px); }
#scene { transition: height .7s cubic-bezier(.2, .8, .2, 1); }
#scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 -14px 24px -14px rgba(60, 30, 10, .28); }

.cloud.c1 { animation: drift 46s linear infinite; }
.cloud.c2 { animation: drift 64s linear infinite reverse; }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(120px); } }
.pulse { animation: pulse 3.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 4.2s ease-in-out infinite; }
.sway[data-d="1"], .sway[data-d="4"] { animation-delay: -1.3s; } .sway[data-d="2"], .sway[data-d="5"] { animation-delay: -2.4s; } .sway[data-d="3"], .sway[data-d="6"] { animation-delay: -3.1s; }
@keyframes sway { 0%, 100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }
.awning { transform-box: fill-box; transform-origin: 50% 0; animation: flap 5s ease-in-out infinite; }
@keyframes flap { 0%, 100% { transform: skewX(0) scaleY(1); } 50% { transform: skewX(-.7deg) scaleY(1.025); } }
.opensign { transform-box: fill-box; transform-origin: 50% 0; animation: swing 3.4s ease-in-out infinite; }
@keyframes swing { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.signboard { transform-box: fill-box; transform-origin: 50% 50%; }
.signboard.flip { animation: flip .55s ease; }
@keyframes flip { 0% { transform: scaleY(1); } 45% { transform: scaleY(0); } 55% { transform: scaleY(0); } 100% { transform: scaleY(1); } }
.door { transform-box: fill-box; transform-origin: 0 50%; transition: transform .6s cubic-bezier(.5, 0, .3, 1); }
.street.open .door { transform: perspective(300px) scaleX(.16); }
.street.enter { transform: scale(4.6); transform-origin: 68.6% 66%; opacity: 0; }

/* ---------- Mo and what Mo says */
#coach { position: relative; z-index: 3; display: flex; align-items: flex-end; gap: 6px; margin: -62px 14px 0; min-height: 104px; }
#mo { flex: none; width: 92px; filter: drop-shadow(0 6px 8px rgba(70, 40, 20, .18)); }
#mo .mo { display: block; width: 100%; height: auto; overflow: visible; }
.mo-all { transform-box: fill-box; transform-origin: 50% 100%; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-3px) scaleY(1.015); } }
.mo-shadow { transform-box: fill-box; transform-origin: 50% 50%; animation: shadow 2.6s ease-in-out infinite; }
@keyframes shadow { 50% { transform: scaleX(.9); opacity: .09; } }
.mo-arm-l { transform-box: view-box; transform-origin: 24px 72px; animation: wave 1.1s ease-in-out 4 alternate; }
@keyframes wave { from { transform: rotate(-10deg); } to { transform: rotate(22deg); } }
.mo-eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 4.6s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.mo-bubs circle { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; animation: bub 3.4s ease-out infinite; }
.mo-bubs .b2 { animation-delay: -1.2s; } .mo-bubs .b3 { animation-delay: -2.3s; }
@keyframes bub { 0% { transform: translateY(8px) scale(.5); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-22px) scale(1.25); opacity: 0; } }
@keyframes steam { 0% { stroke-dashoffset: 46; opacity: 0; transform: translateY(4px); } 35% { opacity: .9; } 100% { stroke-dashoffset: -46; opacity: 0; transform: translateY(-8px); } }
#mo.hop .mo-all { animation: hop .5s var(--pop); }
@keyframes hop { 0% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-16px) scale(.96, 1.06); } 70% { transform: translateY(0) scale(1.06, .94); } 100% { transform: translateY(0) scale(1, 1); } }

#bubble { position: relative; flex: 1; margin-bottom: 26px; background: var(--paper); border: 2.5px solid var(--line); border-radius: 20px 20px 20px 6px; padding: 12px 16px; font-size: 16.5px; line-height: 1.4; box-shadow: 0 6px 0 rgba(120, 80, 40, .1); transform-origin: 0 100%; }
#bubble.in { animation: say .42s var(--pop); }
@keyframes say { from { transform: scale(.6); opacity: 0; } }
#bubble p { margin: 0 0 6px; } #bubble p:last-child { margin: 0; }
#bubble b { font-weight: 800; color: var(--clay-d); }

/* ---------- the sheet */
#sheet { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; display: flex; flex-direction: column; gap: 12px; padding: 2px 16px calc(16px + env(safe-area-inset-bottom)); }
#sheet::-webkit-scrollbar { display: none; }
.ask { margin: 0; font: 600 21px/1.2 var(--head); text-align: center; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lang { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px 12px; background: var(--paper); border: 2.5px solid var(--line); border-bottom-width: 6px; border-radius: 22px; transition: transform .08s ease, border-color .2s ease, background .2s ease; animation: rise .5s var(--pop) backwards; }
.lang:nth-child(2) { animation-delay: .06s; } .lang:nth-child(3) { animation-delay: .12s; } .lang:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { transform: translateY(18px) scale(.94); opacity: 0; } }
.lang svg { width: 54px; height: 54px; }
.lang b { font: 600 21px/1.1 var(--head); }
.lang span { font-size: 13.5px; color: var(--ink-2); font-weight: 700; }
.lang:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 3px; }
.lang.picked { border-color: var(--clay); background: #FFEFE2; }
.lang:disabled { opacity: .55; flex-direction: row; justify-content: center; gap: 8px; padding: 7px 8px 6px; border-bottom-width: 4px; border-radius: 16px; }
.lang:disabled svg { width: 30px; height: 30px; }
.lang:disabled b { font-size: 16px; }
.lang:disabled span { display: none; }
.lang:disabled::after { content: "soon"; position: static; font: 800 10.5px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--paper); background: var(--ink-2); border-radius: 999px; padding: 2px 8px; }
.fine { margin: auto 0 0; text-align: center; font-size: 13px; color: #A58E7B; }

/* ---------- inside: the counter */
.inside { opacity: 0; transform: scale(1.12); }
.inside.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.puffs circle { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; animation: puff 3.2s ease-out infinite; }
.puffs .p2 { animation-delay: -1.1s; } .puffs .p3 { animation-delay: -2.1s; }
@keyframes puff { 0% { transform: translate(0, 0) scale(.5); opacity: 0; } 20% { opacity: .85; } 100% { transform: translate(10px, -34px) scale(2.2); opacity: 0; } }
.cupsteam path { stroke-dasharray: 60; animation: steam 3.2s ease-in-out infinite; }
.cupsteam .s2 { animation-delay: -1.1s; } .cupsteam .s3 { animation-delay: -2.2s; }
.b-head { transform-box: fill-box; transform-origin: 50% 100%; animation: nod 5.2s ease-in-out infinite; }
@keyframes nod { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.8deg); } }
.b-eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 5.3s infinite; }
.b-pupils { transition: transform .35s ease; }
.barista.look .b-pupils { transform: translate(-5px, 3.5px); }
.b-mouth { transition: d .3s ease; }
.barista.look .b-mouth { d: path("M289 208 q13 14 26 0"); }

.liquid, .surface { transition: fill .9s ease; }
.liquid { fill: #4A2A1A; } .surface { fill: #6B4028; }
.inside.milk .liquid { fill: #B98562; } .inside.milk .surface { fill: #D2A27E; }
.inside.tea .liquid { fill: #C2772A; } .inside.tea .surface { fill: #DB9A4B; }
.inside.tea.milk .liquid { fill: #DCB487; } .inside.tea.milk .surface { fill: #EBCFA9; }
.fill { transform-box: fill-box; transform-origin: 50% 100%; }
.swirl { opacity: 0; }
.teatag { opacity: 0; transform: translateY(-14px); transition: opacity .3s ease, transform .5s var(--pop); }
.inside.tea .teatag { opacity: 1; transform: none; }
.cube-in { opacity: 0; transition: opacity .4s ease .2s; }
.inside.sugar .cube-in { opacity: .6; }
.cube { transform-box: fill-box; transform-origin: 50% 50%; transition: opacity .2s ease, transform .4s var(--pop); }
.inside.sugar .cube { opacity: 0; transform: scale(.3); }
.drops circle { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.jug { opacity: 0; }
.jug-body { transform-box: view-box; transform-origin: 150px 120px; }
.stream { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); }

/* ---------- screen 2's sheet */
.opts { display: grid; gap: 9px; }
.opt { display: grid; grid-template-columns: 62px 1fr 1fr; gap: 9px; align-items: center; animation: rise .5s var(--pop) backwards; }
.opt:nth-child(2) { animation-delay: .07s; } .opt:nth-child(3) { animation-delay: .14s; }
.opt > span { font: 800 12.5px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.pick { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 10px; background: var(--paper); border: 2.5px solid var(--line); border-bottom-width: 5px; border-radius: 17px; font: 600 17px/1.1 var(--head); transition: transform .08s ease, background .2s ease, border-color .2s ease; }
.pick svg { width: 26px; height: 26px; flex: none; }
.pick:active { transform: translateY(2px); border-bottom-width: 3px; }
.pick[aria-pressed="true"] { background: #FFEBD9; border-color: var(--clay); }
.pick[aria-pressed="true"] svg { animation: tick .45s var(--pop); }
@keyframes tick { 0% { transform: scale(.6) rotate(-12deg); } 100% { transform: none; } }

.ticket { position: relative; margin-top: 4px; background: #fff; border-radius: 4px 4px 14px 14px; padding: 15px 18px 14px; text-align: center; box-shadow: 0 5px 0 rgba(120, 80, 40, .12), 0 0 0 2px var(--line); animation: rise .5s var(--pop) .2s backwards; }
.ticket::before { content: ""; position: absolute; left: 0; right: 0; top: -7px; height: 8px; background: linear-gradient(135deg, #fff 33.3%, transparent 0) 0 0 / 14px 8px, linear-gradient(225deg, #fff 33.3%, transparent 0) 0 0 / 14px 8px; }
.ticket small { display: block; font: 800 11.5px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 3px; }
.ticket p { margin: 0; font: 600 19px/1.3 var(--head); color: var(--ink); }
.ticket p.swap { animation: swap .35s ease; }
@keyframes swap { 0% { opacity: .2; transform: translateY(4px); } }
.ticket .stamp { position: absolute; right: 10px; top: 6px; font: 700 13px var(--head); letter-spacing: .08em; color: var(--green-l); border: 2.5px solid var(--green-l); border-radius: 8px; padding: 1px 7px; transform: rotate(9deg) scale(0); opacity: 0; }
.ticket.done .stamp { animation: stamp .4s var(--pop) forwards; }
@keyframes stamp { from { transform: rotate(-20deg) scale(2.2); opacity: 0; } to { transform: rotate(9deg) scale(1); opacity: 1; } }

.go { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 4; margin-top: auto; min-height: 60px; box-shadow: 0 -10px 18px 6px var(--cream); border: 0; border-bottom: 6px solid var(--clay-d); border-radius: 20px; background: var(--clay); color: #fff; font: 600 20px var(--head); letter-spacing: .01em; transition: transform .08s ease, border-bottom-width .08s ease, filter .2s ease; animation: rise .5s var(--pop) .3s backwards; }
.go:active { transform: translateY(4px); border-bottom-width: 2px; }
.go:disabled { filter: saturate(.6) brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .cloud, .sway, .awning, .opensign, .mo-all, .mo-shadow, .mo-arm-l, .b-head, .pulse { animation: none; }
}
@media (max-height: 700px) { #bubble { font-size: 15.5px; padding: 10px 14px; } .pick { min-height: 46px; } .ticket p { font-size: 17.5px; } .go { min-height: 54px; } }

/* ---------- the café's bubbles: soft glows that drift up */
.floaters circle { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; animation: floatup 11s ease-in-out infinite; }
.floaters .f2 { animation-delay: -3.4s; animation-duration: 13s; } .floaters .f3 { animation-delay: -6.1s; } .floaters .f4 { animation-delay: -8.3s; animation-duration: 14s; } .floaters .f5 { animation-delay: -1.7s; animation-duration: 12s; }
@keyframes floatup { 0% { transform: translate(0, 0) scale(.7); opacity: 0; } 15% { opacity: .9; } 50% { transform: translate(10px, -150px) scale(1); } 85% { opacity: .7; } 100% { transform: translate(-6px, -300px) scale(1.15); opacity: 0; } }
.inside .floaters circle { animation-name: floatin; }
@keyframes floatin { 0% { transform: translate(0, 30px) scale(.8); opacity: 0; } 20% { opacity: .75; } 100% { transform: translate(8px, -120px) scale(1.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .floaters circle, .mo-bubs circle { animation: none; } }

/* ================================================================ the lesson's steps */
#app.lesson #scene { height: clamp(150px, 24dvh, 220px); }
#app.lesson.ordering #scene { height: clamp(230px, 36dvh, 330px); }
#app.lesson.finished #scene { height: clamp(150px, 22dvh, 200px); }
#app.lesson #coach { margin-top: -44px; min-height: 0; }
#app.lesson #mo { width: 66px; }
#app.lesson #bubble { font-size: 15.5px; line-height: 1.36; padding: 10px 14px; margin-bottom: 16px; }
.order { transition: opacity .45s ease, transform .5s ease; }
.inside.pending .order { opacity: 0; transform: translateY(12px); }

.topbar { position: absolute; z-index: 6; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.back { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255, 251, 243, .92); color: var(--ink); display: grid; place-items: center; box-shadow: 0 3px 0 rgba(60, 30, 10, .18); }
.back svg { width: 22px; height: 22px; }
.back:disabled { opacity: 0; }
.track { flex: 1; height: 14px; border-radius: 14px; background: rgba(255, 251, 243, .8); box-shadow: inset 0 2px 3px rgba(60, 30, 10, .18); overflow: hidden; }
.track i { display: block; height: 100%; width: 0; border-radius: 14px; background: linear-gradient(180deg, #8FD08F, #5FAE6D); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); transition: width .45s var(--pop); }

#app.lesson #sheet { gap: 10px; padding-top: 0; }
.body { flex: 1 0 auto; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
#app.lesson #bubble.long { font-size: 14.2px; line-height: 1.33; padding: 9px 12px; }
#app.lesson #bubble.long p { margin-bottom: 4px; }
.body > * { animation: stepin .38s var(--pop) backwards; }
.body > *:nth-child(2) { animation-delay: .05s; } .body > *:nth-child(3) { animation-delay: .1s; } .body > *:nth-child(4) { animation-delay: .15s; }
@keyframes stepin { from { transform: translateY(14px); opacity: 0; } }
.foot { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 10px; padding-top: 6px; background: linear-gradient(to top, var(--cream) 70%, rgba(255, 246, 230, 0)); }
.body.t-done ~ .foot { flex-direction: column; }

.b { flex: 1; min-height: 58px; padding: 10px 16px; border: 0; border-bottom: 6px solid; border-radius: 19px; font: 600 19px/1.15 var(--head); display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; transition: transform .08s ease, border-bottom-width .08s ease; }
.b:active { transform: translateY(4px); border-bottom-width: 2px; }
.b.main { flex: 2; background: var(--clay); border-color: var(--clay-d); color: #fff; }
.b.good { flex: 2; background: #5FAE6D; border-color: #3E8A50; color: #fff; }
.b.soft { background: var(--paper); border: 2.5px solid var(--line); border-bottom-width: 6px; color: var(--ink-2); }
.b.soft:active { border-bottom-width: 3px; }

.hear { flex: none; width: 46px; height: 46px; border: 0; border-bottom: 4px solid #5876C4; border-radius: 50%; background: #6F8FD8; color: #fff; display: grid; place-items: center; }
.hear svg { width: 24px; height: 24px; }
.hear:active { transform: translateY(2px); border-bottom-width: 2px; }
.hear.ping { animation: ping .4s var(--pop); }
@keyframes ping { 0% { transform: scale(.82); } }

/* a concept bubble, as the screen draws it */
.orb { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 190px; min-height: 132px; padding: 26px 34px; }
.orb .o1, .orb .o2 { position: absolute; border-radius: 50%; pointer-events: none; }
.orb .o1 { inset: -10px -4px; background: radial-gradient(closest-side, rgba(255, 215, 114, .85), rgba(255, 215, 114, .32) 58%, rgba(255, 215, 114, 0)); animation: breathe 3s ease-in-out infinite; }
.orb .o2 { inset: 18% 14%; background: radial-gradient(closest-side, rgba(255, 253, 240, .95), rgba(255, 253, 240, 0)); animation: breathe 3s ease-in-out -1.5s infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.95); opacity: .82; } 50% { transform: scale(1.06); opacity: 1; } }
.orb b { position: relative; font: 600 38px/1.1 var(--head); color: var(--ink); text-align: center; }
.orb span { position: relative; font: 700 15px var(--body); color: var(--ink-2); text-align: center; }
.orb b em { font-style: normal; color: #fff; background: var(--clay); border-radius: 9px; padding: 0 5px; margin: 0 1px; box-shadow: 0 0 0 3px rgba(217, 98, 59, .25), 0 0 18px 4px rgba(255, 200, 90, .9); }
.orb.changed .o1 { animation: change .45s ease; }
.orb.changed b { animation: wordpop .45s var(--pop); }
@keyframes change { 0% { transform: scale(1); filter: none; } 45% { transform: scale(1.3); filter: brightness(1.25) saturate(1.3); } 100% { transform: scale(1); } }
@keyframes wordpop { 40% { transform: scale(1.12); } }
.orb.sm { min-width: 92px; min-height: 84px; padding: 14px 12px; }
.orb.sm b { font-size: 25px; }
.orb.sm span { font-size: 12.5px; max-width: 116px; line-height: 1.2; }

.stage { display: flex; align-items: center; justify-content: center; gap: 4px; }
.how { margin: 0; text-align: center; font-size: 16px; color: var(--ink-2); }
.how b { color: var(--ink); font-weight: 800; }
.note { margin: 0; text-align: center; font-size: 14.5px; color: var(--ink-2); font-style: italic; }
.saythis { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; background: #fff; border-radius: 18px; padding: 11px 16px 13px; box-shadow: 0 0 0 2.5px var(--line), 0 5px 0 rgba(120, 80, 40, .1); }
.saythis small { font: 800 11.5px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--clay-d); }
.saythis b { font: 600 20px/1.3 var(--head); }

/* flashcard */
.flash { perspective: 900px; }
.flip { position: relative; min-height: 220px; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); }
.flash.turned .flip { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; background: #fff; border-radius: 26px; box-shadow: 0 0 0 2.5px var(--line), 0 7px 0 rgba(120, 80, 40, .12); text-align: center; }
.face small, .askcard small { font: 800 11.5px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.face b { font: 600 40px/1.1 var(--head); }
.backface { transform: rotateY(180deg); background: #FFF3E6; }
.backface b { color: var(--clay-d); }
.backface p { margin: 0; font-size: 15px; color: var(--ink-2); }

/* a question to answer out loud */
.askcard { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 20px 18px; background: #fff; border-radius: 26px; box-shadow: 0 0 0 2.5px var(--line), 0 7px 0 rgba(120, 80, 40, .12); text-align: center; min-height: 190px; justify-content: center; }
.askcard .en { font: 600 27px/1.2 var(--head); }
.askcard .hint { margin: 0; font-size: 15px; color: var(--ink-2); }
.answer { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; padding-top: 12px; border-top: 2.5px dashed var(--line); width: 100%; animation: reveal .4s var(--pop); }
.answer b { font: 600 27px/1.2 var(--head); color: var(--clay-d); }
@keyframes reveal { from { transform: scale(.85); opacity: 0; } }
.bossround .askcard { background: var(--green); box-shadow: 0 0 0 2.5px #24493F, 0 7px 0 #1C3A32; color: var(--cream); }
.bossround .askcard small, .bossround .askcard .hint { color: #BFD8CE; }
.bossround .answer { border-top-color: #4C7A6C; }
.bossround .answer b { color: var(--butter); }
.bosschip { font: 700 13px var(--head); letter-spacing: .06em; color: var(--green); background: var(--butter); border-radius: 999px; padding: 3px 12px; margin-bottom: 4px; }

/* the four ways */
.ways { display: grid; gap: 7px; }
.way { display: flex; gap: 11px; align-items: center; background: #fff; border-radius: 17px; padding: 8px 12px; box-shadow: 0 0 0 2.5px var(--line); animation: stepin .4s var(--pop) backwards; }
.way svg { flex: none; width: 36px; height: 36px; }
.way b { display: block; font: 600 16.5px/1.2 var(--head); }
.way span { display: block; font-size: 14px; line-height: 1.3; color: var(--ink-2); }
.way.four { background: #FFF7E0; box-shadow: 0 0 0 2.5px var(--butter); }
.q { margin: 2px 0 0; text-align: center; font: 600 19px/1.25 var(--head); }

/* the study */
.study { display: grid; grid-template-columns: repeat(10, 1fr); gap: 9px; max-width: 330px; width: 100%; margin: 4px auto 0; }
.study i { aspect-ratio: 1; border-radius: 50%; background: var(--line); }
.study i.on { background: radial-gradient(circle at 35% 30%, #FFF6CF, var(--butter) 62%); box-shadow: 0 0 10px 2px rgba(246, 196, 83, .6); animation: lit .5s var(--pop) backwards; }
@keyframes lit { from { transform: scale(.3); background: var(--line); box-shadow: none; } }
.caption { margin: 0; text-align: center; font: 500 17px var(--head); color: var(--ink-2); }
.caption b { color: var(--ink); font-weight: 600; font-size: 22px; }

/* bubbles in a row */
.chain { display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap; gap: 0 2px; padding-top: 4px; }
.chain > * { animation: light .7s ease backwards; }
@keyframes light { from { opacity: .18; transform: scale(.9); } }
.chain.linked { flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 2px; }
.linkline b { display: block; font: 600 17.5px/1.3 var(--head); background: #fff; border: 2.5px dashed var(--butter); border-radius: 14px; padding: 6px 14px; }
.tip { margin: 0; text-align: center; font-size: 14.5px; line-height: 1.35; color: #6B5330; background: #FFF4D6; border-radius: 14px; padding: 8px 12px; box-shadow: 0 0 0 2px var(--butter); }
.phrase { display: flex; align-items: center; justify-content: center; gap: 12px; }
.phrase > div { text-align: center; }
.phrase b { display: block; font: 600 24px/1.2 var(--head); color: var(--clay-d); }
.phrase span { font-size: 14.5px; color: var(--ink-2); }

/* what the barista says */
.bsay { position: absolute; z-index: 3; left: 12px; top: calc(58px + env(safe-area-inset-top)); max-width: 62%; background: #fff; border-radius: 18px 18px 18px 6px; padding: 9px 13px; box-shadow: 0 4px 0 rgba(60, 30, 10, .16); animation: say .4s var(--pop); transform-origin: 100% 100%; }
.bsay b { display: block; font: 600 18px/1.25 var(--head); }
.bsay span { font-size: 13.5px; color: var(--ink-2); }

/* lists of moves, and the end */
.moves { margin: 0; padding: 0 0 0 4px; list-style: none; counter-reset: m; display: grid; gap: 8px; }
.moves li { counter-increment: m; position: relative; padding-left: 38px; font-size: 15.5px; line-height: 1.35; }
.moves li::before { content: counter(m); position: absolute; left: 0; top: -1px; width: 27px; height: 27px; border-radius: 50%; background: var(--butter); font: 700 15px/27px var(--head); text-align: center; }
.moves b { font-weight: 800; }
.body.t-done { justify-content: flex-start; }
.body.t-done h2 { margin: 0; font: 600 22px/1.2 var(--head); text-align: center; }
.party { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.party i { position: absolute; bottom: -30px; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, #FFFDF0, rgba(255, 215, 114, .8) 55%, rgba(255, 215, 114, 0)); animation: floatparty 5s ease-in infinite; }
@keyframes floatparty { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-80vh) scale(1.5); opacity: 0; } }
@media (max-height: 700px) { .orb { min-height: 104px; padding: 18px 26px; } .orb b { font-size: 32px; } .flip { min-height: 170px; } .askcard { min-height: 150px; padding: 14px; } .b { min-height: 50px; font-size: 17.5px; } .way { padding: 6px 10px; } .way span { font-size: 13px; } }

/* ---------- the comparison lesson (no concept bubbles): words as plain text on a card */
.wordtile { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 190px; min-height: 112px; padding: 18px 26px; background: #fff; border-radius: 22px; box-shadow: 0 0 0 2.5px var(--line), 0 6px 0 rgba(120, 80, 40, .1); }
.wordtile b { font: 600 34px/1.15 var(--head); color: var(--ink); text-align: center; }
.wordtile span { font: 700 15px var(--body); color: var(--ink-2); text-align: center; }
.wordtile b em { font-style: normal; color: var(--clay-d); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.body.t-rule .wordtile b { font-size: 27px; }

/* the end of each lesson: the pitch, and the two boss rounds side by side */
.pitch { position: relative; z-index: 2; display: grid; gap: 7px; padding: 15px 17px 16px; background: #FFF4D6; border-radius: 22px; box-shadow: 0 0 0 2.5px var(--butter), 0 6px 0 rgba(120, 80, 40, .1); text-align: center; }
.pitch p { margin: 0; font-size: 16px; line-height: 1.4; }
.pitch p b { font-weight: 800; }
.pitch .sofar { font-size: 14.5px; color: var(--ink-2); }
.links { margin: 0; text-align: center; font-size: 14.5px; color: var(--ink-2); }
.textlink { background: none; border: 0; padding: 0; font: inherit; color: var(--clay-d); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score { display: grid; justify-items: center; gap: 0; padding: 14px 10px 13px; background: #fff; border-radius: 22px; box-shadow: 0 0 0 2.5px var(--line), 0 6px 0 rgba(120, 80, 40, .1); text-align: center; }
.score b { font: 600 54px/1 var(--head); color: var(--ink); }
.score i { font: 700 14px var(--body); font-style: normal; color: var(--ink-2); }
.score span { margin-top: 7px; font: 700 14.5px/1.2 var(--head); color: var(--ink-2); }
.score.with { background: #FFF4D6; box-shadow: 0 0 0 2.5px var(--butter), 0 0 26px 2px rgba(255, 215, 114, .55), 0 6px 0 rgba(120, 80, 40, .1); }
.plainp { margin: 0; text-align: center; font-size: 16px; line-height: 1.4; }


/* ================================================================ Python by ear */
:root { --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; --code-bg: #1D2633; }
.mono { font-family: var(--mono) !important; font-weight: 700; letter-spacing: -.01em; }

/* the study scene */
#app.home #scene { height: clamp(210px, 33dvh, 310px); }
#app.home.welcome #scene { height: clamp(200px, 30dvh, 290px); }
.study .twinkle { animation: twinkle 3.2s ease-in-out infinite; }
.study .twinkle[data-d="1"] { animation-delay: -.8s; } .study .twinkle[data-d="2"] { animation-delay: -1.7s; } .study .twinkle[data-d="3"] { animation-delay: -2.4s; }
@keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.scr-line { font: 700 8.6px var(--mono); fill: #E8EEF5; white-space: pre; }
.scr-title { font: 600 7px var(--body); fill: #8796AA; }
.caret { animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
#mo .mo-arm-l { animation: none; }
#mo .mo-arm-l.wave { animation: wave 1.1s ease-in-out 4 alternate; }

/* top bar: a label under the track, and a home button */
.topbar { flex-wrap: wrap; row-gap: 3px; }
.barlabel { flex-basis: 100%; order: 3; text-align: center; font: 700 12px var(--body); letter-spacing: .04em; color: #fff; text-shadow: 0 1px 2px rgba(40, 20, 10, .55); }
.barlabel:empty { display: none; }

/* code */
.code { margin: 0; padding: 12px 14px; background: var(--code-bg); color: #E8EEF5; border-radius: 16px; font: 600 15.5px/1.55 var(--mono); text-align: left; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: 100%; }
.code::-webkit-scrollbar { display: none; }
.code .ln { display: block; white-space: pre; border-radius: 6px; padding: 0 4px; margin: 0 -4px; transition: background .2s ease; }
.code .ln.on { background: rgba(246, 196, 83, .22); box-shadow: inset 3px 0 0 var(--butter); }
pre.code .ln { color: #E8EEF5; font-size: inherit; font-weight: inherit; }
pre.code .t-kw { color: #F28B6C; } pre.code .t-fn { color: #7FC8F8; } pre.code .t-str { color: #A6DE8E; } pre.code .t-num { color: #F6C453; } pre.code .t-com { color: #8796AA; font-style: italic; }
pre.code span { font-size: inherit; }

/* the bubble of an idea (English), and of code */
.orb.idea b { font: 600 24px/1.25 var(--head); max-width: 300px; }
.orb.idea.card { min-height: 150px; padding: 30px 26px; width: 100%; }
.orb.idea.card b { font-size: 23px; }
.orb.idea.sm b { font-size: 16.5px; max-width: 170px; line-height: 1.2; }
.orb b.mono { font-size: 34px; }
.orb.sm b.mono { font-size: 21px; }
.orb.xs { min-width: 0; min-height: 0; padding: 12px 14px; }
.orb.xs b { font-size: 15px !important; }
.orb.xs span { font-size: 11.5px; }
.orb b.mono em { font-style: normal; }
.stage.codeline { flex-direction: row; align-items: center; gap: 8px; }
.codebubble { position: relative; flex: 1; min-width: 0; }
.codebubble .o1 { position: absolute; inset: -14px -10px; border-radius: 28px; background: radial-gradient(closest-side, rgba(255, 215, 114, .55), rgba(255, 215, 114, 0)); animation: breathe 3s ease-in-out infinite; pointer-events: none; }
.codebubble .code { position: relative; animation: reveal .4s var(--pop); }
.codebubble.changed .o1 { animation: change .45s ease; }
.cardnum { text-align: center; font: 600 14px var(--head); color: var(--ink-2); }
.cardnum b { color: var(--clay-d); font-weight: 600; }
.cardnote { margin: 0; text-align: center; font-size: 14.5px; line-height: 1.35; color: #6B5330; background: #FFF4D6; border-radius: 14px; padding: 8px 12px; box-shadow: 0 0 0 2px var(--butter); }
.body.t-deck { justify-content: flex-start; padding-top: 4px; }
.body.t-deck .saythis b { font-size: 17px; }

/* flashcards and answers with code */
.face b.mono { font-size: 40px; color: var(--clay-d); }
.askcard .en { font-size: 22px; line-height: 1.3; }
.answer { flex-wrap: nowrap; }
.answer .code { flex: 1; min-width: 0; font-size: 14.5px; }
.bossround .askcard .code, .pzcard .code { box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }
.phrase { width: 100%; }
.phrase .code { flex: 1; min-width: 0; font-size: 14.5px; }
.chain .orb.idea.sm { min-width: 160px; }

/* how each card works */
.methodcard { display: grid; gap: 12px; padding: 14px 16px 16px; background: #fff; border-radius: 22px; box-shadow: 0 0 0 2.5px var(--line), 0 6px 0 rgba(120, 80, 40, .1); }
.mini { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 4px; }
.mini .arrow { font: 600 14px var(--head); color: var(--ink-2); border: 2px dashed var(--butter); border-radius: 12px; padding: 3px 9px; }
.body.t-method, .body.t-info { justify-content: center; }

/* puzzles */
.body.t-puzzle { justify-content: flex-start; padding-top: 4px; }
.pzcard { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 16px 16px 18px; background: var(--green); color: var(--cream); border-radius: 26px; box-shadow: 0 0 0 2.5px #24493F, 0 7px 0 #1C3A32; }
.pzcard .bosschip { align-self: center; }
.given { margin: 0; text-align: center; font-size: 14.5px; color: #BFD8CE; }
.given b { color: var(--butter); font-size: 14px; }
.parts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: pt; }
.part { counter-increment: pt; position: relative; padding: 9px 12px 9px 40px; background: rgba(255, 255, 255, .08); border-radius: 14px; font: 600 17px/1.35 var(--head); cursor: pointer; animation: stepin .38s var(--pop) backwards; }
.part::before { content: counter(pt); position: absolute; left: 10px; top: 9px; width: 22px; height: 22px; border-radius: 50%; background: var(--butter); color: var(--green); font: 700 13px/22px var(--head); text-align: center; }
.part.playing { background: rgba(246, 196, 83, .18); box-shadow: inset 0 0 0 2px rgba(246, 196, 83, .6); }
.answer.pz { border-top-color: #4C7A6C; }
.pzcard .cardnote { color: #6B5330; }
.uses { margin: 0; text-align: center; font-size: 14px; color: #BFD8CE; }
.uses .textlink { color: var(--butter); }
.peek { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(40, 25, 15, .45); animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } }
.peekcard { display: grid; gap: 10px; width: 100%; padding: 16px; background: var(--paper); border-radius: 22px; box-shadow: 0 10px 30px rgba(40, 20, 10, .3); animation: reveal .3s var(--pop); }
.peekcard small { font: 800 11.5px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.peekcard p { margin: 0; font: 600 18px/1.3 var(--head); }
.peekcard .b { flex: none; min-height: 48px; }

/* the end of a round, a set */
.foot.col { flex-direction: column; }
.score.big { position: relative; z-index: 2; padding: 22px 12px 18px; }
.score.big b { font-size: 50px; }
.setbadge { position: relative; z-index: 2; display: grid; justify-items: center; gap: 2px; padding: 20px 14px; background: var(--green); color: var(--cream); border-radius: 26px; box-shadow: 0 0 0 2.5px #24493F, 0 0 30px 4px rgba(255, 215, 114, .5), 0 7px 0 #1C3A32; text-align: center; }
.setbadge small { font: 800 12px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--butter); }
.setbadge b { font: 600 34px/1.1 var(--head); }
.setbadge span { font-size: 15px; color: #BFD8CE; }
.body.t-done { justify-content: center; }

/* home: the map of sections and puzzle sets */
#app.home #sheet { gap: 10px; }
.homehead { display: grid; gap: 7px; padding-top: 2px; }
.homehead h2 { margin: 0; text-align: center; font: 600 22px var(--head); }
.bigbar { height: 12px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 2px var(--line); overflow: hidden; }
.bigbar i { display: block; height: 100%; width: 0; background: linear-gradient(180deg, #8FD08F, #5FAE6D); border-radius: 12px; transition: width .6s var(--pop); }
.map { display: grid; gap: 7px; }
.sec, .setrow { display: grid; grid-template-columns: 1fr 64px auto; align-items: center; gap: 10px; padding: 10px 13px; background: var(--paper); border: 2.5px solid var(--line); border-bottom-width: 5px; border-radius: 17px; text-align: left; transition: transform .08s ease; }
.sec:active, .setrow:active { transform: translateY(2px); border-bottom-width: 3px; }
.secname b { display: block; font: 600 16.5px/1.15 var(--head); }
.secname small { font-size: 12.5px; color: var(--ink-2); font-weight: 700; }
.secbar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.secbar i { display: block; height: 100%; width: 0; background: #5FAE6D; border-radius: 8px; }
.seccount { font: 700 13.5px var(--body); color: var(--ink-2); min-width: 34px; text-align: right; }
.sec.full { background: #F1F8EC; border-color: #BFDDB4; }
.sec.full .seccount { color: #3E8A50; font-size: 17px; }
.setrow { grid-template-columns: 1fr auto; background: var(--green); border-color: #24493F; color: var(--cream); }
.setrow .secname small { color: #BFD8CE; }
.setrow .seccount { color: var(--butter); }
.setrow.locked { opacity: .62; }
.practice { justify-self: end; margin: -3px 6px 2px 0; font-size: 13.5px; }
.extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; padding: 6px 0 2px; font-size: 14.5px; }
#app.home .foot { margin-top: 0; }

/* the welcome question */
.choices { display: grid; gap: 9px; }
.choice { display: grid; gap: 1px; padding: 13px 16px; background: var(--paper); border: 2.5px solid var(--line); border-bottom-width: 6px; border-radius: 20px; text-align: left; animation: rise .5s var(--pop) backwards; transition: transform .08s ease; }
.choice:nth-child(2) { animation-delay: .06s; } .choice:nth-child(3) { animation-delay: .12s; }
.choice b { font: 600 19px/1.2 var(--head); }
.choice span { font-size: 14px; color: var(--ink-2); }
.choice:active { transform: translateY(3px); border-bottom-width: 3px; }
.choice:first-child { background: #FFEFE2; border-color: var(--clay); }

/* settings */
.body.t-settings { justify-content: flex-start; gap: 14px; padding-top: 6px; }
.setting { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; background: #fff; border-radius: 18px; box-shadow: 0 0 0 2.5px var(--line); }
.setting span { font: 600 17px var(--head); }
.setting b { justify-self: end; margin-top: -30px; font: 600 17px var(--head); color: var(--clay-d); }
.setting.check { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.setting input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--clay); }
.setting input[type=range] { accent-color: var(--clay); width: 100%; }
.textlink.danger { color: #A23B2A; font-size: 14px; }
@media (max-height: 700px) { .orb.idea.card { min-height: 120px; padding: 22px; } .orb.idea.card b { font-size: 20px; } .code { font-size: 14px; } .sec, .setrow { padding: 8px 12px; } }

/* the bottom buttons sit flush on the cream, so nothing scrolls into view below them */
#sheet { padding-bottom: 0; }
.foot { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--cream) 82%, rgba(255, 246, 230, 0)); }
.homehead small { text-align: center; font: 700 13px var(--body); color: var(--ink-2); }

/* the sound switch: in the top bar, or floating on screens without one */
.soundb svg { width: 21px; height: 21px; }
.soundb.off { color: #A23B2A; }
.soundb.floating { position: absolute; z-index: 6; right: 12px; top: calc(10px + env(safe-area-inset-top)); }
.toast { position: absolute; z-index: 30; left: 50%; top: calc(58px + env(safe-area-inset-top)); transform: translateX(-50%); max-width: 86%; padding: 8px 14px; border-radius: 999px; background: rgba(58, 42, 34, .92); color: #fff; font: 700 14px var(--body); text-align: center; animation: say .3s var(--pop); transition: opacity .5s ease; }
.toast.gone { opacity: 0; }

/* the idea on a card: plain type on white (the bubbles are for the code) */
.ideacard { flex: 1; display: grid; gap: 6px; padding: 16px 18px; background: #fff; border-radius: 22px; box-shadow: 0 0 0 2.5px var(--line), 0 6px 0 rgba(120, 80, 40, .1); text-align: center; }
.ideacard small { font: 800 11.5px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--clay-d); }
.ideacard b { font: 600 21px/1.3 var(--head); }
.ideacard.sm { padding: 10px 14px; gap: 2px; box-shadow: 0 0 0 2px var(--line); }
.ideacard.sm b { font-size: 17px; }

/* a line, a character at a time */
.pieces { flex: 1; min-width: 0; font-size: 19px; line-height: 2.1; white-space: pre; }
.pieces .pc { position: relative; color: #E8EEF5; border-radius: 7px; padding: 2px 1px; transition: background .25s ease, box-shadow .25s ease, color .25s ease; }
.pieces .pc.done { color: #FFE9A8; }
.pieces .pc.on { color: var(--ink); background: radial-gradient(closest-side, #FFFDF0, #FFD772); box-shadow: 0 0 0 3px rgba(255, 215, 114, .45), 0 0 18px 6px rgba(255, 215, 114, .55); }
.pieces .pc.pop { animation: wordpop .45s var(--pop); }
.buildpanel { display: grid; gap: 8px; }
.saythis.explain b { font-size: 18px; line-height: 1.45; }
.xpart { border-radius: 7px; padding: 1px 2px; cursor: pointer; transition: background .25s ease, color .25s ease; }
.xpart.on { background: #FFE9A8; color: var(--clay-d); }
.moves.small li { font-size: 14.5px; }
.moves.small { gap: 6px; }
.body > .ideacard { flex: none; }
.choice.tutrow { animation: none; }
.choice.tutrow:not(.done) { background: #FFEFE2; border-color: var(--clay); }
.choice.tutrow.done { padding: 9px 14px; border-bottom-width: 4px; }
.choice.tutrow.done b { font-size: 16px; }

/* code reads as typed: no joined symbols (== stays two characters) */
.code, .scr-line { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
