/* ============ Custom properties / palette ============ */
:root {
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;

  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --red-50: #fef2f2;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --white: #ffffff;

  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-ui);
  color: var(--slate-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

img {
  max-width: 100%;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--white);
  border-bottom: 1px solid var(--slate-100);
}

.site-header__inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.brand-chip {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--indigo-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-chip svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--white);
}

.brand-text h1 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--slate-900);
  line-height: 1.3;
}

.brand-text .brand-by {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--slate-500);
}

.brand-by a {
  flex-shrink: 0;
}

.brand-by img {
  height: 1.5rem;
  width: auto;
  display: block;
}

.site-header__progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.site-header__progress .progress-label {
  font-size: 0.8rem;
  color: var(--slate-500);
  white-space: nowrap;
}

.progress-track {
  width: 8rem;
  height: 0.5rem;
  background: var(--slate-100);
  border-radius: 9999px;
  overflow: hidden;
  box-shadow: var(--shadow-inner);
}

.progress-fill {
  height: 100%;
  background: var(--indigo-600);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.progress-pct {
  font-weight: 700;
  color: var(--indigo-600);
  font-size: 0.9rem;
  min-width: 2.5rem;
  text-align: right;
}

/* ============ Main / home ============ */
main.home {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem;
}

.home__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.home__head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
}

.home__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.btn-primary {
  background: var(--indigo-600);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--indigo-700);
}

.btn-dark {
  background: var(--slate-900);
  color: var(--white);
}
.btn-dark:hover {
  background: var(--slate-700);
}

.btn-outline {
  background: var(--white);
  color: var(--slate-700);
  border-color: var(--slate-300);
}
.btn-outline:hover {
  background: var(--slate-50);
}

/* ============ Plan table ============ */
.plan-card {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
}

.plan-table thead th {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  background: var(--slate-50);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--slate-200);
}

.plan-table th.col-num { width: 3rem; }
.plan-table th.col-progress, .plan-table td.col-progress { text-align: right; }

.plan-table tbody tr.chapter-row td {
  background: rgba(248, 250, 252, 0.5);
  font-weight: 700;
  color: var(--indigo-600);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--slate-100);
}

.plan-table tbody tr.chapter-row td span {
  color: var(--slate-900);
}

.chapter-row .chapter-icon {
  display: inline-flex;
  vertical-align: -0.2em;
  margin-right: 0.4rem;
  width: 1rem;
  height: 1rem;
  color: var(--indigo-600);
}

.plan-table tbody tr.topic-row {
  cursor: pointer;
  border-bottom: 1px solid var(--slate-100);
  transition: background-color 0.1s ease;
}

.plan-table tbody tr.topic-row:last-child {
  border-bottom: none;
}

.plan-table tbody tr.topic-row:hover {
  background: var(--slate-50);
}

.plan-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.col-num {
  font-family: var(--font-mono);
  color: var(--slate-400);
  font-variant-numeric: tabular-nums;
}

.col-title {
  font-weight: 500;
  color: var(--slate-900);
}

.col-desc {
  color: var(--slate-500);
  font-size: 0.875rem;
}

.col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}

/* ============ Status pill ============ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.pill-not-started {
  background: var(--slate-100);
  color: var(--slate-600);
}
.pill-not-started .dot { background: var(--slate-400); }

.pill-in-progress {
  background: var(--amber-100);
  color: var(--amber-800);
}
.pill-in-progress .dot { background: var(--amber-600); }

.pill-completed {
  background: var(--emerald-100);
  color: var(--emerald-700);
}
.pill-completed .dot { background: var(--emerald-600); }

/* Icon button (open presentation) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-lg);
  border: none;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--slate-100);
  color: var(--indigo-600);
}

.icon-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ============ Presentation overlay ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--white);
  display: flex;
  flex-direction: column;
}

.overlay[hidden] {
  display: none;
}

.overlay__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--slate-100);
  gap: 1rem;
}

@media (min-width: 768px) {
  .overlay__top { padding: 1.5rem; }
}

.overlay__topic-title {
  font-weight: 600;
  color: var(--slate-800);
  font-size: 1.05rem;
  margin: 0 0 0.2rem 0;
}

.overlay__slide-counter {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
}

.overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: none;
  background: var(--slate-100);
  color: var(--slate-600);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.overlay__close:hover {
  background: var(--slate-200);
}

.overlay__close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.overlay__content {
  flex: 1;
  display: flex;
  overflow-y: auto;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .overlay__content { padding: 3rem; }
}

.slide-wrapper {
  max-width: 64rem;
  margin: auto;
  width: 100%;
}

.slide-wrapper.anim-in {
  animation: slide-in 0.3s ease-in-out;
}

.slide-wrapper.anim-out {
  animation: slide-out 0.3s ease-in-out;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-40px); }
}

.slide h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 1.25rem 0;
}

@media (min-width: 768px) {
  .slide h2 { font-size: 2.1rem; }
}

.slide__content p,
.slide__content li {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--slate-700);
  margin: 0 0 0.85rem 0;
}

.slide__content strong {
  color: var(--slate-900);
  font-weight: 700;
}

.slide__content .note {
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  color: var(--amber-800);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
}

/* ============ Code window ============ */
code-window {
  display: block;
  margin-top: 1.25rem;
}

.code-window {
  background: var(--slate-900);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.code-window__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 0.75rem;
}

.code-window__header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.code-window__header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.code-window__dots {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.code-window__dots span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 9999px;
  display: block;
}

.code-window__dots span:nth-child(1) { background: #ff5f56; }
.code-window__dots span:nth-child(2) { background: #ffbd2e; }
.code-window__dots span:nth-child(3) { background: #27c93f; }

.code-window__filename,
.code-window__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--slate-400);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-window__label {
  background: transparent;
  padding: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--slate-300);
}

.code-window__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--radius-lg);
  border: none;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.code-window__action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--slate-100);
}

.code-window__action svg {
  width: 1rem;
  height: 1rem;
}

.code-window__action .copied-tip {
  position: absolute;
  top: -1.8rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--emerald-600);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-lg);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.code-window__action .copied-tip.show {
  opacity: 1;
}

.code-window pre {
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--slate-200);
}

.code-window pre .line {
  display: block;
  min-height: 1.6em;
}

/* Terminal variant: prompt-style $ lines */
.code-window--terminal pre .line {
  color: var(--slate-300);
}

/* Syntax highlight tokens */
.tok-keyword { color: #c084fc; }
.tok-string { color: #86efac; }
.tok-number { color: #fdba74; }
.tok-comment { color: #64748b; font-style: italic; }
.tok-function { color: #93c5fd; }
.tok-attr { color: #67e8f9; }
.tok-const { color: #f9a8d4; }
.tok-prompt { color: #34d399; font-weight: 700; }

/* ============ Cards (resource links) ============ */
/* Máximo 3 tarjetas por fila, con las filas incompletas centradas */
.card-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.card-grid > * {
  flex: 0 0 calc((100% - 2rem) / 3);
  min-width: 0;
}

@media (max-width: 900px) {
  .card-grid > * { flex-basis: calc((100% - 1rem) / 2); }
}

@media (max-width: 560px) {
  .card-grid > * { flex-basis: 100%; }
}

.resource-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: 1.25rem 1.1rem;
  text-decoration: none;
  color: var(--slate-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.resource-card:hover {
  border-color: var(--indigo-600);
  box-shadow: var(--shadow-sm);
}

.resource-card img {
  height: 56px;
  max-width: 100%;
  object-fit: contain;
}

.resource-card .resource-card__name {
  font-weight: 700;
  color: var(--slate-900);
}

.resource-card .resource-card__desc {
  font-size: 0.8rem;
  color: var(--slate-500);
}

.resource-card .resource-card__url {
  font-size: 0.8rem;
  color: var(--indigo-600);
  font-weight: 600;
  word-break: break-all;
}

.resource-card:hover .resource-card__url {
  text-decoration: underline;
}

/* ============ Asset grid slide ============ */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.asset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: 1rem;
  text-align: center;
}

.asset-card__preview {
  width: 100%;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asset-card__preview img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
}

.asset-card__preview .font-tile {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--slate-900);
  color: var(--amber-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}

.asset-card__preview svg {
  width: 48px;
  height: 48px;
  color: var(--indigo-600);
}

.asset-card__filename {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-900);
  word-break: break-all;
}

.asset-card__purpose {
  font-size: 0.75rem;
  color: var(--slate-500);
}

/* ============ What-is-pygame logo ============ */
.slide-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.slide-logo img {
  max-height: 80px;
  width: auto;
  display: block;
}

/* ============ Gallery grid ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gallery-item .gif-frame {
  margin-top: 0;
  width: 100%;
}

.gallery-item .gif-frame img {
  width: 100%;
  max-width: none;
}

.gallery-item .gif-caption {
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ GIF slide ============ */
.gif-card {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.gif-frame {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 0.75rem;
  background: var(--slate-50);
  box-shadow: var(--shadow-sm);
}

.gif-frame img {
  display: block;
  width: 100%;
  max-width: 800px;
  image-rendering: pixelated;
  border-radius: calc(var(--radius-xl) - 0.25rem);
}

.gif-caption {
  color: var(--slate-500);
  font-size: 0.9rem;
  text-align: center;
  max-width: 40rem;
}

/* ============ Download slide ============ */
.download-card {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--indigo-600);
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: var(--radius-xl);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease;
}

.download-btn:hover {
  background: var(--indigo-700);
}

.download-btn svg {
  width: 1.4rem;
  height: 1.4rem;
}

.download-hint {
  color: var(--slate-500);
  font-size: 0.9rem;
}

/* ============ Contact slide ============ */
.contact-card {
  margin: 1.5rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  max-width: 36rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 2.5rem 2rem;
  background: var(--white);
}

.contact-card img.logo {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.contact-card h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--slate-900);
  font-weight: 700;
}

.contact-card .contact-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--slate-900);
  margin-top: 0.25rem;
}

.contact-card .contact-subtitle {
  color: var(--slate-500);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.75rem;
}

.contact-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--slate-200);
  border-radius: 9999px;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--slate-700);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.contact-chip:hover {
  border-color: var(--indigo-600);
  background: var(--indigo-50);
  color: var(--indigo-700);
}

.contact-chip svg {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  color: var(--indigo-600);
}

@media (max-width: 640px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ Home footer ============ */
.home-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  color: var(--slate-500);
  font-size: 0.85rem;
}

.home-footer a {
  color: var(--slate-500);
  text-decoration: none;
  font-weight: 600;
}

.home-footer a:hover {
  text-decoration: underline;
  color: var(--indigo-600);
}

.home-footer .home-footer__ucab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.home-footer .home-footer__ucab img {
  height: 20px;
  width: auto;
  display: block;
}

/* ============ Chapter intro interstitial ============ */
.chapter-intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 1;
  animation: chapter-intro-in 0.3s ease-out;
  transition: opacity 0.6s ease;
  background: var(--indigo-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  cursor: pointer;
  color: var(--white);
  text-align: center;
  padding: 2rem;
}

.chapter-intro__title {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.chapter-intro__progress {
  width: 16rem;
  max-width: 80vw;
  height: 0.4rem;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  overflow: hidden;
}

.chapter-intro__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--white);
  border-radius: 9999px;
}

.chapter-intro__progress-fill.animate {
  width: 100%;
  transition: width 2.5s linear;
}

.chapter-intro__caption {
  color: var(--slate-300);
  font-size: 0.85rem;
}

.chapter-intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

@keyframes chapter-intro-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ Footer / nav ============ */
.overlay__footer {
  position: relative;
  border-top: 1px solid var(--slate-100);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 768px) {
  .overlay__footer { padding: 1.5rem; }
}

.footer-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--slate-100);
}

.footer-progress__fill {
  height: 100%;
  background: var(--indigo-600);
  transition: width 0.3s ease;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--slate-50);
}

.nav-btn:disabled {
  color: var(--slate-400);
  border-color: var(--slate-200);
  cursor: not-allowed;
}

.nav-btn.nav-btn--primary {
  background: var(--indigo-600);
  border-color: var(--indigo-600);
  color: var(--white);
}

.nav-btn.nav-btn--primary:hover {
  background: var(--indigo-700);
}

.nav-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ============ Interactive demos (shared) ============ */
.demo {
  margin-top: 1.25rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 1rem;
  background: var(--slate-50);
}

.demo:focus-visible,
.demo.has-focus {
  outline: 2px solid var(--indigo-600);
  outline-offset: 2px;
}

.demo__hint {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-bottom: 0.75rem;
  text-align: center;
}

.demo canvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-lg);
  background: var(--white);
  max-width: 100%;
  touch-action: none;
}

.demo__readout {
  margin-top: 0.75rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--slate-700);
}

.demo__readout--lg {
  font-size: 1.1rem;
  font-weight: 700;
}

.demo__readout .true { color: var(--red-600); font-weight: 700; }
.demo__readout .false { color: var(--emerald-600); font-weight: 700; }

/* FSM demo */
.fsm-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.fsm-row {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.fsm-node {
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--slate-600);
  background: var(--white);
  text-align: center;
  min-width: 8rem;
  transition: all 0.2s ease;
}

.fsm-node.active {
  border-color: var(--indigo-600);
  background: var(--indigo-50);
  color: var(--indigo-600);
  box-shadow: var(--shadow-sm);
}

.fsm-node small {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--slate-400);
  margin-top: 0.25rem;
  font-family: var(--font-ui);
}

.fsm-arrow {
  font-size: 1.5rem;
  color: var(--slate-400);
}

.fsm-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.fsm-buttons .nav-btn:disabled {
  opacity: 0.4;
}

/* D-pad (sprite demo) */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 0.3rem;
  justify-content: center;
}

.dpad button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-600);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dpad button:hover {
  background: var(--slate-50);
}

.dpad button.active {
  background: var(--indigo-600);
  border-color: var(--indigo-600);
  color: var(--white);
}

.dpad button.dpad__center {
  background: var(--indigo-50);
  border-color: var(--indigo-100);
  font-size: 1.3rem;
}

.dpad button.dpad__center:hover {
  background: var(--indigo-100);
}

.dpad .dpad__up    { grid-column: 2; grid-row: 1; }
.dpad .dpad__left  { grid-column: 1; grid-row: 2; }
.dpad .dpad__center{ grid-column: 2; grid-row: 2; }
.dpad .dpad__right { grid-column: 3; grid-row: 2; }
.dpad .dpad__down  { grid-column: 2; grid-row: 3; }

/* Sprite demo */
.sprite-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
}

.sprite-demo__sheet {
  text-align: center;
}

.sprite-demo__sheet-wrap {
  position: relative;
  display: inline-block;
}

.sprite-demo__labels {
  font-size: 0.75rem;
  color: var(--slate-500);
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0.15rem;
  text-align: left;
  font-family: var(--font-mono);
}

.sprite-demo__preview {
  text-align: center;
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .site-header__inner {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }
  .brand-text h1 {
    font-size: 0.85rem;
  }
  .site-header__progress {
    width: 100%;
  }
  .progress-track {
    flex: 1;
    width: auto;
  }
  main.home {
    padding: 1.25rem;
  }
  .home__head h2 {
    font-size: 1.25rem;
  }
  .plan-table thead {
    display: none;
  }
  .plan-table td {
    padding: 0.6rem 0.75rem;
  }
  .col-desc {
    display: none;
  }
  .overlay__content {
    padding: 1rem;
  }
}

/* ============ Share modal ============ */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 1;
  animation: chapter-intro-in 0.25s ease-out;
  transition: opacity 0.25s ease;
}

.share-modal.fade-out {
  opacity: 0;
  pointer-events: none;
}

.share-modal__card {
  position: relative;
  background: var(--white);
  border-radius: 1rem;
  border: 1px solid var(--slate-200);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 44rem;
  text-align: center;
}

.share-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  border: none;
  background: var(--slate-100);
  color: var(--slate-500);
  border-radius: 9999px;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.share-modal__close:hover { background: var(--slate-200); }
.share-modal__close svg { width: 1.1rem; height: 1.1rem; }

.share-modal__icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  border-radius: 0.75rem;
  background: var(--indigo-50);
  color: var(--indigo-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-modal__icon svg { width: 1.5rem; height: 1.5rem; }

.share-modal__card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  color: var(--slate-900);
}

.share-modal__card p {
  margin: 0 0 1.1rem;
  color: var(--slate-500);
  font-size: 0.95rem;
}

.share-modal__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.6rem;
  border: 1.5px dashed var(--indigo-300);
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  overflow-wrap: anywhere;
}

.share-modal__link:hover { background: var(--indigo-100); border-color: var(--indigo-500); }
.share-modal__link svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.share-modal__link .copied-tip {
  position: absolute;
  top: -0.85rem;
  right: 0.6rem;
  transform: translateY(-100%);
  background: var(--emerald-600);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-lg);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.share-modal__link .copied-tip.show {
  opacity: 1;
}

.share-modal__actions {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ Intro del sitio (estilo Zelda) ============ */
.no-scroll { overflow: hidden; }

.site-intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  background:
    radial-gradient(ellipse at 50% 35%, #1e2a4a 0%, #0b1020 65%, #050810 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  text-align: center;
  cursor: pointer;
  padding: 1.5rem;
  overflow: hidden;
  opacity: 1;
  animation: chapter-intro-in 0.4s ease-out;
  transition: opacity 0.6s ease;
}

.site-intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

.site-intro__hearts {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.4rem;
}

.site-intro__hearts img {
  width: 1.5rem;
  height: 1.5rem;
  image-rendering: pixelated;
}

.site-intro__triforce {
  position: relative;
  width: 6.5rem;
  height: 5.5rem;
  filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.45));
  animation: triforce-glow 2.4s ease-in-out infinite;
}

.site-intro__triforce span {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 1.6rem solid transparent;
  border-right: 1.6rem solid transparent;
  border-bottom: 2.75rem solid #facc15;
}

.site-intro__triforce span:nth-child(1) { left: 50%; top: 0; transform: translateX(-50%); }
.site-intro__triforce span:nth-child(2) { left: 50%; bottom: 0; transform: translateX(-103%); }
.site-intro__triforce span:nth-child(3) { left: 50%; bottom: 0; transform: translateX(3%); }

@keyframes triforce-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.35)); }
  50% { filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.7)); }
}

.site-intro__title {
  font-family: "Press Start 2P", var(--font-mono);
  font-size: clamp(1.3rem, 5vw, 2.6rem);
  line-height: 1.5;
  color: #facc15;
  text-shadow: 3px 3px 0 #7c2d12, 6px 6px 0 rgba(0, 0, 0, 0.4);
  margin: 0;
}

.site-intro__subtitle {
  font-family: "Press Start 2P", var(--font-mono);
  font-size: clamp(0.55rem, 2vw, 0.8rem);
  color: var(--slate-300);
}

.site-intro__walker {
  width: min(22rem, 80vw);
  height: 6rem;
  position: relative;
  overflow: hidden;
}

.site-intro__walker::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.4rem;
  height: 2px;
  background: rgba(148, 163, 184, 0.35);
}

.site-intro__link {
  position: absolute;
  bottom: 0.6rem;
  left: 0;
  width: 16px;
  height: 16px;
  background: url("../img/link_sheet.png") no-repeat;
  background-position: 0 -32px; /* fila 3: caminando a la derecha */
  image-rendering: pixelated;
  transform-origin: bottom left;
  transform: scale(4);
  animation:
    link-walk-frames 0.35s steps(2) infinite,
    link-walk-across 7s linear infinite;
  /* arrancar con Link ya dentro de la pantalla */
  animation-delay: 0s, -2.5s;
}

@keyframes link-walk-frames {
  from { background-position-x: 0; }
  to { background-position-x: -32px; }
}

@keyframes link-walk-across {
  from { left: -18%; }
  to { left: 104%; }
}

.site-intro__start {
  font-family: "Press Start 2P", var(--font-mono);
  font-size: clamp(0.75rem, 2.6vw, 1.05rem);
  color: var(--white);
  animation: start-blink 1.1s steps(1) infinite;
}

@keyframes start-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0; }
}

.site-intro__hint {
  font-size: 0.8rem;
  color: var(--slate-400);
}

@media (max-width: 640px) {
  .share-modal__card { padding: 2.25rem 1.25rem 1.5rem; }
  .share-modal__link { font-size: 0.78rem; }
  .share-modal__actions .btn { flex: 1 1 100%; justify-content: center; }
  .site-intro { gap: 1.1rem; }
  .site-intro__link { transform: scale(3); }
  .site-intro__triforce { transform: scale(0.8); }
}
