/* Treino interativo: Harness e Loop (prefixo hl-) */
:root {
  --hl-harness: #f97316;
  --hl-harness-soft: #fff4e8;
  --hl-loop: #6d28d9;
  --hl-loop-soft: #f3edff;
  --hl-ok: #12805c;
  --hl-ok-soft: #e7f7f0;
  --hl-bad: #b42318;
  --hl-bad-soft: #fdecea;
  --hl-border: #e4e7ec;
}

/* ---------- Tracker de progresso ---------- */
.hl-tracker {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 28px 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--hl-border);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(6px);
}

.hl-tracker-steps {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.hl-tracker-steps li {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--hl-border);
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  background: #fff;
  transition: all 0.25s ease;
}

.hl-tracker-steps li.is-done {
  background: var(--hl-ok);
  border-color: var(--hl-ok);
  color: #fff;
}

.hl-tracker-bar {
  flex: 1 1 160px;
  min-width: 140px;
}

.hl-tracker-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 6px;
}

.hl-bar {
  height: 10px;
  border-radius: 999px;
  background: #eef1f6;
  overflow: hidden;
}

.hl-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hl-harness), var(--hl-loop));
  transition: width 0.45s ease;
}

/* ---------- Missões ---------- */
.hl-mission {
  margin: 44px 0;
  padding: 30px;
  border: 1px solid var(--hl-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.07);
  scroll-margin-top: 90px;
}

.hl-mission.is-complete {
  border-color: #9bd8bf;
}

.hl-mission-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hl-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.hl-mission.is-complete .hl-badge {
  background: var(--hl-ok-soft);
  color: var(--hl-ok);
}

.hl-mission h3 {
  margin: 0;
}

.hl-mission-goal {
  margin: 6px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.hl-status {
  margin-top: 18px;
  font-weight: 700;
  color: var(--blue-dark);
}

.hl-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 12px 22px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  transition: transform 0.15s ease, background 0.2s ease;
}

.hl-btn:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.hl-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hl-btn--ghost {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--blue);
}

.hl-btn--ghost:hover:not(:disabled) {
  background: var(--blue-soft);
}

:where(.hl-btn, .hl-explore-btn, .hl-opt, .hl-step-btn, .hl-switch input):focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

/* ---------- Missão 1: explorar o harness ---------- */
.hl-explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.hl-explore-btn {
  appearance: none;
  text-align: left;
  cursor: pointer;
  padding: 14px 16px;
  border: 2px solid #fed7aa;
  border-radius: 14px;
  background: var(--hl-harness-soft);
  font: inherit;
  color: var(--text);
  display: flex;
  gap: 10px;
  align-items: center;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.hl-explore-btn i {
  color: var(--hl-harness);
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.hl-explore-btn strong {
  display: block;
  font-size: 15px;
}

.hl-explore-btn span {
  font-size: 12.5px;
  color: var(--muted);
}

.hl-explore-btn:hover {
  transform: translateY(-2px);
}

.hl-explore-btn.is-active {
  border-color: var(--hl-harness);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.hl-explore-btn.is-visited::after {
  content: "\2713";
  margin-left: auto;
  color: var(--hl-ok);
  font-weight: 900;
}

.hl-explore-panel {
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: 16px;
  background: #fffaf4;
  border: 1px dashed #fdba74;
  min-height: 120px;
  line-height: 1.65;
}

.hl-explore-panel h4 {
  margin: 0 0 8px;
  color: var(--hl-harness);
  font-size: 18px;
}

.hl-explore-panel .hl-without {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--hl-bad-soft);
  color: var(--hl-bad);
  font-size: 14.5px;
}

/* ---------- Missão 2: montar o loop ---------- */
.hl-order {
  display: grid;
  gap: 18px;
}

.hl-order-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  counter-reset: slot;
}

.hl-slot {
  counter-increment: slot;
  min-height: 92px;
  padding: 12px 14px;
  border: 2px dashed #c7b6f2;
  border-radius: 14px;
  background: var(--hl-loop-soft);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.hl-slot::before {
  content: counter(slot) "\00ba passo";
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--hl-loop);
  margin-bottom: 4px;
}

.hl-slot.is-filled {
  border-style: solid;
  border-color: var(--hl-loop);
  color: var(--text);
  background: #fff;
}

.hl-slot.is-filled strong {
  display: block;
  color: var(--hl-loop);
}

.hl-order-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hl-step-btn {
  appearance: none;
  cursor: pointer;
  padding: 12px 18px;
  border: 2px solid var(--hl-loop);
  border-radius: 12px;
  background: #fff;
  color: var(--hl-loop);
  font: inherit;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.2s ease;
}

.hl-step-btn:hover:not(:disabled) {
  background: var(--hl-loop-soft);
  transform: translateY(-1px);
}

.hl-step-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.hl-step-btn.is-shake {
  animation: hl-shake 0.35s ease;
  border-color: var(--hl-bad);
  color: var(--hl-bad);
}

@keyframes hl-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.hl-hint {
  min-height: 24px;
  font-size: 14.5px;
  color: var(--muted);
}

/* ---------- Casos de múltipla escolha (missões 3 e 5) ---------- */
.hl-case {
  margin: 0 0 14px;
  padding: 18px 20px;
  border: 1px solid var(--hl-border);
  border-radius: 16px;
  background: #fcfcfd;
}

.hl-case-text {
  margin: 0 0 12px;
  font-weight: 600;
  line-height: 1.55;
}

.hl-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hl-opt {
  appearance: none;
  cursor: pointer;
  padding: 10px 16px;
  border: 2px solid var(--hl-border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.hl-opt:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.hl-opt:disabled {
  cursor: default;
}

.hl-opt.is-correct {
  border-color: var(--hl-ok);
  background: var(--hl-ok-soft);
  color: var(--hl-ok);
}

.hl-opt.is-wrong {
  border-color: var(--hl-bad);
  background: var(--hl-bad-soft);
  color: var(--hl-bad);
}

.hl-explain {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--blue-soft);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---------- Missão 4: simulador ---------- */
.hl-sim-task {
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--blue-soft);
  line-height: 1.6;
  margin-bottom: 18px;
}

.hl-switches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.hl-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: var(--hl-harness-soft);
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
}

.hl-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--hl-harness);
}

.hl-sim-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hl-terminal {
  min-height: 220px;
  max-height: 460px;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13.5px;
  line-height: 1.7;
}

.hl-terminal p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hl-terminal .t-muted { color: #94a3b8; }
.hl-terminal .t-plan { color: #c4b5fd; }
.hl-terminal .t-exec { color: #7dd3fc; }
.hl-terminal .t-eval { color: #fde68a; }
.hl-terminal .t-learn { color: #86efac; }
.hl-terminal .t-ok { color: #4ade80; font-weight: 700; }
.hl-terminal .t-err { color: #f87171; font-weight: 700; }

.hl-verdict {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  line-height: 1.6;
  font-weight: 600;
}

.hl-verdict.is-ok { background: var(--hl-ok-soft); color: var(--hl-ok); }
.hl-verdict.is-bad { background: var(--hl-bad-soft); color: var(--hl-bad); }

/* ---------- Certificado ---------- */
.hl-cert {
  margin: 44px 0;
  padding: 34px 30px;
  border-radius: 22px;
  text-align: center;
  border: 2px dashed var(--hl-border);
  background: #fcfcfd;
}

.hl-cert.is-unlocked {
  border: 2px solid var(--hl-harness);
  background: linear-gradient(135deg, var(--hl-harness-soft), var(--hl-loop-soft));
}

.hl-cert i {
  font-size: 40px;
  color: var(--muted);
  margin-bottom: 12px;
}

.hl-cert.is-unlocked i {
  color: var(--hl-harness);
}

.hl-cert h3 {
  margin: 0 0 8px;
}

.hl-cert-rank {
  font-size: 26px;
  font-weight: 800;
  color: var(--hl-loop);
  margin: 6px 0;
}

@media (max-width: 640px) {
  .hl-mission { padding: 22px 16px; }
  .hl-tracker { padding: 12px; gap: 12px; }
  .hl-tracker-steps li { width: 30px; height: 30px; }
  .hl-case { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .hl-bar-fill, .hl-step-btn, .hl-explore-btn { transition: none; }
  .hl-step-btn.is-shake { animation: none; }
}

/* ---------- Ajustes de especificidade (o tema do artigo estiliza ".content p") ---------- */
.post-detail .content .hl-terminal {
  padding: 18px 20px;
  border: 1px solid #1e293b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 12px 30px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  line-height: 1.6;
}

.post-detail .content .hl-terminal p {
  margin: 0 0 3px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
}

.post-detail .content .hl-terminal p.t-muted { color: #94a3b8; }
.post-detail .content .hl-terminal p.t-plan { color: #c4b5fd; }
.post-detail .content .hl-terminal p.t-exec { color: #7dd3fc; }
.post-detail .content .hl-terminal p.t-eval { color: #fde68a; }
.post-detail .content .hl-terminal p.t-learn { color: #86efac; }
.post-detail .content .hl-terminal p.t-ok { color: #4ade80; font-weight: 700; margin-top: 8px; }
.post-detail .content .hl-terminal p.t-err { color: #fca5a5; font-weight: 700; }

/* separador de ciclo mais visível */
.post-detail .content .hl-terminal p.t-muted:not(:first-child) {
  margin-top: 8px;
}

.post-detail .content .hl-case-text,
.post-detail .content .hl-explain,
.post-detail .content .hl-mission-goal,
.post-detail .content .hl-hint,
.post-detail .content .hl-status,
.post-detail .content .hl-verdict,
.post-detail .content .hl-cert p {
  font-size: 15.5px;
  line-height: 1.6;
}

.post-detail .content .hl-case-text { margin: 0 0 12px; color: var(--text); }
.post-detail .content .hl-explain { margin: 12px 0 0; color: var(--blue-dark); }
.post-detail .content .hl-mission-goal { margin: 6px 0 22px; color: var(--muted); }
.post-detail .content .hl-hint { margin: 0; color: var(--muted); }
.post-detail .content .hl-status { margin: 18px 0 0; color: var(--blue-dark); }
.post-detail .content .hl-verdict { margin: 16px 0 0; }
.post-detail .content .hl-verdict.is-ok { color: var(--hl-ok); }
.post-detail .content .hl-verdict.is-bad { color: var(--hl-bad); }
.post-detail .content .hl-cert p { margin: 0 0 10px; color: var(--muted); }
.post-detail .content .hl-cert .hl-cert-rank { color: var(--hl-loop); font-size: 26px; }
.post-detail .content .hl-explore-panel p { margin: 0 0 10px; font-size: 15.5px; line-height: 1.65; }
.post-detail .content .hl-explore-panel .hl-without { color: var(--hl-bad); font-size: 14.5px; margin: 10px 0 0; }
.post-detail .content .hl-sim-task { font-size: 15.5px; margin-bottom: 18px; }
.post-detail .content .hl-mission h3 { margin: 0; }

@media (max-width: 640px) {
  .post-detail .content .hl-terminal,
  .post-detail .content .hl-terminal p { font-size: 13px; }
}
