/* levels.css — split out of style.css on 2026-09-02 so a feature's styles live
   with the feature and parallel sessions stop colliding in one 4,600-line
   file. Sections and the 5-levels ladder: the piece page's section chips (sections.js), the ✂️ section editor's strip (section-editor.js), the levels screen, the level result and the flash between levels (ladder.js), and the 🎓 designer's tabs, form and engraving (ladder-editor.js).
   Loads AFTER style.css (index.html), so the cascade order the rules had
   inside it is preserved: nothing here was moved relative to what follows it. */

/* ------------------------------------------------- sections (piece page) */
/* Named structural blocks of a piece (app.piece_sections). Tick one or more
   and the run is stitched from just those bars — Free Play's answer to "I
   only want to play the coda". Hidden for pieces nobody has sectioned. */
.pp-sections { margin-top: 14px; text-align: left; }
.pp-sections .ps-h {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
  font-size: 10.5px; font-weight: 900; letter-spacing: 2px;
  color: rgba(255, 255, 255, .45);
}
.pp-sections .ps-h .ps-sum {
  letter-spacing: .02em; font-size: 11.5px; font-weight: 700;
  color: var(--cyan); margin-left: auto; text-transform: none;
}
.ps-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .05);
  font-size: 12.5px; font-weight: 700; color: #fff;
  font-family: inherit; transition: border-color .12s, background .12s;
}
.ps-chip:hover { border-color: rgba(255, 255, 255, .38); }
.ps-chip.on { border-color: var(--cyan); background: rgba(52, 211, 255, .16); }
.ps-chip .ps-bars {
  font-weight: 600; font-size: 11px; opacity: .6;
  font-variant-numeric: tabular-nums;
}
.ps-chip.ps-all { border-style: dashed; }
.ps-chip.ps-all.on { border-style: solid; }
.ps-note { margin-top: 7px; font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.ps-edit {
  margin-top: 8px; font-size: 11.5px; background: none; border: 0;
  color: var(--gold); cursor: pointer; font-family: inherit; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
/* sections replace the timeline itself, so the modes that own their own
   timeline (study markers in seconds, the learn ladder in bars) can't run
   on top of one */
.pp-mode-grid .mode-btn.ps-off { opacity: .38; pointer-events: none; }
/* ------------------------------------------------------- section editor */
/* .panel.wide caps at 720px — the strip needs the whole screen to give 260
   bars a clickable width, so this has to out-specify it */
.panel.wide.se-panel { width: min(97vw, 1280px); max-width: 1280px; text-align: left; }
/* the panel body reads left-to-right like a workbench, but the title stays
   centred so the floating Back button never lands on top of it */
.se-panel .title { text-align: center; margin-bottom: 4px; }
.se-hover {
  float: right; font-size: 12px; font-weight: 800; color: var(--cyan);
  font-variant-numeric: tabular-nums; min-height: 16px;
}
.se-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.se-top .midi-select { max-width: 460px; }
.se-hint { margin: 8px 0 10px; font-size: 12.5px; }
.se-strip {
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px;
  background: rgba(0, 0, 0, .3); padding: 8px 8px 6px; overflow-x: auto;
}
.se-loading { padding: 26px 8px; text-align: center; opacity: .6; font-size: 13px; }
.se-bars { display: flex; align-items: flex-end; gap: 1px; height: 118px; min-width: 620px; }
.se-bar {
  position: relative; flex: 1 1 0; min-width: 4px; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
  padding: 0; border: 0; border-radius: 3px 3px 0 0; cursor: pointer;
  background: rgba(255, 255, 255, .05); font-family: inherit;
}
.se-bar:hover { background: rgba(255, 255, 255, .14); }
.se-bar i { display: block; background: rgba(52, 211, 255, .5); border-radius: 3px 3px 0 0; }
.se-bar.alt i { background: rgba(255, 171, 46, .5); }
.se-bar.on i { background: var(--cyan); }
.se-bar.alt.on i { background: var(--orange); }
/* the split point itself: a hard left edge, the way a double barline reads */
.se-bar.start { box-shadow: inset 2px 0 0 #fff; }
.se-bar em {
  font-style: normal; font-size: 8.5px; line-height: 12px; height: 12px;
  text-align: center; opacity: .5; overflow: hidden; font-variant-numeric: tabular-nums;
}
.se-bands { display: flex; gap: 1px; margin-top: 4px; min-width: 620px; }
.se-band {
  flex: 1 1 0; min-width: 0; padding: 4px 6px; border-radius: 5px; cursor: pointer;
  font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; background: rgba(52, 211, 255, .16); color: #cdefff;
}
.se-band.alt { background: rgba(255, 171, 46, .16); color: #ffe0b8; }
.se-band.on { outline: 1px solid #fff; }
.se-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 4px; }
.se-tools .se-grow { flex: 1; }
.se-tools .big-btn { display: inline-block; width: auto; margin: 0; padding: 12px 26px; font-size: 15px; }
.se-tools .small-btn { margin: 0; }
.se-every { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.se-every input {
  width: 56px; padding: 6px 8px; border-radius: 8px; font: inherit; color: #fff;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .2);
}
.se-blocks { margin-top: 6px; max-height: 34vh; overflow-y: auto; }
.se-block {
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 7px 9px; margin-bottom: 6px; background: rgba(255, 255, 255, .03);
}
.se-block.on { border-color: var(--cyan); background: rgba(52, 211, 255, .09); }
.se-brow { display: flex; align-items: center; gap: 9px; }
.se-bnum {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 900;
  background: rgba(255, 255, 255, .1); font-variant-numeric: tabular-nums;
}
.se-bname {
  flex: 1 1 200px; min-width: 120px; padding: 6px 9px; border-radius: 8px;
  font: inherit; font-weight: 700; font-size: 13.5px; color: #fff;
  background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .16);
}
.se-bname:focus { outline: none; border-color: var(--cyan); }
.se-bmeta { font-size: 11.5px; opacity: .62; white-space: nowrap; font-variant-numeric: tabular-nums; }
.se-mini {
  flex: none; width: 30px; height: 28px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; font-family: inherit; font-size: 13px;
}
.se-mini:hover { background: rgba(255, 255, 255, .18); }
.se-mini.on { background: var(--cyan); color: #03202b; border-color: var(--cyan); }
.se-mini:disabled { opacity: .3; cursor: default; }
.se-presets { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 2px; }
.se-preset {
  padding: 4px 9px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16);
}
.se-preset:hover { border-color: var(--cyan); color: #fff; }
#se-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  padding: 11px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  background: rgba(10, 10, 20, .96); border: 1px solid var(--cyan); color: #fff;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
#se-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#se-toast.bad { border-color: var(--red); }
@media (max-width: 720px) {
  .se-bmeta { display: none; }
  .se-blocks { max-height: 40vh; }
}
/* ---------------------------------------------- learn it in 5 levels */
/* the piece page's ladder: one row per level, climbed top to bottom */
.pp-levels .rung-list { display: flex; flex-direction: column; gap: 5px; }
.rung-row {
  display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center;
  gap: 10px; width: 100%; padding: 8px 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05);
  color: #fff; font-family: inherit; text-align: left; transition: border-color .12s, background .12s;
}
.rung-row:hover:not(:disabled) { border-color: rgba(255, 255, 255, .4); }
.rung-row.next { border-color: var(--cyan); background: rgba(52, 211, 255, .12); }
.rung-row.done { border-color: rgba(120, 230, 140, .45); background: rgba(120, 230, 140, .08); }
.rung-row:disabled { opacity: .42; cursor: default; }
.rung-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 900; background: rgba(255, 255, 255, .12);
  font-variant-numeric: tabular-nums;
}
.rung-row.done .rung-num { background: #6fe08a; color: #06200c; }
.rung-row.next .rung-num { background: var(--cyan); color: #03202b; }
.rung-name { font-weight: 800; font-size: 13px; line-height: 1.2; }
.rung-rules { font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rung-state { font-size: 11.5px; font-weight: 800; white-space: nowrap; min-width: 44px; text-align: right; }
.rung-row.done .rung-state { color: #8ff0a4; }
.rung-row.next .rung-state { color: var(--cyan); }
/* the piece page's door to the 5-levels screen */
.pp-levels .rung-open {
  width: 100%; margin-top: 2px; display: flex; flex-direction: column;
  gap: 2px; align-items: flex-start;
}
.rung-open-sub {
  font-size: 11px; font-weight: 600; opacity: .6;
  text-transform: none; letter-spacing: 0;
}
/* the 5-levels screen: the ladder + webcam / ladder-record setup */
#ls-title { margin-top: 46px; }
/* clear the floating back button */
#ladder-screen .lr-name { margin: -4px 0 12px; }
#ls-list { margin-bottom: 4px; }
#ls-camrec { justify-content: center; }
#ladder-screen .ps-note { max-width: 520px; margin: 8px auto 0; }
#ls-start { margin-top: 14px; }
/* during the run: the level's rules, beside the board (same slot as the learn panel) */
#rung-panel .lp-stage { color: var(--cyan); }
/* the result overlay */
.lr-name { font-weight: 900; font-size: 16px; margin: -6px 0 10px; color: var(--cyan); }
/* the learned screen's grade tier: the normal results' #grade, one size down */
.lr-grade {
  font-size: 96px; font-weight: 900; font-style: italic; line-height: 1;
  background: linear-gradient(180deg, #fff8d0, var(--gold) 60%, #c8860a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 215, 94, .55));
  animation: grade-in .6s cubic-bezier(.2, 2.2, .35, 1);
}
#lr-fullstats { font-size: 14px; width: 420px; gap: 7px 22px; margin-bottom: 10px; }
/* ⏹ stop the ladder recording: a red big-btn, one size down */
#lr-stoprec {
  font-size: 16px; padding: 11px 34px; letter-spacing: 1.5px; color: #2a000b;
  background: linear-gradient(180deg, #ff8ba0, var(--red));
  box-shadow: 0 0 22px rgba(255, 59, 92, .4), 0 4px 0 #a91f3a;
}
#lr-stoprec:hover { box-shadow: 0 0 32px rgba(255, 59, 92, .6), 0 6px 0 #a91f3a; }
#lr-stoprec:active { box-shadow: 0 0 18px rgba(255, 59, 92, .35), 0 1px 0 #a91f3a; }
.lr-stats { display: flex; flex-direction: column; gap: 5px; margin: 0 auto 12px; max-width: 360px; }
.lr-stat {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; border-radius: 9px;
  background: rgba(255, 255, 255, .06); font-size: 13px; font-variant-numeric: tabular-nums;
}
.lr-stat b { font-weight: 900; }
.lr-stat.ok b { color: #8ff0a4; }
.lr-stat.bad b { color: #ff8ba0; }
#rung-result .big-btn + .big-btn { margin-top: 8px; }
/* the big title flash between levels: passed → straight on to the next.
   Above the .overlay layer (10) and the in-play controls (40), under the
   toasts at 60. It stays up THROUGH the next level's load, so the menu
   never flickers underneath. */
#rung-flash {
  position: fixed; inset: 0; z-index: 55;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; cursor: pointer;
  background: rgba(6, 8, 18, 0.84);
}
.lf-passed {
  font-size: 20px; font-weight: 900; letter-spacing: 2px; color: #8ff0a4;
}
.lf-title {
  font-size: clamp(34px, 6vw, 64px); font-weight: 900; color: #fff;
  line-height: 1.1; max-width: 90vw;
  text-shadow: 0 4px 30px rgba(120, 160, 255, 0.45);
}
.lf-rules { font-size: 17px; color: #bcd; max-width: 640px; padding: 0 16px; }
.lf-hint {
  margin-top: 10px; font-size: 12px; opacity: 0.55;
  letter-spacing: 1px; text-transform: uppercase;
}
#rung-flash.show .lf-passed,
#rung-flash.show .lf-title,
#rung-flash.show .lf-rules,
#rung-flash.show .lf-hint { animation: lf-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
#rung-flash.show .lf-title { animation-delay: 0.12s; }
#rung-flash.show .lf-rules { animation-delay: 0.26s; }
#rung-flash.show .lf-hint { animation-delay: 0.4s; }
@keyframes lf-pop {
  from { opacity: 0; transform: scale(1.25) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
/* the designer: level tabs + the rules form, on the section editor's strip */
.le-tabs { display: flex; gap: 6px; margin: 8px 0 2px; flex-wrap: wrap; }
.le-tab {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05);
  color: #fff; font-family: inherit; font-size: 12.5px;
}
.le-tab b { font-size: 13px; }
.le-tab span { opacity: .65; font-size: 11px; }
.le-tab.empty span { opacity: .4; font-style: italic; }
.le-tab.on { border-color: var(--cyan); background: rgba(52, 211, 255, .16); }
.se-bar.anchor { box-shadow: inset 0 0 0 2px #fff; }
.le-form { margin-top: 10px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 9px 11px; background: rgba(255, 255, 255, .03); }
.le-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.le-presets { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; }
.le-rules { margin: 6px 0 8px; row-gap: 8px; }
.le-lab { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; }
.le-lab b { color: var(--cyan); font-variant-numeric: tabular-nums; }
.le-lab input[type=number] {
  width: 56px; padding: 4px 6px; border-radius: 7px; font: inherit; font-size: 12.5px; color: #fff;
  background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .16);
}
.le-rules input[type=range] { width: 150px; }
.le-check { font-size: 12px; display: flex; align-items: center; gap: 5px; }
.le-ranges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.le-ranges .ps-chip i { font-style: normal; opacity: .6; }
.le-note { font-size: 11.5px; color: rgba(255, 255, 255, .6); }
.le-meta { white-space: normal; }
#le-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  padding: 10px 16px; border-radius: 10px; background: #0f1a24; color: #fff; font-size: 13px;
  border: 1px solid var(--cyan); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50;
}
#le-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#le-toast.bad { border-color: var(--red); }
/* ---------------------------------------------- designer: the engraving */
.le-sheet {
  position: relative; margin-top: 8px; height: 230px; overflow-x: auto; overflow-y: hidden;
  border-radius: 10px; background: #f6f2e8; border: 1px solid rgba(255,255,255,.14);
}
.le-sheet .le-sheet-in { position: relative; height: 100%; }
.le-sheet img { position: absolute; top: 0; height: 100%; display: block; pointer-events: none; }
.le-sm {
  position: absolute; top: 0; bottom: 0; box-sizing: border-box; cursor: pointer;
  border-left: 1px solid rgba(0,0,0,.12); background: transparent;
}
.le-sm:hover { background: rgba(0,0,0,.06); }
.le-sm.on { background: rgba(52,211,255,.26); }
.le-sm.alt { background: rgba(255,171,46,.18); }
.le-sm.alt.on { background: rgba(52,211,255,.26); }
.le-sm.anchor { box-shadow: inset 0 0 0 2px #0b8fc0; }
.le-sm em {
  position: absolute; top: 3px; left: 3px; font-style: normal; font-size: 10px; font-weight: 800;
  color: rgba(0,0,0,.55); background: rgba(255,255,255,.7); padding: 0 4px; border-radius: 4px;
}
.le-sheet .se-loading { color: #333; }
/* On a phone the chooser's big vertical cards would make the hub four screens
   of scrolling — worse than the four buttons it replaced. Compact row cards
   here only; the PLAY chooser keeps its poster layout. */
