/* The lesson demo. Plays a real lesson from the academy, with its real voice
   and its real word timings. Layouts here mirror the ones the academy draws. */

.demo { display: grid; gap: 14px; min-width: 0; }
.demo > * { min-width: 0; }

.demo__stage {
  position: relative; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9;
}

.demo__scene { position: absolute; inset: 0; }
.ly { position: absolute; inset: 0; padding: 26px 30px; display: flex; flex-direction: column; }
.ly__h {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 14px; flex: none;
}

/* TitleCard */
.ly--title { align-items: flex-start; justify-content: center; gap: 10px; }
.ly__title { font-size: clamp(22px, 3.6vw, 40px); letter-spacing: -0.03em; line-height: 1.05; max-width: 16ch; }
.ly__sub { color: var(--ink-soft); font-size: clamp(13px, 1.5vw, 17px); }

/* LabeledDiagram */
.ly__canvas { position: relative; flex: 1; }
.ly__edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.ly__edge { stroke: var(--line-strong); stroke-width: 1.5; }
.ly__node {
  position: absolute; transform: translate(-50%, -50%); text-align: center;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; min-width: 88px; transition: border-color .3s, box-shadow .3s, opacity .4s, transform .4s;
}
.ly__node-l { display: block; font-weight: 800; font-size: clamp(11px, 1.3vw, 14px); letter-spacing: -.01em; }
.ly__node-s { display: block; font-size: clamp(9px, 1vw, 11.5px); color: var(--ink-faint); margin-top: 2px; }
.ly__node.is-lit { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.ly__node.is-lit .ly__node-l { color: var(--c); }

/* CompareTable */
.ly__tbl { width: 100%; border-collapse: collapse; font-size: clamp(11px, 1.3vw, 14px); }
.ly__tbl th, .ly__tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.ly__tbl thead th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
                    text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }
.ly__tbl tbody th { color: var(--ink-soft); font-weight: 600; width: 27%; }
.ly__tbl tbody td { color: var(--ink); }
.ly__tbl tbody tr { transition: background .3s; border-radius: 8px; }
.ly__tbl tbody tr.is-lit { background: var(--green-soft); }
.ly__tbl tbody tr.is-lit th, .ly__tbl tbody tr.is-lit td { color: var(--green); }

/* StepThrough */
.ly__steplist { display: grid; gap: 8px; align-content: center; flex: 1; }
.ly__step {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: baseline;
  padding: 9px 12px; border-radius: 10px; border: 1px solid transparent;
  transition: background .3s, border-color .3s, opacity .4s, transform .4s;
}
.ly__step-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.ly__step-t { font-size: clamp(12px, 1.4vw, 15px); display: inline; }
.ly__step-d { color: var(--ink-soft); font-size: clamp(11px, 1.25vw, 13.5px); display: inline; }
.ly__step-d::before { content: " \2014  "; }
.ly__step.is-lit { background: var(--green-soft); border-color: rgba(52,210,122,.3); }
.ly__step.is-lit .ly__step-n { color: var(--green); }

/* Parts fade in as the voice reaches them. */
.ly__node, .ly__step, .ly__tbl tbody tr { opacity: .3; }
.ly__node.is-seen, .ly__step.is-seen, .ly__tbl tbody tr.is-seen { opacity: 1; }

/* --- the play gate: browsers will not start sound on their own --- */
.demo__gate {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  background: rgba(13,15,15,.72); backdrop-filter: blur(3px); border: 0;
  color: var(--ink); font: inherit; transition: opacity .35s, visibility .35s;
}
.demo__gate.is-gone { opacity: 0; visibility: hidden; }
.demo__gate-btn {
  width: 56px; height: 56px; border-radius: 99px; display: grid; place-items: center;
  background: var(--green); color: var(--on-green); transition: transform .18s, background .18s;
}
.demo__gate:hover .demo__gate-btn { background: var(--green-hover); transform: scale(1.06); }
.demo__gate-t { font-weight: 800; font-size: 15px; }
.demo__gate-s { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); letter-spacing: .05em; }

/* --- captions: the real words, lit as they are actually spoken --- */
.demo__caption {
  height: 76px; overflow-y: auto; padding: 12px 14px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14.5px; line-height: 1.55; color: var(--ink-faint); scrollbar-width: thin;
}
.demo__caption w { transition: color .1s; }
.demo__caption w.said { color: var(--ink-soft); }
.demo__caption w.on { color: var(--green); font-weight: 700; }

/* --- controls --- */
.demo__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo__track { flex: 1 1 100px; height: 5px; background: var(--raised); border-radius: 99px; overflow: hidden; min-width: 80px; }
.demo__fill { height: 100%; width: 0; background: var(--green); border-radius: 99px; transition: width .15s linear; }
.demo__time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.demo__dots { display: flex; gap: 5px; align-items: center; }
.demo__dot {
  width: 8px; height: 8px; border-radius: 99px; background: var(--raised);
  border: 1px solid var(--line-strong); cursor: pointer; transition: all .2s;
}
.demo__dot.is-q { border-radius: 2px; }
.demo__dot.is-done { background: var(--ink-faint); border-color: var(--ink-faint); }
.demo__dot.is-on { background: var(--green); border-color: var(--green); transform: scale(1.25); }

.play { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; flex: none;
        background: var(--green); color: var(--on-green); border: 0; cursor: pointer; }
.play:hover { background: var(--green-hover); }

/* --- the question: it waits for you --- */
.demo__checkin {
  position: absolute; inset: 0; background: var(--panel-2);
  padding: 26px 30px; display: none; flex-direction: column; justify-content: center; gap: 10px;
  /* A long question with four options can exceed a 16:9 box on narrow screens.
     Never clip the options — scroll instead. */
  overflow-y: auto;
}
.demo__checkin.is-live { display: flex; }
.demo__q { font-size: clamp(15px, 2vw, 20px); font-weight: 800; letter-spacing: -.01em; max-width: 30ch; }
.demo__opts { display: grid; gap: 7px; max-width: 460px; }
.opt {
  text-align: left; padding: 10px 13px; border-radius: 10px; background: var(--raised);
  border: 1px solid var(--line-strong); color: var(--ink); font: inherit;
  font-size: clamp(12px, 1.4vw, 13.5px); cursor: pointer; transition: all .15s;
}
.opt:hover:not(:disabled) { border-color: var(--orange); }
.opt:disabled { cursor: default; }
.opt.is-right { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 700; }
.opt.is-wrong { background: rgba(255,122,84,.12); border-color: var(--orange); color: var(--orange); }
.demo__verdict { font-size: 13px; color: var(--ink-soft); min-height: 1em; }

.demo__note { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); letter-spacing: .02em; }

/* --- "the same idea, four ways" --- */
.rw { display: grid; gap: 12px; }
.rw__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 13px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--raised); color: var(--ink-soft); font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.chip.is-on { background: var(--green-soft); border-color: rgba(52,210,122,.45); color: var(--green); }
.rw__body { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; }
.rw__meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
            color: var(--green); margin-bottom: 10px; }
.rw__text { font-size: clamp(15px, 1.9vw, 18px); line-height: 1.55; }

@media (max-width: 620px) {
  .demo__stage { aspect-ratio: 4 / 3; }
  .demo__q { font-size: 14px; }
  .opt { padding: 8px 11px; }
  .ly, .demo__checkin { padding: 16px 18px; }
  .ly__node { padding: 6px 8px; min-width: 64px; }
  .ly__step-d { display: none; }
  .demo__caption { height: 92px; }
}
