: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);
}

/* Transformação Digital e IA → logica (amber/orange) */
.context-nav__active-only--logica {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.65);
}

/* IA Clássica → cypress (purple) */
.context-nav__active-only--cypress {
  background: rgba(139, 92, 246, 0.2);
  color: #ddd6fe;
  border-color: rgba(139, 92, 246, 0.65);
}

/* IA Generativa → github (teal) */
.context-nav__active-only--github {
  background: rgba(20, 184, 166, 0.2);
  color: #99f6e4;
  border-color: rgba(20, 184, 166, 0.65);
}

.context-nav__active-only--cicd {
  background: rgba(14, 165, 233, 0.2);
  color: #bae6fd;
  border-color: rgba(14, 165, 233, 0.65);
}

/* IA-driven → indigo */
.context-nav__active-only--indigo {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.65);
}

/* Análise de Dados com IA → emerald */
.context-nav__active-only--emerald {
  background: rgba(52, 211, 153, 0.2);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.65);
}

/* Data Scraping com IA → orange */
.context-nav__active-only--orange {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
  border-color: rgba(249, 115, 22, 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;
}

/* Transformação Digital e IA → logica (amber/orange) */
.context-nav__btn--logica {
  border-color: rgba(245, 158, 11, 0.42);
}

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

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

/* IA Clássica → cypress (purple) */
.context-nav__btn--cypress {
  border-color: rgba(139, 92, 246, 0.38);
}

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

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

/* IA Generativa → github (teal) */
.context-nav__btn--github {
  border-color: rgba(20, 184, 166, 0.42);
}

.context-nav__btn--github:hover {
  background: rgba(20, 184, 166, 0.14);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.55);
}

.context-nav__btn--github.context-nav__btn--active {
  background: rgba(20, 184, 166, 0.2);
  color: #99f6e4;
  border-color: rgba(20, 184, 166, 0.65);
}

.context-nav__btn--cicd {
  border-color: rgba(14, 165, 233, 0.42);
}

.context-nav__btn--cicd:hover {
  background: rgba(14, 165, 233, 0.14);
  color: #7dd3fc;
  border-color: rgba(14, 165, 233, 0.55);
}

.context-nav__btn--cicd.context-nav__btn--active {
  background: rgba(14, 165, 233, 0.2);
  color: #e0f2fe;
  border-color: rgba(14, 165, 233, 0.62);
}

/* IA-driven → indigo */
.context-nav__btn--indigo {
  border-color: rgba(99, 102, 241, 0.42);
}

.context-nav__btn--indigo:hover {
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.55);
}

.context-nav__btn--indigo.context-nav__btn--active {
  background: rgba(99, 102, 241, 0.2);
  color: #e0e7ff;
  border-color: rgba(99, 102, 241, 0.65);
}

/* Análise de Dados com IA → emerald */
.context-nav__btn--emerald {
  border-color: rgba(52, 211, 153, 0.42);
}

.context-nav__btn--emerald:hover {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.55);
}

.context-nav__btn--emerald.context-nav__btn--active {
  background: rgba(52, 211, 153, 0.2);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.65);
}

/* Data Scraping com IA → orange */
.context-nav__btn--orange {
  border-color: rgba(249, 115, 22, 0.42);
}

.context-nav__btn--orange:hover {
  background: rgba(249, 115, 22, 0.14);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.55);
}

.context-nav__btn--orange.context-nav__btn--active {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
  border-color: rgba(249, 115, 22, 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: #b45309;
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.38);
}

html[data-theme="light"] .context-nav__btn--logica.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__btn--cypress: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--cypress.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--github:hover {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.35);
}

html[data-theme="light"] .context-nav__btn--github.context-nav__btn--active {
  color: #134e4a;
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.42);
}

html[data-theme="light"] .context-nav__btn--cicd:hover {
  color: #0369a1;
  background: rgba(3, 105, 161, 0.1);
  border-color: rgba(3, 105, 161, 0.35);
}

html[data-theme="light"] .context-nav__btn--cicd.context-nav__btn--active {
  color: #0c4a6e;
  background: rgba(3, 105, 161, 0.12);
  border-color: rgba(3, 105, 161, 0.4);
}

html[data-theme="light"] .context-nav__active-only--logica {
  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--cypress {
  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--github {
  color: #134e4a;
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.42);
}

html[data-theme="light"] .context-nav__active-only--cicd {
  color: #0c4a6e;
  background: rgba(3, 105, 161, 0.12);
  border-color: rgba(3, 105, 161, 0.4);
}

.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;
}

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

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

.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);
}

/* Transformação Digital e IA → logica → amber/orange */
.topic-btn--current.topic-btn--ctx-logica {
  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-logica:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

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

/* IA Clássica → cypress → purple */
.topic-btn--current.topic-btn--ctx-cypress {
  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-cypress:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(139, 92, 246, 0.25);
  color: #ddd6fe;
}

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

/* IA Generativa → github → teal */
.topic-btn--current.topic-btn--ctx-github {
  background: rgba(20, 184, 166, 0.2);
  border-color: rgba(20, 184, 166, 0.65);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.2);
}

.topic-btn--current.topic-btn--ctx-github:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(20, 184, 166, 0.22);
  color: #99f6e4;
}

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

.topic-btn--current.topic-btn--ctx-cicd {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(14, 165, 233, 0.62);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.18);
}

.topic-btn--current.topic-btn--ctx-cicd:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(14, 165, 233, 0.22);
  color: #e0f2fe;
}

.topic-btn--current.topic-btn--ctx-cicd .topic-btn__title {
  color: #e0f2fe;
}

/* IA-driven → indigo */
.topic-btn--current.topic-btn--ctx-indigo {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.topic-btn--current.topic-btn--ctx-indigo:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(99, 102, 241, 0.25);
  color: #e0e7ff;
}

.topic-btn--current.topic-btn--ctx-indigo .topic-btn__title {
  color: #e0e7ff;
}

/* Análise de Dados com IA → emerald */
.topic-btn--current.topic-btn--ctx-emerald {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2);
}

.topic-btn--current.topic-btn--ctx-emerald:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(52, 211, 153, 0.22);
  color: #a7f3d0;
}

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

/* Data Scraping com IA → orange */
.topic-btn--current.topic-btn--ctx-orange {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.2);
}

.topic-btn--current.topic-btn--ctx-orange:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(249, 115, 22, 0.22);
  color: #fed7aa;
}

.topic-btn--current.topic-btn--ctx-orange .topic-btn__title {
  color: #fed7aa;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-logica {
  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-logica: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-logica .topic-btn__title {
  color: #92400e;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cypress {
  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-cypress: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-cypress .topic-btn__title {
  color: #4c1d95;
}

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

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-github:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(15, 118, 110, 0.16);
  color: #134e4a;
}

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

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cicd {
  background: rgba(3, 105, 161, 0.12);
  border-color: rgba(3, 105, 161, 0.4);
  box-shadow: 0 0 0 1px rgba(3, 105, 161, 0.1);
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cicd:not(.topic-btn--done) .topic-btn__badge {
  background: rgba(3, 105, 161, 0.16);
  color: #0c4a6e;
}

html[data-theme="light"] .topic-btn--current.topic-btn--ctx-cicd .topic-btn__title {
  color: #0c4a6e;
}

.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);
  }
}

.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;
  scroll-margin-top: var(--topbar-offset, 7.5rem);
}

.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;
}

.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;
}

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

/* Canvas link block inside theory */
.canvas-link-block {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid rgba(61, 156, 240, 0.3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.canvas-link-block__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.canvas-link-block__desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.canvas-link-block .btn {
  align-self: flex-start;
}

.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;
}

.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);
}

.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;
}

.theory-figure {
  margin: 1.25rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.theory-figure__img {
  display: block;
  max-height: 250px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.theory-figure__img:hover {
  opacity: 0.88;
}

.theory-figure__caption {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

.lightbox-dialog {
  padding: 0;
  border: none;
  background: transparent;
  max-width: 94vw;
  max-height: 94vh;
  overflow: visible;
}

.lightbox-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
}

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

.lightbox-dialog__panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-dialog__img {
  display: block;
  max-width: 90vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.lightbox-dialog__close {
  position: absolute;
  top: -1rem;
  right: -1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.lightbox-dialog__close:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

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

.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;
}

.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);
}

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

.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--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

.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__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

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

.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);
}

/* ── Canvas Page Styles ─────────────────────────────────────────────────── */

.canvas-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--canvas-topbar-h, 4rem);
}

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

.canvas-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.canvas-topbar__back:hover {
  background: var(--surface);
  border-color: var(--accent);
}

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

.canvas-topbar__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}

.canvas-topbar__theme {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.canvas-main {
  flex: 1;
  padding: 1.5rem 1.25rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.canvas-manager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.canvas-manager__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-basis: 100%;
}

.canvas-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.canvas-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: rgba(61, 156, 240, 0.5);
}

.canvas-manager__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.canvas-manager__actions .btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
}

.canvas-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.canvas-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--surface);
}

.canvas-grid + .canvas-grid {
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.canvas-grid--3col {
  grid-template-columns: repeat(3, 1fr);
}

.canvas-grid--2col {
  grid-template-columns: repeat(2, 1fr);
}

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

.canvas-cell:last-child {
  border-right: none;
}

.canvas-label {
  display: block;
  padding: 0.65rem 0.85rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  line-height: 1.25;
  cursor: default;
  user-select: none;
}

.canvas-field {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  min-height: 140px;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
  padding: 0.75rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text);
  resize: none;
  transition: background 0.15s;
}

.canvas-field:focus {
  outline: none;
  background: rgba(61, 156, 240, 0.04);
}

.canvas-field::placeholder {
  color: var(--muted);
  opacity: 0.7;
  font-size: 0.82rem;
  line-height: 1.45;
}

.canvas-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-wrap: wrap;
}

.canvas-save-status {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.canvas-save-status--saved {
  color: var(--success);
}

.canvas-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 3.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.canvas-empty-state p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

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

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

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

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

.canvas-import-dialog__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--text);
}

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

.canvas-import-dialog__textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 8rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
  margin-bottom: 0.85rem;
}

.canvas-import-dialog__textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: rgba(61, 156, 240, 0.5);
}

.canvas-import-dialog__error {
  display: none;
  font-size: 0.82rem;
  color: var(--danger);
  margin-bottom: 0.65rem;
}

.canvas-import-dialog__error--visible {
  display: block;
}

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

@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;
  }

  /* Canvas mobile: 1 coluna */
  .canvas-grid--3col,
  .canvas-grid--2col {
    grid-template-columns: 1fr;
  }

  .canvas-cell {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .canvas-cell:last-child {
    border-bottom: none;
  }

  .canvas-grid + .canvas-grid {
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

@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;
  }

  .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;
  }

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

  .canvas-select {
    width: 100%;
  }

  .canvas-manager__actions {
    justify-content: stretch;
  }

  .canvas-manager__actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}
