/* Lesson player: one lesson as one path, one screen at a time (course.html).
   Uses the existing tokens (--gold, --gold-bright, --gold-line, --red-light, --han, --serif, --ink, --deep). */
body.flow-open{overflow:hidden}
.flow{position:fixed;inset:var(--lesson-header-height,86px) 0 0 0;z-index:60;isolation:isolate;display:flex;flex-direction:column;align-items:center;overflow-y:auto;overscroll-behavior:contain;background:var(--deep)}
.flow[hidden]{display:none}
.flow-landscapes{position:fixed;inset:0;z-index:-3;background:var(--deep)}
.flow-landscapes img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity 1.2s ease;transform:scale(1.03)}
.flow-landscapes img.active{opacity:1}
.flow-shade{position:fixed;inset:0;z-index:-2;background:radial-gradient(ellipse at 50% 46%,#0a161466 0%,#0b1914b8 58%,#071510e8 100%),linear-gradient(0deg,#06140fe6 0%,transparent 30%,transparent 78%,#05141199 100%)}
.flow .flow-frame{position:fixed;z-index:-1}

.flow-header{width:100%;box-sizing:border-box;display:flex;align-items:center;gap:28px;padding:26px 60px 0}
.flow-header .brand{display:none}
.flow-progress{flex:1;display:flex;gap:6px;max-width:620px;margin:0 auto;padding:0;list-style:none}
.flow-progress.is-hidden{visibility:hidden}
.flow-progress li{flex:1;height:3px;border-radius:3px;background:#d7b77433;transition:background .4s}
.flow-progress li.done{background:var(--gold)}
.flow-progress li.current{background:var(--red-light);box-shadow:0 0 12px #b84d3599}
.flow-exit{flex-shrink:0;background:#07150e8c;margin-left:auto;cursor:pointer}

.flow-stage{flex:1 0 auto;width:min(780px,calc(100% - 40px));display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:26px 0 8px}
.flow-stage.flow-enter{animation:flowIn .55s ease both}
@keyframes flowIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.flow-eyebrow{display:flex;justify-content:center;gap:10px;margin:0 0 18px;text-transform:uppercase;text-shadow:0 2px 14px #030c09}
.flow-eyebrow-mark{font-family:var(--han);letter-spacing:0}
.flow-title{font-size:clamp(40px,4.6vw,66px);margin:0 0 22px}
.flow-title-han{font-family:var(--han);color:var(--gold-bright);letter-spacing:.04em}
.flow-lead{font-size:20px;color:#ddd9c3;margin:0 0 12px;text-shadow:0 2px 14px #030c09}
.flow-goal{font-family:var(--han);font-size:clamp(68px,9vw,118px);line-height:1.05;letter-spacing:.06em;color:#f1d79870;margin:0;text-shadow:0 4px 30px #030c09cc}
.flow-goal-done{color:var(--gold-bright);font-size:clamp(56px,7.5vw,92px);margin-bottom:6px}
.flow-translation{font-family:var(--serif);font-size:clamp(22px,2.2vw,30px);color:var(--ink);margin:14px 0 0;text-shadow:0 2px 16px #030c09}
.flow-ladder{list-style:none;margin:30px 0 0;border-radius:14px;padding:6px 24px;width:min(560px,100%);box-sizing:border-box;border:1px solid #d7b77455;background:#07150edb;backdrop-filter:blur(8px)}
.flow-ladder li{display:flex;align-items:center;gap:16px;padding:12px 0;font-size:18px;color:#d6d3bd}
.flow-ladder li+li{border-top:1px solid var(--gold-line)}
.flow-ladder-count{font-family:var(--serif);font-weight:400;font-size:26px;color:var(--gold-bright);min-width:28px;text-align:right}
.flow-ladder-label{flex:1;text-align:left}
.flow-ladder-sample{font-family:var(--han);font-size:24px;color:var(--gold-bright);letter-spacing:.06em}
.flow-ladder-mark{font-family:var(--han);font-size:22px;color:#eddfbd;background:#932d25;width:38px;height:44px;display:grid;place-items:center;box-shadow:inset 0 0 0 3px #932d25,inset 0 0 0 4px #e4b99375;flex-shrink:0}

/* Character: the film, then the strokes */
.flow-art{position:relative;width:min(540px,100%);aspect-ratio:500/430;border:0;padding:0;background:none;cursor:pointer;color:var(--gold-bright)}
.flow-art.plain{width:min(340px,74vw);aspect-ratio:1}
.flow-morph{position:absolute;inset:0;width:100%;height:100%;transition:opacity .55s ease}
.flow-morph polyline{stroke:var(--gold-bright)}
.flow-scenery{filter:brightness(2.5)}
.flow-strokes{position:absolute;left:25%;top:26%;width:50%;height:58.1%;opacity:0;transition:opacity .55s ease;filter:drop-shadow(0 6px 20px #07170cb0)}
.flow-art.plain .flow-strokes{inset:0;width:100%;height:100%}
.flow-art.is-writing .flow-morph{opacity:0}
.flow-art.is-writing .flow-strokes{opacity:1}
.flow-glyph{position:absolute;inset:0;display:none;place-items:center;font-family:var(--han);font-size:clamp(150px,22vw,230px);color:var(--gold-bright);text-shadow:0 4px 34px #030c09d9}
.flow-art.is-text .flow-glyph{display:grid}
.flow-art.is-text .flow-morph{opacity:0}
.flow-art:focus-visible{outline:2px solid var(--gold);outline-offset:6px}
.flow-definition{margin:6px auto 0}
.flow-definition .pinyin{display:block}
.flow-note{max-width:560px;font-size:20px;line-height:1.55;color:#ddd9c3;margin:14px auto 0;text-shadow:0 2px 14px #030c09}
.flow-example{font-family:var(--han);color:var(--gold-bright);font-size:24px}

.flow-reveal,.flow-reveal-word,.flow-parts{opacity:0;transform:translateY(10px);transition:opacity .6s ease,transform .6s ease}
.flow-reveal.shown,.flow-reveal-word.shown,.flow-parts.shown{opacity:1;transform:none}
.flow-parts{display:flex;align-items:center;justify-content:center;gap:14px;margin:0 0 6px;min-height:0}
.flow-parts:empty{display:none}
.flow-part{display:inline-flex;align-items:center;gap:10px;padding:7px 15px;border:1px solid var(--part);color:var(--part);background:#071b15c4;border-radius:4px;font-size:18px}
.flow-part span:first-child{font-family:var(--han);font-size:34px;line-height:1}
.flow-plus{color:var(--gold);font-size:24px}

/* Phrase: two characters come together */
.flow-join{display:flex;align-items:center;justify-content:center;gap:30px}
.flow-piece{display:flex;flex-direction:column;align-items:center;gap:6px}
.flow-piece span,.flow-group span{font-family:var(--han);color:var(--gold-bright);line-height:1;text-shadow:0 4px 26px #030c09cc}
.flow-piece span{font-size:clamp(72px,9vw,110px)}
.flow-piece small,.flow-group small{font-size:18px;color:#d6d3bd}
.flow-plus-big{font-size:36px}
.from-left{animation:fromLeft .7s cubic-bezier(.2,.8,.2,1) .15s both}
.from-right{animation:fromRight .7s cubic-bezier(.2,.8,.2,1) .15s both}
@keyframes fromLeft{from{opacity:0;transform:translateX(-46px)}to{opacity:1;transform:none}}
@keyframes fromRight{from{opacity:0;transform:translateX(46px)}to{opacity:1;transform:none}}
.flow-word{font-family:var(--han);font-size:clamp(96px,13vw,160px);line-height:1.05;letter-spacing:.06em;color:var(--gold-bright);margin:10px 0 16px;text-shadow:0 4px 34px #030c09d9}

/* Sentence */
.flow-sentence{display:flex;flex-wrap:wrap;justify-content:center;gap:clamp(14px,2.6vw,38px)}
.flow-group{display:flex;flex-direction:column;align-items:center;gap:12px}
.flow-group span{font-size:clamp(72px,10vw,128px);padding-bottom:12px;border-bottom:1px solid #d7b774b0;letter-spacing:.04em}
.flow-sentence-pinyin{margin:10px 0 0}
.flow-listen{margin:10px auto 0}

/* Your turn */
.flow-slots{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;margin:30px 0 0}
.flow-slot{width:clamp(62px,9vw,92px);aspect-ratio:1;border:1px dashed #d7b774a0;display:grid;place-items:center;font-family:var(--han);font-size:clamp(42px,6vw,62px);color:var(--gold-bright);background:#07150e80}
.flow-slot.filled{border-style:solid;border-color:var(--gold);background:#0e201ad9;animation:slotIn .3s ease both}
@keyframes slotIn{from{transform:scale(.7);opacity:0}to{transform:none;opacity:1}}
.flow-tiles{display:flex;flex-wrap:wrap;gap:14px;justify-content:center;margin:26px 0 0}
.flow-tile{width:clamp(66px,9vw,96px);aspect-ratio:1;border:1px solid #c7ac6e80;background:#0e201ae6;color:var(--gold-bright);font-family:var(--han);font-size:clamp(40px,5.5vw,58px);cursor:pointer;transition:transform .2s,opacity .3s}
.flow-tile:hover{transform:translateY(-2px);border-color:var(--gold)}
.flow-tile:disabled{opacity:.18;cursor:default;transform:none}
.flow-tile.shake{animation:shake .35s ease;border-color:var(--red-light)}
@keyframes shake{0%,100%{transform:none}25%{transform:translateX(-7px)}75%{transform:translateX(7px)}}
.flow-build-status{min-height:30px;font-size:19px;color:#d6d3bd;margin:22px 0 0}
.flow-build-status.success{color:var(--gold-bright);font-size:22px}

/* Done */
.flow-seal{font-family:var(--han);font-size:52px;line-height:1.08;color:#eddfbd;background:#932d25;width:104px;padding:14px 0;display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:inset 0 0 0 5px #932d25,inset 0 0 0 6px #e4b99375,0 18px 40px #05120bb0;margin-bottom:28px;animation:stamp .75s cubic-bezier(.2,.8,.2,1) .15s both}
@keyframes stamp{0%{opacity:0;transform:scale(1.8) rotate(-12deg)}60%{opacity:1;transform:scale(.95) rotate(-4deg)}100%{opacity:1;transform:rotate(-4deg)}}
.flow-stats{display:flex;gap:14px;list-style:none;padding:0;margin:20px 0 0}
.flow-stats li{min-width:118px;padding:14px 10px;border:1px solid #d7b77455;background:#07150edb;display:flex;flex-direction:column;align-items:center;font-size:18px;color:#d6d3bd}
.flow-stats b{font-family:var(--serif);font-weight:400;font-size:40px;color:var(--gold-bright);line-height:1.1}
.flow-done-actions{display:flex;flex-direction:column;align-items:center;gap:8px;margin-top:30px}
.flow-done-actions .flow-stay{align-self:center;text-align:center}

.flow-footer{width:100%;display:flex;justify-content:center;padding:18px 20px 44px;box-sizing:border-box}
.flow-next{min-width:260px;font-size:20px;border-radius:999px;padding:12px 28px;box-shadow:0 10px 26px rgba(120,30,20,.35),inset 0 1px 0 rgba(255,235,220,.25);cursor:pointer}
.flow-next[hidden]{display:none}
.flow-next:disabled{opacity:.4;cursor:default;transform:none}

/* Keep the button clear of the analytics question while it is open (it stays on top so it can be answered) */
body:has(#analytics-banner:not([hidden])) .flow-footer{padding-bottom:150px}

/* Reopen the player from the lesson page */
.lesson-play{margin-top:18px}

@media(max-width:700px){
  .flow-header{padding:22px 22px 0;gap:16px}
  .flow-brand-name{display:none}
  .flow-stage{padding-top:18px}
  .flow-ladder{padding:4px 16px}
  .flow-ladder-sample{font-size:19px}
  .flow-goal{font-size:clamp(40px,13vw,90px);letter-spacing:.02em}
  .flow-group span{font-size:clamp(52px,15vw,96px)}
  .flow-join{gap:16px}
  .flow-tiles,.flow-slots{gap:9px}
  .flow-stats li{min-width:92px}
  .flow-footer .flow-next,.flow-done-actions .flow-next{width:100%;min-width:0}
  .flow-done-actions{width:100%}
  .flow-footer{padding-bottom:28px}
  body:has(#analytics-banner:not([hidden])) .flow-footer{padding-bottom:300px}
}
@media(prefers-reduced-motion:reduce){.flow-stage.flow-enter,.from-left,.from-right,.flow-seal,.flow-slot.filled{animation:none}.flow-reveal,.flow-reveal-word,.flow-parts{transition:none}}

/* 2026-11-03 · Phones: keep Next on screen. It sat just below the fold on character screens,
   so the step looked unfinished until people scrolled. Pin it to the bottom and shrink the art a little. */
@media (max-width:700px){
 .flow-footer{position:sticky;bottom:0;z-index:2;padding:12px 20px calc(env(safe-area-inset-bottom) + 14px);background:linear-gradient(0deg,#06140ff2 55%,transparent)}
 body:has(#analytics-banner:not([hidden])) .flow-footer{padding-bottom:calc(env(safe-area-inset-bottom) + 14px)}
 .flow-art{width:min(440px,100%)}
 .flow-art.plain{width:min(260px,64vw)}
 .flow-stage{justify-content:flex-start;padding-top:10px}
 .flow-eyebrow{margin-bottom:8px}
}
@media (max-width:700px) and (max-height:620px){
 .flow-art{width:min(300px,80vw)}
 .flow-art.plain{width:min(190px,52vw)}
}

/* 2026-11-03 · Lesson 4 milestone and Lesson 5 preview end screens */
.flow-milestone{width:min(560px,100%);box-sizing:border-box;margin:18px auto 0;padding:16px 22px;border:1px solid #d7b77455;border-radius:14px;background:#07150edb;backdrop-filter:blur(8px);text-align:left}
.flow-milestone-title{margin:0 0 10px;font-family:var(--serif);font-size:24px;color:var(--gold-bright);text-align:center}
.flow-milestone-list{list-style:none;margin:0;padding:0}
.flow-milestone-list li,.flow-preview-next{display:flex;align-items:baseline;gap:14px;padding:8px 0;border-top:1px solid var(--gold-line)}
.flow-milestone-han{font-family:var(--han);font-size:26px;color:var(--gold-bright);letter-spacing:.06em;white-space:nowrap}
.flow-milestone-meaning{font-size:18px;color:#d6d3bd}
.flow-milestone-counts{margin:10px 0 0;font-size:16px;color:#cfc8ad;text-align:center}
.flow-preview-chars{margin:4px 0 8px;font-family:var(--han);font-size:44px;letter-spacing:.12em;color:#f1d798b8;text-align:center}
.flow-price-note{margin:4px 0 0;font-size:17px;color:#d6d3bd}
