.aluno-page {
  min-height: 100vh;
  background: var(--bg);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

/* —— Top bar —— */
.curso-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.curso-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 0.55rem clamp(0.9rem, 2.5vw, 1.5rem);
}

.curso-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: wrap;
  font-size: 0.86rem;
}

.curso-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.curso-brand img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 999px;
  box-shadow:
    0 0 0 2px rgba(212, 175, 55, 0.5),
    0 0 0 4px rgba(20, 184, 166, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.32);
}

.gate-card > img {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 999px;
  margin-bottom: 0.25rem;
  box-shadow:
    0 0 0 2.5px rgba(212, 175, 55, 0.5),
    0 0 0 7px rgba(20, 184, 166, 0.14),
    0 18px 40px rgba(0, 0, 0, 0.4);
}

.crumb-sep {
  color: var(--text-muted);
}

.crumb-track,
.crumb-current {
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 18ch;
}

.crumb-current {
  color: var(--accent);
  font-weight: 700;
}

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

.aluno-chip {
  display: none;
  flex-direction: column;
  line-height: 1.15;
  text-align: right;
}

.aluno-chip small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.enrolled-pill {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* —— Layout player + conteúdo —— */
.curso-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 56px);
}

.curso-stage {
  padding: 1rem clamp(0.9rem, 2.5vw, 1.5rem) 2rem;
  min-width: 0;
}

.curso-sidebar {
  border-top: 1px solid var(--border);
  background: var(--bg-solid);
  display: flex;
  flex-direction: column;
  max-height: none;
}

/* —— Video —— */
.video-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  box-shadow: var(--card-shadow);
}

.video-frame.is-theater {
  position: fixed;
  inset: 0;
  z-index: 70;
  border-radius: 0;
  aspect-ratio: auto;
}

.video-frame video,
.video-frame .bunny-embed {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  border: 0;
}

.video-frame video {
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.video-frame .bunny-embed {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* display:block acima não pode vencer o atributo hidden */
.video-frame video[hidden],
.video-frame .bunny-embed[hidden],
.video-fallback[hidden] {
  display: none !important;
}

.video-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
}

.video-fallback img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.35);
}

.fallback-copy {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  padding: 1.25rem;
  text-align: center;
  color: #f5faf8;
}

.fallback-copy h2 {
  color: #fff;
  margin: 0.5rem 0;
}

.fallback-copy p {
  color: rgba(245, 250, 248, 0.78);
  margin-bottom: 1rem;
}

.fallback-copy code {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
}

/* —— Lesson meta —— */
.lesson-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
}

.lesson-heading h1 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  margin: 0.15rem 0 0.7rem;
  line-height: 1.25;
}

.lesson-byline {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.instructor-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
}

.lesson-byline strong {
  display: block;
  font-size: 0.92rem;
}

.lesson-byline small {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.lesson-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: border-color var(--duration), background var(--duration), color var(--duration);
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tool-btn.is-done {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}

.lesson-nav-btns {
  display: flex;
  gap: 0.35rem;
}

.lesson-utils {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* —— Curtidas e comentários —— */
.lesson-engagement {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 1rem;
}

.engagement-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
}

.like-btn svg {
  width: 18px;
  height: 18px;
}

.like-btn.is-liked {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
}

.like-btn.is-liked svg path {
  fill: currentColor;
}

.like-btn strong {
  font-size: 0.85rem;
}

.engagement-meta {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.comment-form {
  display: grid;
  gap: 0.5rem;
}

.comment-form label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-soft);
}

.comment-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.comment-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.comment-error {
  color: #f87171;
  font-size: 0.86rem;
  margin: 0;
}

.comments-list {
  display: grid;
  gap: 0.7rem;
}

.comment-card {
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.comment-card header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.comment-card strong {
  font-size: 0.9rem;
}

.comment-card time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.comment-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.comments-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.4rem 0;
}

.comment-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-soft);
}

.comment-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.comment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.comment-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.comment-badge.is-question {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: #fbbf24;
}

.comment-badge.is-answered {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.comment-badge.is-instructor {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.comment-replies {
  margin-top: 0.75rem;
  padding-left: 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  display: grid;
  gap: 0.55rem;
}

.reply-card {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: var(--bg-solid);
  border: 1px solid var(--border);
}

.reply-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-bottom: 0.35rem;
}

.reply-card header time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reply-card p {
  margin: 0;
  line-height: 1.45;
  color: var(--text);
}

.reply-card.is-instructor {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-solid));
  box-shadow: inset 3px 0 0 var(--accent);
}

.reply-form {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.4rem;
}

.reply-form textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text);
  font: inherit;
}

.reply-toggle {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.util-chip {
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.util-chip:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}

.util-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* —— Sidebar conteúdo —— */
.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.sidebar-tab {
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  background: transparent;
}

.sidebar-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sidebar-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-course-head {
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-course-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0.15rem 0 0.85rem;
  line-height: 1.3;
}

.sidebar-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.sidebar-progress-meta strong {
  color: var(--accent);
}

.content-tree {
  padding: 0.65rem;
  display: grid;
  gap: 0.45rem;
  overflow: auto;
  align-content: start;
  align-items: stretch;
}

.module-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  align-self: start;
  width: 100%;
}

.module-block.is-open {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.module-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: transparent;
}

.module-toggle:hover {
  background: var(--accent-soft);
}

.module-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
}

.module-toggle-copy {
  min-width: 0;
  display: grid;
  gap: 0.05rem;
}

.module-toggle-copy strong {
  font-size: 0.86rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-toggle-copy small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.module-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.module-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 180ms ease;
  opacity: 0.75;
}

.module-block.is-open .module-chevron {
  transform: rotate(225deg);
}

.module-lessons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  gap: 0.2rem;
}

.module-block.is-open .module-lessons {
  display: grid;
  padding: 0 0.4rem 0.45rem;
}

.lesson-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}

.lesson-row:hover {
  background: var(--accent-soft);
}

.lesson-row.is-current {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--accent-soft);
}

.lesson-row.is-done .lesson-check {
  background: var(--success);
  color: #042f2e;
  border-color: transparent;
}

.lesson-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lesson-row-copy {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.lesson-row-copy strong {
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.3;
}

.lesson-row-copy small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.here-tag {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  white-space: nowrap;
}

/* —— Mobile sidebar drawer —— */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.5);
}

.sidebar-scrim[hidden] {
  display: none;
}

@media (max-width: 1099px) {
  .curso-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(380px, 92vw);
    border-top: none;
    border-left: 1px solid var(--border);
    transform: translateX(105%);
    transition: transform 240ms var(--ease, ease);
    max-height: 100vh;
  }

  .curso-sidebar.is-open {
    transform: translateX(0);
  }

  .content-tree {
    flex: 1;
    max-height: calc(100vh - 180px);
  }
}

@media (min-width: 720px) {
  .aluno-chip {
    display: flex;
  }

  .crumb-track,
  .crumb-current {
    max-width: 28ch;
  }
}

@media (min-width: 1100px) {
  .curso-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .curso-sidebar {
    border-top: none;
    border-left: 1px solid var(--border);
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    max-height: calc(100vh - 56px);
  }

  .content-tree {
    flex: 1;
  }

  .sidebar-toggle {
    display: none;
  }
}

/* —— Auth gate —— */
.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(420px, 100%);
  padding: 1.6rem 1.35rem;
  border-radius: var(--radius-lg);
  background: var(--bg-solid);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  text-align: center;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
}

.gate-card p {
  color: var(--text-soft);
}

.gate-creds {
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.gate-creds p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: var(--text);
}

.login-form {
  width: 100%;
  display: grid;
  gap: 0.65rem;
  text-align: left;
}

.login-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}

.login-form input {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.gate-error {
  color: #f87171 !important;
  font-size: 0.88rem;
}

.text-link {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}
