:root {
  --bg: #0b0f14;
  --surface: #121a24;
  --card: #1a2332;
  --card-hover: #243044;
  --line: #2d3a4f;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-soft: rgba(59,130,246,.15);
  --ok: #22c55e;
  --warn: #eab308;
  --radius: 16px;
}
* { box-sizing: border-box; }
body.comunidade {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  background: rgba(11,15,20,.92);
  border-bottom: 1px solid var(--line);
  padding: .85rem 1rem;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.topbar__nav { display: flex; gap: .45rem; flex-wrap: wrap; margin-left: auto; }
.tab {
  padding: .45rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}
.tab.active, .tab--primary.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.stats-bar {
  display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center;
  color: var(--muted); font-size: .85rem; margin-bottom: 1rem;
}
.stats-bar strong { color: var(--accent2); }
.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 { margin: 0 0 .5rem; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.hero p { margin: 0; color: var(--muted); max-width: 640px; margin-inline: auto; line-height: 1.5; }
.section-title {
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 2rem 0 1rem;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  transition: border-color .2s, transform .2s, background .2s;
  cursor: pointer;
  min-height: 180px;
}
.product-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  transform: translateY(-2px);
}
.product-card.locked { opacity: .75; }
.product-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.product-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; flex: 1; }
.product-card__meta {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--muted);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #93c5fd;
  font-weight: 700;
}
.pill.ok { background: rgba(34,197,94,.15); color: var(--ok); }
.pill.warn { background: rgba(234,179,8,.15); color: var(--warn); }
.breadcrumb {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: .85rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.course-head { margin-bottom: 1.5rem; }
.course-head h2 { margin: 0 0 .35rem; font-size: 1.6rem; }
.course-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.chapter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.chapter__head {
  padding: .9rem 1.1rem;
  background: var(--card-hover);
  border-bottom: 1px solid var(--line);
}
.chapter__head h3 { margin: 0; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: .85rem;
  align-items: center;
  padding: .8rem 1rem;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s;
}
.lesson-item:first-child { border-top: 0; }
.lesson-item:hover { background: rgba(255,255,255,.03); }
.lesson-item__num {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #93c5fd;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
}
.lesson-item__title { margin: 0; font-size: .92rem; font-weight: 600; }
.lesson-item__sub { margin: .1rem 0 0; color: var(--muted); font-size: .76rem; }
.lesson-item__status { font-size: .68rem; font-weight: 700; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(960px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.modal__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.modal__head h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.modal__head p { margin: .25rem 0 0; color: var(--muted); font-size: .82rem; }
.modal__close {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.modal__body { padding: 1rem 1.1rem 1.25rem; }
.modal video, .modal iframe.video-frame {
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  border-radius: 12px;
  background: #000;
}
.modal__desc {
  margin-top: 1rem;
  color: #cbd5e1;
  line-height: 1.6;
  font-size: .92rem;
  white-space: pre-wrap;
}
.modal__section { margin-top: 1.1rem; }
.modal__section h3 {
  margin: 0 0 .55rem;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal__links, .modal__materials { list-style: none; margin: 0; padding: 0; }
.modal__links li, .modal__materials li {
  padding: .45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.modal__links li:last-child, .modal__materials li:last-child { border-bottom: 0; }
.modal__actions {
  margin-top: 1rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: .45rem .8rem;
  border-radius: 10px;
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card);
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty-note {
  color: var(--muted);
  font-size: .88rem;
  padding: .75rem 0;
}
@media (max-width: 640px) {
  .lesson-item { grid-template-columns: 32px 1fr; }
  .lesson-item__status { grid-column: 1 / -1; }
}
