/* ============================================================
   Central de Tutoriais — Pulso Social
   Tokens em HSL alinhados a lp-provisorio/css/styles.css.
   Modos suportados: system (padrao), light, dark.
   ============================================================ */

:root {
  color-scheme: light;

  --brand: 217 100% 52%;        /* azul da marca */
  --brand-2: 199 98% 60%;       /* azul claro do icone */
  --brand-ink: 217 60% 22%;
  --accent: 142 71% 45%;
  --warning: 38 92% 50%;
  --danger: 0 72% 51%;

  --bg: 210 40% 99%;
  --bg-soft: 214 32% 96%;
  --card: 0 0% 100%;
  --border: 215 20% 88%;
  --fg: 222 47% 11%;
  --fg-muted: 218 17% 35%;
  --ring: 217 100% 52%;
  --shadow-sm: 0 1px 2px hsl(222 47% 11% / 0.06);
  --shadow-md: 0 8px 24px -12px hsl(222 47% 11% / 0.25);
  --shadow-lg: 0 24px 60px -24px hsl(222 47% 11% / 0.35);

  --radius: 0.875rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1.25rem;
  --header-h: 4.5rem;
  --sidebar-w: 16.5rem;
  --maxw: 1400px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* dark via preferencia do sistema (sem escolha explicita de light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: 222 47% 8%;
    --bg-soft: 222 44% 12%;
    --card: 222 44% 13%;
    --border: 217 22% 24%;
    --fg: 210 40% 98%;
    --fg-muted: 216 16% 68%;
    --brand: 214 100% 62%;
    --brand-ink: 210 40% 98%;
    --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.4);
    --shadow-md: 0 10px 28px -14px hsl(0 0% 0% / 0.7);
    --shadow-lg: 0 28px 70px -28px hsl(0 0% 0% / 0.8);
  }
}

/* dark forcado */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: 222 47% 8%;
  --bg-soft: 222 44% 12%;
  --card: 222 44% 13%;
  --border: 217 22% 24%;
  --fg: 210 40% 98%;
  --fg-muted: 216 16% 68%;
  --brand: 214 100% 62%;
  --brand-ink: 210 40% 98%;
  --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.4);
  --shadow-md: 0 10px 28px -14px hsl(0 0% 0% / 0.7);
  --shadow-lg: 0 28px 70px -28px hsl(0 0% 0% / 0.8);
}

/* light forcado */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: 210 40% 99%;
  --bg-soft: 214 32% 96%;
  --card: 0 0% 100%;
  --border: 215 20% 88%;
  --fg: 222 47% 11%;
  --fg-muted: 218 17% 35%;
  --brand: 217 100% 52%;
  --brand-ink: 217 60% 22%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: hsl(var(--bg));
  color: hsl(var(--fg));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 32rem;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60rem 24rem at 15% -8%, hsl(var(--brand) / 0.16), transparent 70%),
    radial-gradient(48rem 20rem at 90% -12%, hsl(var(--brand-2) / 0.14), transparent 70%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: hsl(var(--brand)); color: #fff;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.25rem; height: 1.25rem; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsl(var(--bg) / 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid hsl(var(--border));
}

.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  min-height: var(--header-h);
  padding: 0.75rem 1.25rem;
  display: flex; align-items: center; gap: 0.9rem;
}

.brand { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
/* O PNG ja traz o arredondamento e a transparencia da marca: nao recortar. */
.brand-logo {
  width: 2.25rem; height: 2.25rem;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; gap: 0.1rem; }
.brand-wordmark {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
  line-height: 1.15; color: hsl(var(--brand));
  white-space: nowrap;
}
.brand-text small {
  font-size: 0.72rem; color: hsl(var(--fg-muted));
  letter-spacing: 0.04em; text-transform: uppercase;
}

.search {
  position: relative; flex: 1; min-width: 0;
  max-width: 34rem; margin-inline: auto;
}
.search input {
  width: 100%;
  padding: 0.7rem 5rem 0.7rem 2.6rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  border-color: hsl(var(--brand));
  box-shadow: 0 0 0 4px hsl(var(--brand) / 0.16);
  outline: none;
}
.search-icon {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  color: hsl(var(--fg-muted)); pointer-events: none;
}
.search-kbd {
  position: absolute; right: 0.85rem; top: 50%; transform: translateY(-50%);
  font-size: 0.72rem; font-family: inherit; color: hsl(var(--fg-muted));
  border: 1px solid hsl(var(--border)); border-radius: 0.4rem;
  padding: 0.05rem 0.4rem; background: hsl(var(--bg-soft));
}
.search:focus-within .search-kbd { display: none; }
.search .search-clear { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: 0.7rem; border: 1px solid transparent;
  background: transparent; color: hsl(var(--fg-muted));
  cursor: pointer; transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.icon-btn:hover {
  background: hsl(var(--bg-soft)); color: hsl(var(--fg));
  border-color: hsl(var(--border));
}

/* ----------------------------------------------------------
   Tooltip: no unico em position: fixed, posicionado por JS
   (js/tooltip.js). Largura acompanha o texto, com virada de
   lado e ajuste horizontal quando encosta na borda da tela.
   ---------------------------------------------------------- */

.tip {
  position: fixed;
  top: 0; left: 0;
  z-index: 90;
  max-width: min(22rem, calc(100vw - 2rem));
  width: max-content;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  background: hsl(var(--fg));
  color: hsl(var(--bg));
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(0.2rem);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.tip.is-open { opacity: 1; transform: translateY(0); }

/* Mede o balao antes de posicionar, sem piscar na tela. */
.tip.is-measuring { opacity: 0; transition: none; }

.tip::after {
  content: "";
  position: absolute;
  left: var(--tip-arrow, 50%);
  margin-left: -5px;
  border: 5px solid transparent;
}
.tip[data-side="top"]::after {
  top: 100%;
  border-top-color: hsl(var(--fg));
}
.tip[data-side="bottom"]::after {
  bottom: 100%;
  border-bottom-color: hsl(var(--fg));
}

@media (prefers-reduced-motion: reduce) {
  .tip { transition: none; }
}

.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select {
  appearance: none;
  padding: 0.5rem 1.6rem 0.5rem 2.1rem;
  border-radius: 0.7rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  cursor: pointer;
  font-size: 0.85rem;
}
.select-wrap.compact select { padding-left: 0.85rem; }
.select-icon {
  position: absolute; left: 0.6rem; width: 1.05rem; height: 1.05rem;
  color: hsl(var(--fg-muted)); pointer-events: none;
}

/* ---------------- Layout ---------------- */

.layout {
  position: relative;
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 2rem; padding: 0 1.25rem;
}

.sidebar {
  position: sticky; top: var(--header-h);
  align-self: start;
  height: calc(100dvh - var(--header-h));
  padding: 1.75rem 0 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  overflow-y: auto;
}

.sidebar-head {
  display: none; align-items: center; justify-content: space-between;
  font-weight: 600; padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.cat-nav { display: flex; flex-direction: column; gap: 0.25rem; }

.cat-item {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.6rem 0.75rem; border-radius: 0.7rem;
  border: 1px solid transparent; background: transparent;
  text-align: left; cursor: pointer;
  color: hsl(var(--fg-muted));
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.cat-item:hover { background: hsl(var(--bg-soft)); color: hsl(var(--fg)); }
.cat-item .icon { color: hsl(var(--brand)); }
.cat-item-body { display: flex; flex-direction: column; min-width: 0; }
.cat-item-name { font-weight: 600; font-size: 0.92rem; color: inherit; }
.cat-item-desc {
  font-size: 0.74rem; color: hsl(var(--fg-muted));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-item-count {
  margin-left: auto; font-size: 0.72rem; font-variant-numeric: tabular-nums;
  background: hsl(var(--bg-soft)); border: 1px solid hsl(var(--border));
  border-radius: 999px; padding: 0.05rem 0.45rem; color: hsl(var(--fg-muted));
}
.cat-item[aria-current="true"] {
  background: hsl(var(--brand) / 0.1);
  border-color: hsl(var(--brand) / 0.35);
  color: hsl(var(--fg));
}
.cat-item[aria-current="true"] .cat-item-count {
  background: hsl(var(--brand)); border-color: transparent; color: #fff;
}

.sidebar-foot {
  margin-top: auto; display: flex; flex-direction: column; gap: 0.35rem;
  padding-top: 1rem; border-top: 1px solid hsl(var(--border));
}
.side-link {
  font-size: 0.82rem; color: hsl(var(--fg-muted)); padding: 0.25rem 0.75rem;
  border-radius: 0.5rem; transition: color 0.18s ease, background 0.18s ease;
}
.side-link:hover { color: hsl(var(--fg)); background: hsl(var(--bg-soft)); }

.content { position: relative; z-index: 1; padding: 2rem 0 3rem; min-width: 0; }

/* ---------------- Hero ---------------- */

.hero { margin-bottom: 2rem; max-width: 58rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: hsl(var(--brand));
  background: hsl(var(--brand) / 0.1);
  border: 1px solid hsl(var(--brand) / 0.25);
  border-radius: 999px; padding: 0.3rem 0.75rem;
}
.hero h1 {
  font-size: clamp(1.75rem, 3.3vw, 2.6rem);
  margin: 0.9rem 0 0.6rem;
  text-wrap: balance;
}
/* Em telas largas o titulo cabe em uma linha: libera a largura do bloco. */
@media (min-width: 1100px) {
  .hero { max-width: none; }
  .hero .lead { max-width: 52rem; }
  .hero h1 { white-space: nowrap; }
}
.hero .lead { color: hsl(var(--fg-muted)); font-size: 1.05rem; margin: 0; }

.hero-stats {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin: 1.4rem 0 0; padding: 0;
}
.hero-stats li {
  display: flex; align-items: baseline; gap: 0.4rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 999px; padding: 0.35rem 0.9rem; box-shadow: var(--shadow-sm);
}
.hero-stats strong { font-size: 1.05rem; color: hsl(var(--brand)); }
.hero-stats span { font-size: 0.8rem; color: hsl(var(--fg-muted)); }

/* ---------------- Toolbar / chips ---------------- */

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  border-radius: 999px; padding: 0.35rem 0.85rem;
  font-size: 0.82rem; color: hsl(var(--fg-muted)); cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { color: hsl(var(--fg)); border-color: hsl(var(--brand) / 0.4); }
.chip[aria-pressed="true"] {
  background: hsl(var(--brand)); border-color: hsl(var(--brand));
  color: #fff; font-weight: 600;
}

.results-count {
  font-size: 0.85rem; color: hsl(var(--fg-muted)); margin: 0 0 1rem;
}

/* ---------------- Grid de cards ---------------- */

.grid {
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    border-color 0.25s ease;
  animation: rise 0.35s var(--ease) both;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: hsl(var(--brand) / 0.4);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card-thumb {
  position: relative; display: block; width: 100%;
  aspect-ratio: 16 / 9; background: hsl(var(--bg-soft));
  border: 0; padding: 0; cursor: pointer; overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease), filter 0.3s ease;
}
.card:hover .card-thumb img { transform: scale(1.05); }

.thumb-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, hsl(222 47% 8% / 0.05), hsl(222 47% 8% / 0.55));
  color: #fff; opacity: 0.92; transition: opacity 0.2s ease;
}
.thumb-play span {
  display: grid; place-items: center;
  width: 3.1rem; height: 3.1rem; border-radius: 999px;
  background: hsl(var(--brand)); box-shadow: 0 8px 22px hsl(var(--brand) / 0.5);
  transition: transform 0.25s var(--ease);
}
.card:hover .thumb-play span { transform: scale(1.08); }
.thumb-play .icon { width: 1.4rem; height: 1.4rem; }

.badge {
  position: absolute; top: 0.6rem; left: 0.6rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #fff;
  background: hsl(var(--brand)); border-radius: 999px;
  padding: 0.2rem 0.55rem; box-shadow: var(--shadow-sm);
}

.card-body { padding: 1rem 1.1rem 0.4rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.tag {
  font-size: 0.7rem; letter-spacing: 0.02em;
  border-radius: 999px; padding: 0.12rem 0.5rem;
  border: 1px solid hsl(var(--border)); color: hsl(var(--fg-muted));
  background: hsl(var(--bg-soft));
}
.tag.level-basic { color: hsl(var(--accent)); border-color: hsl(var(--accent) / 0.35); background: hsl(var(--accent) / 0.1); }
.tag.level-intermediate { color: hsl(var(--warning)); border-color: hsl(var(--warning) / 0.35); background: hsl(var(--warning) / 0.1); }
.tag.level-advanced { color: hsl(var(--danger)); border-color: hsl(var(--danger) / 0.35); background: hsl(var(--danger) / 0.1); }

.card-title { font-size: 1.02rem; font-weight: 650; }
.card-desc { font-size: 0.86rem; color: hsl(var(--fg-muted)); margin: 0; }
.card-desc mark, .card-title mark {
  background: hsl(var(--brand) / 0.2); color: inherit;
  border-radius: 0.25rem; padding: 0 0.12rem;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.5rem 0.75rem 0.75rem;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border-radius: 0.7rem; border: 1px solid transparent;
  padding: 0.5rem 0.9rem; font-size: 0.87rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  color: #fff; box-shadow: 0 6px 18px -8px hsl(var(--brand) / 0.8);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; border-color: hsl(var(--border)); color: hsl(var(--fg-muted));
}
.btn-ghost:hover { color: hsl(var(--fg)); border-color: hsl(var(--brand) / 0.45); background: hsl(var(--bg-soft)); }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

/* ---------------- Estado vazio ---------------- */

.empty {
  text-align: center; padding: 3.5rem 1rem;
  border: 1px dashed hsl(var(--border)); border-radius: var(--radius-lg);
  background: hsl(var(--card) / 0.6);
}
.empty-icon { width: 2.5rem; height: 2.5rem; color: hsl(var(--fg-muted)); margin: 0 auto 0.75rem; }
.empty h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.empty p { color: hsl(var(--fg-muted)); margin: 0 0 1.2rem; }

/* ---------------- Modal / player ---------------- */

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: hsl(222 47% 6% / 0.7); backdrop-filter: blur(4px);
  animation: fade 0.2s ease both;
}
.modal-panel {
  position: relative; width: min(64rem, 100%);
  max-height: 92dvh; overflow-y: auto;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop 0.28s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid hsl(var(--border));
}
.modal-head h2 { font-size: 1.15rem; }
.modal-sub { margin: 0.2rem 0 0; font-size: 0.85rem; color: hsl(var(--fg-muted)); }

.modal-video { aspect-ratio: 16 / 9; background: #000; }
.modal-video iframe { width: 100%; height: 100%; border: 0; display: block; }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.85rem 1.25rem 1.1rem; flex-wrap: wrap;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  z-index: 90; display: inline-flex; align-items: center; gap: 0.5rem;
  background: hsl(var(--fg)); color: hsl(var(--bg));
  padding: 0.55rem 0.95rem; border-radius: 999px;
  font-size: 0.85rem; box-shadow: var(--shadow-md);
  animation: pop 0.22s var(--ease) both;
}

/* ---------------- Rodape ---------------- */

.site-footer {
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
  font-size: 0.82rem; color: hsl(var(--fg-muted));
}
.site-footer p { margin: 0.15rem 0; }
.muted { opacity: 0.8; }

/* ---------------- Responsivo ---------------- */

.only-mobile { display: none; }
.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: hsl(222 47% 6% / 0.55); backdrop-filter: blur(2px);
  animation: fade 0.2s ease both;
}

@media (max-width: 960px) {
  .only-mobile { display: inline-flex; }
  .sidebar-head { display: flex; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: min(19rem, 86vw); height: 100dvh;
    padding: 1.25rem 1rem;
    background: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
  }
  .sidebar.is-open { transform: none; }
  .brand-text small { display: none; }
}

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; row-gap: 0.6rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-text { display: none; }
  .hero-stats { gap: 0.4rem; }
  .modal-foot .btn span { display: none; }
  .modal-foot { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------- Seletor de tema (system | light | dark) ---------------- */

.theme-switch {
  display: inline-flex; align-items: center; gap: 0.1rem;
  padding: 0.15rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--bg-soft));
}

.theme-opt {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.85rem; height: 1.85rem;
  border: 0; border-radius: 999px;
  background: transparent; color: hsl(var(--fg-muted));
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.theme-opt .icon { width: 1rem; height: 1rem; }
.theme-opt:hover { color: hsl(var(--fg)); }
.theme-opt[aria-pressed="true"] {
  background: hsl(var(--card));
  color: hsl(var(--brand));
  box-shadow: var(--shadow-sm);
}

@media (max-width: 380px) {
  .theme-opt { width: 1.7rem; height: 1.7rem; }
  .theme-opt .icon { width: 0.92rem; height: 0.92rem; }
  .select-wrap select { padding-right: 1.2rem; font-size: 0.8rem; }
}

/* ---------------- Maratona guiada (progresso local) ---------------- */

.track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 1.25rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, hsl(var(--brand) / 0.08), transparent 55%),
    hsl(var(--card));
  box-shadow: var(--shadow-sm);
}
.track.is-complete { border-color: hsl(var(--accent) / 0.45); }

.track-ring { position: relative; width: 4.5rem; height: 4.5rem; flex-shrink: 0; }
.track-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.track-ring circle { fill: none; stroke-width: 4; }
.track-ring-bg { stroke: hsl(var(--border)); }
.track-ring-fill {
  stroke: hsl(var(--brand)); stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 119.4;
  transition: stroke-dashoffset 0.5s var(--ease), stroke 0.3s ease;
}
.track.is-complete .track-ring-fill { stroke: hsl(var(--accent)); }
.track-ring strong {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.88rem; font-variant-numeric: tabular-nums;
}

.track-body { min-width: 0; }
.track-body h2 { font-size: 1.05rem; }
.track-sub { margin: 0.15rem 0 0.5rem; font-size: 0.85rem; color: hsl(var(--fg-muted)); }
.track-meta {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin: 0 0 0.5rem; font-size: 0.8rem; color: hsl(var(--fg-muted));
}
.track-dot { width: 3px; height: 3px; border-radius: 999px; background: currentColor; opacity: 0.5; }

.track-bar {
  height: 0.4rem; border-radius: 999px;
  background: hsl(var(--bg-soft)); overflow: hidden;
}
.track-bar span {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--brand)), hsl(var(--brand-2)));
  transition: width 0.5s var(--ease);
}
.track.is-complete .track-bar span { background: hsl(var(--accent)); }

.track-actions {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem;
  min-width: 13rem;
}
.track-note { font-size: 0.7rem; color: hsl(var(--fg-muted)); text-align: center; }

/* ---------------- Estado das aulas nos cards ---------------- */

.card.is-done { border-color: hsl(var(--accent) / 0.45); }
.card.is-done .card-thumb img { filter: saturate(0.75) brightness(0.85); }

.card-step {
  position: absolute; top: 0.6rem; right: 0.6rem;
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.68rem; font-weight: 700;
  color: #fff; background: hsl(222 47% 8% / 0.72);
  border: 1px solid hsl(0 0% 100% / 0.18);
  border-radius: 999px; padding: 0.15rem 0.5rem;
  backdrop-filter: blur(4px);
}

.card-status {
  position: absolute; left: 0.6rem; bottom: 0.6rem;
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; font-weight: 600;
  border-radius: 999px; padding: 0.18rem 0.55rem;
  background: hsl(var(--accent)); color: #fff;
  box-shadow: var(--shadow-sm);
}
.card-status .icon { width: 0.85rem; height: 0.85rem; stroke-width: 2.4; }
.card-status.is-views { background: hsl(222 47% 8% / 0.72); border: 1px solid hsl(0 0% 100% / 0.18); }

.card-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: hsl(0 0% 100% / 0.18);
}
.card-progress span {
  display: block; height: 100%;
  background: hsl(var(--brand-2));
  transition: width 0.4s var(--ease);
}

.done-toggle[aria-pressed="true"] {
  color: hsl(var(--accent));
  border-color: hsl(var(--accent) / 0.45);
  background: hsl(var(--accent) / 0.1);
}

#player-done[aria-pressed="true"] {
  color: hsl(var(--accent));
  border-color: hsl(var(--accent) / 0.45);
  background: hsl(var(--accent) / 0.12);
}

@media (max-width: 860px) {
  .track { grid-template-columns: auto minmax(0, 1fr); row-gap: 0.9rem; }
  .track-actions { grid-column: 1 / -1; min-width: 0; }
}
@media (max-width: 480px) {
  .track { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .track-ring { width: 3.5rem; height: 3.5rem; }
}

.card-foot-actions { display: inline-flex; align-items: center; gap: 0.15rem; }

/* Versao da Central: discreta, no rodape do menu lateral. */
.side-version {
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: hsl(var(--fg-muted));
  opacity: 0.75;
  cursor: default;
  transition: opacity 0.18s ease, border-color 0.18s ease;
}
.side-version:hover { opacity: 1; border-color: hsl(var(--brand) / 0.4); }

/* ---------------- Destaque de boas-vindas (aula de apresentacao) ---------------- */

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid hsl(var(--brand) / 0.3);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(120deg, hsl(var(--brand) / 0.12), transparent 60%),
    hsl(var(--card));
  box-shadow: var(--shadow-md);
}

.welcome-poster {
  position: relative;
  display: block; width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0; border: 0; cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: hsl(var(--bg-soft));
}
.welcome-poster img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.45s var(--ease);
}
.welcome:hover .welcome-poster img { transform: scale(1.04); }

.welcome-play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(180deg, hsl(222 47% 8% / 0.1), hsl(222 47% 8% / 0.5));
  color: #fff;
}
.welcome-play .icon {
  width: 1.5rem; height: 1.5rem;
  padding: 1rem; box-sizing: content-box;
  border-radius: 999px;
  background: hsl(var(--brand));
  box-shadow: 0 10px 30px hsl(var(--brand) / 0.55);
  transition: transform 0.25s var(--ease);
}
.welcome:hover .welcome-play .icon { transform: scale(1.07); }

.welcome-body { min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.welcome-badge {
  align-self: flex-start;
  display: inline-flex; align-items: center;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, hsl(var(--brand)), hsl(var(--brand-2)));
  border-radius: 999px; padding: 0.25rem 0.7rem;
}
.welcome-body h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }
.welcome-body p { margin: 0; color: hsl(var(--fg-muted)); font-size: 0.92rem; max-width: 44rem; }

.welcome-actions {
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap; margin-top: 0.25rem;
}
.welcome-note { font-size: 0.76rem; color: hsl(var(--fg-muted)); }

@media (max-width: 760px) {
  .welcome { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
}

/* ============================================================
   Ajustes de toque e densidade (auditoria UI/UX)
   Regras guiadas por ponteiro grosso (touch), sem inchar o desktop.
   ============================================================ */

@media (pointer: coarse), (max-width: 760px) {
  /* Alvos de toque: 44px minimo, mantendo o desenho visual do botao. */
  .icon-btn { width: 2.75rem; height: 2.75rem; }

  .theme-switch { padding: 0.2rem; }
  .theme-opt { width: 2.4rem; height: 2.4rem; }
  .theme-opt .icon { width: 1.05rem; height: 1.05rem; }

  .chip { min-height: 2.75rem; padding-inline: 1rem; }

  .side-link { min-height: 2.75rem; display: flex; align-items: center; }

  .btn { min-height: 2.75rem; }
  .btn-sm { min-height: 2.5rem; }

  .select-wrap select { min-height: 2.75rem; }

  /* Espacamento entre alvos adjacentes, para evitar toque errado. */
  .card-foot-actions { gap: 0.5rem; }
  .header-actions { gap: 0.6rem; }
}

/* Legibilidade: nenhum texto de apoio abaixo de 12px no mobile. */
@media (max-width: 760px) {
  .tag { font-size: 0.78rem; }
  .cat-item-desc { font-size: 0.8rem; }
  .card-desc { font-size: 0.9rem; }
  .side-version { font-size: 0.72rem; }
  .welcome-note, .track-note { font-size: 0.78rem; }
  .card-step, .card-status, .badge { font-size: 0.72rem; }
}

/* Caminho ate o conteudo: no mobile o topo era quase duas telas de
   altura antes do primeiro card. Compacta hero, destaque e maratona. */
@media (max-width: 760px) {
  .hero { margin-bottom: 1.25rem; }
  .hero h1 { font-size: clamp(1.6rem, 7vw, 2rem); margin: 0.6rem 0 0.4rem; }
  .hero .lead { font-size: 0.95rem; }
  .hero-stats { display: none; }
  .hero .lead {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Destaque compacto: miniatura ao lado do texto, em vez de poster inteiro. */
  .welcome {
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem; padding: 0.8rem; margin-bottom: 1rem;
  }
  .welcome-play .icon { padding: 0.55rem; width: 1.1rem; height: 1.1rem; }
  .welcome-body { gap: 0.35rem; }
  .welcome-badge { font-size: 0.64rem; padding: 0.15rem 0.5rem; }
  .welcome-body h2 { font-size: 1.05rem; }
  .welcome-body p {
    font-size: 0.85rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .welcome-actions { margin-top: 0.15rem; }
  .welcome-note { display: none; }

  .track { padding: 0.9rem; margin-bottom: 1rem; row-gap: 0.6rem; }
  .track-sub { display: none; } /* o titulo e a barra ja comunicam */
  .track-actions { gap: 0.35rem; }

  /* Filtros em trilho horizontal: mantem os alvos grandes sem empilhar
     quatro linhas de chips antes do primeiro card. */
  .toolbar { gap: 0.5rem; }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
    margin-inline: -1.25rem;
    padding-inline: 1.25rem;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; scroll-snap-align: start; }
  .toolbar .select-wrap { width: 100%; }
  .toolbar .select-wrap select { width: 100%; }
}

/* Modal: o gesto de rolar dentro do player nao arrasta a pagina atras. */
.modal-panel { overscroll-behavior: contain; }
