/* tutorial.css — Video Tutorial library bolt-on (RPM narrated tutorial,
   plan 2026-11-06; Lee's decisions settled 2026-11-07). Companion to
   tutorial.js: the entry button sits beside the welcome panel's Take
   the Tour button (.tour-launch-button); the library itself is a
   full-screen view (chapter index -> player + transcript). All classes
   are tut- prefixed so nothing collides with the bundle.

   Exit fix (2026-11-08): the view is a flex column — a persistent dark
   top bar (never scrolls, never covered) above a scrolling pane. The
   bar's z-order: #tut-view now sits above the showcase banner
   (z 2147482000), its panel (2147482500) and toast (2147482900) and the
   chat widgets (9992/9993), so while the library is open nothing in the
   app can paint over the exit controls. */

.tut-launch-button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-left: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .25);
  background: linear-gradient(#ffe783, #f2c94c);
  color: #17191d;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.tut-launch-button b { font-size: 15px; }
.tut-launch-button span { font-size: 12px; opacity: .75; }
.tut-launch-button:hover { filter: brightness(1.05); }

body.tut-open { overflow: hidden; }

#tut-view {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  background: #f7f5f0;
  color: #17191d;
  box-sizing: border-box;
  font-family: inherit;
}

/* --- Persistent exit bar (never scrolls away) -------------------------- */
.tut-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #17191d;
  color: #f7f5f0;
  border-bottom: 3px solid #cba523;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
}
.tut-bar-left { display: flex; align-items: center; min-height: 44px; }
.tut-bar-title { font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.tut-exit, .tut-back {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.tut-exit {
  flex: none;
  background: linear-gradient(#ffe783, #f2c94c);
  color: #17191d;
  border: 1px solid rgba(0, 0, 0, .35);
}
.tut-exit:hover { filter: brightness(1.05); }
.tut-back {
  background: transparent;
  color: #f7f5f0;
  border: 1px solid rgba(255, 255, 255, .45);
}
.tut-back:hover { background: rgba(255, 255, 255, .12); }

/* --- Scrolling pane ----------------------------------------------------- */
.tut-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 18px 60px;
  box-sizing: border-box;
}
.tut-scroll > * { max-width: 880px; margin-left: auto; margin-right: auto; }

.tut-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 6px;
}
.tut-eyebrow {
  color: #8a6d1f;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
  margin: 0 0 4px;
}
.tut-head h2 { margin: 0; font-size: 26px; line-height: 1.2; }
.tut-close {
  flex: none;
  border: 1px solid rgba(0,0,0,.25);
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tut-intro { font-size: 15px; line-height: 1.5; margin: 10px auto 18px; }

.tut-list { display: flex; flex-direction: column; gap: 8px; }
.tut-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 10px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
}
.tut-row:hover { border-color: #cba523; }
.tut-num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #17191d;
  color: #ffe783;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.tut-row-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tut-row-title { font-weight: 700; font-size: 16px; }
.tut-row-meta { font-size: 12.5px; opacity: .65; }
.tut-dur { flex: none; font-variant-numeric: tabular-nums; font-size: 14px; opacity: .8; }

.tut-chmeta { font-size: 13.5px; opacity: .7; margin: 2px auto 12px; }
.tut-stage { position: relative; }
.tut-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
}

/* --- End-of-chapter card (replaces the old autoplay chain) -------------- */
.tut-ended {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(9, 11, 15, .86);
  border-radius: 10px;
  text-align: center;
  padding: 18px;
  box-sizing: border-box;
}
.tut-ended[hidden] { display: none; }
.tut-ended-title { color: #fff; font-size: 20px; font-weight: 800; margin: 0; }
.tut-ended-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.tut-ended .tut-navbtn { max-width: none; min-height: 44px; }

.tut-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 14px auto;
}
.tut-navbtn {
  border: 1px solid rgba(0,0,0,.25);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tut-transcript {
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 18px 22px;
  margin-top: 8px;
}
.tut-transcript h3 { margin: 0 0 10px; font-size: 17px; }
.tut-transcript p { font-size: 15.5px; line-height: 1.65; margin: 0 0 12px; }
.tut-transcript p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .tut-head h2 { font-size: 21px; }
  .tut-launch-button { margin-left: 0; margin-top: 8px; }
  .tut-navbtn { max-width: 34%; font-size: 13px; }
  .tut-ended .tut-navbtn { max-width: none; }
  .tut-ended-title { font-size: 17px; }
  .tut-exit, .tut-back { padding: 10px 14px; font-size: 14px; }
}

/* Track D addition (2026-11-07): per-track group headings in the index. */
.tut-trackhead { margin: 26px auto 10px; }
.tut-trackhead .tut-eyebrow { margin-bottom: 2px; }
.tut-track-title { font-size: 20px; margin: 0; line-height: 1.25; }
.tut-track-meta { font-size: 13px; opacity: .65; margin: 3px 0 0; }
