/* ============================================================
   styles.css — Curso interactivo de Git y GitHub
   ============================================================ */

:root {
  --bg: #0e1117;
  --bg-panel: #161b22;
  --bg-soft: #1c2330;
  --bg-input: #0b0f15;
  --border: #2a3441;
  --text: #e6edf3;
  --text-dim: #9aa7b6;
  --accent: #6ea8fe;
  --accent-2: #3fb950;
  --accent-3: #d29922;
  --danger: #f85149;
  --purple: #bc8cff;
  --lane-1: #6ea8fe;
  --lane-2: #3fb950;
  --lane-3: #d29922;
  --lane-4: #bc8cff;
  --lane-5: #f78166;
  --radius: 12px;
  --radius-s: 8px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

:root[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-panel: #ffffff;
  --bg-soft: #eef2f6;
  --bg-input: #ffffff;
  --border: #d7dee6;
  --text: #1c2128;
  --text-dim: #5b6775;
  --accent: #0969da;
  --accent-2: #1a7f37;
  --accent-3: #9a6700;
  --danger: #cf222e;
  --purple: #8250df;
  --lane-1: #0969da;
  --lane-2: #1a7f37;
  --lane-3: #bf8700;
  --lane-4: #8250df;
  --lane-5: #d1531f;
  --shadow: 0 10px 30px rgba(20, 30, 50, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: .92em;
}

code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .06em .38em;
  color: var(--text);
  white-space: nowrap;
  overflow-wrap: anywhere;
}

/* en pantallas estrechas, el código en línea puede partirse para no
   provocar desplazamiento horizontal de toda la página */
@media (max-width: 760px) {
  code {
    white-space: normal;
  }
}

pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: .8rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: .6rem 0;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 .5rem;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 8px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 6px;
  z-index: 100;
}

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

/* ---------------- barra superior ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .9rem;
  background: color-mix(in srgb, var(--bg-panel) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--purple));
  color: #fff;
  font-size: 1.15rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-size: .98rem;
}

.brand-sub {
  font-size: .68rem;
  color: var(--text-dim);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.search {
  position: relative;
  flex: 1;
  max-width: 560px;
  margin-left: auto;
}

.search input {
  width: 100%;
  padding: .5rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: .92rem;
}

.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 50;
  max-height: 70vh;
  overflow-y: auto;
}

.search-results a {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: .1rem .6rem;
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.search-results a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}

.search-results .kind {
  grid-row: span 2;
  align-self: center;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-align: center;
  padding: .1rem 0;
}

.search-results .sub {
  font-size: .8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results .see-all {
  display: block;
  text-align: center;
  color: var(--accent);
  grid-template-columns: none;
}

.head-progress {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 96px;
}

.head-progress .bar {
  flex: 1;
}

.hp-text {
  font-size: .75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#menu-toggle {
  display: none;
}

/* ---------------- barras de progreso ---------------- */

.bar {
  height: 7px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s ease;
}

/* ---------------- estructura ---------------- */

.layout {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 290px;
  flex-shrink: 0;
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 1rem .8rem 3rem;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 1.4rem clamp(.8rem, 2.5vw, 2rem) 4rem;
}

.backdrop {
  display: none;
}

/* ---------------- barra lateral ---------------- */

.side-progress {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  margin-bottom: .9rem;
}

.side-progress-top {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  margin-bottom: .35rem;
}

.side-progress-meta {
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: .35rem;
}

.side-nav {
  display: grid;
  gap: 2px;
  margin-bottom: 1.1rem;
}

.side-nav a {
  padding: .4rem .55rem;
  border-radius: var(--radius-s);
  color: var(--text);
  font-size: .9rem;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--accent);
}

.side-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-dim);
  margin: 0 0 .4rem .3rem;
}

.mod {
  border-radius: var(--radius-s);
  margin-bottom: 2px;
}

.mod>summary {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  padding: .45rem .55rem;
  border-radius: var(--radius-s);
  font-size: .86rem;
  font-weight: 600;
  list-style: none;
}

.mod>summary::-webkit-details-marker {
  display: none;
}

.mod>summary::before {
  content: "▸";
  color: var(--text-dim);
  transition: transform .15s;
}

.mod[open]>summary::before {
  transform: rotate(90deg);
}

.mod>summary:hover {
  background: var(--bg-soft);
}

.mod-name {
  flex: 1;
}

.mod-count {
  font-size: .7rem;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 .45rem;
}

.mod-count.complete {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.mod-lessons {
  list-style: none;
  margin: .1rem 0 .5rem;
  padding: 0 0 0 .5rem;
  border-left: 1px solid var(--border);
}

.mod-lessons a {
  display: grid;
  grid-template-columns: 14px 22px 1fr;
  align-items: center;
  gap: .3rem;
  padding: .3rem .4rem;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: .84rem;
}

.mod-lessons a:hover {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}

.mod-lessons a.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-weight: 600;
}

.mod-lessons a.done {
  color: var(--text);
}

.mod-lessons .tick {
  color: var(--accent-2);
  font-size: .8rem;
}

.mod-lessons .l-num {
  font-variant-numeric: tabular-nums;
  font-size: .72rem;
  color: var(--text-dim);
  text-align: right;
}

/* ---------------- lección ---------------- */

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 44%);
  gap: 1.6rem;
  align-items: start;
}

.lesson-pane {
  min-width: 0;
}

.practice-pane {
  position: sticky;
  top: 70px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: calc(100vh - 86px);
  display: flex;
  flex-direction: column;
}

.lesson-head {
  margin-bottom: 1.2rem;
}

.lesson-meta {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .3rem;
}

.mod-chip {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .6rem;
  background: var(--bg-soft);
}

.pos {
  font-size: .78rem;
  color: var(--text-dim);
}

.lesson-head h1 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  margin: .1rem 0 .7rem;
  font-family: var(--mono);
  letter-spacing: -.02em;
}

.bar-lesson {
  margin-bottom: .8rem;
}

.lesson-tools {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: .45rem .85rem;
  font-size: .88rem;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06131f;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.1);
  color: #06131f;
}

.btn-lg {
  padding: .7rem 1.2rem;
  font-size: 1rem;
}

.btn-done.is-done {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* bloques de contenido */

.block {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.block h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  margin-bottom: .6rem;
}

.block p {
  margin: .4rem 0;
}

.block-context {
  border-left: 3px solid var(--accent-3);
}

.block-objective {
  border-left: 3px solid var(--accent);
}

.block-concept {
  border-left: 3px solid var(--purple);
}

.block-exercise {
  border-left: 3px solid var(--accent-2);
}

.block-exercise.solved {
  background: color-mix(in srgb, var(--accent-2) 8%, var(--bg-panel));
}

.block-challenge {
  border-left: 3px solid var(--lane-5);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .6rem;
}

.tag {
  font-size: .74rem;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .6rem;
}

.prep {
  margin: .3rem 0;
  padding-left: 1.2rem;
}

.prep li {
  margin: .25rem 0;
}

.steps-hint {
  font-size: .86rem;
  color: var(--text-dim);
}

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: .85rem 1rem;
  margin: .7rem 0;
  background: var(--bg-soft);
  animation: fade .25s ease;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.step-head {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}

.step-head h3 {
  font-size: 1rem;
  margin: 0;
}

.step-n {
  font-size: .7rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .05rem .5rem;
  white-space: nowrap;
}

.cmd {
  display: flex;
  align-items: center;
  gap: .6rem;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: .5rem .7rem;
  margin: .55rem 0;
  overflow-x: auto;
}

.cmd code {
  background: none;
  border: 0;
  color: var(--accent-2);
  font-size: .95rem;
  white-space: pre;
}

.cmd-actions {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}

.mini {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: .72rem;
  padding: .18rem .5rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.mini:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.cmd-parts {
  list-style: none;
  margin: .4rem 0;
  padding: 0;
  display: grid;
  gap: .25rem;
}

.cmd-parts li {
  display: flex;
  gap: .5rem;
  font-size: .87rem;
  align-items: baseline;
}

.cmd-parts code {
  color: var(--accent);
  flex-shrink: 0;
}

.expected {
  margin: .5rem 0;
}

.expected summary,
.hint summary,
.solution summary {
  cursor: pointer;
  font-size: .84rem;
  color: var(--accent);
  user-select: none;
}

.expected pre {
  font-size: .82rem;
  white-space: pre-wrap;
}

.step-check {
  font-size: .87rem;
  color: var(--text-dim);
  border-top: 1px dashed var(--border);
  padding-top: .5rem;
  margin-top: .5rem;
}

.step-check span {
  color: var(--accent-2);
}

.steps-nav {
  display: flex;
  gap: .5rem;
  margin-top: .8rem;
  flex-wrap: wrap;
}

/* quiz */

.quiz {
  border-top: 1px solid var(--border);
  padding-top: .8rem;
  margin-top: .8rem;
}

.quiz:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.quiz .q {
  font-weight: 600;
}

.opts {
  display: grid;
  gap: .4rem;
  margin: .5rem 0;
}

.opt {
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-s);
  padding: .55rem .8rem;
  cursor: pointer;
  font-family: inherit;
  font-size: .9rem;
}

.opt:hover:not(:disabled) {
  border-color: var(--accent);
}

.opt.right {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 15%, transparent);
}

.opt.wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
}

.quiz-feedback {
  font-size: .88rem;
  padding: .5rem .7rem;
  border-radius: var(--radius-s);
  background: var(--bg-soft);
}

.quiz-feedback.ok {
  border-left: 3px solid var(--accent-2);
}

.quiz-feedback.ko {
  border-left: 3px solid var(--accent-3);
}

/* ejercicio */

.level {
  font-size: .68rem;
  border-radius: 999px;
  padding: .1rem .55rem;
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.level-inicial {
  color: var(--accent-2);
}

.level-intermedio {
  color: var(--accent-3);
}

.level-avanzado {
  color: var(--lane-5);
}

.level-colaborativo {
  color: var(--purple);
}

.tasks {
  padding-left: 1.2rem;
}

.tasks li {
  margin: .25rem 0;
}

.check-list {
  list-style: none;
  margin: .6rem 0;
  padding: 0;
  display: grid;
  gap: .35rem;
}

.check-list li {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  font-size: .9rem;
  color: var(--text-dim);
}

.check-list li.ok {
  color: var(--text);
}

.check-list .box {
  width: 19px;
  height: 19px;
  border: 1px solid var(--border);
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: .75rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.check-list li.ok .box {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #06131f;
}

.ex-done {
  color: var(--accent-2);
  font-weight: 600;
}

.ex-tools {
  display: grid;
  gap: .5rem;
  margin-top: .6rem;
}

.sol-warn {
  font-size: .82rem;
  color: var(--accent-3);
}

.block-key .key {
  padding-left: 1.2rem;
}

.source-note {
  font-size: .84rem;
  color: var(--text-dim);
}

.diagram {
  margin: .9rem 0;
  padding: .8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  overflow-x: auto;
}

.diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.diagram pre {
  border: 0;
  background: none;
  margin: 0;
  font-size: .8rem;
  color: var(--text-dim);
}

.lesson-foot {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.lesson-foot .btn {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ---------------- panel de práctica ---------------- */

.practice-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.tabs {
  display: flex;
  gap: .2rem;
  overflow-x: auto;
  flex: 1;
}

.tab {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  border-radius: 7px;
  padding: .3rem .6rem;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--accent);
}

.panes {
  flex: 1;
  overflow: auto;
  min-height: 340px;
}

.pane {
  display: none;
  padding: .6rem;
}

.pane.active {
  display: block;
}

.pane-note {
  font-size: .76rem;
  color: var(--text-dim);
  margin: .5rem .2rem 0;
}

/* terminal */

.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--bg-input);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.term-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.r {
  background: #ff5f57;
}

.dot.y {
  background: #febc2e;
}

.dot.g {
  background: #28c840;
}

.term-title {
  font-size: .74rem;
  color: var(--text-dim);
  margin-left: .4rem;
  flex: 1;
}

.term-body {
  padding: .6rem .7rem;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.55;
  min-height: 300px;
  max-height: 46vh;
  overflow-y: auto;
  cursor: text;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.t-out {
  color: var(--text);
}

.t-err {
  color: var(--danger);
}

.t-cmd {
  color: var(--text);
}

.t-hint {
  color: var(--text-dim);
}

.t-welcome {
  color: var(--accent-3);
}

.p-user {
  color: var(--accent-2);
}

.p-path {
  color: var(--accent);
}

.p-branch {
  color: var(--purple);
}

.p-dollar {
  color: var(--text-dim);
  margin-left: .25rem;
}

.term-inputline {
  display: flex;
  align-items: baseline;
  gap: .35rem;
}

.term-input {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: .82rem;
  outline: none;
  min-width: 40px;
}

/* visualizaciones */

.viz-empty {
  color: var(--text-dim);
  font-size: .88rem;
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-s);
}

.graph-scroll {
  overflow-x: auto;
  padding-bottom: .3rem;
}

.graph-svg {
  min-width: 100%;
}

.graph-svg .edge {
  fill: none;
  stroke-width: 2.5;
  opacity: .75;
}

.graph-svg .g-sha {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-dim);
}

.graph-svg .g-msg {
  font-family: var(--sans);
  font-size: 10px;
  fill: var(--text-dim);
}

.graph-svg .ref rect {
  fill: var(--bg-soft);
  stroke: var(--border);
}

.graph-svg .ref text {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--text);
}

.graph-svg .ref-head rect {
  fill: color-mix(in srgb, var(--accent) 30%, var(--bg-soft));
  stroke: var(--accent);
}

.graph-svg .ref-tag rect {
  fill: color-mix(in srgb, var(--accent-3) 26%, var(--bg-soft));
  stroke: var(--accent-3);
}

.graph-svg .ref-remote rect {
  fill: color-mix(in srgb, var(--purple) 24%, var(--bg-soft));
  stroke: var(--purple);
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}

.chip {
  font-size: .73rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: .1rem .6rem;
  color: var(--text-dim);
}

.chip-branch {
  color: var(--purple);
}

.chip-staged {
  color: var(--accent-2);
}

.chip-mod {
  color: var(--accent-3);
}

.chip-untracked {
  color: var(--danger);
}

.chip-conflict {
  color: var(--danger);
  border-color: var(--danger);
}

.workflow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: .3rem;
}

.wf-col {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: .5rem;
  min-width: 0;
}

.wf-col h4 {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-bottom: .35rem;
}

.wf-wt {
  border-top: 3px solid var(--accent-3);
}

.wf-idx {
  border-top: 3px solid var(--accent-2);
}

.wf-repo {
  border-top: 3px solid var(--accent);
}

.wf-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .2rem;
}

.wf-col li {
  font-family: var(--mono);
  font-size: .75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .12rem .35rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-empty {
  font-size: .75rem;
  color: var(--text-dim);
  margin: 0;
}

.wf-arrow {
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: .9rem;
}

.wf-arrow span {
  font-family: var(--mono);
  font-size: .64rem;
  color: var(--accent);
  display: block;
}

.wf-note {
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: .6rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}

.file-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  overflow: hidden;
}

.file-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem .55rem;
  background: var(--bg-soft);
  font-size: .8rem;
}

.file-name {
  font-family: var(--mono);
}

.file-tag {
  font-size: .68rem;
  color: var(--text-dim);
}

.f-untracked .file-tag {
  color: var(--danger);
}

.f-mod .file-tag {
  color: var(--accent-3);
}

.f-staged .file-tag {
  color: var(--accent-2);
}

.f-conflict {
  border-color: var(--danger);
}

.f-conflict .file-tag {
  color: var(--danger);
}

.file-content {
  margin: 0;
  border: 0;
  border-radius: 0;
  font-size: .75rem;
  max-height: 160px;
  white-space: pre-wrap;
}

.file-content.empty {
  color: var(--text-dim);
}

/* GitHub */

.gh-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .6rem;
}

.gh-user {
  font-size: .85rem;
  margin-bottom: .5rem;
}

.gh-repo {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  margin-bottom: .5rem;
  overflow: hidden;
}

.gh-repo-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  background: var(--bg-soft);
  padding: .35rem .6rem;
  font-size: .86rem;
}

.gh-repo-body {
  padding: .4rem .6rem;
  font-size: .78rem;
  display: grid;
  gap: .2rem;
}

.gh-repo-body code {
  white-space: normal;
  word-break: break-all;
}

.badge {
  font-size: .66rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .02rem .5rem;
  color: var(--text-dim);
}

.badge-fork {
  color: var(--purple);
  border-color: var(--purple);
}

.badge-ok,
.badge-merged {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.badge-open {
  color: var(--accent);
  border-color: var(--accent);
}

.badge-closed {
  color: var(--danger);
  border-color: var(--danger);
}

.gh-section {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  margin: .8rem 0 .3rem;
}

.gh-pr {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s);
  padding: .4rem .6rem;
  margin-bottom: .4rem;
  font-size: .82rem;
}

.gh-pr-merged {
  border-left-color: var(--accent-2);
}

.gh-pr-closed {
  border-left-color: var(--danger);
}

.gh-conflict {
  color: var(--danger);
  font-size: .78rem;
}

.gh-ok {
  color: var(--accent-2);
  font-size: .78rem;
}

.gh-log {
  font-size: .78rem;
  color: var(--text-dim);
  padding-left: 1.1rem;
  margin: 0;
}

.fake-link {
  color: var(--accent);
}

.video-box {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-s);
  overflow: hidden;
}

.video-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------------- páginas auxiliares ---------------- */

.page {
  max-width: 900px;
  margin: 0 auto;
}

.page h1 {
  font-size: 1.8rem;
}

.lead {
  color: var(--text-dim);
}

.cmd-filter {
  width: 100%;
  padding: .6rem .9rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  margin: .8rem 0;
  font-size: .95rem;
}

.cmd-list {
  display: grid;
  gap: .8rem;
}

.cmd-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
}

.cmd-card h3 {
  margin: 0 0 .3rem;
}

.cmd-card h3 code {
  background: none;
  border: 0;
  color: var(--accent-2);
  font-size: 1.1rem;
  padding: 0;
}

.cmd-purpose {
  margin: .2rem 0 .5rem;
}

.cmd-syntax span,
.cmd-example span {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

.cmd-syntax pre,
.cmd-example pre {
  margin: .2rem 0 .5rem;
  font-size: .84rem;
}

.cmd-warning {
  font-size: .85rem;
  color: var(--accent-3);
}

.cmd-related,
.cmd-lessons {
  font-size: .82rem;
  color: var(--text-dim);
}

.cmd-related span,
.cmd-lessons span {
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .06em;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .8rem;
  margin-top: 1rem;
}

.ach {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  opacity: .55;
}

.ach.got {
  opacity: 1;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 30%, transparent);
}

.ach-icon {
  font-size: 2rem;
  display: block;
}

.ach h3 {
  font-size: .98rem;
  margin: .3rem 0;
}

.ach p {
  font-size: .8rem;
  color: var(--text-dim);
  margin: 0 0 .4rem;
}

.ach-state {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}

.ach.got .ach-state {
  color: var(--accent-2);
}

.glossary dt {
  font-weight: 700;
  margin-top: .8rem;
  color: var(--accent);
}

.glossary dd {
  margin: .1rem 0 0;
  color: var(--text);
}

.search-results-page,
.search-results ul {
  list-style: none;
}

ul.search-results {
  list-style: none;
  padding: 0;
  display: grid;
  gap: .4rem;
}

ul.search-results a {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: .1rem .7rem;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-panel);
  color: var(--text);
}

ul.search-results .kind {
  grid-row: span 2;
  align-self: center;
  font-size: .7rem;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 999px;
}

ul.search-results .sub {
  font-size: .82rem;
  color: var(--text-dim);
}

.empty {
  color: var(--text-dim);
  padding: 1rem 0;
}

/* inicio */

.hero {
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 14%, var(--bg-panel)), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem clamp(1rem, 3vw, 2.4rem);
  margin-bottom: 1.4rem;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .74rem;
  color: var(--accent);
  margin: 0;
}

.hero h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.7rem);
  margin: .3rem 0 .6rem;
  max-width: 22ch;
}

.hero .lead {
  max-width: 68ch;
  color: var(--text);
  opacity: .85;
}

.hero-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin: 1.2rem 0;
}

.hero-progress .bar {
  max-width: 420px;
}

.hero-progress p {
  font-size: .82rem;
  color: var(--text-dim);
  margin: .35rem 0 0;
}

.home section {
  margin-bottom: 1.6rem;
}

.home h2 {
  font-size: 1.15rem;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .6rem;
  padding: 0;
  margin: .6rem 0 0;
  counter-reset: f;
  list-style: none;
}

.flow-steps li {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s);
  padding: .6rem .8rem;
  font-size: .88rem;
  counter-increment: f;
}

.flow-steps li::before {
  content: counter(f);
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #06131f;
  font-size: .72rem;
  font-weight: 700;
  margin-right: .5rem;
}

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: .8rem;
  margin-top: .7rem;
}

.mod-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  display: block;
}

.mod-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  transition: .15s;
}

.mod-icon {
  font-size: 1.5rem;
}

.mod-card h3 {
  font-size: 1rem;
  margin: .3rem 0;
}

.mod-card p {
  font-size: .84rem;
  color: var(--text-dim);
  margin: 0 0 .6rem;
  min-height: 2.6em;
}

.mod-meta {
  font-size: .74rem;
  color: var(--text-dim);
  display: block;
  margin-top: .35rem;
}

.home-note {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: .9rem;
}

/* almacenamiento (IndexedDB) y copias de seguridad */

.storage-box {
  border-top: 1px dashed var(--border);
  margin-top: .8rem;
  padding-top: .8rem;
}

.storage-meta {
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.storage-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .6rem;
}

/* evita el parpadeo mientras se abre la base de datos */
body.loading .layout {
  opacity: 0;
}

.layout {
  opacity: 1;
  transition: opacity .18s ease;
}

/* proyecto */

.stages {
  display: grid;
  gap: .5rem;
}

.stage {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-soft);
  overflow: hidden;
}

.stage.done {
  border-color: var(--accent-2);
}

.stage>summary {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  cursor: pointer;
  list-style: none;
  font-size: .92rem;
}

.stage>summary::-webkit-details-marker {
  display: none;
}

.stage-n {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: .78rem;
  flex-shrink: 0;
}

.stage.done .stage-n {
  background: var(--accent-2);
  color: #06131f;
  border-color: var(--accent-2);
}

.stage-title {
  flex: 1;
}

.stage-state {
  color: var(--accent-2);
}

.stage-body {
  padding: .3rem .8rem .8rem;
  background: var(--bg-panel);
  font-size: .9rem;
}

/* ---------------- modal y avisos ---------------- */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 1rem;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  width: min(460px, 100%);
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-top: 0;
}

.modal label {
  display: block;
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: .6rem;
}

.modal label.check {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
  color: var(--text);
}

.modal input,
.modal select {
  width: 100%;
  margin-top: .2rem;
  padding: .45rem .6rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
}

.modal label.check input {
  width: auto;
  margin-top: .35rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .6rem;
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: .5rem;
  z-index: 95;
  max-width: min(380px, 92vw);
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--accent-2);
  border-left-width: 4px;
  border-radius: var(--radius-s);
  padding: .6rem .9rem;
  font-size: .87rem;
  box-shadow: var(--shadow);
  animation: slide .25s ease;
  white-space: pre-line;
}

.toast.error {
  border-color: var(--danger);
}

.toast.out {
  opacity: 0;
  transition: opacity .55s;
}

@keyframes slide {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------------- responsive ---------------- */

@media (max-width: 1180px) {
  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .practice-pane {
    position: static;
    max-height: none;
  }

  .term-body {
    max-height: 60vh;
  }
}

@media (max-width: 980px) {
  #menu-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 53px;
    left: 0;
    bottom: 0;
    height: auto;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform .2s ease;
    width: min(300px, 86vw);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: none;
  }

  .backdrop.show {
    display: block;
    position: fixed;
    inset: 53px 0 0 0;
    background: rgba(0, 0, 0, .5);
    z-index: 44;
  }

  .brand-sub {
    display: none;
  }

  .head-progress {
    display: none;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 15px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: .5rem;
    gap: .5rem;
  }

  .search {
    order: 5;
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }

  .sidebar {
    top: 96px;
  }

  .backdrop.show {
    top: 96px;
  }

  .brand-text {
    font-size: .9rem;
  }

  .workflow {
    grid-template-columns: 1fr;
  }

  .wf-arrow {
    transform: rotate(90deg);
    padding: .1rem 0;
  }

  .lesson-foot .btn {
    max-width: 100%;
    flex: 1;
  }

  .block {
    padding: .9rem;
  }

  .term-body {
    font-size: .78rem;
    min-height: 240px;
  }

  .mod-card p {
    min-height: 0;
  }
}

@media print {

  .topbar,
  .sidebar,
  .practice-pane,
  .toasts {
    display: none;
  }
}
