:root {
  --bg: #07090a;
  --surface: rgba(13, 16, 18, 0.92);
  --surface-strong: #0d1012;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --text: #eef2f1;
  --text-muted: #99a5a7;
  --text-faint: #657174;
  --border: rgba(210, 221, 222, 0.16);
  --border-strong: rgba(210, 221, 222, 0.3);
  --accent: #8eb7cc;
  --accent-strong: #c2e5f5;
  --accent-soft: rgba(142, 183, 204, 0.14);
  --ok: #72d19b;
  --ok-soft: rgba(114, 209, 155, 0.12);
  --radius: 4px;
  --maxw: 1240px;
  --grid-small: rgba(187, 198, 200, 0.12);
  --grid-large: rgba(187, 198, 200, 0.19);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  position: relative;
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: 0;
  inset: -15% 0;
  opacity: 0.8;
  transform: translate3d(0, calc(var(--scroll, 0) * -0.06px), 0);
  will-change: transform;
  background-image:
    linear-gradient(to right, var(--grid-large) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-large) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-small) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-small) 1px, transparent 1px);
  background-position: center center;
  background-size: 140px 140px, 140px 140px, 28px 28px, 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), transparent 92%);
}

body::after {
  z-index: 0;
  background: radial-gradient(circle at 50% 0%, rgba(66, 100, 113, 0.12), transparent 38%), linear-gradient(90deg, rgba(0, 0, 0, 0.22), transparent 35%, transparent 65%, rgba(0, 0, 0, 0.22));
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 10, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1px solid var(--accent-strong);
  content: "";
}

.brand:hover {
  color: var(--accent-strong);
}

.topbar-tag,
.eyebrow {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topbar-tag {
  white-space: nowrap;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 28px 76px;
}

#app.wide {
  max-width: 1280px;
}

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px 34px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  padding-top: 18px;
  text-transform: uppercase;
}

/* ---------- Inicio ---------- */

.hero-simple {
  padding: 78px 0 60px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  display: flex;
  justify-content: space-between;
  max-width: 360px;
  margin-bottom: 28px;
  color: var(--accent);
}

.eyebrow span {
  color: var(--text-faint);
}

.hero-simple h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(3.4rem, 7vw, 7.5rem);
  font-weight: 500;
  letter-spacing: -0.085em;
  line-height: 0.88;
}

.hero-simple h1 em {
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.hero-simple p {
  max-width: 440px;
  margin: 32px 0 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.hero-progress {
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 430px;
  margin-top: 42px;
}

.hero-progress .bar {
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: rgba(210, 221, 222, 0.2);
}

.hero-progress .bar > span {
  display: block;
  height: 100%;
  background: var(--accent-strong);
  transition: width 0.3s ease;
}

.hero-progress .label {
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.65rem;
  white-space: nowrap;
}

.home-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 32px;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.note-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

/* (modelo 3D eliminado) */

.section-title {
  margin: 62px 0 18px;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.area-card {
  display: flex;
  min-height: 212px;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-top: 2px solid var(--area-color, var(--accent));
  background: rgba(13, 16, 18, 0.76);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.area-card:hover {
  z-index: 1;
  background: rgba(28, 37, 40, 0.92);
  transform: translateY(-3px);
}

.area-card h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.area-card p {
  flex: 1;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.area-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
}

.mini-bar {
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: rgba(210, 221, 222, 0.16);
}

.mini-bar > span {
  display: block;
  height: 100%;
  background: var(--area-color, var(--accent));
  transition: width 0.3s ease;
}

/* ---------- Navegación y áreas ---------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0 0 28px;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-strong);
}

.breadcrumb .sep {
  color: var(--text-faint);
}

.area-header,
.course-hero {
  border: 1px solid var(--border);
  border-top: 2px solid var(--area-color, var(--accent));
  background: rgba(13, 16, 18, 0.9);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

.area-header {
  padding: 28px;
  margin-bottom: 28px;
}

.area-header h1,
.course-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}

.area-header p,
.course-desc {
  max-width: 740px;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.progress-row .mini-bar {
  max-width: 300px;
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.topic-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 130px;
  padding: 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(13, 16, 18, 0.78);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.topic-card:hover {
  background: rgba(28, 37, 40, 0.92);
  border-color: var(--border-strong);
}

.topic-card.done {
  background: var(--ok-soft);
}

.topic-num {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.66rem;
}

.topic-card.done .topic-num {
  border-color: var(--ok);
  background: var(--ok);
  color: #07100b;
}

.topic-body {
  min-width: 0;
  flex: 1;
}

.topic-body h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topic-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.topic-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
}

.topic-progress .mini-bar {
  max-width: 150px;
}

.badge {
  display: inline-block;
  margin-left: 9px;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  color: var(--accent-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.56rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.badge.nivel {
  color: var(--text-faint);
}

/* ---------- Cursos ---------- */

.course-hero {
  padding: 30px;
  margin-bottom: 12px;
}

.course-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.course-badges .badge {
  margin-left: 0;
}

.section-index {
  position: sticky;
  top: 72px;
  z-index: 20;
  display: flex;
  gap: 26px;
  overflow-x: auto;
  padding: 13px 2px 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 10, 0.86);
  backdrop-filter: blur(16px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
  scrollbar-width: none;
}

.section-index::-webkit-scrollbar {
  display: none;
}

.section-index::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  width: calc(var(--read, 0) * 100%);
  height: 1px;
  background: var(--accent);
  content: "";
  transition: width 0.12s linear;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 240px;
  padding: 0 0 13px;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip::after {
  position: absolute;
  right: 100%;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--border-strong);
  content: "";
  transition: right 0.25s ease, background 0.2s ease;
}

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

.chip:hover::after {
  right: 0;
}

.chip.active {
  color: var(--text);
}

.chip.active::after {
  right: 0;
  background: var(--accent-strong);
}

.chip.done {
  color: var(--ok);
}

.chip-check {
  flex: none;
  min-width: 1.5em;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  text-align: right;
}

.chip.done .chip-check {
  color: var(--ok);
}

.chip.active .chip-check {
  color: var(--accent-strong);
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-section {
  scroll-margin-top: 132px;
  padding: 32px;
  border: 1px solid var(--border);
  background: rgba(13, 16, 18, 0.9);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.lesson-section.done {
  border-color: rgba(114, 209, 155, 0.5);
  background: rgba(20, 37, 29, 0.82);
}

.lesson-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.lesson-num {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.65rem;
}

.lesson-section.done .lesson-num {
  border-color: var(--ok);
  background: var(--ok);
  color: #07100b;
}

.lesson-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.lesson-body {
  max-width: 900px;
  color: #d7dfde;
  font-size: 1rem;
  line-height: 1.8;
}

.lesson-body p {
  margin: 12px 0;
}

.lesson-body h3 {
  margin: 24px 0 8px;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 600;
}

.lesson-body ul,
.lesson-body ol {
  margin: 12px 0;
  padding-left: 25px;
}

.lesson-body li {
  margin: 6px 0;
}

.lesson-body strong {
  color: #f2f6f5;
  font-weight: 650;
}

.lesson-body .katex,
.lesson-body .katex-display {
  color: #d9f0fa;
}

.lesson-body .katex-display {
  overflow-x: auto;
  margin: 22px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(142, 183, 204, 0.16);
  border-bottom: 1px solid rgba(142, 183, 204, 0.16);
  scrollbar-width: thin;
}

.lesson-body .katex-display::-webkit-scrollbar {
  height: 4px;
}

.lesson-body .katex-display::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(142, 183, 204, 0.28);
}

.lesson-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.btn {
  appearance: none;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

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

.btn.primary {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn.primary:hover {
  background: var(--accent-soft);
}

.btn.done {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.nav-row .btn {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ---------- Recursos descargables ---------- */

.recursos {
  margin: 0 0 22px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  background: linear-gradient(120deg, rgba(142, 183, 204, 0.08), rgba(13, 16, 18, 0.92));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
}

.recursos-head {
  margin-bottom: 16px;
}

.recursos-kicker {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.recursos-head h2 {
  margin: 5px 0 4px;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.recursos-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.recurso-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recurso-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  background: rgba(13, 16, 18, 0.78);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.recurso-card:hover {
  border-color: var(--border-strong);
  background: rgba(28, 37, 40, 0.9);
  transform: translateY(-2px);
}

.recurso-icon {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  font-size: 1rem;
  line-height: 1;
}

.recurso-body {
  min-width: 0;
  flex: 1;
}

.recurso-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.recurso-titulo {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.recurso-meta {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.recurso-desc {
  margin: 6px 0 12px;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.recurso-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recurso-btn {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.2s ease;
}

.recurso-btn:hover {
  background: var(--accent-soft);
}

.recurso-link {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.recurso-link:hover {
  color: var(--accent-strong);
}

/* ---------- Recomendación variable ---------- */

.reco {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--ok);
  background: linear-gradient(120deg, rgba(114, 209, 155, 0.08), rgba(13, 16, 18, 0.92));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
}

.reco-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reco-kicker {
  color: var(--ok);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.reco-shuffle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.reco-shuffle:hover {
  color: var(--accent-strong);
}

.reco-title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.reco-title:hover {
  color: var(--accent-strong);
}

.reco-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.reco-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.reco-btn {
  display: inline-block;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  color: var(--accent-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.reco-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Candados, bloqueos y modal ---------- */

.area-card.locked {
  position: relative;
  opacity: 0.72;
}

.area-card.locked:hover {
  opacity: 1;
}

.lock-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.locked-view {
  max-width: 560px;
  margin: 0 auto;
  padding: 70px 20px;
  text-align: center;
}

.locked-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.locked-view h1 {
  margin: 18px 0 10px;
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.locked-view p {
  margin: 0 auto 24px;
  max-width: 430px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 7, 0.74);
  backdrop-filter: blur(6px);
  animation: routeIn 0.22s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.modal-box {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.modal-kicker {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.modal-box h3 {
  margin: 8px 0 6px;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-box p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.modal-box .update-actions {
  margin-top: 4px;
}

.reco-locked {
  border-left-color: var(--border-strong);
}

.recurso-card.recurso-locked {
  opacity: 0.78;
}

.recurso-note {
  margin: 0 0 10px;
  color: #e8a13c;
  font-size: 0.76rem;
}

/* ---------- Botón de Google ---------- */

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: linear-gradient(180deg, #4285f4, #3367d6);
  color: #ffffff;
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.google-btn:hover {
  filter: brightness(1.14);
  transform: translateY(-1px);
}

.google-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.topic-card.locked {
  position: relative;
  opacity: 0.72;
}

.topic-card.locked:hover {
  opacity: 1;
}

.locked-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ---------- Inicio centrado (solo escritorio) ---------- */

@media (min-width: 981px) {
  .hero-simple {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-simple .eyebrow,
  .hero-simple .hero-progress,
  .hero-simple .home-note,
  .hero-simple .continue-card {
    align-self: center;
  }

  .hero-simple .hero-mark {
    text-align: center;
  }

  .hero-simple .hero-mark img {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-simple .hero-desc {
    max-width: 520px;
    margin: 32px auto 0;
    text-align: center;
  }

  .hero-simple .home-note {
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .hero-simple {
    padding: 62px 0 50px;
  }

  .area-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 18px 18px 14px;
  }

  #app {
    padding: 20px 18px 54px;
  }

  .footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .hero-simple h1 {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .hero-simple p {
    font-size: 0.88rem;
  }

  .hero-progress {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .hero-progress .bar {
    width: 100%;
  }

  /* modelo 3D eliminado */

  .area-grid,
  .topic-list {
    grid-template-columns: 1fr;
  }

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

  .area-card {
    min-height: 180px;
  }

  .area-header,
  .course-hero,
  .lesson-section {
    padding: 22px 18px;
  }

  .area-header h1,
  .course-hero h1 {
    font-size: 2rem;
  }

  .lesson-section {
    scroll-margin-top: 118px;
  }

  .lesson-head h2 {
    font-size: 1.12rem;
  }

  .lesson-body {
    font-size: 0.94rem;
  }

  .section-index {
    top: 86px;
    gap: 20px;
  }
}

/* ---------- Movimiento ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.route-enter {
  animation: routeIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

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

.continue-card {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 34px;
  padding: 14px 18px;
  border: 1px solid var(--border-strong);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.continue-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(4px);
}

.continue-kicker {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.continue-title {
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.continue-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ---------- Cuenta y sincronización ---------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.account {
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-note {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-email {
  max-width: 190px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-btn {
  appearance: none;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s ease, border-color 0.2s ease;
}

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

.account-btn.primary {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.sync-dot.synced {
  background: var(--ok);
}

.sync-dot.syncing {
  background: var(--accent-strong);
  animation: syncPulse 1.2s ease-in-out infinite;
}

.sync-dot.pending {
  background: #e0b34d;
}

.sync-dot.offline {
  background: #e07a5f;
}

@keyframes syncPulse {
  50% {
    opacity: 0.25;
  }
}

@media (max-width: 640px) {
  .topbar-right {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .account-email {
    max-width: 150px;
  }
}

/* ---------- Marca, perfil y avatar ---------- */

.hero-mark img {
  display: block;
  width: min(560px, 82%);
  height: auto;
  margin: 2px 0 22px;
}

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: #1c2333;
  color: #fff;
}

.avatar-auto {
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.72rem;
}

.avatar-md {
  width: 52px;
  height: 52px;
  font-size: 1.2rem;
}

.avatar-lg {
  width: 88px;
  height: 88px;
  font-size: 2rem;
}

.hero-user {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.hero-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.hero-user-kicker {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-user-name {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.account-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.account-name {
  max-width: 150px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile:hover .account-name {
  color: var(--accent-strong);
}

/* Modal de perfil */

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 6, 7, 0.72);
  backdrop-filter: blur(6px);
  animation: profileFade 0.2s ease both;
}

.profile-modal {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: profileIn 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.profile-kicker {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.profile-modal h2 {
  margin: 8px 0 6px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.profile-modal p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.profile-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.profile-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.profile-link:hover {
  color: var(--text-muted);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}

.profile-field span {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-field input {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 0.9rem;
}

.profile-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes profileFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (max-width: 640px) {
  .hero-mark img {
    width: 100%;
  }

  .account-name {
    max-width: 96px;
  }

  .profile-modal {
    padding: 22px 18px;
  }
}

/* Figuras (SVG generado) */

.fig {
  margin: 22px 0;
}

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

.fig figcaption {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}

.table-wrap {
  margin: 20px 0;
  overflow-x: auto;
}

.lesson-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lesson-body th,
.lesson-body td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: center;
}

.lesson-body th {
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.lesson-body tbody tr:hover {
  background: rgba(142, 183, 204, 0.06);
}

/* Aviso de novedades */

.update-banner {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  width: min(360px, calc(100% - 40px));
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: profileIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.update-kicker {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.update-banner h3 {
  margin: 6px 0 4px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.update-banner p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.update-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.update-banner.update-error {
  border-top: 2px solid var(--warn, #e8a13c);
}

.update-banner.update-error .update-kicker {
  color: var(--warn, #e8a13c);
}

.update-banner.update-info {
  border-top: 2px solid var(--accent);
}

.update-banner.update-info .update-kicker {
  color: var(--accent);
}

.lesson-lock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .update-banner {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Tipografía de inicio (subrayados y textos clave) ---------- */

.hero-simple .hero-desc {
  font-size: 1.18rem;
  line-height: 1.45;
}

.home-note {
  font-size: 0.85rem;
  line-height: 1.4;
}

/* ---------- Responsive completo ---------- */

.topbar-right {
  flex-wrap: wrap;
}

.progress-row {
  flex-wrap: wrap;
}

.hero-progress .label {
  white-space: normal;
  line-height: 1.4;
}

.reco-actions,
.update-actions,
.modal-actions {
  flex-wrap: wrap;
}

.continue-card {
  max-width: 100%;
}

@media (max-width: 780px) {
  .hero-simple {
    padding: 60px 0 44px;
  }

  .hero-simple .hero-desc {
    font-size: 1.1rem;
  }

  .lesson-section {
    padding: 26px 20px;
  }

  .course-hero,
  .area-header {
    padding: 24px 20px;
  }

  .recursos {
    padding: 18px 16px;
  }

  .reco {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .area-grid,
  .topic-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-simple {
    padding: 46px 0 36px;
  }

  .hero-simple .hero-mark img {
    width: 92%;
  }

  .hero-simple .hero-desc {
    font-size: 1.05rem;
  }

  .home-note {
    font-size: 0.8rem;
  }

  .area-card {
    min-height: 150px;
    padding: 16px;
  }

  .topic-card {
    min-height: 0;
    padding: 14px;
  }

  .lesson-section {
    padding: 20px 14px;
  }

  .lesson-body {
    font-size: 0.92rem;
  }

  .google-btn {
    padding: 7px 10px;
    font-size: 0.55rem;
  }

  .btn {
    padding: 8px 11px;
  }

  .modal-box {
    padding: 20px 16px;
  }

  .course-hero h1,
  .area-header h1 {
    font-size: 1.6rem;
  }

  .continue-card {
    width: 100%;
  }

  .locked-view {
    padding: 40px 14px;
  }

  .locked-view h1 {
    font-size: 1.5rem;
  }

  .recurso-card {
    padding: 12px;
  }

  .hero-progress {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .hero-progress .bar {
    width: 100%;
  }

  .nav-row {
    flex-direction: column;
  }

  .nav-row .btn {
    max-width: 100%;
    text-align: center;
  }

  .lesson-head {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .eyebrow {
    font-size: 0.55rem;
  }

  .section-title {
    font-size: 0.62rem;
  }

  .topic-progress {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

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

  .reco-btn {
    text-align: center;
  }

  .recurso-actions {
    flex-wrap: wrap;
  }

  .lesson-lock {
    align-items: stretch;
  }

  .recursos-head h2 {
    font-size: 1rem;
  }

  .modal-kicker,
  .update-kicker {
    letter-spacing: 0.1em;
  }
}
