/* ════════════════════════════════════════════════════════════════════════════
   player.css — styling for the v2 lesson renderer (LAYER 3 chrome only).
   Self-contained: every value is local, so the player can be dropped into the
   isolated preview without pulling in the live site's stylesheet. Tokens mirror
   the site aesthetic (#08070f bg, #00d4d4 teal, Geist Mono).
   ════════════════════════════════════════════════════════════════════════════ */
.ltp2 {
  --bg:      #08070f;
  --bg2:     #0d0b18;
  --panel:   #14121f;
  --line:    #272240;
  --teal:    #00d4d4;
  --bear:    #f2f2f2;
  --ink:     #e8e8f0;
  --muted:   #8d8aa3;
  --red:     #cc2222;
  /* player-chrome polish: one quiet footer surface, hairline dividers, ghost-hover fill */
  --footer:   #0b0a14;
  --hairline: rgba(255,255,255,.06);
  --ghost:    rgba(255,255,255,.06);
  /* accent follows the module/course colour when the host sets --mod-accent, else teal */
  --accent:  var(--mod-accent, var(--teal));
  /* strong easing (matches the site; self-contained for the standalone hubs) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* display font for headings/titles — falls back to the body mono */
  --font-display: 'Geist Mono', ui-monospace, monospace;
  /* caption (subtitle) size — Medium default; .cap-sm / .cap-lg override; mobile forces smallest */
  --cap-fs: 13px; --cap-pad: 12px 18px; --cap-mh: 54px;
  --font: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  /* the player is the sizing context for its own type (cqw below): stage text
     tracks the PLAYER's width, not the screen's — right size at every fit */
  container-type: inline-size;
}

/* ── Height-fit (laptop) ── the stage is 16:9 OF THE WIDTH, so a 960px player is
   703px tall — taller than the content area of an 800px-high laptop, cutting the
   caption + transport below the fold. Cap the width so stage + caption (--cap-mh
   tracks the user's caption-size preset) + control bar + the lesson page chrome
   (header/banner/watch-link/paddings/footer ≈ 310px, kept honest by the compact
   laptop chrome block in lt-styles.css) always fit inside the viewport height.
   ≥ ~965px-tall viewports resolve to the full 960px — large desktops unchanged. */
@media (min-width: 769px) {
  .ltp2 {
    /* /var(--app-zoom): inside the zoomed body (lt-styles.css scale tiers)
       viewport units resolve zoom-times too small — divide back to the real
       viewport height before subtracting the (layout-px) chrome. */
    max-width: clamp(500px, calc((100vh / var(--app-zoom, 1) - 310px - var(--cap-mh)) * 16 / 9), 960px);
    max-width: clamp(500px, calc((100dvh / var(--app-zoom, 1) - 310px - var(--cap-mh)) * 16 / 9), 960px);
  }
}

/* ── stage (chart canvas + overlays live here) ── */
.ltp2-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(0,212,212,.05), transparent 60%),
    var(--bg);
}
.ltp2-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* on-chart heading (chart / candle beats) */
.ltp2-heading {
  position: absolute; top: 18px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(15px, 2.4vw, 24px);
  font-size: clamp(15px, 2.3cqw, 20px);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ink);
  pointer-events: none;
  opacity: 0; transition: opacity .28s var(--ease-out);
}
.ltp2-heading.on { opacity: 1; }

/* ── lesson-complete overlay ── revealed over the stage with the quest-complete fanfare
   so the end of the lesson is unmistakable. pointer-events:none keeps the nav clickable. */
.ltp2-complete {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(0,212,212,.18), transparent 58%),
    rgba(8,7,15,.80);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  transition: opacity .45s var(--ease-out), visibility 0s linear .45s;
}
.ltp2-complete.show { opacity: 1; visibility: visible; transition: opacity .45s var(--ease-out); }
.ltp2-complete-card { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.ltp2-complete.show .ltp2-complete-card { animation: ltp2Complete .55s var(--ease-out) both; }
.ltp2-complete-mark {
  width: 64px; height: 64px; margin-bottom: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--teal);
  border: 2px solid var(--teal); border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,212,.18), transparent 72%);
  box-shadow: 0 0 0 5px rgba(231,181,58,.10), 0 0 26px rgba(0,212,212,.30);
}
.ltp2-complete-mark svg { width: 32px; height: 32px; }
.ltp2-complete.show .ltp2-complete-mark { animation: ltp2CheckIn .5s var(--ease-out) .06s both; }
.ltp2-complete-kicker {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--teal);
}
.ltp2-complete-status {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(26px, 5.2vw, 40px); font-size: clamp(26px, 4.6cqw, 34px);
  line-height: 1.04; color: var(--ink);
  text-shadow: 0 2px 18px rgba(0,0,0,.5);
}
.ltp2-complete-title { font-family: var(--font); font-size: 13px; color: var(--muted); max-width: 34ch; }
@keyframes ltp2Complete { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ltp2CheckIn { from { opacity: 0; transform: scale(.45); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .ltp2-complete { -webkit-backdrop-filter: none; backdrop-filter: none; transition: opacity .2s linear; }
  .ltp2-complete.show .ltp2-complete-card, .ltp2-complete.show .ltp2-complete-mark { animation: none; }
}

/* ── concept panel (CONCEPT beats) ── */
.ltp2-panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(20px, 6%, 64px);
  background:
    radial-gradient(130% 100% at 0% 0%, rgba(0,212,212,.06), transparent 55%),
    var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity .24s var(--ease-out);
}
.ltp2-panel.on { opacity: 1; }
/* groups the whole concept slide so the renderer can scale it into the fixed
   stage when it would otherwise overflow (no-scroll rule) — see _fitConcept.
   flex:none: the panel is a column flexbox, and a shrinkable item would be
   squeezed to the stage height while its CONTENT still bled past — the box
   must always wrap the content so the scale math and origin are true. */
.ltp2-panel-inner { flex: none; transform-origin: 50% 50%; }
/* windowed mode (_fitConcept, slides past the 0.72 readability floor): the
   header pins, the bullet list becomes the window — newest bullet in view,
   already-narrated ones exit under the top fade (same language as the
   caption's lyric window). */
.ltp2-panel--window .ltp2-panel-inner { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; transform: none; }
.ltp2-panel--window .ltp2-lines {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;              /* user-scrollable — early bullets stay reachable */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ltp2-panel--window .ltp2-lines::-webkit-scrollbar { display: none; }
/* same live edge-fade language as the caption (renderer toggles lines-*) */
.ltp2-lines.lines-below {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}
.ltp2-lines.lines-above {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
}
.ltp2-lines.lines-above.lines-below {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent);
}
.ltp2-kicker {
  font-size: clamp(10px, 1.4vw, 13px);
  font-size: clamp(10px, 1.3cqw, 12px);
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--accent);
  margin-bottom: 12px;
}
.ltp2-title {
  font-family: var(--font-display);
  /* cqw = % of the PLAYER width (vw line is the no-container-query fallback):
     40px max read blown-up on laptops; 33px at the full 960 player, scaling
     down with the height-fit. Mobile lands on the same 22px floor as before. */
  font-size: clamp(22px, 4.4vw, 40px);
  font-size: clamp(22px, 4.1cqw, 33px);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 20px;
}
/* short accent rule under the title for hierarchy */
.ltp2-title::after {
  content: ''; display: block;
  width: 44px; height: 3px; margin-top: 12px;
  background: var(--accent); border-radius: 2px;
}
/* concept "idea" glyph above the kicker (only on CONCEPT beats) */
.ltp2-pmark { display: none; color: var(--accent); margin-bottom: 12px; }
.ltp2-pmark svg { width: 30px; height: 30px; display: block; }
.ltp2.is-concept .ltp2-pmark { display: block; }
.ltp2-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(10px, 1.8vw, 18px); gap: clamp(10px, 1.7cqw, 15px); }
.ltp2-lines li {
  position: relative;
  padding-left: 26px;
  font-size: clamp(13px, 2.1vw, 19px);
  font-size: clamp(13px, 2.1cqw, 16.5px);
  line-height: 1.4;
  color: var(--ink);
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.ltp2-lines li.on { opacity: 1; transform: none; }
.ltp2-lines li::before {
  content: '›'; position: absolute; left: 4px; top: -1px;
  color: var(--accent); font-weight: 700;
}
.ltp2-lines li em { color: var(--accent); font-style: normal; font-weight: 600; }
.ltp2-lines li strong { color: #fff; }

/* ── 2×2 matrix graphic (e.g. the Price / OI quadrant) ── */
.ltp2-quad { margin-top: clamp(8px, 1.6vw, 16px); margin-top: clamp(8px, 1.6cqw, 14px); }
.ltp2-quad-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: clamp(6px, 1.2vw, 10px);
  gap: clamp(6px, 1.1cqw, 9px);
  max-width: 560px;
}
.ltp2-quad-col, .ltp2-quad-row {
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(11px, 1.7vw, 14px); font-size: clamp(11px, 1.6cqw, 13px);
  font-weight: 600; color: var(--ink); opacity: 0.72;
}
.ltp2-quad-row { justify-content: flex-end; padding-right: 4px; }
.ltp2-quad-cell {
  border: 1px solid rgba(255,255,255,0.13); border-radius: 10px;
  padding: clamp(9px,1.6vw,14px) clamp(11px,1.9vw,16px);
  padding: clamp(9px,1.5cqw,13px) clamp(11px,1.8cqw,15px);
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .32s var(--ease-out), transform .32s var(--ease-out);
}
.ltp2-quad-cell.on { opacity: 1; transform: none; }
.ltp2-quad-cell b { font-size: clamp(13px,2vw,17px); font-size: clamp(13px,1.9cqw,15.5px); font-weight: 700; line-height: 1.2; }
.ltp2-quad-cell span { font-size: clamp(11px,1.6vw,13px); font-size: clamp(11px,1.5cqw,12.5px); color: var(--ink); opacity: 0.6; }
.ltp2-quad-cell.tone-bull { background: rgba(0,200,120,0.10); border-color: rgba(0,200,120,0.45); }
.ltp2-quad-cell.tone-bull b { color: #00c878; }
.ltp2-quad-cell.tone-bear { background: rgba(255,46,136,0.10); border-color: rgba(255,46,136,0.45); }
.ltp2-quad-cell.tone-bear b { color: #ff5c9e; }
.ltp2-quad-cell.tone-weak { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.14); }
.ltp2-quad-cell.tone-weak b { color: var(--ink); }

/* ── caption (narration `say` — the silent stand-in + future TTS sync point) ── */
.ltp2-caption {
  display: block;
  padding: var(--cap-pad);
  height: var(--cap-mh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background: var(--footer);
  border-top: 1px solid var(--hairline);
  font-size: var(--cap-fs); line-height: 1.5; color: var(--ink);
}
/* caption size presets (set on the player root by the renderer from the setting) */
.ltp2.cap-sm { --cap-fs: 11.5px; --cap-pad: 10px 16px; --cap-mh: 88px; }
.ltp2.cap-md { --cap-fs: 13px;   --cap-pad: 12px 18px; --cap-mh: 102px; }
.ltp2.cap-lg { --cap-fs: 15px;   --cap-pad: 15px 18px; --cap-mh: 118px; }
.ltp2-caption .say { display: block; }
/* karaoke: the spoken word lights up as the narration plays (no layout shift) */
.ltp2-caption .say .ltp2-w { transition: color .1s linear, text-shadow .1s linear; }
.ltp2-caption .say .ltp2-w.on {
  color: var(--accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ── ONE control bar: transport (prev · play · next) on the left, the segmented
   progress bar (one segment per beat; click to jump) filling the middle, and the
   counter + speed + volume on the right. Replaces the old two stacked rows, halving
   the footer chrome. ── */
.ltp2-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px 11px;
  background: var(--footer);   /* one continuous footer surface with the caption — no internal seam */
}
.ltp2-transport { flex: none; display: flex; align-items: center; gap: 6px; }
.ltp2-seg-track { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; }
.ltp2-seg-item {
  flex: 1; min-width: 8px; height: 16px; padding: 0; position: relative;
  background: none; border: none; cursor: pointer;
}
.ltp2-seg-item::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: 3px; border-radius: 3px; background: var(--line);
  transition: background .2s var(--ease-out, ease), height .15s var(--ease-out, ease), box-shadow .2s;
}
.ltp2-seg-item.done::before { background: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.ltp2-seg-item.cur::before  { background: var(--accent); box-shadow: 0 0 6px -2px var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .ltp2-seg-item:hover::before { height: 6px; background: color-mix(in srgb, var(--accent) 78%, var(--line)); }
}
.ltp2-seg-item:not(.cur):active::before { height: 6px; }
.ltp2-counter { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── speed + volume chips (live in the position row, flanking the segments) ── */
.ltp2-chip {
  flex: none; font-family: var(--font); font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 4px 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.ltp2-chip:hover { color: var(--accent); background: var(--ghost); }
.ltp2-chip svg { width: 14px; height: 14px; display: block; flex: none; }
.ltp2-speed-wrap { flex: none; position: relative; }
.ltp2-speed { gap: 5px; font-variant-numeric: tabular-nums; }
.ltp2-speed-val { line-height: 1; }
.ltp2-speed-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 20;
  display: none; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 5px; box-shadow: 0 12px 32px rgba(0,0,0,.55);
}
.ltp2-speed-wrap.open .ltp2-speed-menu { display: flex; }
.ltp2-speed-opt {
  font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--ink);
  background: transparent; border: none; border-radius: 6px; padding: 6px 16px; cursor: pointer;
  text-align: center; white-space: nowrap; transition: background .12s, color .12s;
}
.ltp2-speed-opt:hover { background: var(--bg4, #1d1a30); color: var(--accent); }
.ltp2-speed-opt.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }

.ltp2-vol { flex: none; display: inline-flex; align-items: center; }
.ltp2-mute { padding: 4px 6px; color: var(--muted); border-radius: 8px; transition: color .15s, background .15s; }
.ltp2-mute:hover { color: var(--accent); background: var(--ghost); }
.ltp2-mute svg { width: 16px; height: 16px; display: block; }
/* slider is hidden until the learner hovers the volume control (desktop) or taps it
   (touch → .open); it then slides open. */
.ltp2-vol-slider {
  -webkit-appearance: none; appearance: none; width: 0; height: 4px; margin-left: 0;
  background: var(--line); border-radius: 3px; cursor: pointer; outline: none; opacity: 0;
  transition: width .2s var(--ease-out, ease), opacity .2s ease, margin-left .2s var(--ease-out, ease);
}
.ltp2-vol:hover .ltp2-vol-slider,
.ltp2-vol:focus-within .ltp2-vol-slider,
.ltp2-vol.open .ltp2-vol-slider { width: 66px; opacity: 1; margin-left: 7px; }
.ltp2-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.ltp2-vol-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; }
.ltp2-counter b { color: var(--ink); }

/* ── transport buttons: prev/next are icon-only, play is icon + label (primary) ── */
.ltp2-btn {
  font-family: var(--font); font-size: 13px; white-space: nowrap;
  color: var(--muted); background: transparent;          /* ghost by default — recedes */
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
  transition: color .15s, background .15s, transform .12s var(--ease-out, ease);
}
.ltp2-btn:hover:not(:disabled) { background: var(--ghost); color: var(--accent); }   /* soft fill, no box */
.ltp2-btn:not(:disabled):active { transform: scale(0.97); }   /* press feedback */
.ltp2-btn:disabled { opacity: .35; cursor: default; }
/* the ONE primary control — a solid teal pill with dark text, unmistakably the CTA */
.ltp2-btn.play {
  min-width: 88px; color: var(--bg); font-weight: 700;
  background: var(--accent);
}
.ltp2-btn.play:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #fff); color: var(--bg); }
.ltp2-btn-icon { padding: 8px 9px; color: #bdbbd0; }         /* prev/next chevrons — mid-ink, present at rest */
.ltp2-btn-icon svg { width: 15px; height: 15px; display: block; }

@media (prefers-reduced-motion: reduce) {
  .ltp2-heading, .ltp2-panel, .ltp2-lines li, .ltp2-seg-item::before { transition: none; }
}

/* ── CONCEPT beats: let the stage hug its content instead of a fixed 16:9 box
   (kills the dead vertical space on text-only beats); add a themed left rail. ── */
/* uniform player + NO-SCROLL rule: concept beats share the standard stage box
   and the panel stays PINNED to it (absolute, inset:0 from the base rule) —
   content that would overflow is scale-to-fitted whole by _fitConcept, never
   scrolled, never clipped. The player never changes height between beats. */
.ltp2.is-concept .ltp2-stage { overflow-y: hidden; }
.ltp2.is-concept .ltp2-panel {
  opacity: 1;
  padding: clamp(22px, 5%, 48px) clamp(20px, 6%, 60px);
}

/* ── Play/Pause button: icon + label, lit when playing ── */
.ltp2-btn.play { display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.ltp2-btn.play svg { width: 12px; height: 12px; flex: none; }
.ltp2-btn.playing { background: color-mix(in srgb, var(--accent) 82%, #000); color: var(--bg); border-color: transparent; }

/* ── end-of-lesson completion cue (final beat) ── */
.ltp2-done {
  display: none; align-items: center; gap: 14px;
  padding: 12px 18px; background: var(--footer); border-top: 1px solid var(--hairline);
}
.ltp2-done.on { display: flex; }
/* right-aligned completion badge (the in-player "Continue" button was removed —
   the app's bottom nav "Next" advances to the next step) */
.ltp2-done-txt { font-size: 13px; font-weight: 600; color: var(--ink); margin-left: auto; }
.ltp2-done-check { color: var(--accent); font-weight: 700; }

/* ── keyboard focus visibility ── */
.ltp2-btn:focus-visible, .ltp2-seg-item:focus-visible,
.ltp2-chip:focus-visible, .ltp2-speed-opt:focus-visible, .ltp2-vol-slider:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}

/* ── laptop / desktop: a touch roomier, still a single compact bar ── */
@media (min-width: 561px) {
  .ltp2-bar { padding: 11px 18px; gap: 14px; }
  .ltp2-seg-track { gap: 6px; }
  .ltp2-seg-item { height: 18px; }
  .ltp2-btn { padding: 9px 16px; font-size: 13.5px; }
  .ltp2-btn-icon { padding: 9px 11px; }
  .ltp2-btn.play { min-width: 100px; }
}

/* ── mobile: the bar WRAPS into two rows — segmented progress + counter/speed/volume
   on top, the three thumb-sized transport buttons filling the row below (the liked
   mobile layout). Charts get more height; long narration can't dwarf the chart. ── */
/* ── Mobile no-clip rules ── the stage is the HERO: full width, 4:3, never
   shrunk for text. The caption takes the viewport REMAINDER (_fitCaptions
   measures the real sibling chrome); when a narration is longer than the
   remainder the box becomes a synced lyric window (.ltp2--capflow): whole
   lines, a bottom fade, and the existing karaoke auto-advance reveals the
   rest in time with the narration — never a raw mid-line clip, never a
   scrollbar. Sub-750px-tall phones drop the module banner/watch-link
   (lt-styles.css) and tighten the control bar to buy the caption more lines. */
.ltp2--capflow .ltp2-caption { scrollbar-width: none; }
.ltp2--capflow .ltp2-caption::-webkit-scrollbar { display: none; }
/* edge fades follow the LIVE scroll state (renderer toggles cap-above/-below):
   a static fade would dim the very line being narrated and fake "more below"
   at the end of the text. */
.ltp2-caption.cap-below {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
}
.ltp2-caption.cap-above {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px);
}
.ltp2-caption.cap-above.cap-below {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 26px), transparent);
}
/* the stage's Lesson Complete overlay announces completion on EVERY playback
   path (the silent-dwell final beat now calls _showComplete too) — the extra
   done row would grow the player past the no-clip height budget at completion */
@media (max-width: 768px), (min-width: 769px) and (max-height: 960px) {
  .ltp2-done.on { display: none; }
}

@media (max-width: 560px) {
  /* uniform player: EVERY beat kind shares the calibrated 4:3 stage (charts keep
     their tuned geometry; concept slides SCALE-to-fit — never scroll, see
     _fitConcept) + a per-lesson fixed caption block sized to the longest
     narration (_fitCaptions) — the player and its buttons never move between
     beats, and nothing ever clips or scrolls. --cap-mh here is only the
     pre-measure default; the renderer's inline value takes over. */
  .ltp2-stage, .ltp2.is-chart .ltp2-stage, .ltp2.is-candle .ltp2-stage,
  .ltp2.is-concept .ltp2-stage { aspect-ratio: 4 / 3; min-height: 0; overflow-y: hidden; }
  .ltp2 { --cap-mh: 118px; }
  .ltp2-caption { font-size: 11.5px; line-height: 1.42; padding: 9px 14px; }
  /* concept slides: reclaim the decorative air so text keeps full size —
     the glyph is ornament, and tight margins beat a scaled-down slide */
  .ltp2.is-concept .ltp2-pmark { display: none; }
  .ltp2-kicker { margin-bottom: 8px; }
  .ltp2-title { margin-bottom: 12px; }
  .ltp2-title::after { margin-top: 8px; }
  .ltp2.is-concept .ltp2-panel { padding: 14px 18px; }
  .ltp2-lines { gap: 8px; }
  .ltp2-bar { flex-wrap: wrap; padding: 8px 14px 10px; gap: 7px; }
  .ltp2-seg-track { order: 0; gap: 4px; }
  .ltp2-seg-item { height: 22px; min-width: 4px; }
  .ltp2-counter { order: 1; }
  .ltp2-speed-wrap { order: 2; }
  .ltp2-vol { order: 3; }
  .ltp2-chip { padding: 8px 9px; }
  .ltp2-mute { padding: 8px 8px; }
  .ltp2-transport { order: 4; flex: 1 1 100%; gap: 8px; }     /* own row, thumb-sized */
  .ltp2-transport .ltp2-btn { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; }
  .ltp2-btn.play { min-width: 0; }
}

/* short phones: tighter bar + caption buys the caption window more lines.
   AFTER the ≤560 block — at equal specificity the later rules must win, or
   these are dead on exactly the portrait phones they target. */
@media (max-width: 768px) and (max-height: 750px) {
  .ltp2-bar { padding: 6px 12px 8px; gap: 6px; }
  .ltp2-caption { font-size: 11px; padding: 8px 12px; }
}

/* tall laptop/desktop windows (>960px): the compact chrome block in
   lt-styles.css no longer applies, so the airy chrome costs ~38px more —
   budget for it or the transport dips below the fold at 961-1050px heights. */
@media (min-width: 769px) and (min-height: 961px) {
  .ltp2 {
    max-width: clamp(500px, calc((100vh / var(--app-zoom, 1) - 348px - var(--cap-mh)) * 16 / 9), 960px);
    max-width: clamp(500px, calc((100dvh / var(--app-zoom, 1) - 348px - var(--cap-mh)) * 16 / 9), 960px);
  }
}
