/* The café lesson, the polished draft: screens 1 and 2. */
: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: #EFD9BA; } }
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); }
/* On a computer the app floats as a card with room above and below, so it reads as the whole thing, not a cut-off page. */
@media (min-width: 520px) and (min-height: 640px) { #app { height: calc(100% - 56px); margin: 28px auto; border-radius: 30px; box-shadow: 0 0 0 1px rgba(120, 80, 40, .08), 0 18px 60px rgba(90, 50, 20, .22); } }

/* ---------- 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; }

/* On a computer (the card layout above), a shorter home scene and smaller language cards, so all four languages show without scrolling. */
@media (min-width: 520px) and (min-height: 640px) {
  #scene { height: clamp(250px, 34dvh, 430px); }
  .lang { padding: 10px 8px 9px; } .lang svg { width: 42px; height: 42px; }
}
@media (min-width: 520px) and (min-height: 640px) and (max-height: 820px) {
  #app { height: calc(100% - 36px); margin: 18px auto; }
  #scene { height: clamp(200px, 28dvh, 260px); }
  .lang { padding: 8px 8px 7px; } .lang svg { width: 38px; height: 38px; }
  /* keep the BUBBLE CAFÉ sign in view: the street art stays tall and the sidewalk, under Mo's bubble, is what crops */
  #scene .scene.street { height: 340px; inset: 0 0 auto 0; }
}
