/* ==========================================================================
   "You be the evaluator": micro-lesson styles.
   Uses only tokens from styles.css. No transitions or animations,
   so prefers-reduced-motion is respected by default.
   ========================================================================== */

.lesson {
  --ls-on-accent: #ffffff;
  max-width: 920px;
  margin: 0 auto;
  min-width: 0;
}
:root[data-theme="dark"] .lesson { --ls-on-accent: #14110f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lesson { --ls-on-accent: #14110f; }
}

.ls-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--text);
}

/* ---------- Console header strip ---------- */

.ls-console {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 18px;
  background: var(--console);
  color: var(--console-text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ls-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lane-training);
  box-shadow: 0 0 0 2px rgba(224, 104, 90, 0.25);
}
.ls-console-tag { color: var(--console-muted); font-weight: 600; }
.ls-console-sep { color: var(--console-muted); }
.ls-console-title { color: var(--console-text); font-weight: 600; }
.ls-console-time { color: var(--lane-sound); font-weight: 600; }

/* ---------- Body ---------- */

.ls-body { padding: clamp(18px, 4vw, 32px); }
.ls-body > * + * { margin-top: 0; }

.ls-eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 6px;
}

.ls-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.2;
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}
.ls-title:focus { outline: none; }
.ls-title:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.ls-case-q { color: var(--text-muted); font-weight: 500; }

.ls-sub {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 22px 0 10px;
}

.ls-objective {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.5;
  max-width: 60ch;
  margin-bottom: 10px;
}
.ls-stake { color: var(--text-muted); max-width: 60ch; margin-bottom: 0; }

/* ---------- Rubric chips ---------- */

.ls-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px) { .ls-rules { grid-template-columns: minmax(0, 1fr); } }

.ls-rule {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ls-rule-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls-rule-body span { color: var(--text-muted); }

.ls-rule-id {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  line-height: 1.5;
}

/* ---------- Buttons ---------- */

.ls-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.ls-actions:empty { display: none; }

.ls-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.ls-btn-primary { background: var(--accent); color: var(--ls-on-accent); }
.ls-btn-primary:hover { text-decoration: underline; text-underline-offset: 3px; }
.ls-btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.ls-btn-ghost:hover { background: var(--surface-2); }

@media (max-width: 480px) {
  .ls-actions .ls-btn { width: 100%; }
}

/* ---------- Progress meter ---------- */

.ls-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ls-meter {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 5px;
  flex: 1 1 140px;
  max-width: 260px;
}
.ls-seg {
  flex: 1 1 0;
  min-width: 0;
  height: 22px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.ls-seg.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ls-seg.done-good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.ls-seg.done-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.ls-progress-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ls-case-id { font-family: var(--font-mono); letter-spacing: 0.08em; }

/* ---------- Note / rewrite panels ---------- */

.ls-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 4px 0 20px;
}
@media (min-width: 720px) {
  .ls-panels { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
}

.ls-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px 18px;
  min-width: 0;
}
.ls-panel-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Principal's note: existing serif, italic, on ruled paper. */
.ls-note {
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(1.75rem - 1px),
    var(--border) calc(1.75rem - 1px),
    var(--border) 1.75rem
  );
  background-position: 0 2.35rem;
  border-left: 4px solid var(--lane-sound);
}
.ls-note-text {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.75rem;
  overflow-wrap: anywhere;
}

.ls-rewrite {
  background: var(--surface);
  border-left: 4px solid var(--lane-ai);
}
.ls-rewrite-text {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.75rem;
  overflow-wrap: anywhere;
}

/* ---------- Highlights ---------- */

.ls-body mark.ls-mark {
  background: var(--warn-soft);
  color: var(--text);
  font-weight: 700;
  font-style: normal;
  padding: 1px 3px;
  margin: 0 -1px;
  border-radius: 3px;
  border-bottom: 2px solid var(--warn);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.ls-body mark.ls-mark-neutral {
  background: var(--surface);
  border: 1px solid var(--text-muted);
  border-bottom: 2px dashed var(--text-muted);
}
.ls-note mark.ls-mark-neutral { background: var(--surface); }

/* ---------- Answer buttons ---------- */

.ls-answers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@media (min-width: 560px) {
  .ls-answers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.ls-answer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ls-answer:hover { background: var(--surface-2); border-color: var(--text-muted); }
.ls-answer-main { font-size: 1.1rem; font-weight: 700; }
.ls-answer-sub { font-size: 0.86rem; color: var(--text-muted); }

.ls-answer.is-locked { cursor: default; }
.ls-answer.is-locked:not(.is-correct):not(.is-wrong) { opacity: 0.75; }
.ls-answer.is-locked:not(.is-correct):not(.is-wrong):hover { background: var(--surface); border-color: var(--border); }
.ls-answer.is-correct,
.ls-answer.is-correct:hover { background: var(--good-soft); border-color: var(--good); }
.ls-answer.is-correct .ls-answer-main { color: var(--good); }
.ls-answer.is-wrong,
.ls-answer.is-wrong:hover { background: var(--warn-soft); border-color: var(--warn); }
.ls-answer.is-wrong .ls-answer-main { color: var(--warn); }

/* ---------- Feedback ---------- */

.ls-feedback { margin-top: 18px; }
.ls-feedback:empty { display: none; }

.ls-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 1.02rem;
  border-left: 4px solid;
}
.ls-banner.is-good { background: var(--good-soft); border-color: var(--good); }
.ls-banner.is-good strong { color: var(--good); }
.ls-banner.is-warn { background: var(--warn-soft); border-color: var(--warn); }
.ls-banner.is-warn strong { color: var(--warn); }

.ls-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
}
.ls-icon.is-good { background: var(--good); color: var(--surface); }
.ls-icon.is-warn { background: var(--warn); color: var(--surface); }

.ls-why { margin: 0 0 12px; max-width: 64ch; }
.ls-rule-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 8px;
  font-size: 0.94rem;
  color: var(--text-muted);
}
.ls-rule-line strong { color: var(--text); }
.ls-rule-line.is-clear .ls-rule-id { background: var(--good); color: var(--surface); }
.ls-mark-hint { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

/* Checker reveal */
.ls-checker {
  margin-top: 18px;
  padding: 14px 16px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ls-checker .ls-sub { margin-top: 0; }
.ls-badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ls-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.92rem;
  font-weight: 600;
}
.ls-badge.is-good { background: var(--good-soft); border-color: var(--good); }
.ls-badge.is-warn { background: var(--warn-soft); border-color: var(--warn); }
.ls-badge-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--console);
  color: var(--console-text);
}
.ls-checker-note { margin: 10px 0 0; font-size: 0.84rem; color: var(--text-muted); }

/* ---------- Results ---------- */

.ls-scores {
  display: grid;
  gap: 8px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  background: var(--console);
  color: var(--console-text);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.ls-score-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
}
.ls-score-label { color: var(--console-muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; }
.ls-score-num { font-weight: 600; white-space: nowrap; }
.ls-pips { display: flex; gap: 5px; }
.ls-pip {
  flex: 1 1 0;
  max-width: 56px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.ls-pip.on.is-you { background: var(--lane-sound); border-color: var(--lane-sound); }
.ls-pip.on.is-v { background: var(--lane-ai); border-color: var(--lane-ai); }

.ls-compare { font-size: 1.05rem; max-width: 64ch; margin-bottom: 14px; }

.ls-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 0 0 16px;
}
.ls-recap,
.ls-gagne {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.ls-recap caption,
.ls-gagne caption {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ls-recap th,
.ls-recap td,
.ls-gagne th,
.ls-gagne td {
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.ls-recap tr:last-child > *,
.ls-gagne tr:last-child > * { border-bottom: 0; }
.ls-recap thead th,
.ls-gagne thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
}
.ls-recap td .ls-icon { vertical-align: -5px; width: 20px; height: 20px; }
.ls-mono { font-family: var(--font-mono); font-weight: 600; }
.ls-gagne tbody th { width: 11em; font-weight: 700; white-space: normal; }
@media (max-width: 480px) {
  .ls-gagne tbody th { width: 8.5em; }
}

.ls-takeaway {
  margin: 18px 0 0;
  padding: 16px 18px;
  background: var(--good-soft);
  border-left: 4px solid var(--good);
  border-radius: var(--radius-sm);
  max-width: 68ch;
}
.ls-takeaway strong { color: var(--good); }

.ls-results-actions { align-items: center; }

/* ---------- "Show the design" ---------- */

.ls-design {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.ls-design > summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
}
.ls-design > summary::-webkit-details-marker { display: none; }
.ls-design > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--console);
  color: var(--console-text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1;
}
.ls-design[open] > summary::before { content: "\2212"; }
.ls-design > summary:hover { background: var(--accent-soft); }
.ls-design > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 999px; }

.ls-design-body { margin-top: 16px; }
.ls-design-lede { color: var(--text-muted); max-width: 64ch; }
.ls-choices { margin: 0; padding-left: 1.2em; max-width: 64ch; }
.ls-choices li { margin-bottom: 6px; }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .ls-console { padding: 10px 14px; }
  .ls-score-row { grid-template-columns: 78px minmax(0, 1fr) auto; gap: 8px; }
  .ls-recap th, .ls-recap td, .ls-gagne th, .ls-gagne td { padding: 8px 10px; }
}

.ls-recap td { white-space: nowrap; }

/* Narrow screens: keep the icon, hide the visible word but leave it for screen readers. */
@media (max-width: 520px) {
  .ls-recap .ls-word {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
