* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f7f7;
  --node-primary: #fdff00;
  --node-secondary: #ffe599;
  --node-border: #1a1a1a;
  --line: #2b78e4;
  --done-check: #22a55b;
  --text: #1a1a1a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Comic Sans MS", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

/* ---------- header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 32px 24px 24px;
  text-align: center;
}
.site-header h1 { font-size: 2.4rem; font-weight: 800; }
.site-header p { color: #555; margin-top: 4px; }
.progress-wrap {
  margin: 18px auto 0;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 10px;
  background: #e9e9e9;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--done-check);
  border-radius: 999px;
  transition: width .25s ease;
}
.progress-label { font-size: .85rem; color: #555; white-space: nowrap; }
.reset-btn {
  font-size: .75rem;
  color: #888;
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.reset-btn:hover { color: #c0392b; border-color: #c0392b; }

/* ---------- roadmap canvas ---------- */
.roadmap {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 16px 120px;
}
.connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.roadmap-content { position: relative; z-index: 1; }
.loading { text-align: center; color: #888; padding: 40px; }

/* ---------- sections ---------- */
.section { margin-bottom: 64px; }
.section-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 28px;
}
.section-note {
  background: #fff;
  border: 2px solid var(--node-border);
  border-radius: 10px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.12);
  max-width: 380px;
  margin: 0 auto 28px;
  padding: 14px 18px;
  font-size: .9rem;
  color: #444;
}

/* each row: left column | trunk | right column */
.node-row {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px) 1fr;
  gap: 16px 40px;
  align-items: center;
  margin-bottom: 36px;
}
.side-col { display: flex; flex-direction: column; gap: 12px; }
.side-col.left  { align-items: flex-end; }
.side-col.right { align-items: flex-start; }

/* ---------- nodes ---------- */
.node {
  position: relative;
  display: inline-block;
  border: 2px solid var(--node-border);
  border-radius: 8px;
  padding: 11px 34px 11px 18px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,.15);
  transition: transform .08s ease, opacity .2s ease;
  text-align: center;
  min-width: 180px;
  user-select: none;
}
.node:hover { transform: translateY(-1px); box-shadow: 4px 4px 0 rgba(0,0,0,.18); }
.node.primary { background: var(--node-primary); width: 100%; }
.node.secondary { background: var(--node-secondary); min-width: 160px; max-width: 280px; }

.node .check {
  position: absolute;
  top: 50%;
  right: -11px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #cfcfcf;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: transparent;
  line-height: 1;
}
.node.done { opacity: .55; }
.node.done .node-title { text-decoration: line-through; text-decoration-thickness: 2px; }
.node.done .check {
  background: var(--done-check);
  border-color: var(--done-check);
  color: #fff;
}

/* ---------- side panel ---------- */
.panel[hidden], .panel-overlay[hidden] { display: none; }

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 48, 60, .55);
  z-index: 40;
}
.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: #fff;
  z-index: 50;
  box-shadow: -8px 0 30px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  animation: slide-in .18s ease;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 0;
}
.panel-status {
  font: inherit;
  font-size: .85rem;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.panel-close {
  font-size: 1.3rem;
  width: 34px;
  height: 34px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}
.panel-close:hover { background: #f0f0f0; }

.panel-body { padding: 12px 28px 40px; overflow-y: auto; }
.panel-body h2 { font-size: 1.9rem; font-weight: 800; margin-bottom: 14px; }
.panel-body p { margin-bottom: 12px; color: #333; }

.resources-box {
  margin-top: 20px;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  padding: 18px 20px;
}
.resources-box h3 { color: #1f9d55; font-size: 1rem; margin-bottom: 12px; }
.resource-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.resource-item a { color: #1a1a1a; font-weight: 600; }
.badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.badge.oficial { background: #2563eb; color: #fff; }
.badge.artigo  { background: #fbcf33; color: #1a1a1a; }
.badge.video   { background: #d9b8f5; color: #3b1d5e; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .node.primary { width: auto; min-width: 240px; }

  /* nó principal centralizado, sub-itens sempre depois dele, alternando esquerda/direita */
  .node-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .side-col.left, .side-col.right, .center-col { display: contents; }
  .node.primary { order: 0; align-self: center; }
  .node[data-child-index="1"] { order: 1; align-self: flex-start; }
  .node[data-child-index="2"] { order: 2; align-self: flex-end; }
  .node[data-child-index="3"] { order: 3; align-self: flex-start; }
  .node[data-child-index="4"] { order: 4; align-self: flex-end; }
  .node[data-child-index="5"] { order: 5; align-self: flex-start; }

  /* indicador de status sempre no lado oposto ao alinhamento do card */
  .node[data-child-index="2"] .check,
  .node[data-child-index="4"] .check {
    left: -11px;
    right: auto;
  }
}

/* ---------- paywall / locked content ---------- */
.section.locked { opacity: .5; }
.section.locked .section-title { color: #888; }
.lock-icon { font-size: 1rem; }

.node.locked { cursor: pointer; }
.node.locked .check { color: #888; }

.paywall-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 48px 0 56px;
}
.paywall-divider::before,
.paywall-divider::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--node-border);
}
.paywall-divider-cta {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
}
.paywall-divider-text {
  font-weight: 700;
  color: #555;
  font-size: .95rem;
  white-space: nowrap;
}
.paywall-divider-btn {
  display: inline-block;
  background: var(--node-primary);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 10px;
  border: 2px solid var(--node-border);
  white-space: nowrap;
}
.paywall-divider-btn:hover { background: #f5f600; }

@media (max-width: 760px) {
  .paywall-divider { margin: 36px 0 44px; }
  .paywall-divider-cta,
  .paywall-divider-text,
  .paywall-divider-btn {
    white-space: normal;
    text-align: center;
  }
}

.paywall-modal .panel-body { text-align: left; }
.paywall-badge {
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .85rem;
}
.paywall-cta {
  display: inline-block;
  margin-top: 10px;
  background: var(--node-primary);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  padding: 14px 22px;
  border-radius: 10px;
  border: 2px solid var(--node-border);
}
.paywall-cta:hover { background: #f5f600; }
