/* Lessons 3 and 4: harmonize the procedure part by part; what complexity costs.
   Six area colours from the MArK blues and the logo's tile tints. */
:root {
  --l3h-a0: #0070c0; --l3h-a1: #65c7f7; --l3h-a2: #0b3760; --l3h-a3: #578ee3; --l3h-a4: #b0ccf3; --l3h-a5: #1d6fbc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --l3h-a0: #2e90de; --l3h-a2: #c3dcef; --l3h-a5: #1565c0; }
}
:root[data-theme='dark'] { --l3h-a0: #2e90de; --l3h-a2: #c3dcef; --l3h-a5: #1565c0; }

.l3h, .l4c { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 1rem; font-family: var(--font); color: var(--ink); }
.l3h-cap, .l4c-cap { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--blue2); margin-bottom: 0.35rem; }
.l3h-num, .l4c-num { display: block; font-size: 3.2rem; font-weight: 800; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--blue2); }
.l3h-num { background: linear-gradient(90deg, var(--blue1) 0%, var(--blue3) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.l3h-num.bump { animation: l34Bump 0.5s ease; }
@keyframes l34Bump { 40% { transform: scale(1.04); } }
.l4c-num.neg { color: var(--ink); }

/* Lesson 3: the tiles on the left, what to harmonize on the right. */
.l3h-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 12.5rem; gap: 0.9rem; }
.l3h-stage { position: relative; min-height: 18rem; border-radius: 1.2rem; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0.5rem 1.6rem rgba(0, 112, 192, 0.07); overflow: hidden; transition: border-color 0.4s, box-shadow 0.4s; }
.l3h-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.l3h.complete .l3h-stage { border-color: var(--blue2); box-shadow: 0 0.8rem 2.4rem rgba(0, 112, 192, 0.18); }
.l3h-opts { display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; }
.l3h-opt {
  display: flex; align-items: center; gap: 0.55rem; text-align: left; width: 100%;
  padding: 0.55rem 0.7rem; border-radius: 0.7rem; border: 1px solid var(--line-strong); background: var(--panel-solid);
  font: 600 0.8rem/1.25 var(--font); color: var(--ink); cursor: pointer; transition: border-color 0.2s, background 0.2s, opacity 0.3s;
}
.l3h-opt i { flex: none; width: 0.85rem; height: 0.85rem; border-radius: 0.25rem; }
.l3h-opt:hover, .l3h-opt:focus-visible { border-color: var(--blue2); }
.l3h-opt.done { opacity: 0.55; border-style: dashed; cursor: default; }
.l3h-opt.done span::after { content: ' ✓'; color: var(--blue2); font-weight: 800; }
.l3h-all {
  margin-top: 0.3rem; padding: 0.7rem 0.9rem; border-radius: 0.7rem; border: 0; cursor: pointer;
  background: var(--blue2); color: #fff; font: 700 0.85rem var(--font); letter-spacing: 0.04em;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 112, 192, 0.25);
}
.l3h-all:hover { background: var(--blue3); }
.l3h-all:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.l3h-again { align-self: flex-start; border: 0; background: none; padding: 0.3rem 0.2rem; font: 700 0.82rem var(--font); color: var(--blue2); cursor: pointer; border-radius: 0.5rem; }

/* Lesson 4: what complexity costs. */
.l4c { gap: 1rem; overflow: auto; }
.l4c-goal { display: flex; align-items: center; gap: 0.9rem; }
.l4c-track { position: relative; flex: 1; height: 0.6rem; border-radius: 999px; background: var(--line); }
.l4c-track i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--blue2); transition: width 0.2s; }
.l4c-tick { position: absolute; left: 80%; top: -0.35rem; bottom: -0.35rem; width: 0.14rem; border-radius: 0.1rem; background: var(--ink); opacity: 0.55; }
.l4c-chip { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.3rem 0.65rem; border-radius: 0.45rem; color: var(--blue2); background: rgba(0, 112, 192, 0.1); white-space: nowrap; transition: background 0.3s, color 0.3s; }
.l4c.reached .l4c-chip { background: var(--blue2); color: #fff; }
.l4c.reached .l4c-tick { opacity: 0; }
.l4c-controls { display: grid; gap: 0.8rem; }
.l4c-slider { display: grid; gap: 0.3rem; }
.l4c-row { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; }
.l4c-row b { font-weight: 800; color: var(--blue2); font-variant-numeric: tabular-nums; }
.l4c-slider input { width: 100%; accent-color: var(--blue2); height: 1.4rem; margin: 0; }
.l4c-kept { display: flex; justify-content: space-between; margin: 0; padding: 0.55rem 0.8rem; border-radius: 0.7rem; border: 1px dashed var(--line-strong); font-size: 0.85rem; font-weight: 600; }
.l4c-kept b { font-weight: 800; color: var(--ink); }
.l4c-steps { display: grid; gap: 0.45rem; }
.l4c-tiles { display: flex; flex-wrap: wrap; gap: 0.22rem; min-height: 0.7rem; }
.l4c-tiles i { width: 0.7rem; height: 0.7rem; border-radius: 0.2rem; background: var(--ink); opacity: 0.22; animation: l4cIn 0.3s ease both; }
.l4c-tiles i.core { background: var(--blue2); opacity: 1; }
@keyframes l4cIn { from { transform: scale(0.4); opacity: 0; } }
.l4c-bars { display: grid; gap: 0.45rem; }
.l4c-bar { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 4.4rem; align-items: center; gap: 0.7rem; font-size: 0.85rem; font-weight: 600; }
.l4c-bar small { font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.l4c-bar i { height: 0.9rem; border-radius: 0.45rem; background: var(--line); overflow: hidden; }
.l4c-bar em { display: block; height: 100%; border-radius: 0.45rem; transition: width 0.2s; }
.l4c-bar.gross em { background: var(--blue2); }
.l4c-bar.train em { background: var(--ink); opacity: 0.35; }
.l4c-bar.run em { background: var(--ink); opacity: 0.2; }
.l4c-bar b { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.l4c-steppers { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.l4c-step { display: inline-flex; align-items: center; gap: 0.4rem; }
.l4c-step button { width: 1.6rem; height: 1.6rem; border-radius: 0.55rem; border: 1px solid var(--line-strong); background: var(--panel-solid); color: var(--ink); font: 700 0.9rem var(--font); cursor: pointer; }
.l4c-step button:hover { border-color: var(--blue2); }
.l4c-step b { min-width: 1.8rem; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .l3h, .l4c { position: relative; inset: auto; min-height: 100%; }
  .l3h-num, .l4c-num { font-size: 2.4rem; }
  .l3h-body { grid-template-columns: minmax(0, 1fr); }
  .l3h-stage { min-height: 16rem; }
  .l3h-opts { display: grid; grid-template-columns: 1fr 1fr; }
  .l3h-all, .l3h-again { grid-column: 1 / -1; }
  .l4c-bar { grid-template-columns: 7rem minmax(0, 1fr) 3.8rem; font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) {
  .l4c-track i, .l4c-bar em { transition: none; }
  .l4c-tiles i, .l3h-num.bump { animation: none; }
}
