:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-2: #232d3b;
  --border: #2f3d4f;
  --text: #e8eef4;
  --muted: #9db0c4;
  --accent: #3d9cf0;
  --accent-soft: rgba(61, 156, 240, 0.15);
  --success: #3ecf8e;
  --success-bg: rgba(62, 207, 142, 0.12);
  --danger: #f07178;
  --danger-bg: rgba(240, 113, 120, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --code-bg: #0d1117;
  --code-fg: #c9d1d9;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="light"] {
  --bg: #e9eef5;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --border: #c8d4e4;
  --text: #1a2634;
  --muted: #5a6b7e;
  --accent: #0b76d9;
  --accent-soft: rgba(11, 118, 217, 0.12);
  --success: #0d9f6e;
  --success-bg: rgba(13, 159, 110, 0.12);
  --danger: #d63b43;
  --danger-bg: rgba(214, 59, 67, 0.1);
  --shadow: 0 10px 40px rgba(30, 50, 80, 0.12);
  --code-bg: #f6f8fc;
  --code-fg: #243242;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(61, 156, 240, 0.12), transparent),
    radial-gradient(800px 400px at 100% 0%, rgba(62, 207, 142, 0.08), transparent), var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--topbar-offset, 7.5rem);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  margin-top: auto;
  padding: 0.95rem 1.25rem 1.25rem;
  padding-right: max(1.25rem, 11rem);
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--muted);
}

.site-footer__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.site-footer__credit {
  margin: 0;
  text-align: center;
  line-height: 1.6;
}

.site-footer__credit .site-footer__linkedin {
  display: inline-block;
  margin-inline-start: 0.5rem;
  vertical-align: middle;
}

.site-footer__recommend {
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
}

.site-footer__linkedin {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-soft);
  transition: filter 0.15s;
}

.site-footer__linkedin:hover {
  filter: brightness(1.05);
}

.site-footer__linkedin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

article {
  background: transparent;
}

.context-nav-wrap {
  display: contents;
}

.context-nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.context-nav__toggle:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.context-nav__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.context-nav__burger {
  width: 1.05rem;
  height: 0.72rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.context-nav__burger span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.context-nav__toggle-label {
  line-height: 1;
}

.context-nav__active-only {
  display: none;
  box-sizing: border-box;
  margin: 0.35rem auto 0;
  width: fit-content;
  max-width: 100%;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.context-nav__active-only--logica {
  background: rgba(139, 92, 246, 0.2);
  color: #ddd6fe;
  border-color: rgba(139, 92, 246, 0.65);
}

.context-nav__active-only--cypress {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.65);
}

.context-nav__active-only--github {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.65);
}

.context-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.context-nav__intro {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text);
  padding: 0.5rem 0.75rem 0.15rem;
}

.context-nav__intro-hint {
  color: var(--muted);
  font-weight: 500;
}

.context-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.context-nav__btn--logica {
  border-color: rgba(139, 92, 246, 0.35);
}

.context-nav__btn--logica:hover {
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.55);
}

.context-nav__btn--logica.context-nav__btn--active {
  background: rgba(139, 92, 246, 0.2);
  color: #ddd6fe;
  border-color: rgba(139, 92, 246, 0.65);
}

.context-nav__btn--cypress {
  border-color: rgba(16, 185, 129, 0.38);
}

.context-nav__btn--cypress:hover {
  background: rgba(16, 185, 129, 0.14);
  color: #5eead4;
  border-color: rgba(16, 185, 129, 0.55);
}

.context-nav__btn--cypress.context-nav__btn--active {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.65);
}

.context-nav__btn--github {
  border-color: rgba(245, 158, 11, 0.42);
}

.context-nav__btn--github:hover {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.55);
}

.context-nav__btn--github.context-nav__btn--active {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.65);
}

.context-nav__btn--complete .context-nav__check {
  color: var(--success);
  font-weight: 800;
}

.context-nav__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.context-nav__label {
  text-align: left;
  line-height: 1.25;
}

html[data-theme="light"] .context-nav__btn--logica:hover {
  color: #5b21b6;
  background: rgba(91, 33, 182, 0.1);
  border-color: rgba(91, 33, 182, 0.38);
}

html[data-theme="light"] .context-nav__btn--logica.context-nav__btn--active {
  color: #4c1d95;
  background: rgba(91, 33, 182, 0.14);
  border-color: rgba(91, 33, 182, 0.45);
}

html[data-theme="light"] .context-nav__btn--cypress:hover {
  color: #047857;
  background: rgba(4, 120, 87, 0.1);
  border-color: rgba(4, 120, 87, 0.35);
}

html[data-theme="light"] .context-nav__btn--cypress.context-nav__btn--active {
  color: #065f46;
  background: rgba(4, 120, 87, 0.14);
  border-color: rgba(4, 120, 87, 0.42);
}

html[data-theme="light"] .context-nav__btn--github:hover {
  color: #b45309;
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.38);
}

html[data-theme="light"] .context-nav__btn--github.context-nav__btn--active {
  color: #92400e;
  background: rgba(180, 83, 9, 0.14);
  border-color: rgba(180, 83, 9, 0.45);
}

html[data-theme="light"] .context-nav__active-only--logica {
  color: #4c1d95;
  background: rgba(91, 33, 182, 0.14);
  border-color: rgba(91, 33, 182, 0.45);
}

html[data-theme="light"] .context-nav__active-only--cypress {
  color: #065f46;
  background: rgba(4, 120, 87, 0.14);
  border-color: rgba(4, 120, 87, 0.42);
}

html[data-theme="light"] .context-nav__active-only--github {
  color: #92400e;
  background: rgba(180, 83, 9, 0.14);
  border-color: rgba(180, 83, 9, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
}

.brand__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar__progress {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  min-width: 200px;
  flex: 1;
  max-width: min(420px, 100%);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.progress-wrap__storage-hint {
  margin: 0;
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: right;
}

.progress-wrap__label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #6ad9ff);
  border-radius: 999px;
  transition: width 0.45s ease;
}

.progress-wrap__pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  min-width: 2.75rem;
  text-align: right;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) minmax(260px, 320px);
  gap: 0;
  min-height: 0;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1rem 0.5rem;
  gap: 0.5rem;
}

.sidebar__head h2 {
  margin: 0;
  width: 100%;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
}

.sidebar__toggle {
  display: none;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  gap: 0.45rem;
  align-self: center;
}

.sidebar__toggle-burger {
  width: 1.05rem;
  height: 0.72rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar__toggle-burger span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.sidebar__toggle-label {
  line-height: 1;
}

.topic-list {
  padding: 0.5rem 0.75rem 1rem;
  overflow-y: auto;
  flex: 1;
}

/* GitHub: no mobile a lista fica sempre oculta; no desktop a lista aparece por padrão e o sidebarToggle fica oculto. */
@media (max-width: 1024px) {
  .sidebar.sidebar--github-context #topicList {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  .sidebar.sidebar--github-context .sidebar__toggle {
    display: none !important;
  }
}

.topic-block {
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.topic-block .topic-btn {
  margin-bottom: 0;
}

.btn-topic-theory {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.38rem 0.55rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}

.btn-topic-theory:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(61, 156, 240, 0.38);
}

.btn-topic-theory:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html[data-theme="light"] .btn-topic-theory:hover {
  border-color: rgba(11, 118, 217, 0.35);
}

.topic-btn {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
}

.topic-btn:hover {
  filter: brightness(1.07);
}

.topic-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topic-btn__badge {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

html[data-theme="light"] .topic-btn__badge {
  background: rgba(26, 38, 52, 0.06);
}

.topic-btn__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.topic-btn__title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
  color: var(--text);
}

/* Tópico atual — cores alinhadas ao context-nav (tema escuro) */
.topic-btn--current.topic-btn--ctx-logica {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2);
}

.topic-btn--current.topic-btn--ctx-logica:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(139, 92, 246, 0.25);
  color: #ddd6fe;
}

.topic-btn--current.topic-btn--ctx-logica .topic-btn__title {
  color: #ddd6fe;
}

.topic-btn--current.topic-btn--ctx-cypress {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.topic-btn--current.topic-btn--ctx-cypress:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
}

.topic-btn--current.topic-btn--ctx-cypress .topic-btn__title {
  color: #a7f3d0;
}

.topic-btn--current.topic-btn--ctx-github {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.topic-btn--current.topic-btn--ctx-github:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

.topic-btn--current.topic-btn--ctx-github .topic-btn__title {
  color: #fde68a;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-logica {
  background: rgba(91, 33, 182, 0.14);
  border-color: rgba(91, 33, 182, 0.45);
  box-shadow: 0 0 0 1px rgba(91, 33, 182, 0.12);
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-logica:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(91, 33, 182, 0.18);
  color: #4c1d95;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-logica .topic-btn__title {
  color: #4c1d95;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cypress {
  background: rgba(4, 120, 87, 0.14);
  border-color: rgba(4, 120, 87, 0.42);
  box-shadow: 0 0 0 1px rgba(4, 120, 87, 0.12);
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cypress:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(4, 120, 87, 0.16);
  color: #065f46;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cypress .topic-btn__title {
  color: #065f46;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-github {
  background: rgba(180, 83, 9, 0.14);
  border-color: rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.12);
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-github:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(180, 83, 9, 0.18);
  color: #92400e;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-github .topic-btn__title {
  color: #92400e;
}

.topic-btn--done .topic-btn__badge {
  background: var(--success-bg);
  color: var(--success);
}

.check {
  margin-left: auto;
  color: var(--success);
  font-weight: 700;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}

.topic-btn--done .check {
  opacity: 1;
  transform: scale(1);
}

.main {
  padding: 1.25rem 1.5rem 2rem;
  overflow-y: auto;
  min-height: 0;
}

.main__inner {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 4.5rem;
}

#main__inner {
  scroll-margin-top: calc(var(--topbar-offset, 7.5rem) + 0.4rem);
}

#feedbackPanel {
  scroll-margin-top: calc(var(--topbar-offset, 7.5rem) + 0.4rem);
}

#mainPanel {
  scroll-margin-top: calc(var(--topbar-offset, 7.5rem) + var(--sidebar-fixed-offset, 0px) + 0.4rem);
}

#theorySubpanel {
  scroll-margin-top: calc(var(--topbar-offset, 7.5rem) + var(--sidebar-fixed-offset, 0px) + 0.4rem);
}

@media (max-width: 1024px) {
  .activity-actions-wrap {
    scroll-margin-top: calc(var(--topbar-offset, 7.5rem) + var(--sidebar-fixed-offset, 0px) + 0.4rem);
  }
}

/* —— Teoria (destaque antes das questões) —— */

.theory-shell {
  margin: 0 auto;
}

.theory-panel {
  position: relative;
  border-radius: var(--radius);
  padding: 0;
  overflow: visible;
  box-shadow: none;
  margin-bottom: 0;
  background: transparent;
}

.theory-panel::before {
  display: none;
}

.theory-panel__inner {
  position: relative;
  z-index: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  padding: 1.2rem 1.25rem;
}

.theory-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(61, 156, 240, 0.38);
  color: var(--accent);
  background: var(--surface-2);
}

html[data-theme="light"] .theory-badge {
  border-color: rgba(11, 118, 217, 0.35);
  color: var(--accent);
}

.theory-panel h2.theory-heading {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--text);
}

.theory-section {
  margin: 1.15rem 0 0;
}

.theory-section:first-of-type {
  margin-top: 0;
}

.theory-section__title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.theory-subnav {
  margin: 0 0 1rem;
}

.theory-subnav__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.theory-subnav__btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.theory-subnav__btn:hover {
  border-color: rgba(61, 156, 240, 0.45);
  color: var(--text);
}

.theory-subnav__btn--active {
  background: var(--accent-soft);
  border-color: rgba(61, 156, 240, 0.5);
  color: var(--accent);
}

.theory-subnav__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theory-subpanel {
  margin: 0 0 0.25rem;
}

.theory-subpanel .theory-section {
  margin-top: 0;
}

.theory-body p {
  margin: 0 0 0.85rem;
  color: var(--text);
  line-height: 1.62;
  font-size: 0.95rem;
}

.theory-body p:last-child {
  margin-bottom: 0;
}

/* Respiro entre o texto da teoria e o snippet (ex.: seção XPath, fluxo de código). */
.theory-section .theory-body + .code-block {
  margin-top: 0.85rem;
}

.theory-links {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.theory-links h3 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.theory-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.theory-links a {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.theory-links a::after {
  content: "↗";
  font-size: 0.75rem;
  opacity: 0.65;
}

.theory-links a:hover {
  text-decoration: underline;
}

.theory-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.desafios-intro {
  margin-bottom: 0.25rem;
}

.desafios-site {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.desafios-site__label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.desafios-site__link {
  color: #5eead4;
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-all;
}

.desafios-site__link:hover {
  text-decoration: underline;
}

html[data-theme="light"] .desafios-site__link {
  color: #047857;
}

.desafios-site p {
  margin: 0;
}

.desafios-creds {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.desafios-creds__title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.desafios-creds p {
  margin: 0.25rem 0 0;
}

.desafios-creds p:first-of-type {
  margin-top: 0;
}

.desafios-creds code {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.desafios-bloco {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px dashed var(--border);
}

.desafios-bloco__title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  color: var(--text);
}

.desafios-passos {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.92rem;
}

.desafios-passos li {
  margin-bottom: 0.4rem;
}

.desafios-code-collapse {
  margin-top: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}

.desafios-code-collapse__summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  color: var(--accent);
  user-select: none;
}

.desafios-code-collapse__summary::-webkit-details-marker {
  display: none;
}

.desafios-code-collapse__summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
  opacity: 0.75;
}

.desafios-code-collapse[open] .desafios-code-collapse__summary::before {
  transform: rotate(90deg);
}

.desafios-code-collapse__summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .desafios-code-collapse__summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.desafios-code-collapse__body {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.desafios-code-collapse__body pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--code-fg);
}

/* —— Tema + reset (canto inferior direito) —— */

.app-floating-actions {
  position: fixed;
  z-index: 200;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem 0.45rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  color: var(--muted);
}

.app-reset-btn {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.app-reset-btn:hover {
  color: var(--text);
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 22%, transparent);
}

.app-reset-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-switch__label {
  font-weight: 700;
  color: var(--text);
}

.theme-switch__toggle {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 3px;
  cursor: pointer;
  display: grid;
  align-items: center;
  justify-content: start;
  transition: background 0.2s, border-color 0.2s;
}

.theme-switch__toggle[aria-checked="true"] {
  justify-content: end;
  background: var(--accent-soft);
  border-color: rgba(61, 156, 240, 0.45);
}

html[data-theme="light"] .theme-switch__toggle[aria-checked="true"] {
  border-color: rgba(11, 118, 217, 0.4);
}

.theme-switch__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-switch__thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.theory-follow {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.loading {
  color: var(--muted);
  text-align: center;
  padding: 3rem;
}

.congrats {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.congrats h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  background: linear-gradient(90deg, var(--accent), var(--success));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.congrats p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 36ch;
  margin-inline: auto;
}

.congrats p + p {
  margin-top: 0.75rem;
}

.congrats__share {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: stretch;
  max-width: 28rem;
  margin-inline: auto;
  width: 100%;
}

.congrats__share .btn {
  flex: 1 1 calc(50% - 0.35rem);
  min-width: 7.5rem;
  max-width: 100%;
}

@media (max-width: 320px) {
  .congrats__share .btn {
    flex: 1 1 100%;
  }
}

.share-dialog {
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  max-width: calc(100vw - 2rem);
  width: min(34rem, 100%);
  box-sizing: border-box;
}

.share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

html[data-theme="light"] .share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.share-dialog__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.share-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.12rem;
  color: var(--text);
}

.share-dialog__hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.share-dialog__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.share-dialog__textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 9.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
  margin-bottom: 1rem;
}

.share-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.activity-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: none;
}

.activity-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.activity-card__head .theory-badge {
  margin-bottom: 0;
}

.activity-card__progress {
  margin-left: auto;
}

.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(61, 156, 240, 0.3);
}

.activity-card__title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}

.activity-desc {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.activity-desc .activity-desc--iu {
  font-style: italic;
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

/* Desktop: enunciado em cima; código à esquerda e opções à direita (só ● Perguntas com código) */
.activity-split {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.activity-split__code {
  min-width: 0;
}

.activity-split__code .code-block {
  margin-bottom: 0;
}

.activity-split__options {
  min-width: 0;
}

.activity-split__options .options {
  margin-bottom: 0;
}

@media (min-width: 601px) {
  .activity-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem 1.25rem;
    align-items: stretch;
  }

  .activity-split__code {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .activity-split__code .code-block {
    flex: 1 1 auto;
    min-height: 0;
  }
}

.code-block {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.code-block pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--code-fg);
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.checklist-root {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 1.25rem;
}

.checklist__card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.checklist__card .checklist__item {
  border: none;
  border-radius: 0;
  background: transparent;
}

.checklist__card:hover {
  border-color: rgba(61, 156, 240, 0.3);
}

.checklist__card:has(.checklist__check:checked) {
  border-color: rgba(62, 207, 142, 0.45);
  background: var(--success-bg);
}

.checklist__details {
  border-top: 1px dashed var(--border);
  font-size: 0.87rem;
}

.checklist__summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.85rem 0.55rem;
  padding-left: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.checklist__summary::-webkit-details-marker {
  display: none;
}

.checklist__summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.75rem;
  opacity: 0.85;
}

.checklist__details[open] .checklist__summary::before {
  transform: rotate(90deg);
}

.checklist__summary:hover {
  color: var(--text);
  background: var(--surface);
}

.checklist__details-body {
  padding: 0 0.95rem 0.85rem 1.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.checklist__details-body p {
  margin: 0 0 0.6rem;
}

.checklist__details-body p:last-child {
  margin-bottom: 0;
}

.checklist__code-intro {
  margin: 0.35rem 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.checklist__code-block {
  margin: 0 0 0.25rem;
}

.checklist__code-block .checklist__copy-btn {
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
}

.checklist__code {
  margin: 0 0 0.25rem;
  padding: 0.75rem 0.9rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.checklist__code pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.52;
  color: var(--code-fg);
}

.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.checklist__check {
  margin-top: 0.25rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checklist__marker {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent);
}

.checklist__text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.48;
  color: var(--text);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option:hover {
  border-color: rgba(61, 156, 240, 0.4);
}

.option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.option.option--correct {
  border-color: rgba(62, 207, 142, 0.55);
  background: var(--success-bg);
}

.option.option--correct:hover {
  border-color: rgba(62, 207, 142, 0.8);
  background: var(--success-bg);
}

.option.option--correct input {
  accent-color: var(--success);
}

.option.option--wrong {
  border-color: rgba(240, 113, 120, 0.55);
  background: var(--danger-bg);
}

.option.option--wrong:hover {
  border-color: rgba(240, 113, 120, 0.8);
  background: var(--danger-bg);
}

.option.option--wrong input {
  accent-color: var(--danger);
}

.option__id {
  font-weight: 700;
  color: var(--accent);
  min-width: 1.25rem;
  font-size: 0.85rem;
}

.option__text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.activity-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.activity-actions__hint {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

@media (min-width: 601px) {
  .activity-card .actions #btnNext {
    margin-left: auto;
  }
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(180deg, #4aa8ff, var(--accent));
  color: #061018;
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.feedback {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.feedback__head {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.feedback__head h2 {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.feedback__body {
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.feedback__hint {
  margin: 0;
  color: var(--muted);
}

.feedback-result {
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.feedback-result--ok {
  background: var(--success-bg);
  border-color: rgba(62, 207, 142, 0.35);
}

.feedback-result--bad {
  background: var(--danger-bg);
  border-color: rgba(240, 113, 120, 0.35);
}

.feedback-result__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.feedback-result--ok .feedback-result__title {
  color: var(--success);
}

.feedback-result--bad .feedback-result__title {
  color: var(--danger);
}

.feedback-result p {
  margin: 0;
  color: var(--muted);
}

.feedback-section {
  margin-top: 1rem;
  min-width: 0;
  max-width: 100%;
}

.feedback-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    padding-top: var(--sidebar-fixed-offset, 0px);
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-offset, 7.5rem);
    left: 0;
    right: 0;
    z-index: 250;
    max-height: calc(100vh - var(--topbar-offset, 7.5rem));
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar.sidebar--mobile-topic-active {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .sidebar__head {
    flex-shrink: 0;
    background: var(--surface);
  }

  .sidebar.sidebar--mobile-topic-active #topicList {
    display: none !important;
  }

  .sidebar.sidebar--mobile-topic-active .sidebar__head {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .sidebar.sidebar--mobile-topic-active .sidebar__head h2 {
    margin: 0;
    text-align: center;
    max-width: 100%;
    width: 100%;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
  }

  .topic-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar__toggle {
    display: inline-flex;
  }

  .sidebar__head h2 {
    width: 100%;
    text-align: center;
    min-width: 0;
  }

  .topic-list.collapsed {
    display: none;
  }

  .sidebar:not(.sidebar--mobile-topic-active):has(#topicList:not(.collapsed)) .sidebar__toggle {
    display: none !important;
  }

  .feedback {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 280px;
  }

  .feedback__head {
    text-align: center;
  }

  .context-nav-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.65rem;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 0.65rem;
  }

  .context-nav__toggle {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    justify-self: start;
  }

  .context-nav__active-only {
    display: block;
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    width: fit-content;
    max-width: 100%;
    justify-self: end;
    text-align: center;
    min-width: 0;
  }

  .context-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
    flex-direction: column;
    align-items: stretch;
    border-top: none;
    padding-top: 0;
    gap: 0.4rem;
    justify-content: flex-start;
  }

  .context-nav-wrap.context-nav-wrap--open .context-nav {
    display: flex;
    border-top: 1px dashed var(--border);
    padding-top: 0.65rem;
    margin-top: 0.35rem;
  }

  .context-nav-wrap.context-nav-wrap--open .context-nav__btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .app-floating-actions {
    position: static;
    z-index: auto;
    right: auto;
    bottom: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 1.25rem;
  }

  .theory-subnav__inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }

  .theory-subnav__btn {
    white-space: normal;
    text-align: center;
    justify-self: stretch;
  }

  .site-footer {
    padding-right: 1.25rem;
    flex-direction: column;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-wrap,
  .topbar__progress {
    width: 100%;
    max-width: none;
  }

  .activity-actions-wrap .actions {
    justify-content: center;
  }

  .activity-actions__hint {
    display: none;
  }

  .main__inner {
    padding-bottom: 0;
  }

  .feedback {
    margin-bottom: 15px;
    max-height: none;
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .feedback__body {
    height: 100%;
    min-height: 0;
  }

  .theme-switch {
    display: none;
  }
}
