:root {
  /* Base verde — fundos e superfícies */
  --bg-deep: #030806;
  --bg-mid: #06140d;
  --bg-card: #0a1a12;
  --bg-elevated: #0f2418;
  --green-glow: rgba(0, 230, 118, 0.14);
  --accent: #00e676;
  --accent-soft: #34d399;
  --accent-dim: rgba(0, 230, 118, 0.12);
  --accent-border: rgba(0, 230, 118, 0.35);
  --text: #e8f5ef;
  --text-muted: #7a9d8a;
  --border: rgba(0, 230, 118, 0.1);
  --radius: clamp(12px, 2.5vw, 16px);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --touch: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 130% 90% at 50% -25%, var(--green-glow), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(0, 180, 90, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(52, 211, 153, 0.06), transparent),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 45%);
}

.page {
  width: 100%;
  max-width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px) clamp(12px, 4vw, 24px) clamp(40px, 8vw, 80px);
  padding-left: max(clamp(12px, 4vw, 24px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(12px, 4vw, 24px), env(safe-area-inset-right, 0px));
  padding-bottom: max(clamp(40px, 8vw, 80px), env(safe-area-inset-bottom, 0px));
}

header {
  text-align: center;
  margin-bottom: clamp(24px, 5vw, 40px);
  padding-top: max(4px, env(safe-area-inset-top, 0px));
}

header .badge {
  display: inline-block;
  font-size: clamp(10px, 2.2vw, 11px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 12px;
}

header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, #f0fff4 0%, var(--accent-soft) 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: clamp(0.88rem, 2.8vw, 0.95rem);
  padding: 0 4px;
}

header p code {
  font-size: 0.88em;
  color: var(--accent-soft);
  word-break: break-word;
}

.layout {
  display: grid;
  gap: clamp(16px, 3vw, 24px);
  align-items: start;
  min-width: 0;
}

@media (min-width: 880px) {
  .layout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

/* Mobile: lista vertical em cartões — título inteiro visível, sem scroll horizontal */
@media (max-width: 879px) {
  .lesson-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 12px 16px;
    position: static;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 40%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  }

  .lesson-nav h2 {
    display: block;
    margin: 0 0 4px;
    padding: 4px 4px 2px;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--text);
    text-transform: none;
  }

  .lesson-nav h2::after {
    content: "";
    display: block;
    height: 1px;
    margin-top: 10px;
    background: linear-gradient(90deg, var(--accent-border), transparent);
    opacity: 0.6;
  }

  .lesson-btn {
    flex: none;
    width: 100%;
    margin-bottom: 0;
    min-height: 56px;
    align-items: center;
    padding: 14px 14px 14px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    gap: 14px;
  }

  .lesson-btn:hover,
  .lesson-btn:active {
    background: var(--bg-elevated);
    border-color: rgba(0, 230, 118, 0.2);
  }

  .lesson-btn.active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
    box-shadow: 0 0 0 1px rgba(0, 230, 118, 0.15);
    border-left: 4px solid var(--accent);
    padding-left: 9px;
  }

  .lesson-btn .num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    font-size: 0.95rem;
  }

  .lesson-btn .label {
    flex: 1;
    min-width: 0;
    font-size: 0.92rem;
    line-height: 1.4;
  }

  /* Indica que o cartão é tocável */
  .lesson-btn::after {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin-left: 4px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    opacity: 0.45;
  }

  .lesson-btn.active::after {
    border-color: var(--accent);
    opacity: 0.9;
  }
}

.lesson-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}

@media (min-width: 880px) {
  .lesson-nav {
    position: sticky;
    top: max(12px, env(safe-area-inset-top, 0px));
  }
}

.lesson-nav h2 {
  margin: 0 0 12px;
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lesson-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: clamp(0.85rem, 2.4vw, 0.92rem);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.lesson-btn:last-child {
  margin-bottom: 0;
}

.lesson-btn:hover {
  background: var(--bg-elevated);
}

.lesson-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lesson-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.lesson-btn .num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  min-width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
}

.lesson-btn.active .num {
  background: var(--accent);
  color: #021308;
}

.lesson-btn .label {
  font-weight: 600;
  line-height: 1.35;
}

main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.lesson-panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.lesson-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  padding: clamp(14px, 3.5vw, 22px) clamp(14px, 4vw, 24px) clamp(12px, 2.5vw, 16px);
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  margin: 0 0 6px;
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  font-weight: 700;
  line-height: 1.25;
}

.panel-head .sub {
  margin: 0;
  font-size: clamp(0.8rem, 2.4vw, 0.88rem);
  color: var(--text-muted);
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #020403;
  aspect-ratio: 16 / 9;
}

/* Fallback bem antigo sem aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .video-wrap {
    height: 0;
    padding-bottom: 56.25%;
    aspect-ratio: unset;
  }
}

.video-wrap iframe,
.video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-wrap video {
  object-fit: contain;
  background: #000;
}

.panel-foot {
  padding: clamp(14px, 3vw, 18px) clamp(14px, 4vw, 24px) clamp(16px, 3.5vw, 22px);
  color: var(--text-muted);
  font-size: clamp(0.8rem, 2.4vw, 0.88rem);
}

.panel-foot code {
  font-size: 0.9em;
  color: var(--accent-soft);
  word-break: break-all;
}

.cta-section {
  margin-top: clamp(28px, 5vw, 44px);
  text-align: center;
  padding: clamp(24px, 5vw, 40px) clamp(16px, 4vw, 28px);
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-elevated) 55%, #071a10 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset, 0 12px 40px rgba(0, 230, 118, 0.06);
}

.cta-section h2 {
  margin: 0 0 8px;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  color: var(--text);
}

.cta-section > p {
  margin: 0 auto 22px;
  color: var(--text-muted);
  max-width: 28rem;
  font-size: clamp(0.88rem, 2.6vw, 0.95rem);
}

/* CTA verde (base da identidade) */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: min(100%, 380px);
  min-height: var(--touch);
  padding: 14px 24px;
  font-size: clamp(0.95rem, 3vw, 1.05rem);
  font-weight: 700;
  font-family: inherit;
  color: #021308;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 24px rgba(0, 230, 118, 0.35);
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-cta:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 230, 118, 0.45);
}

.btn-cta:active {
  transform: translateY(0);
}

.btn-cta:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.btn-cta svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #021308;
}

footer {
  margin-top: clamp(24px, 4vw, 36px);
  text-align: center;
  font-size: clamp(0.75rem, 2.2vw, 0.82rem);
  color: var(--text-muted);
  padding: 0 8px;
}
