/* lesson — "Every lesson is a case." The five stages of "Who Ate the Cake?".
   Inside the phone everything is laid out in iPhone points (1px = 1pt on a
   393 × 852 canvas) and scaled once per resize; values come from the app's
   Engine/Stages/*.swift and LLTheme.swift. */

[data-scene="lesson"] .lesson-track { height: 860vh; }
[data-scene="lesson"] .lesson-stage { padding: 0 var(--gutter); }

.lesson-layout {
  width: 100%; max-width: 1120px; height: 100%;
  display: flex; align-items: center; gap: clamp(40px, 6vw, 110px);
}

/* ---------- page copy ---------- */
.lesson-copy { flex: 0 1 clamp(300px, 36vw, 470px); min-width: 0; }
.lesson-h2 { text-wrap: balance; font-size: clamp(38px, 4.1vw, 56px); margin-bottom: clamp(26px, 4vh, 40px); }
.lesson-steps { list-style: none; display: grid; gap: clamp(10px, 1.6vh, 16px); }
.lesson-step {
  display: block; text-align: left; width: 100%;
  font-size: clamp(19px, 1.55vw, 22px); line-height: 1.32; font-weight: 600; letter-spacing: -0.016em;
  color: #000; opacity: 0.22;
  transition: opacity 0.45s var(--out);
}
.lesson-step:hover { opacity: 0.45; }
.lesson-step.on { opacity: 1; }
.lesson-step:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 4px; border-radius: 4px; }
.lesson-line { display: none; }

.lesson-area {
  flex: 1; align-self: stretch; min-width: 0; min-height: 0;
  display: grid; place-items: center; padding: 44px 0;
}
.lesson-phone { --phone-w: 330px; }

/* =================================================================== the app */
.ls-ui {
  position: absolute; left: 0; top: 0; width: 393px; height: 852px;
  transform-origin: 0 0;
  font-family: var(--serif); font-size: 17px; line-height: 1.28; color: #1a1a1a;
  letter-spacing: 0; text-align: left;
  -webkit-font-smoothing: antialiased;
  --gold: #c9a66b; --surface: #f9f5ea; --sec: rgba(26, 26, 26, 0.55); --stroke: rgba(26, 26, 26, 0.1);
  --ok: #5b8c5a; --bad: #c75b39; --warm: #c48b5a;
  --shadow: 0 2px 4px rgba(26, 26, 26, 0.06);
}
.ls-ui [hidden] { display: none !important; }
.ls-ui svg { display: block; flex: none; }
:where(.ls-ui) :where(p, h3) { margin: 0; font-weight: inherit; font-size: inherit; }
.ls-ui button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ls-ui button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- navigation bar ---------- */
.ls-bar {
  position: absolute; top: 60px; left: 16px; right: 16px; height: 44px; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  transition: opacity 0.35s ease-in-out;
}
.ls-bar.gone { opacity: 0; }
.ls-circ {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(253, 246, 224, 0.94);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.8) inset, 0 6px 16px rgba(110, 80, 30, 0.12), 0 1px 2px rgba(110, 80, 30, 0.06);
  display: grid; place-items: center;
}
.ls-close svg { width: 22px; height: 22px; color: var(--gold); }
.ls-title {
  position: absolute; left: 56px; right: 56px; text-align: center;
  font-family: var(--sans); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ls-pill { position: relative; }
.ls-pill-n {
  grid-area: 1 / 1;
  font-family: var(--sans); font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  color: rgba(60, 60, 67, 0.75);
}
/* iOS 26 scroll-edge effect: content fades out under the bar */
.ls-edge {
  position: absolute; left: 0; right: 0; top: 0; height: 130px; z-index: 2; pointer-events: none;
  background: linear-gradient(#efe3c7 0, #efe3c7 104px, rgba(239, 227, 199, 0.8) 118px, rgba(239, 227, 199, 0) 138px);
  height: 140px;
  transition: opacity 0.35s ease-in-out;
}
.ls-bar.gone + .ls-edge, .ls-ui:has(.ls-bar.gone) .ls-edge { opacity: 0; }

/* ---------- screens ---------- */
.ls-screens { position: absolute; inset: 0; }
.ls-scr { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.ls-scr.on, .ls-scr.leaving { visibility: visible; }
.ls-scr.on { pointer-events: auto; }
.ls-sc {
  position: absolute; left: 0; right: 0; top: 164px;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- shared pieces ---------- */
.ls-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.ls-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: 10px;
  background: var(--gold); color: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(201, 166, 107, 0.3);
  font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 22px;
  transition: transform 0.2s var(--out), opacity 0.2s;
}
.ls-btn svg { width: 16px; height: 16px; }
.ls-btn:active { transform: scale(0.97); }
.ls-btn.off { opacity: 0.5; pointer-events: none; }
.ls-div { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.ls-div i { flex: 1; height: 0.5px; background: var(--stroke); }
.ls-div b { width: 5px; height: 5px; transform: rotate(45deg) scale(0.8, 1.2); background: rgba(201, 166, 107, 0.4); }
.ls-div-in { margin: 0 20px 20px; }
.ls-div-in20 { margin: 0 20px; }
.ls-div-in32 { width: calc(100% - 64px); margin: 0 auto; }

/* ================================================================= 1 story */
.ls-st-head { padding: 20px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.ls-orn { display: flex; align-items: center; gap: 12px; height: 16px; }
.ls-orn i { width: 32px; height: 2px; background: rgba(201, 166, 107, 0.3); }
.ls-orn svg { width: 13px; height: 13px; color: rgba(201, 166, 107, 0.55); }
.ls-st-title { font-size: 28px; font-weight: 700; line-height: 38px; letter-spacing: -0.005em; }
.ls-narr { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--sec); }
.ls-narr-i { width: 26px; height: 26px; border-radius: 50%; background: rgba(201, 166, 107, 0.1); display: grid; place-items: center; color: var(--gold); }
.ls-narr-i svg { width: 12px; height: 12px; }
.ls-st-head .ls-div { margin-top: 4px; }
.ls-paras { padding: 0 20px 28px; display: flex; flex-direction: column; gap: 24px; }
.ls-para { will-change: transform, opacity; }
.ls-art {
  position: relative; width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 20px;
  background: var(--t08); box-shadow: inset 0 0 0 1px var(--t15);
  display: grid; place-items: center; color: var(--t);
}
.ls-art span { position: absolute; left: 14px; top: 14px; width: 60px; height: 60px; border-radius: 50%; background: var(--t06); }
.ls-art svg { position: relative; width: 40px; height: 40px; }
.ls-para-row { display: flex; align-items: flex-start; gap: 14px; }
.ls-num {
  flex: none; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.ls-para p { font-size: 18px; line-height: 30px; }
.ls-hl {
  display: flex; padding: 16px; border-radius: 14px;
  background: var(--t06); box-shadow: inset 0 0 0 0.5px var(--t12);
}
.ls-hl i { flex: none; width: 4px; margin: 4px 0; border-radius: 2px; background: var(--t); }
.ls-hl p { padding: 4px 0 4px 16px; }
.ls-st-act { padding: 0 20px 40px; }
.ls-st-fin .ls-div-in { margin: 0 20px 20px; }
.ls-more {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 0; border-radius: 12px;
  background: rgba(201, 166, 107, 0.08); box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.2);
  color: var(--gold); font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 19px;
}
.ls-more svg { width: 13px; height: 13px; }

/* ================================================================== 2 quiz */
.ls-s-quiz .ls-sc { padding-top: 16px; }
.ls-sit { margin: 0 20px 24px; padding: 20px; box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.1), var(--shadow); }
.ls-sit-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--gold); }
.ls-sit-h svg { width: 17px; height: 17px; }
.ls-sit-h span { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--sec); }
.ls-sit p { font-size: 18px; line-height: 28px; }
.ls-qhead { display: flex; align-items: flex-start; gap: 12px; margin: 0 20px 20px; }
.ls-qmark {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(201, 166, 107, 0.1);
  display: grid; place-items: center; color: var(--gold);
  font-family: "New York", Georgia, var(--serif); font-size: 16px; font-weight: 700;
}
.ls-qhead p { font-size: 20px; font-weight: 600; line-height: 28.6px; }
.ls-opts { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 20px; }
.ls-opt {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--stroke), var(--shadow);
  transition: transform 0.35s cubic-bezier(0.34, 1.5, 0.64, 1), opacity 0.3s;
}
.ls-opt::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 12px rgba(91, 140, 90, 0.3); opacity: 0; transition: opacity 0.3s;
}
.ls-opt:hover:not(.dis) { transform: scale(1.01); }
.ls-opt:active:not(.dis) { transform: scale(0.985); }
.ls-badge {
  position: relative; flex: none; width: 36px; height: 36px; border-radius: 8px;
  background: rgba(201, 166, 107, 0.08); display: grid; place-items: center;
  transition: background-color 0.3s;
}
.ls-badge > * { grid-area: 1 / 1; transition: opacity 0.2s; }
.ls-badge b { font-size: 16px; font-weight: 700; color: var(--sec); }
.ls-badge svg { width: 15px; height: 15px; color: #fff; opacity: 0; }
.ls-opt-t { font-size: 17px; line-height: 23.8px; }
.ls-opt.sel .ls-badge { background: var(--gold); }
.ls-opt.sel .ls-badge b { color: #fff; }
.ls-opt.sel { box-shadow: inset 0 0 0 1.5px rgba(201, 166, 107, 0.4), var(--shadow); }
.ls-opt.ok { background: rgba(91, 140, 90, 0.06); box-shadow: inset 0 0 0 1.5px rgba(91, 140, 90, 0.4), var(--shadow); transform: scale(1.015); }
.ls-opt.ok::after { opacity: 1; }
.ls-opt.ok .ls-badge { background: var(--ok); }
.ls-opt.ok .ls-badge b, .ls-opt.bad .ls-badge b { opacity: 0; }
.ls-opt.ok .ls-badge svg:first-of-type { opacity: 1; }
.ls-opt.bad { background: rgba(199, 91, 57, 0.04); box-shadow: inset 0 0 0 1.5px rgba(199, 91, 57, 0.3), var(--shadow); }
.ls-opt.bad .ls-badge { background: var(--bad); }
.ls-opt.bad .ls-badge svg:last-of-type { opacity: 1; }
.ls-opt.dis { cursor: default; }
.ls-opt.dis > * { opacity: 0.55; }
.ls-opt.dis.ok > .ls-badge { opacity: 0.75; }
.ls-fb { padding: 0 20px 40px; }
.ls-hint {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 14px;
  background: rgba(196, 139, 90, 0.05); box-shadow: inset 0 0 0 0.5px rgba(196, 139, 90, 0.15);
}
.ls-hint-i { flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(196, 139, 90, 0.12); display: grid; place-items: center; color: var(--warm); }
.ls-hint-i svg { width: 15px; height: 15px; }
.ls-hint p { font-size: 17px; line-height: 24.8px; }
.ls-exp { display: flex; flex-direction: column; gap: 16px; }
.ls-expl { display: flex; align-items: flex-start; gap: 12px; padding: 16px; box-shadow: inset 0 0 0 0.5px rgba(91, 140, 90, 0.15), var(--shadow); }
.ls-expl.info { box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.12), var(--shadow); }
.ls-expl-i { flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(91, 140, 90, 0.12); display: grid; place-items: center; color: var(--ok); }
.ls-expl-i svg { width: 17px; height: 17px; }
.ls-expl-i svg + svg, .ls-expl.info .ls-expl-i svg:first-child { display: none; }
.ls-expl.info .ls-expl-i { background: rgba(201, 166, 107, 0.1); color: var(--gold); }
.ls-expl.info .ls-expl-i svg + svg { display: block; }
.ls-expl p { font-size: 17px; line-height: 25.8px; }

/* ================================================================== 3 grid */
.ls-s-grid .ls-sc { padding-top: 16px; }
.ls-g-head { padding: 0 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ls-g-head > svg { width: 34px; height: 34px; color: rgba(201, 166, 107, 0.6); }
.ls-g-sit { font-size: 18px; line-height: 27px; text-align: center; }
.ls-g-ins { align-self: stretch; font-size: 13px; font-weight: 500; line-height: 16.6px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--sec); }
.ls-clues { padding: 0 20px 24px; }
.ls-clues-h { display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 10px; text-align: left; }
.ls-clues-h > span:nth-child(2) { flex: 1; font-size: 16px; font-weight: 600; }
.ls-clues-i { width: 28px; height: 28px; border-radius: 50%; background: rgba(201, 166, 107, 0.1); display: grid; place-items: center; color: var(--gold); }
.ls-clues-i svg { width: 14px; height: 14px; }
.ls-clues-c { width: 24px; height: 24px; border-radius: 50%; background: rgba(201, 166, 107, 0.06); display: grid; place-items: center; color: var(--sec); }
.ls-clues-c svg { width: 11px; height: 11px; transition: transform 0.25s ease-in-out; }
.ls-clues-h.closed .ls-clues-c svg { transform: rotate(180deg); }
.ls-clues-h.closed { margin-bottom: 0; }
.ls-clue-list { padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.12), var(--shadow); }
.ls-clue { display: flex; align-items: flex-start; gap: 10px; }
.ls-clue span { flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(201, 166, 107, 0.1); color: var(--gold); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.ls-clue p { font-size: 17px; line-height: 23.8px; }
.ls-table {
  margin: 0 20px 28px; border-radius: 14px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(201, 166, 107, 0.15), var(--shadow);
  position: relative;
}
.ls-grow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: 60px; box-shadow: inset 0 0.5px 0 var(--stroke); }
.ls-ghead { box-shadow: inset 0 -1px 0 rgba(201, 166, 107, 0.2); }
.ls-corner, .ls-attr { background: rgba(201, 166, 107, 0.08); display: grid; place-items: center; }
.ls-corner svg { width: 14px; height: 14px; color: rgba(201, 166, 107, 0.35); }
.ls-attr {
  box-shadow: inset 1px 0 0 rgba(201, 166, 107, 0.12);
  color: var(--gold); font-size: 14px; font-weight: 700; line-height: 1.15; text-align: center; padding: 0 3px;
  overflow: hidden;
}
.ls-attr > span { display: block; max-width: 100%; }
.ls-ent {
  display: grid; place-items: center; padding: 0 6px; text-align: center;
  background: rgba(201, 166, 107, 0.04); box-shadow: inset -1px 0 0 rgba(201, 166, 107, 0.12);
  font-size: 15px; font-weight: 600;
}
.ls-cell {
  position: relative; display: grid; place-items: center;
  background: var(--surface); box-shadow: inset 0.5px 0 0 var(--stroke);
  transition: background-color 0.15s ease-in-out;
}
.ls-cell svg { grid-area: 1 / 1; width: 20px; height: 20px; opacity: 0; transition: opacity 0.15s; }
.ls-cell svg:first-child { color: var(--ok); }
.ls-cell svg:last-child { color: rgba(199, 91, 57, 0.7); }
.ls-cell.m1 svg:first-child, .ls-cell.m2 svg:last-child { opacity: 1; }
.ls-cell.conf { background: #f3e5d0; }
.ls-cell.hint { background: #edefdd; }
.ls-cell.won { background: #f1f0e2; }
.ls-cell:disabled { cursor: default; }
@media (hover: hover) { .ls-cell:not(:disabled):hover { background: #f5eedd; } }
.ls-g-act { padding: 0 20px 40px; }
.ls-solve { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ls-warn {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  background: rgba(196, 139, 90, 0.08); color: var(--warm); font-size: 13px; font-weight: 500;
}
.ls-warn svg { width: 15px; height: 15px; }
.ls-hintbtn {
  display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  background: rgba(201, 166, 107, 0.08); box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.15);
  color: var(--gold); font-size: 13px; font-weight: 500;
}
.ls-hintbtn svg { width: 13px; height: 13px; }
.ls-solved { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 8px; }
.ls-seal {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(91, 140, 90, 0.08); box-shadow: inset 0 0 0 1px rgba(91, 140, 90, 0.2); color: var(--ok);
}
.ls-seal svg { width: 38px; height: 38px; }
.ls-solved-t { font-size: 18px; font-weight: 600; line-height: 1.32; text-align: center; }

/* ================================================================ 4 spot it */
.ls-s-spot .ls-sc { padding-top: 16px; }
.ls-sp-head { padding: 0 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ls-eye { width: 52px; height: 52px; border-radius: 50%; background: rgba(201, 166, 107, 0.08); display: grid; place-items: center; color: rgba(201, 166, 107, 0.6); }
.ls-eye svg { width: 26px; height: 26px; }
.ls-sp-head p { font-size: 20px; font-weight: 600; line-height: 28.6px; text-align: center; }
.ls-sp-sit { margin: 0 20px 24px; padding: 18px; box-shadow: inset 0 0 0 0.5px rgba(201, 166, 107, 0.1), var(--shadow); }
.ls-sp-sit p { font-size: 18px; line-height: 28px; }
.ls-items { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.ls-item {
  position: relative; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--stroke), var(--shadow);
  transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.ls-item::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 12px rgba(91, 140, 90, 0.3); opacity: 0; transition: opacity 0.3s;
}
.ls-item-b { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; }
.ls-item:has(.ls-info:not([hidden])) .ls-item-b { padding-right: 56px; }
.ls-ind {
  flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(201, 166, 107, 0.06); box-shadow: inset 0 0 0 1px var(--stroke);
  transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.ls-ind > * { grid-area: 1 / 1; }
.ls-ind b { font-size: 14px; font-weight: 600; color: var(--sec); }
.ls-ind svg { width: 13px; height: 13px; color: #fff; opacity: 0; transition: opacity 0.2s; }
.ls-item-t { font-size: 16px; line-height: 23.5px; }
.ls-item.sel { background: #f6efdf; box-shadow: inset 0 0 0 1.5px rgba(201, 166, 107, 0.3), var(--shadow); }
.ls-item.sel .ls-ind { background: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.ls-item.sel .ls-ind b, .ls-item.ok .ls-ind b, .ls-item.bad .ls-ind b { opacity: 0; }
.ls-item.sel .ls-ind svg:first-of-type, .ls-item.ok .ls-ind svg:first-of-type { opacity: 1; }
.ls-item.ok { background: #f1f0e2; box-shadow: inset 0 0 0 1.5px rgba(91, 140, 90, 0.25), var(--shadow); }
.ls-item.ok::after { opacity: 1; }
.ls-item.ok .ls-ind { background: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); }
.ls-item.bad { background: #f7eee3; box-shadow: inset 0 0 0 1.5px rgba(199, 91, 57, 0.2), var(--shadow); }
.ls-item.bad .ls-ind { background: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.ls-item.bad .ls-ind svg:last-of-type { opacity: 1; }
.ls-item-b:disabled { cursor: default; }
.ls-info {
  position: absolute; right: 16px; top: 50%; margin-top: -14px;
  width: 28px; height: 28px; border-radius: 50%; background: rgba(196, 139, 90, 0.1);
  color: var(--warm); font-family: var(--sans); font-size: 13px; font-weight: 800; display: grid; place-items: center;
}
.ls-item:has(.ls-why:not([hidden])) .ls-info { top: 30px; }
.ls-why { display: flex; gap: 8px; padding: 0 16px 14px 62px; color: var(--sec); }
.ls-why svg { width: 11px; height: 11px; margin-top: 4px; }
.ls-why p { font-size: 14px; line-height: 20px; }
.ls-sp-act { padding: 0 20px 40px; }
.ls-sp-done { display: flex; flex-direction: column; gap: 16px; }
.ls-sp-ok { display: flex; align-items: center; gap: 10px; color: var(--ok); }
.ls-sp-ok svg { width: 22px; height: 22px; }
.ls-sp-ok p { color: #1a1a1a; font-size: 16px; font-weight: 500; line-height: 22px; }
.ls-sp-rev { font-size: 17px; color: var(--sec); text-align: center; }

/* ================================================================ 5 the tutor */
.ls-chat { padding: 20px 20px 12px; display: flex; flex-direction: column; gap: 16px; }
.ls-msg { display: flex; align-items: flex-start; gap: 10px; }
.ls-msg.ai { padding-right: 44px; }
.ls-msg.me { justify-content: flex-end; padding-left: 44px; }
.ls-av { flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(201, 166, 107, 0.1); display: grid; place-items: center; color: var(--gold); }
.ls-av svg { width: 16px; height: 16px; }
.ls-bub {
  padding: 12px 16px; border-radius: 16px; font-size: 16px; line-height: 24.5px;
  background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--stroke), var(--shadow);
}
.ls-msg.me .ls-bub { background: var(--gold); color: #fff; box-shadow: var(--shadow); }
.ls-dots { display: flex; gap: 5px; padding: 6px 2px; }
.ls-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(26, 26, 26, 0.28); animation: ls-dot 0.8s ease-in-out infinite alternate; }
.ls-dots i:nth-child(2) { animation-delay: 0.16s; }
.ls-dots i:nth-child(3) { animation-delay: 0.32s; }
.ls-away .ls-dots i { animation-play-state: paused; }
@keyframes ls-dot { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -4px, 0); } }
.ls-input {
  position: absolute; left: 0; right: 0; bottom: 34px;
  display: flex; align-items: flex-end; gap: 12px; padding: 10px 20px;
  box-shadow: inset 0 0.5px 0 var(--stroke);
}
.ls-field {
  flex: 1; min-width: 0; min-height: 40px; padding: 9.5px 16px; border-radius: 20px;
  background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--stroke);
  font-size: 16px; line-height: 21px;
}
.ls-field > * { display: block; }
.ls-send { margin-bottom: 2px; }
.ls-ph { color: rgba(26, 26, 26, 0.3); }
.ls-send {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(253, 246, 224, 0.94); box-shadow: 0 4px 12px rgba(110, 80, 30, 0.12);
  color: rgba(26, 26, 26, 0.22); transition: color 0.2s;
}
.ls-send svg { width: 15px; height: 15px; }
.ls-send.on { color: var(--gold); }

/* ============================================================ lesson complete */
.ls-s-done .ls-sc { top: 0; }
.ls-dn { position: relative; padding-top: 118px; display: flex; flex-direction: column; align-items: center; }
.ls-dn-glow {
  position: absolute; left: 50%; top: 0; width: 400px; height: 400px; margin-left: -200px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(201, 166, 107, 0.13), rgba(201, 166, 107, 0.05) 55%, rgba(201, 166, 107, 0));
  pointer-events: none;
}
.ls-seal-wrap { position: relative; width: 140px; height: 140px; margin-bottom: 28px; display: grid; place-items: center; }
.ls-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(201, 166, 107, 0.25); }
.ls-wax {
  position: relative; width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #d4b87a 4%, #c9a66b 48%, #a67b5b 100%);
  box-shadow: 0 4px 20px rgba(201, 166, 107, 0.4);
}
.ls-wax > * { grid-area: 1 / 1; }
.ls-wax-r1 { width: 94px; height: 94px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25); }
.ls-wax-r2 { width: 76px; height: 76px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); }
.ls-wax-dots { position: relative; width: 4px; height: 4px; }
.ls-wax-dots b { position: absolute; left: 0; top: 0; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.ls-wax svg { width: 42px; height: 42px; color: #fff; filter: drop-shadow(0 1px 1px rgba(139, 107, 58, 0.5)); }
.ls-dn-t { font-size: 32px; font-weight: 700; line-height: 1.25; margin-bottom: 6px; text-align: center; padding: 0 20px; }
.ls-dn-n { font-size: 16px; font-weight: 500; color: var(--sec); text-align: center; margin-bottom: 28px; padding: 0 20px; }
.ls-dn-div { display: flex; align-items: center; gap: 12px; width: calc(100% - 96px); margin-bottom: 32px; }
.ls-dn-div i { flex: 1; height: 0.5px; background: rgba(201, 166, 107, 0.25); }
.ls-dn-div b { width: 5px; height: 5px; transform: rotate(45deg) scale(0.8, 1.2); background: rgba(201, 166, 107, 0.4); }
.ls-rcs { align-self: stretch; padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }
.ls-rc {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 0.5px rgba(var(--c), 0.12), var(--shadow);
}
.ls-rc.pts { --c: 196, 149, 107; }
.ls-rc.min { --c: 91, 140, 107; }
.ls-rc.tsk { --c: 107, 139, 166; }
.ls-rc-i {
  flex: none; width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(var(--c), 0.08); box-shadow: inset 0 0 0 0.5px rgba(var(--c), 0.15); color: rgb(var(--c));
}
.ls-rc-i svg { width: 25px; height: 25px; }
.ls-rc p { font-size: 13px; font-weight: 500; color: var(--sec); margin-bottom: 3px; }
.ls-rc-v { display: flex; align-items: baseline; gap: 5px; }
.ls-rc-v b { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ls-rc-v span { font-size: 15px; font-weight: 500; color: var(--sec); }
.ls-glassbtn {
  width: calc(100% - 40px); margin-top: 40px; padding: 16px 0; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255, 248, 230, 0.96);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.9), 0 10px 26px rgba(110, 80, 30, 0.12), 0 1px 3px rgba(110, 80, 30, 0.08);
  font-size: 18px; font-weight: 600; line-height: 23px; color: #1a1a1a;
  transition: transform 0.2s var(--out);
}
.ls-glassbtn:active { transform: scale(0.97); }
.ls-glassbtn svg { width: 16px; height: 16px; }

/* the entrance (LessonCompletionView.runEntrance), replayed each time the screen arrives */
.ls-dn-glow, .ls-ring, .ls-dn-t, .ls-dn-n, .ls-dn-div, .ls-rcs, .ls-glassbtn { opacity: 0; }
.ls-wax { opacity: 0; transform: rotate(-180deg) scale(0.3); }
.ls-dn-t { transform: translate3d(0, 12px, 0); }
.ls-rcs { transform: translate3d(0, 20px, 0); }
.ls-glassbtn { transform: translate3d(0, 16px, 0); }
.ls-ring { transform: scale(0.92); }
.ls-s-done.run .ls-wax { opacity: 1; transform: none; transition: transform 0.75s cubic-bezier(0.3, 1.45, 0.55, 1), opacity 0.25s; }
.ls-s-done.run .ls-dn-glow { opacity: 1; transition: opacity 0.8s 0.1s; }
.ls-s-done.run .ls-ring { opacity: 1; transform: none; transition: opacity 0.8s ease-out 0.3s, transform 0.8s var(--out) 0.3s; }
.ls-s-done.run .ls-dn-t { opacity: 1; transform: none; transition: opacity 0.5s 0.6s, transform 0.55s cubic-bezier(0.3, 1.3, 0.6, 1) 0.6s; }
.ls-s-done.run .ls-dn-n { opacity: 1; transition: opacity 0.4s ease-out 0.8s; }
.ls-s-done.run .ls-dn-div { opacity: 1; transition: opacity 0.3s ease-out 0.95s; }
.ls-s-done.run .ls-rcs { opacity: 1; transform: none; transition: opacity 0.5s 1.1s, transform 0.55s cubic-bezier(0.3, 1.25, 0.6, 1) 1.1s; }
.ls-s-done.run .ls-glassbtn { opacity: 1; transform: none; transition: opacity 0.5s 1.6s, transform 0.55s cubic-bezier(0.3, 1.25, 0.6, 1) 1.6s; }
.ls-s-done.still * { transition: none !important; }

/* =================================================================== phone width */
@media (max-width: 860px) {
  [data-scene="lesson"] .lesson-track { height: 820vh; }
  [data-scene="lesson"] .lesson-stage { padding: 0 16px; }
  .lesson-layout { flex-direction: column; align-items: stretch; gap: 0; padding-top: 58px; }
  .lesson-copy { flex: none; text-align: center; }
  .lesson-copy .kicker { font-size: 15px; margin-bottom: 6px; }
  .lesson-h2 { font-size: 30px; line-height: 1.08; margin-bottom: 10px; }
  .lesson-steps { display: none; }
  .lesson-line { display: grid; min-height: 2.7em; font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -0.012em; }
  .lesson-line p { grid-area: 1 / 1; opacity: 0; transform: translate3d(0, 8px, 0); transition: opacity 0.35s, transform 0.45s var(--out); max-width: 32ch; margin: 0 auto; text-wrap: balance; }
  .lesson-line p.on { opacity: 1; transform: none; }
  .lesson-area { padding: 12px 0 18px; }
}
@media (max-width: 860px) and (max-height: 700px) {
  .lesson-layout { padding-top: 52px; }
  .lesson-copy .kicker { display: none; }
  .lesson-h2 { font-size: 26px; }
}

/* =================================================================== reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ls-sc, .ls-opt, .ls-btn, .ls-clues-c svg, .lesson-line p { transition-property: opacity !important; }
  .lesson-line p { transform: none; }
  .ls-dots i { animation: none; }
  .ls-wax, .ls-dn-t, .ls-rcs, .ls-glassbtn, .ls-ring, .ls-opt.ok { transform: none !important; }
  .ls-s-done.run .ls-wax, .ls-s-done.run .ls-dn-t, .ls-s-done.run .ls-rcs, .ls-s-done.run .ls-glassbtn, .ls-s-done.run .ls-ring { transition: opacity 0.3s !important; }
  .ls-s-done.run .ls-dn-glow, .ls-s-done.run .ls-dn-n, .ls-s-done.run .ls-dn-div { transition: opacity 0.3s !important; }
}
