:root {
  --blue-950: #04122b;
  --blue-900: #081a3a;
  --blue-800: #0f2c67;
  --blue-700: #123a78;
  --green: #a4dd00;
  --orange: #f3950d;
  --red: #cd1818;
  --text: #f5f5f5;
  --muted: #b5c0d4;
  --line: rgba(243, 149, 13, 0.42);
  --panel: rgba(5, 20, 45, 0.92);
  --panel-2: rgba(10, 35, 70, 0.92);
  --page-bg: var(--blue-950);
  --surface-rgb: 4, 18, 43;
  --contrast-rgb: 255, 255, 255;
}

/* Modo claro: se activa con html[data-theme="light"] (ver theme-toggle en app.js).
   Los paneles "hero" (mission-hero, detail-hero) y la terminal Kali se dejan
   siempre oscuros a propósito, como una consola, en ambos temas. */
html[data-theme="light"] {
  --text: #101a30;
  --muted: #4c5872;
  --line: rgba(196, 122, 12, 0.4);
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(240, 244, 252, 0.96);
  --page-bg: #eef1f8;
  --surface-rgb: 255, 255, 255;
  --contrast-rgb: 16, 24, 40;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Teachers", system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--page-bg);
}

body { line-height: 1.5; }

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#root {
  min-height: 100vh;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.video-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  filter: brightness(0.95) saturate(1);
}

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(4, 18, 43, 0.42), rgba(15, 44, 103, 0.28)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 48px);
}

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

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: 22px;
  max-width: 1120px;
  margin: 0 auto;
}

.login-shell.login-single {
  grid-template-columns: minmax(0, min(620px, 100%));
  justify-content: center;
}

.login-panel,
.preview-board,
.topbar,
.panel,
.challenge-card,
.detail,
.profile-hero,
.ranking-row {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24), inset 0 0 16px rgba(164, 221, 0, 0.03);
  backdrop-filter: blur(14px);
  border-radius: 8px;
}

.login-panel {
  padding: 34px;
}

.login-brand {
  align-items: flex-start;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.login-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

.ctf-pill {
  border: 1px solid rgba(164, 221, 0, 0.4);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--green);
  font: 800 0.68rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
}

.auth-card {
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 45%, rgba(164, 221, 0, 0.08), transparent 62%),
    radial-gradient(circle at top right, rgba(243, 149, 13, 0.16), transparent 34%);
}

.auth-card > * {
  position: relative;
}

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.auth-foot span {
  border: 1px solid rgba(181, 192, 212, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(var(--contrast-rgb), 0.06);
  font-size: 0.78rem;
}

.brand-block,
.brand,
.topbar,
.row,
.meta-strip,
.file-row,
.hint-row,
.ranking-row,
.history-row,
.category-row,
.account-chip,
.toolbar,
.section-head {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 18px;
  margin-bottom: 28px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--orange);
  background: radial-gradient(circle at 30% 20%, var(--green), var(--blue-800) 72%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(164, 221, 0, 0.28);
}

.brand-mark.small,
.avatar {
  width: 38px;
  height: 38px;
  font-size: 0.9rem;
}

.avatar.big {
  width: 86px;
  height: 86px;
  font-size: 2rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Gasoek One", "Teachers", system-ui, sans-serif;
  font-weight: 400;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.7rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.75rem;
}

/* Gasoek One es de cartel: se lee bien en títulos grandes (h1, h2) pero a
   tamaño de h3 las letras se empastan. Los h3 usan Teachers en negrita. */
h3 {
  margin-bottom: 12px;
  font-family: "Teachers", system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  text-transform: uppercase;
  font: 700 0.76rem/1 JetBrains Mono, monospace;
}

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

.tight {
  margin: 2px 0 0;
  font-size: 0.86rem;
}

.lead {
  color: #d8e3f8;
  max-width: 62ch;
}

.login-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.field-shell {
  position: relative;
}

.field-shell input {
  padding-left: 38px;
  padding-right: 48px;
}

.field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font: 800 0.78rem/1 JetBrains Mono, monospace;
  z-index: 1;
}

.field-toggle,
.chip-exit {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.field-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  min-height: 30px;
  transform: translateY(-50%);
  padding: 4px 6px;
}

.login-action {
  width: 100%;
  color: var(--blue-950);
}

/* --- Verificación de correo institucional (MFA de registro) --- */
.role-hint {
  margin: 0;
}

.role-hint[data-role="invalid"] {
  color: #ff9d9d;
}

.role-hint[data-role="estudiante"],
.role-hint[data-role="profesor"] {
  color: var(--green);
}

/* Medidor de contraseña: oculto hasta que se usa el campo, y al quedar segura
   solo se ve la barra. */
.pw-meter {
  display: none;
  gap: 6px;
  margin-top: 2px;
  font-weight: 400;
}

label:focus-within > .pw-meter,
.pw-meter:not([data-level="empty"]) {
  display: grid;
}

.pw-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pw-bar {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.pw-bar span {
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  opacity: 0.45;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.pw-bar span.is-on {
  background: var(--pw-color);
  opacity: 1;
}

.pw-meter[data-level="weak"] { --pw-color: #ff7676; }
html[data-theme="light"] .pw-meter[data-level="weak"] { --pw-color: var(--red); }
.pw-meter[data-level="close"] { --pw-color: var(--orange); }
.pw-meter[data-level="safe"] { --pw-color: var(--green); }

.pw-status {
  min-width: 3.4em;
  color: var(--pw-color);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  text-align: right;
}

.pw-missing {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.pw-missing:empty {
  display: none;
}

.pw-missing span::before {
  content: "· ";
  color: var(--pw-color, var(--muted));
}

@media (prefers-reduced-motion: reduce) {
  .pw-bar span { transition: none; }
}

.verify-banner {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(164, 221, 0, 0.3);
  border-radius: 8px;
  background: rgba(164, 221, 0, 0.07);
}

.verify-banner p {
  margin: 0;
  color: var(--muted);
}

.role-badge {
  border: 1px solid rgba(164, 221, 0, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--green);
  font: 800 0.7rem/1 JetBrains Mono, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.verify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
}

.verify-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.role-tag {
  flex: 0 0 auto;
  border: 1px solid rgba(181, 192, 212, 0.24);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.role-tag.role-profesor {
  border-color: rgba(243, 149, 13, 0.4);
  color: var(--orange);
}

.role-tag.role-estudiante {
  border-color: rgba(164, 221, 0, 0.4);
  color: var(--green);
}

.profile-hero .role-tag {
  justify-self: center;
  margin: -6px 0 4px;
}

@media (max-width: 480px) {
  .account-chip .role-tag {
    display: none;
  }
}

.terminal-error pre,
.build-log {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(4, 18, 43, 0.85);
  color: #d7e5df;
  font: 12px/1.5 "JetBrains Mono", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.build-log {
  margin: 0;
  height: 100%;
  box-sizing: border-box;
  border-radius: 0;
  background: #07110e;
}

.terminal-error {
  border-color: rgba(255, 124, 92, 0.5);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.6);
  border: 1px solid rgba(181, 192, 212, 0.18);
}

.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 38px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.auth-tabs .auth-tab-active {
  background: rgba(164, 221, 0, 0.14);
  color: var(--green);
}

.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(181, 192, 212, 0.26);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(var(--surface-rgb), 0.82);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(164, 221, 0, 0.12);
}

.primary-action,
.ghost-action,
.topbar nav button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 700;
}

.ghost-action,
.topbar nav button {
  color: var(--text);
}

.primary-action {
  color: #fff;
  background: linear-gradient(180deg, #ffad33, var(--orange));
  box-shadow: 0 10px 22px rgba(243, 149, 13, 0.24);
}

.primary-action.compact {
  min-height: 36px;
  padding: 8px 12px;
}

.ghost-action,
.topbar nav button {
  background: rgba(var(--contrast-rgb), 0.07);
  border-color: rgba(181, 192, 212, 0.18);
}

.ghost-action:hover,
.topbar nav button:hover,
.nav-active {
  transform: translateY(-1px);
  border-color: rgba(164, 221, 0, 0.5) !important;
  color: var(--green) !important;
}

/* El botón naranja conserva el texto blanco al pasar el mouse: verde sobre
   naranja no se leía (13 oct). Solo se aclara el fondo. */
.primary-action:hover {
  transform: translateY(-1px);
  color: #fff !important;
  background: linear-gradient(180deg, #ffbd57, #f7a21f);
  box-shadow: 0 12px 26px rgba(243, 149, 13, 0.32);
}

.preview-board {
  padding: 22px;
}

.topbar {
  position: relative;
  /* El topbar ya sella su propio stacking context por el backdrop-filter que
     comparte con .panel; sin un z-index explícito aquí, el contenido que
     viene después en el DOM (ticker, hero) pinta encima del desplegable
     "Más" aunque ese desplegable tenga z-index alto puertas adentro. */
  z-index: 5;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  margin-bottom: 20px;
}

.brand {
  gap: 10px;
  min-width: 0;
}

.brand > div {
  min-width: 0;
}

/* El logo ya trae el wordmark "WISPR" dibujado (fondo transparente), así que
   reemplaza el cuadro con la "W" + el texto "WISPR"/subtítulo gris de antes. */
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  flex: 0 0 auto;
}

.brand-logo-lg {
  height: 68px;
}

/* El texto del logo es blanco/contorno claro sobre fondo transparente: en
   modo claro le suma un contorno oscuro sutil para que no se pierda sobre
   fondos casi blancos, sin ponerle una placa sólida detrás. */
html[data-theme="light"] .brand-logo {
  filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.6)) drop-shadow(0 1px 2px rgba(15, 23, 42, 0.35));
}

@media (max-width: 680px) {
  .brand-logo {
    height: 32px;
  }

  .brand-logo-lg {
    height: 54px;
  }
}

.brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span,
.account-chip span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Desplegable "Más" (Teoría/Retos/Progreso/Ranking) ---
   Dashboard y Terminal quedan siempre visibles; el resto vive aquí para que
   la barra no se sienta cargada. */
.nav-more {
  position: relative;
  z-index: 3;
}

.nav-more-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-more-caret {
  font-size: 0.68rem;
  color: var(--muted);
}

.nav-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  padding: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.nav-more-menu button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.nav-more-scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: transparent;
  cursor: default;
}

/* --- Menú hamburguesa (topbar, ≤1040px) ---
   Oculto y sin ocupar espacio en escritorio; a partir de ahí reemplaza el
   menú en línea (que se partía en 2-3 filas) por un desplegable. */
.nav-burger {
  display: none;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.07);
  cursor: pointer;
}

.nav-burger .burger-bar {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-burger.is-open .burger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-burger.is-open .burger-bar:nth-child(2) {
  opacity: 0;
}

.nav-burger.is-open .burger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.account-chip {
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(243, 149, 13, 0.35);
  border-radius: 8px;
  background: rgba(var(--contrast-rgb), 0.06);
  min-width: 0;
}

.account-chip > div {
  min-width: 0;
}

.account-chip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-exit {
  min-height: 30px;
  border-left: 1px solid rgba(181, 192, 212, 0.18);
  padding-left: 10px;
  font-size: 0.78rem;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.35fr);
  gap: 20px;
  align-items: start;
}

.challenges-page {
  min-width: 0;
}

.section-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-copy {
  max-width: 680px;
  margin-bottom: 0;
}

.toolbar {
  gap: 10px;
  margin-bottom: 12px;
}

.vm-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(var(--contrast-rgb), 0.06);
  white-space: nowrap;
}

.vm-dot,
.vm-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 14px rgba(205, 24, 24, 0.5);
}

.vm-dot.on,
.vm-led.on {
  background: var(--green);
  box-shadow: 0 0 16px rgba(164, 221, 0, 0.65);
}

.challenge-list {
  min-width: 0;
}

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
}

.challenge-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 252px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.challenge-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--orange));
  opacity: 0.62;
}

.challenge-card:hover,
.challenge-card.completed,
.ranking-row.current {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(164, 221, 0, 0.18), 0 14px 34px rgba(0,0,0,0.25);
}

.challenge-card:hover {
  transform: translateY(-2px);
}

.card-topline,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-category {
  margin-bottom: 10px;
}

.challenge-card h3 {
  margin-bottom: 10px;
  font-size: 1.12rem;
}

.card-desc {
  display: -webkit-box;
  min-height: 4.4em;
  margin-bottom: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.status,
.open-link {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status.solved,
.open-link {
  color: var(--green);
}

.row {
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  border: 1px solid;
  border-radius: 999px;
  padding: 3px 8px;
  font: 700 0.72rem/1 JetBrains Mono, monospace;
}

.solve,
.score {
  color: var(--orange);
  font: 800 1.25rem/1 JetBrains Mono, monospace;
}

.challenge-card .solve {
  font-size: 1rem;
}

.solve.solved,
.ok,
.owned-label {
  color: var(--green);
}

.detail {
  overflow: hidden;
}

.detail-page {
  border-color: rgba(164, 221, 0, 0.34);
}

.detail-hero {
  position: relative;
  padding: 24px;
  background: linear-gradient(135deg, rgba(18,58,120,0.72), rgba(4,18,43,0.58));
  border-bottom: 1px solid rgba(243,149,13,0.3);
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(164,221,0,0.16), transparent 38%);
}

.detail-hero > * {
  position: relative;
}

/* El hero del briefing se queda siempre oscuro (a propósito, en ambos temas),
   así que sus etiquetas necesitan su propio color fijo en vez del --text
   que sí cambia con el tema. */
.detail-hero .meta-strip span {
  color: #dce7fb;
  background: rgba(255, 255, 255, 0.06);
}

/* mission-hero y detail-hero se quedan oscuros a propósito en ambos temas;
   fuerzan su propio texto e botones claros en vez de heredar --text/--muted,
   que sí cambian con el tema. */
.mission-hero h2,
.detail-hero h2,
.mission-hero .ghost-action,
.detail-hero .ghost-action {
  color: #f4f7ff;
}

.mission-hero .ghost-action,
.detail-hero .ghost-action {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Etiquetas de MITRE: discretas, para no competir con el reto. */
.mitre-tag {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  text-decoration: none;
  transition: border-color 0.18s ease;
}

.mitre-tag:hover {
  border-color: var(--green);
}

.mitre-tag.is-pending {
  opacity: 0.55;
}

.mitre-id {
  color: var(--orange);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

.mitre-related {
  color: var(--muted);
  font-size: 0.74rem;
}

.mitre-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mitre-notice {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.footer-bottom .mitre-notice {
  margin-top: 6px;
  color: inherit;
}

.lesson-header .mitre-tag {
  margin-top: 8px;
}

/* La landing es oscura también en modo claro: sus botones no siguen el tema. */
.landing-page .ghost-action {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: #f4f7ff;
}

.landing-page .ghost-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mission-ring small {
  color: #b9c3da;
}

.back-action {
  margin-bottom: 18px;
}

.meta-strip {
  gap: 8px;
  flex-wrap: wrap;
}

.meta-strip.centered {
  justify-content: center;
}

.meta-strip span,
.tool,
.streak {
  border: 1px solid rgba(181, 192, 212, 0.2);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(var(--contrast-rgb), 0.065);
  color: var(--text);
  font-size: 0.78rem;
}

.panel {
  padding: 18px;
  margin-bottom: 14px;
}

.detail .panel {
  margin: 14px;
}

.tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 14px 0;
}

.kali-panel {
  border-color: rgba(164, 221, 0, 0.35);
}

.crypto-panel {
  border-color: rgba(243, 149, 13, 0.42);
}

.workflow-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.workflow-list li {
  color: var(--muted);
}

.workflow-list code {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(181, 192, 212, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(4, 18, 43, 0.76);
  color: #dff7a2;
  font-size: 0.82rem;
  white-space: nowrap;
}

.vm-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.vm-status {
  display: grid;
  gap: 12px;
  overflow-y: auto;
}

.vm-state {
  display: flex;
  align-items: center;
  gap: 10px;
}

.terminal-panel {
  overflow: hidden;
  border: 1px solid rgba(164, 221, 0, 0.34);
  border-radius: 12px;
  background: rgba(2, 8, 18, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(164, 221, 0, 0.05), inset 0 1px 0 rgba(164, 221, 0, 0.08);
}

.terminal-head,
.terminal-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.terminal-head {
  justify-content: space-between;
  padding: 11px 15px;
  border-bottom: 1px solid rgba(164, 221, 0, 0.22);
  background: linear-gradient(180deg, rgba(164, 221, 0, 0.08), rgba(164, 221, 0, 0));
  color: var(--green);
  font: 700 0.74rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terminal-output {
  min-height: 420px;
  max-height: 520px;
  margin: 0;
  overflow: auto;
  padding: 18px;
  color: #dff7a2;
  font: 0.9rem/1.6 JetBrains Mono, monospace;
  white-space: pre-wrap;
}

.terminal-output::-webkit-scrollbar { width: 10px; }
.terminal-output::-webkit-scrollbar-thumb {
  background: rgba(164, 221, 0, 0.22);
  border-radius: 8px;
}
.terminal-output::-webkit-scrollbar-thumb:hover { background: rgba(164, 221, 0, 0.36); }

.terminal-input {
  padding: 12px;
  border-top: 1px solid rgba(181, 192, 212, 0.14);
}

.terminal-input span {
  color: var(--green);
  font: 800 1rem/1 JetBrains Mono, monospace;
}

.terminal-input input {
  min-height: 38px;
  border-color: rgba(164, 221, 0, 0.26);
  font-family: JetBrains Mono, monospace;
}

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

.terminal-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  /* Terminal un poco más grande: más alto y con más ancho para la shell. */
  height: min(780px, calc(100vh - 160px));
}

.terminal-page .section-head {
  margin-bottom: 16px;
}

.terminal-path {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--green);
  font: 0.78rem/1.5 JetBrains Mono, monospace;
}

.xterm-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
}

.xterm-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* Más margen lateral para que las líneas no queden pegadas al borde. */
  padding: 18px 22px;
  background: #081010;
  border-radius: 12px;
}

.xterm-host:focus {
  outline: 1px solid rgba(164, 221, 0, 0.65);
  outline-offset: -2px;
}

.xterm-host .xterm,
.xterm-host .xterm-screen {
  height: 100%;
}

/* La barra de scroll de xterm se dibuja DENTRO del viewport, sobre la última
   columna. La hacemos fina y con el color del tema, y bloqueamos el scroll
   horizontal para que ninguna línea "traspase" la barra por el borde. */
.xterm-host .xterm-viewport {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(164, 221, 0, 0.32) transparent;
}
.xterm-host .xterm-viewport::-webkit-scrollbar { width: 10px; }
.xterm-host .xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(164, 221, 0, 0.28);
  border-radius: 8px;
}
.xterm-host .xterm-viewport::-webkit-scrollbar-thumb:hover { background: rgba(164, 221, 0, 0.42); }

.terminal-state {
  font: 700 0.72rem/1 JetBrains Mono, monospace;
}

/* Acciones por fila en el panel admin (reset / bloquear / eliminar). */
.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.terminal-state.online { color: var(--green); }
.terminal-state.starting { color: var(--orange); }
.terminal-state.offline { color: #ff9d9d; }

.file-row,
.hint-row,
.history-row,
.category-row,
.ranking-row {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.09);
}

.hint-row p {
  margin: 0;
}

.submit-panel {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(243,149,13,0.3);
}

.submit-panel input {
  font-family: JetBrains Mono, monospace;
}

aside {
  display: grid;
  gap: 14px;
}

.kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.kpi {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.kpi span,
.category-row span:last-child {
  color: var(--muted);
}

.kpi strong {
  color: var(--orange);
}

.profile-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.profile-hero {
  padding: 28px;
  text-align: center;
}

/* El correo institucional es un token largo sin espacios: sin esto se sale
   de la tarjeta en vez de ajustarse. */
.profile-hero p {
  overflow-wrap: anywhere;
}

.profile-hero .avatar {
  margin: 0 auto 16px;
}

.ranking-row {
  margin-bottom: 10px;
  padding: 12px 14px;
}

.rank {
  width: 48px;
  color: var(--green);
  font: 800 1rem/1 JetBrains Mono, monospace;
}

.grow {
  flex: 1;
  min-width: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 10;
  min-width: 280px;
  border-radius: 8px;
  padding: 13px 18px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(var(--surface-rgb), 0.96);
  color: var(--text);
  text-align: center;
  box-shadow: 0 18px 44px rgba(0,0,0,0.34);
}

.toast.success {
  border-color: rgba(164, 221, 0, 0.5);
  color: var(--green);
}

.toast.warn {
  border-color: rgba(243, 149, 13, 0.55);
  color: var(--orange);
}

.toast.error {
  border-color: rgba(205, 24, 24, 0.6);
  color: #ff7b7b;
}

@media (max-width: 1040px) {
  .login-shell,
  .main-grid,
  .workspace,
  .vm-grid,
  .terminal-workspace,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  aside {
    grid-row: auto;
  }

  /* Al apilarse en una sola columna, la altura fija ya no tiene sentido:
     sin esto, el panel de la terminal quedaba comprimido a casi 0px. */
  .terminal-workspace {
    height: auto;
  }

  .vm-status {
    max-height: 320px;
  }

  .xterm-panel {
    min-height: 480px;
  }

  /* Topbar: el menú en línea se reemplaza por el botón hamburguesa. */
  .topbar {
    flex-wrap: wrap;
  }

  .nav-burger {
    display: block;
  }

  /* Más específico que ".topbar nav" (la regla base del menú en línea) para
     poder ganarle y ocultar el <nav> por defecto en este breakpoint. */
  .topbar .main-nav {
    display: none;
  }

  .topbar .main-nav.nav-open {
    display: flex;
    flex-direction: column;
    flex: 1 1 100%;
    gap: 8px;
    order: 4;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid rgba(181, 192, 212, 0.18);
  }

  .topbar .main-nav.nav-open button {
    width: 100%;
  }

  /* Dentro del menú hamburguesa el desplegable "Más" se aplana: se lista
     inline en vez de flotar como panel absoluto sobre el resto. */
  .nav-more {
    width: 100%;
  }

  .nav-more-menu {
    position: static;
    margin-top: 6px;
    box-shadow: none;
  }

  .nav-more-scrim {
    display: none;
  }
}

@media (max-width: 680px) {
  #root {
    padding: 14px;
  }

  /* El topbar (marca · hamburguesa · cuenta) se queda en fila incluso aquí:
     el menú ya vive en el desplegable, así que no hace falta apilarlo. */
  .section-head,
  .submit-panel,
  .file-row,
  .hint-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar select {
    flex: 1 1 140px;
  }

  .streak {
    display: none;
  }

  .login-panel {
    padding: 22px;
  }

  .detail-hero {
    padding: 16px;
  }

  .detail .panel {
    margin: 10px;
    padding: 14px;
  }

  .submit-panel {
    padding: 12px;
  }
}

/* Mission-control dashboard: keeps the original blue, lime and amber WISPR
   identity while giving the main product surface a clearer learning hierarchy. */
.dashboard-page {
  display: grid;
  gap: 16px;
}

.mission-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  align-items: center;
  gap: 28px;
  min-height: 248px;
  padding: 30px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(164, 221, 0, 0.35);
  border-radius: 10px;
  background:
    radial-gradient(circle at 88% 15%, rgba(164, 221, 0, 0.18), transparent 25%),
    linear-gradient(125deg, rgba(5, 22, 50, 0.98), rgba(15, 44, 103, 0.86));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.mission-hero::after {
  content: "";
  position: absolute;
  inset: auto -6% -50% 28%;
  height: 230px;
  border: 1px solid rgba(164, 221, 0, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(164, 221, 0, 0.025), 0 0 0 76px rgba(164, 221, 0, 0.02);
  pointer-events: none;
}

.mission-hero > * {
  position: relative;
  z-index: 1;
}

.mission-hero h2 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.mission-ring {
  display: grid;
  place-content: center;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(var(--green) var(--progress), rgba(255,255,255,0.12) 0);
  box-shadow: 0 0 30px rgba(164, 221, 0, 0.18);
}

.mission-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: #0a1c3e;
  box-shadow: inset 0 0 22px rgba(0,0,0,0.28);
}

.mission-ring span,
.mission-ring small {
  position: relative;
  text-align: center;
}

.mission-ring span {
  color: var(--green);
  font: 800 1.65rem/1 JetBrains Mono, monospace;
}

.mission-ring small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.metric-grid.metric-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 480px;
}

.metric-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  min-width: 0;
  border: 1px solid rgba(181, 192, 212, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
}

.metric-card:has(.metric-action) {
  padding-right: 40px;
}

.metric-action {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.07);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.metric-action:hover {
  color: var(--green);
  border-color: rgba(164, 221, 0, 0.5);
}

.metric-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(243, 149, 13, 0.14);
  color: var(--orange);
  font-size: 1.05rem;
  line-height: 1;
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.metric-content > .muted {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.metric-card strong {
  overflow: hidden;
  color: var(--orange);
  font: 800 clamp(1.15rem, 2.4vw, 1.65rem)/1.2 JetBrains Mono, monospace;
  text-overflow: ellipsis;
}

.metric-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, 0.78fr);
  gap: 16px;
}

.focus-panel,
.protocol-panel {
  min-height: 226px;
  margin-bottom: 0;
}

.focus-panel h3 {
  font-size: 1.35rem;
}

.protocol-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.09);
}

.protocol-step:first-of-type {
  border-top: 0;
}

.protocol-step > span {
  color: var(--green);
  font: 800 0.76rem/1.5 JetBrains Mono, monospace;
}

.protocol-step p {
  margin-bottom: 0;
}

.dashboard-section {
  margin: 12px 0 -2px;
}

.dashboard-grid .challenge-card {
  min-height: 228px;
}

.empty-state {
  max-width: 680px;
  margin: 64px auto;
  padding: 32px;
  text-align: center;
}

.safety-panel {
  border-color: rgba(101, 230, 180, 0.26);
}

.terminal-shortcuts {
  display: grid;
  gap: 7px;
}

.shortcut {
  width: 100%;
  min-height: 33px;
  border: 1px solid rgba(164, 221, 0, 0.24);
  border-radius: 6px;
  padding: 7px 9px;
  overflow: hidden;
  color: #dff7a2;
  background: rgba(4, 18, 43, 0.72);
  font: 600 0.72rem/1.2 JetBrains Mono, monospace;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut:hover {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.09);
}

.architecture-note {
  border-color: rgba(101, 230, 180, 0.2);
}

@media (max-width: 1040px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 680px) {
  .mission-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .mission-ring {
    width: 112px;
    height: 112px;
  }

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

/* --- Selector de modo claro/oscuro ---
   Es un botón flotante (FAB) abajo a la derecha en vez de arriba, para no
   competir nunca con el topbar/account-chip ni con el brand del login en
   ninguna resolución; respeta el safe-area de móviles con notch/gestos. */
.theme-toggle {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

/* Selector de idioma: va encima del interruptor de tema. */
.lang-toggle {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: grid;
  gap: 1px;
  place-items: center;
  width: 44px;
  min-height: 52px;
  padding: 6px 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--green) !important;
}

.lang-code.is-active {
  color: var(--green);
}

@media (max-width: 680px) {
  .lang-toggle {
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    width: 40px;
  }
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--green) !important;
  color: var(--text) !important;
}

@media (max-width: 680px) {
  .theme-toggle {
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: 40px;
    height: 40px;
    font-size: 1.02rem;
  }
}

/* En modo claro el video de fondo se atenúa mucho más para que no compita
   con paneles casi blancos; en modo oscuro conserva el aspecto original. */
html[data-theme="light"] .video-bg {
  opacity: 0.16;
  filter: brightness(1.3) saturate(0.4) grayscale(0.35);
}

html[data-theme="light"] .video-overlay {
  background:
    linear-gradient(135deg, rgba(238, 241, 250, 0.95), rgba(220, 228, 244, 0.9)),
    repeating-linear-gradient(0deg, rgba(16, 24, 40, 0.035) 0, rgba(16, 24, 40, 0.035) 1px, transparent 1px, transparent 48px);
}

/* ===== wispr :: motion pass ===== */

#wispr-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(164, 221, 0, 0.10), rgba(164, 221, 0, 0) 65%);
  pointer-events: none;
  z-index: 1;
  filter: blur(4px);
}

.challenge-grid {
  perspective: 1200px;
}

.challenge-card {
  transform-style: preserve-3d;
  will-change: transform;
}

.challenge-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(164, 221, 0, 0.16), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.challenge-card:hover::before {
  opacity: 1;
}

.topbar nav button {
  position: relative;
  overflow: hidden;
}

.topbar nav button::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.topbar nav button:hover::after,
.topbar nav button.nav-active::after {
  transform: scaleX(1);
}

/* ===== wispr :: motion pass v2 ===== */

.wispr-ghost-heading {
  position: absolute;
  top: -8px;
  left: -4px;
  /* "right" además de "left" obliga al ancho a ajustarse al contenedor en
     vez de al texto (que es nowrap); overflow:hidden recorta el sobrante en
     vez de desbordar el documento — un saludo largo en pantallas angostas
     ya no empuja todo el layout fuera del viewport. */
  right: -4px;
  overflow: hidden;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px rgba(164, 221, 0, 0.16);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.protocol-step {
  transition: transform 0.2s ease, background 0.2s ease;
  border-radius: 6px;
}

.protocol-step:hover {
  transform: translateX(4px);
  background: rgba(164, 221, 0, 0.04);
}

.theory-modules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theory-module {
  padding: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.theory-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
}

.theory-module.open .theory-module-head {
  border-bottom: 1px solid rgba(181, 192, 212, 0.18);
}

.theory-caret {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(181, 192, 212, 0.18);
  color: var(--orange);
  font: 700 1.1rem/1 JetBrains Mono, monospace;
}

.theory-topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 20px;
  padding: 14px 20px 18px;
}

.theory-topic {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--text);
}

.topic-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

button.theory-topic {
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: default;
}

.theory-topic-lesson {
  grid-column: 1 / -1;
  justify-content: flex-start;
  cursor: pointer;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.theory-topic-lesson:hover {
  background: rgba(164, 221, 0, 0.08);
  color: var(--green);
}

.lesson-cta,
.lesson-done-badge {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.lesson-cta { color: var(--orange); }
.lesson-done-badge { color: var(--green); }

/* ===== wispr :: lección interactiva (Aprender → Practicar → Comprobar) ===== */

.lesson-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lesson-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.lesson-header .back-action {
  margin-bottom: 8px;
}

.lesson-stepper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.lesson-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.lesson-step-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(181, 192, 212, 0.25);
  font: 700 0.75rem/1 JetBrains Mono, monospace;
}

.lesson-step.active {
  color: var(--orange);
}

.lesson-step.active .lesson-step-index {
  border-color: var(--orange);
  color: var(--orange);
}

.lesson-step.done {
  color: var(--green);
}

.lesson-step.done .lesson-step-index {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.12);
  color: var(--green);
}

.lesson-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(181, 192, 212, 0.16);
  overflow: hidden;
}

.lesson-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--orange));
  transition: width 0.3s ease;
}

.lesson-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
}

.lesson-stage > .eyebrow {
  margin: 0;
}

.lesson-video-frame {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: #000;
}

.lesson-video {
  display: block;
  width: 100%;
  max-height: 460px;
  background: #000;
}

.lesson-video-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(181, 192, 212, 0.16);
  overflow: hidden;
}

.lesson-video-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--orange);
  transition: width 0.15s linear;
}

.lesson-objective {
  margin: 0;
  color: var(--text);
  max-width: 68ch;
}

.lesson-concepts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.concept-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concept-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.05);
}

.concept-chip strong {
  color: var(--orange);
  font: 800 0.85rem/1.2 JetBrains Mono, monospace;
}

.concept-chip small {
  color: var(--muted);
  font-size: 0.72rem;
}

.concept-chip.small {
  padding: 6px 10px;
  min-width: 0;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.practice-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
}

.practice-card.revealed {
  border-color: rgba(164, 221, 0, 0.5);
}

.practice-card-badge {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(243, 149, 13, 0.14);
  color: var(--orange);
  font: 800 0.85rem/1.1 JetBrains Mono, monospace;
  text-align: center;
}

.practice-card.revealed .practice-card-badge {
  background: rgba(164, 221, 0, 0.14);
  color: var(--green);
}

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

.practice-card-body strong {
  display: block;
  color: var(--text);
}

.practice-card-controls {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 4px;
}

.practice-card-controls .ghost-action {
  min-height: 0;
  padding: 4px 10px;
}

.practice-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.practice-attempts {
  color: var(--muted);
  font-size: 0.82rem;
}

.practice-feedback {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid;
}

.practice-feedback.ok {
  border-color: rgba(164, 221, 0, 0.4);
  background: rgba(164, 221, 0, 0.08);
  color: var(--green);
}

.practice-feedback.bad {
  border-color: rgba(205, 24, 24, 0.4);
  background: rgba(205, 24, 24, 0.08);
  color: #ff8f8f;
}

.practice-feedback p {
  margin: 4px 0 0;
  color: var(--text);
}

.quiz-count {
  margin: 0;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.quiz-option {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}

.quiz-option:hover:not(:disabled) {
  border-color: rgba(164, 221, 0, 0.5);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.correct {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.12);
  color: var(--green);
}

.quiz-option.wrong {
  border-color: var(--red);
  background: rgba(205, 24, 24, 0.12);
  color: #ff8f8f;
}

.quiz-feedback {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid;
}

.quiz-feedback.ok {
  border-color: rgba(164, 221, 0, 0.4);
  background: rgba(164, 221, 0, 0.08);
  color: var(--green);
}

.quiz-feedback.bad {
  border-color: rgba(205, 24, 24, 0.4);
  background: rgba(205, 24, 24, 0.08);
  color: #ff8f8f;
}

.quiz-feedback p {
  margin: 4px 0 0;
  color: var(--text);
}

.lesson-quiz-results h3 {
  margin: 0;
}

.quiz-percent {
  font: 800 2rem/1 JetBrains Mono, monospace;
  color: var(--orange);
  margin: 0;
}

.quiz-review {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-complete {
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 32px 20px;
}

.lesson-complete-badge {
  font-size: 2.4rem;
  line-height: 1;
}

.lesson-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--green);
  font-weight: 700;
}

.lesson-checklist > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lesson-score {
  margin: 6px 0 0;
  font: 800 1.4rem/1 JetBrains Mono, monospace;
  color: var(--text);
}

.xp-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffad33, var(--orange));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

/* --- "Aprender" por pasos (sin video) ------------------------------------ */
.learn-step-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.learn-step-track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(var(--contrast-rgb), 0.1);
  overflow: hidden;
}

.learn-step-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), var(--green));
  transition: width 0.3s ease;
}

.learn-step-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.learn-step-concept {
  margin: 0;
  font-size: 1.2rem;
}

.learn-step-explanation {
  margin: 0;
  color: var(--muted);
}

.learn-step-visual {
  margin-top: 4px;
}

/* --- Primitivas visuales reutilizables de "aprender" --------------------- */
.lv-list-items,
.lv-cluster-nodes,
.lv-check-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lv-list-item,
.lv-node,
.lv-check-option {
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.lv-list-item {
  padding: 10px 14px;
  font-weight: 600;
}

.lv-list-item.active,
.lv-node.open {
  border-color: rgba(243, 149, 13, 0.5);
  background: rgba(243, 149, 13, 0.1);
  color: var(--orange);
}

.lv-note {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(164, 221, 0, 0.3);
  background: rgba(164, 221, 0, 0.06);
}

.lv-note p {
  margin: 0;
  color: var(--text);
}

.lv-node {
  flex: 1 1 160px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lv-node strong {
  color: var(--text);
}

.lv-node small {
  color: var(--muted);
}

.lv-node-detail {
  margin: 4px 0 0;
  padding-top: 6px;
  border-top: 1px dashed rgba(243, 149, 13, 0.3);
  color: var(--orange);
  font: 700 0.82rem/1.3 JetBrains Mono, monospace;
}

.lv-compare-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.lv-compare-col {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
}

.lv-compare-col > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.lv-compare-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.07);
  font: 0.82rem/1.3 JetBrains Mono, monospace;
}

.lv-compare-row:first-child {
  border-top: none;
}

.lv-compare-row.diff {
  color: var(--red);
}

.lv-check {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(181, 192, 212, 0.18);
}

.lv-check-prompt {
  margin: 0 0 8px;
  font-weight: 700;
}

.lv-check-option {
  padding: 8px 12px;
  font-size: 0.86rem;
}

.lv-check-option.correct {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.12);
  color: var(--green);
}

.lv-check-option.wrong {
  border-color: var(--red);
  background: rgba(205, 24, 24, 0.12);
  color: #ff8f8f;
}

.lv-check-feedback {
  margin: 8px 0 0;
  font-size: 0.86rem;
}

.lv-check-feedback.ok { color: var(--green); }
.lv-check-feedback.bad { color: #ff8f8f; }

.lv-icon-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.lv-icon-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
  text-align: center;
  align-items: center;
}

.lv-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.lv-icon-item strong {
  color: var(--text);
}

.lv-icon-item small {
  color: var(--muted);
}

/* --- Práctica tipo "relacionar" ------------------------------------------ */
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.match-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-item {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  text-align: left;
  font: 700 0.86rem/1.3 JetBrains Mono, monospace;
  cursor: pointer;
}

.match-item:hover:not(:disabled) {
  border-color: rgba(243, 149, 13, 0.5);
}

.match-item.selected {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.12);
  color: var(--orange);
}

.match-item.matched {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.12);
  color: var(--green);
  cursor: default;
}

/* --- Primitivas visuales nuevas: timeline, byte-breakdown, spectrum, frame-fields --- */
.lv-timeline-track {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  position: relative;
}

.lv-timeline-item {
  display: flex;
  flex-direction: column;
  flex: 1 1 100px;
  min-width: 100px;
}

.lv-timeline-dot {
  padding: 10px 6px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  font: 700 0.78rem/1.2 JetBrains Mono, monospace;
  text-align: center;
  cursor: pointer;
}

.lv-timeline-dot.open {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.14);
  color: var(--orange);
}

.lv-timeline-detail {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(164, 221, 0, 0.3);
  background: rgba(164, 221, 0, 0.06);
}

.lv-timeline-detail strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.lv-timeline-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.lv-bytes-value {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font: 800 1.1rem/1.4 JetBrains Mono, monospace;
}

.lv-byte {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
}

.lv-byte:hover {
  border-color: rgba(243, 149, 13, 0.4);
}

.lv-byte.active {
  background: rgba(243, 149, 13, 0.16);
  border-color: var(--orange);
  color: var(--orange);
}

.lv-spectrum-axis {
  position: relative;
  height: 56px;
  border-radius: 8px;
  background: rgba(var(--contrast-rgb), 0.04);
  border: 1px solid rgba(181, 192, 212, 0.18);
  overflow: hidden;
}

.lv-spectrum-band {
  position: absolute;
  top: 10px;
  bottom: 10px;
  min-width: 36px;
  border-radius: 6px;
  border: 1px solid rgba(164, 221, 0, 0.5);
  background: rgba(164, 221, 0, 0.18);
  color: var(--green);
  font: 700 0.72rem/1 JetBrains Mono, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  text-align: center;
  cursor: pointer;
}

.lv-spectrum-band.selected {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.22);
  color: var(--orange);
  z-index: 2;
}

.lv-spectrum-band.overlap {
  border-color: var(--red);
}

.lv-spectrum-band.static {
  cursor: default;
}

.lv-spectrum-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.lv-frame-bar {
  display: flex;
  gap: 2px;
}

.lv-frame-field {
  padding: 10px 6px;
  border-radius: 6px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  font: 700 0.72rem/1.2 JetBrains Mono, monospace;
  text-align: center;
  cursor: pointer;
  min-width: 0;
}

.lv-frame-field.active {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.16);
  color: var(--orange);
}

/* --- Práctica "build-network" ------------------------------------------- */
.build-devices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.build-device {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.build-device.selected {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.14);
  color: var(--orange);
}

.build-device-icon {
  font-size: 1.1rem;
}

.build-zones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.build-zone {
  min-height: 90px;
  padding: 14px;
  border-radius: 8px;
  border: 1px dashed rgba(164, 221, 0, 0.35);
  background: rgba(164, 221, 0, 0.04);
  cursor: pointer;
}

.build-zone strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.build-zone-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.build-zone-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(164, 221, 0, 0.14);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
}

/* --- Práctica "classify" -------------------------------------------------- */
.classify-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.classify-item {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
}

.classify-item.solved {
  border-color: rgba(164, 221, 0, 0.4);
}

.classify-item-head strong {
  color: var(--text);
}

.classify-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.classify-option {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.classify-option:disabled {
  cursor: default;
}

.classify-option.correct {
  border-color: var(--green);
  background: rgba(164, 221, 0, 0.14);
  color: var(--green);
}

.classify-option.wrong {
  border-color: var(--red);
  background: rgba(205, 24, 24, 0.14);
  color: #ff8f8f;
}

.classify-feedback {
  margin: 8px 0 0;
  font-size: 0.84rem;
}

.classify-feedback.ok { color: var(--green); }
.classify-feedback.bad { color: #ff8f8f; }

/* --- Práctica "channel-assign" -------------------------------------------- */
.channel-assign-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.channel-assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--contrast-rgb), 0.04);
}

.channel-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.channel-option {
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--text);
  font: 700 0.82rem/1.2 JetBrains Mono, monospace;
  cursor: pointer;
}

.channel-option.active {
  border-color: var(--orange);
  background: rgba(243, 149, 13, 0.16);
  color: var(--orange);
}

.channel-spectrum-live {
  position: relative;
  height: 48px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: rgba(var(--contrast-rgb), 0.04);
  border: 1px solid rgba(181, 192, 212, 0.18);
  overflow: hidden;
}

.channel-overlap-status {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.84rem;
}

.channel-overlap-status.ok {
  color: var(--green);
  background: rgba(164, 221, 0, 0.08);
}

.channel-overlap-status.bad {
  color: var(--red);
  background: rgba(205, 24, 24, 0.08);
}

@media (max-width: 720px) {
  .practice-card {
    align-items: flex-start;
  }

  .lesson-video {
    max-height: 260px;
  }

  .match-board {
    grid-template-columns: 1fr;
  }

  .lv-compare-cols {
    grid-template-columns: 1fr;
  }

  .build-zones {
    grid-template-columns: 1fr;
  }

  .channel-assign-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== wispr :: motion pass v3 — movimiento continuo ===== */

.wispr-ticker {
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(var(--surface-rgb), 0.4);
  padding: 6px 0;
  margin-bottom: 16px;
}

.wispr-ticker-track {
  display: inline-flex;
  gap: 40px;
  padding-left: 40px;
}

.wispr-ticker-track span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (prefers-reduced-motion: no-preference) {
  .wispr-ticker-track {
    animation: wispr-ticker-scroll 18s linear infinite;
  }
}

@keyframes wispr-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* logo con vida propia, siempre */
@media (prefers-reduced-motion: no-preference) {
  .brand-logo {
    animation: wispr-float 3.2s ease-in-out infinite;
  }
}

@keyframes wispr-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(3deg); }
}

/* barrido de luz cruzando las tarjetas, sin necesitar hover */
.challenge-card {
  background-image:
    linear-gradient(120deg, transparent 40%, rgba(164, 221, 0, 0.09) 50%, transparent 60%),
    linear-gradient(145deg, var(--panel), var(--panel-2));
  background-size: 250% 250%, 100% 100%;
  background-position: 200% 0, 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .challenge-card {
    animation: wispr-scan 7s ease-in-out infinite;
  }
}

@keyframes wispr-scan {
  0%   { background-position: 200% 0, 0 0; }
  100% { background-position: -50% 0, 0 0; }
}

/* feedback de presión en botones */
.primary-action,
.ghost-action {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-action:active,
.ghost-action:active {
  transform: scale(0.96);
}

/* =========================================
   WISPR HERO NETWORK
   ========================================= */

.mission-hero {
  isolation: isolate;
}

.hero-network {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.72;
  overflow: hidden;
}

.hero-network svg {
  width: 100%;
  height: 100%;
}

.network-lines line {
  stroke: rgba(164, 221, 0, 0.16);
  stroke-width: 1;
}

.network-nodes circle {
  fill: var(--green);
  opacity: 0.75;
  filter: drop-shadow(0 0 7px rgba(164, 221, 0, 0.8));
}

.network-nodes circle:nth-child(4) {
  opacity: 1;
  r: 8;
}

.network-pulse {
  fill: none;
  stroke: var(--green);
  stroke-width: 1;
  opacity: 0.65;
  transform-box: fill-box;
  transform-origin: center;
  animation: wisprPulse 2.8s ease-out infinite;
}

@keyframes wisprPulse {
  0% {
    transform: scale(0.5);
    opacity: 0.7;
  }

  70% {
    transform: scale(2.4);
    opacity: 0;
  }

  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.mission-hero > *:not(.hero-network) {
  position: relative;
  z-index: 2;
}

/* --- Panel admin: listado de cuentas y borrado ------------------------- */
.admin-main {
  min-width: 0;
}

.admin-hero {
  grid-template-columns: 1fr;
}

/* --- Gráficos de actividad del home admin: SVG dibujado a mano --------- */
.chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-panel {
  min-width: 0;
}

.chart-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.activity-chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart-baseline {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.35;
}

.chart-axis-label,
.chart-row-label,
.chart-value-label {
  font: 700 9px JetBrains Mono, monospace;
  fill: var(--muted);
}

.chart-value-label {
  fill: var(--text);
}

.role-chart .chart-row-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 720px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}

.role-tag.role-admin {
  border-color: rgba(205, 24, 24, 0.45);
  color: var(--red);
}

/* --- Grupos: tarjetas de profesor/admin --------------------------------- */
.groups-list {
  display: grid;
  gap: 16px;
}

.group-card .section-head {
  margin-bottom: 12px;
}

.group-create-form,
.group-add-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.group-create-form input,
.group-add-form input {
  flex: 1 1 240px;
  width: auto;
}

.group-add-form {
  margin-bottom: 8px;
}

.group-members {
  display: grid;
}

/* --- Tareas por grupo ---------------------------------------------------- */
.task-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.09);
}

.task-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.task-form select[name="challengeId"] {
  flex: 1 1 220px;
  width: auto;
}

.task-form input[name="title"],
.task-form input[name="description"] {
  flex: 1 1 180px;
  width: auto;
}

.task-form input[name="dueDate"] {
  flex: 0 0 auto;
  width: auto;
}

.task-list {
  display: grid;
}

.task-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.07);
}

.task-row:first-child {
  border-top: none;
}

.task-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.task-row.task-done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.task-status {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  color: var(--muted);
}

.task-status.done {
  color: var(--green);
}

.task-status-count {
  width: auto;
  min-width: 42px;
  padding: 2px 8px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  border-radius: 999px;
  font: 700 0.75rem/1.5 JetBrains Mono, monospace;
  cursor: default;
}

.task-status-count.done {
  border-color: rgba(164, 221, 0, 0.4);
}

.task-due {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.24);
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.task-due.overdue {
  border-color: rgba(205, 24, 24, 0.4);
  color: var(--red);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.admin-toolbar .admin-search {
  flex: 1 1 260px;
}

.admin-toolbar select {
  flex: 0 0 auto;
  width: auto;
  min-width: 170px;
}

.admin-table {
  padding: 8px 18px;
}

.admin-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid rgba(var(--contrast-rgb), 0.09);
}

.admin-row:first-child {
  border-top: none;
}

.admin-row .grow {
  min-width: 180px;
}

.admin-cell {
  flex: 0 0 auto;
  font-size: 0.85rem;
  white-space: nowrap;
}

.admin-row-head {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 14px;
}

.admin-row-spacer {
  flex: 1 1 auto;
}

.admin-row-check,
.admin-row-check-empty {
  flex: 0 0 auto;
  width: 20px;
  display: flex;
  justify-content: center;
}

.admin-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.admin-empty {
  padding: 14px 0;
}

/* Diálogo propio: reemplaza a alert/confirm/prompt del navegador. */
.wdialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 10, 26, 0.62);
  backdrop-filter: blur(4px);
  animation: wdialog-fade 0.16s ease;
}

.wdialog {
  --wdialog-color: var(--orange);
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: var(--text);
  animation: wdialog-rise 0.18s ease;
}

.wdialog-danger { --wdialog-color: var(--red); border-color: rgba(205, 24, 24, 0.5); }
.wdialog-success { --wdialog-color: var(--green); }

.wdialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wdialog-head h3 {
  margin: 0;
  font-size: 1.12rem;
}

.wdialog-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--wdialog-color) 16%, transparent);
  color: var(--wdialog-color);
  font-size: 1.15rem;
}

html:not([data-theme="light"]) .wdialog-danger .wdialog-icon {
  color: #ff7676;
}

.wdialog-message,
.wdialog-note {
  margin: 0;
  line-height: 1.5;
}

.wdialog-note {
  color: var(--muted);
  font-size: 0.86rem;
}

.wdialog-secret {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--wdialog-color);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.wdialog-secret code {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  user-select: all;
  overflow-wrap: anywhere;
}

/* Informe al resolver un reto: pop-up mediano, sin ocupar toda la pantalla. */
.wdialog-wide {
  width: min(540px, 100%);
}

.wreport {
  display: grid;
  gap: 14px;
}

.wreport-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wreport-stat {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}

.wreport-stat .ico {
  color: var(--orange);
}

.wreport-stat strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.15rem;
}

.wreport-stat span {
  color: var(--muted);
  font-size: 0.76rem;
}

.wreport-lines {
  display: grid;
  gap: 4px;
  font-size: 0.88rem;
}

.wreport-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.wreport-line strong {
  color: var(--wdialog-color);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

.wreport-line.is-minus strong {
  color: var(--orange);
}

.wreport-clean {
  margin: 0;
  color: var(--wdialog-color);
  font-size: 0.86rem;
}

.wstars {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wstars-title {
  margin: 0 0 6px;
  font-weight: 600;
}

.wstars-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.wstars-buttons {
  display: flex;
  gap: 2px;
}

.wdialog .wstar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 1.35rem;
}

.wdialog .wstar:hover {
  transform: none;
  background: transparent;
}

.wstar.is-on {
  color: var(--orange) !important;
}

.wstar.is-on .ico {
  fill: currentColor;
}

.wstars-status {
  color: var(--muted);
  font-size: 0.8rem;
}

.rating-average {
  color: var(--orange);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .wreport-stat strong { font-size: 1rem; }
}

html[data-theme="light"] .wdialog-success { --wdialog-color: #4a9440; }
html[data-theme="light"] .wdialog-secret { background: rgba(15, 44, 103, 0.06); }

.wdialog-field {
  margin: 0;
}

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

.wdialog-actions button {
  min-height: 40px;
  width: auto;
}

.wdialog-actions .danger-action {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.wdialog-actions .danger-action:hover:not(:disabled) {
  filter: brightness(1.12);
}

@keyframes wdialog-fade {
  from { opacity: 0; }
}

@keyframes wdialog-rise {
  from { opacity: 0; transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .wdialog-backdrop, .wdialog { animation: none; }
}

.danger-action {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(205, 24, 24, 0.4);
  background: rgba(205, 24, 24, 0.1);
  color: var(--red);
  font-weight: 700;
}

.danger-action:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
}

.danger-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .admin-row {
    justify-content: space-between;
  }

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

  .admin-toolbar select {
    width: 100%;
    min-width: 0;
  }
}

/* ===========================================================================
   Landing pública — concepto propio, deliberadamente distinto del panel/
   consola del resto de la app: fondo "aura" animado, tipografía grande,
   tarjetas de vidrio. Siempre oscura (ignora el toggle claro/oscuro), igual
   que el resto de "heroes" de la app — ver nota en el :root de este archivo.
   El contraste con el login/dashboard de después es intencional.
   =========================================================================== */

body.landing-active .video-bg,
body.landing-active .video-overlay {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.landing-page {
  position: relative;
  min-height: 100vh;
  color: #f5f5f5;
}

/* absolute (no fixed) a propósito: fixed solo pinta el alto de UN viewport,
   dejando el fondo por defecto asomado detrás de las secciones de más abajo
   en páginas largas. absolute + .landing-page en position:relative hace que
   cubra el alto real de todo el documento. */
.landing-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at top, #0c2548 0%, #061328 55%, #02060f 100%);
}

.landing-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 48px);
  pointer-events: none;
}

/* fixed (no absolute) a propósito: así los orbes siguen visibles cerca de
   donde estés mirando, en vez de quedar fijos en un punto del documento. */
.aura {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}

.aura-a {
  top: -140px;
  left: -100px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(164, 221, 0, 0.55), transparent 70%);
  animation: auraDrift 22s ease-in-out infinite;
}

.aura-b {
  top: 8%;
  right: -180px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(243, 149, 13, 0.45), transparent 70%);
  animation: auraDrift 26s ease-in-out infinite reverse;
}

.aura-c {
  bottom: -160px;
  left: 28%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(18, 58, 120, 0.65), transparent 70%);
  animation: auraDrift 30s ease-in-out infinite;
}

@keyframes auraDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .aura { animation: none; }
}

/* --- Topbar flotante tipo "pill" de vidrio ------------------------------ */
.public-topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.public-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 10px 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 20, 45, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.public-nav a {
  color: rgba(245, 245, 245, 0.75);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.public-nav a:hover {
  color: var(--green);
}

.public-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* --- Hero: mascota a la izquierda, texto centrado en el espacio restante */
.landing-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 90px 20px 70px;
}

.hero-mascot {
  flex: 0 0 auto;
  width: 220px;
  height: auto;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.45));
}

.hero-copy {
  flex: 1 1 auto;
  max-width: 680px;
  text-align: center;
}

.hero-kicker {
  margin-bottom: 20px;
}

.landing-hero h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
}

.text-gradient {
  background: linear-gradient(120deg, var(--green), var(--orange));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 560px;
  margin: 0 auto 30px;
  color: rgba(245, 245, 245, 0.72);
  font-size: 1.05rem;
}

.landing-hero .hero-actions {
  justify-content: center;
}

.hero-scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 56px;
  color: rgba(245, 245, 245, 0.42);
  font: 700 0.72rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-scroll-arrow {
  animation: heroBob 1.8s ease-in-out infinite;
}

@media (max-width: 860px) {
  .landing-hero {
    flex-direction: column;
    padding-top: 70px;
  }

  .hero-mascot {
    width: 160px;
  }
}

@keyframes heroBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* --- Tira de estadísticas ------------------------------------------------ */
.landing-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  max-width: 980px;
  margin: 0 auto 100px;
  padding: 0 20px;
}

.landing-stat {
  padding: 26px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.landing-stat + .landing-stat {
  border-left: none;
}

.landing-stat strong {
  display: block;
  margin-bottom: 6px;
  background: linear-gradient(120deg, var(--green), var(--orange));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font: 800 2rem/1 JetBrains Mono, monospace;
}

.landing-stat span {
  color: rgba(245, 245, 245, 0.6);
  font-size: 0.8rem;
}

/* --- Secciones generales ------------------------------------------------- */
.landing-section {
  max-width: 1040px;
  margin: 0 auto 100px;
  padding: 0 20px;
  scroll-margin-top: 110px;
}

.landing-section .eyebrow {
  color: var(--green);
}

.landing-section h2 {
  margin: 6px 0 22px;
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.landing-acronym {
  margin: -8px 0 18px;
  color: var(--green);
  font: 700 0.85rem/1.4 JetBrains Mono, monospace;
  letter-spacing: 0.02em;
}

.landing-statement {
  max-width: 740px;
  margin: 0 0 14px;
  color: #fff;
  font-size: 1.12rem;
  line-height: 1.6;
}

.landing-substatement {
  max-width: 700px;
  margin: 0;
  color: rgba(245, 245, 245, 0.64);
}

/* --- Servicios: tarjetas que voltean (hover en desktop, tap en móvil) --- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.flip-card {
  height: 220px;
  perspective: 1200px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

/* hover cubre desktop; .is-flipped (via click/tap) cubre pantallas táctiles,
   donde no existe el concepto de "pasar el cursor por encima". */
.flip-card:hover .flip-card-inner,
.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 26px 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(10px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: border-color 0.25s ease;
}

.flip-card:hover .flip-card-front,
.flip-card:hover .flip-card-back,
.flip-card.is-flipped .flip-card-front,
.flip-card.is-flipped .flip-card-back {
  border-color: rgba(164, 221, 0, 0.4);
}

.flip-card-front {
  justify-content: center;
}

.flip-card-back {
  transform: rotateY(180deg);
  justify-content: flex-start;
}

.bento-index {
  display: block;
  margin-bottom: 10px;
  color: rgba(164, 221, 0, 0.65);
  font: 800 1.5rem/1 JetBrains Mono, monospace;
}

.flip-card-front h3,
.flip-card-back h3 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 1.05rem;
}

.flip-card-back p {
  margin: 0;
  color: rgba(245, 245, 245, 0.68);
  font-size: 0.92rem;
}

.flip-card-back .bento-index {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.flip-card-back h3 {
  margin-bottom: 6px;
  font-size: 0.98rem;
}

@media (prefers-reduced-motion: reduce) {
  .flip-card-inner {
    transition: none;
  }
}

/* --- Beneficios: lista con check ----------------------------------------- */
.benefit-list {
  max-width: 760px;
}

.benefit-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.benefit-row:first-child {
  border-top: none;
  padding-top: 0;
}

.benefit-check {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgba(164, 221, 0, 0.15);
  color: var(--green);
  font-weight: 800;
}

.benefit-row h3 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 1rem;
}

.benefit-row p {
  margin: 0;
  color: rgba(245, 245, 245, 0.64);
}

/* --- Equipo: fotos circulares con anillo degradado ----------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 24px;
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.team-photo-ring {
  width: 114px;
  height: 114px;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--orange));
}

.team-photo {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  background: #0a1f3f;
}

.team-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-photo-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, var(--green), var(--blue-800) 72%);
  color: #fff;
  font: 800 1.15rem/1 JetBrains Mono, monospace;
}

.team-card strong {
  color: #fff;
  font-size: 1rem;
}

.team-role {
  max-width: 200px;
  margin: 2px 0 0;
  color: rgba(245, 245, 245, 0.6);
  font-size: 0.84rem;
}

/* --- Footer multi-columna -------------------------------------------------*/
.landing-footer {
  max-width: 1040px;
  margin: 60px auto 0;
  padding: 40px 20px 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.footer-brand p {
  max-width: 320px;
  margin: 10px 0 0;
  color: rgba(245, 245, 245, 0.58);
}

.footer-links,
.footer-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.footer-links .eyebrow,
.footer-cta .eyebrow {
  color: var(--green);
}

.footer-links a {
  color: rgba(245, 245, 245, 0.7);
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--green);
}

.footer-bottom {
  color: rgba(245, 245, 245, 0.4);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 760px) {
  .public-topbar-inner {
    flex-wrap: wrap;
    border-radius: 20px;
  }

  .public-nav {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

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

  .footer-top {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
/* =====================================================================
   wispr :: MÓDULO 3 — Autenticación ("detrás de la conexión")
   Las superficies .m3-lab son el "laboratorio" y se mantienen oscuras en
   ambos temas a propósito (como la terminal y los heros). Todo lo que
   queda fuera de ellas usa las variables del tema.
   Paleta: #0f2c67 · #081a3a · #f3950d · #5eae52 · #cd1818 · #f5f5f5 · #b5c0d4
   ===================================================================== */

.lesson-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 600;
}

.m3-quiz-title {
  margin: 0;
  color: var(--orange);
  font: 800 1.05rem/1.2 JetBrains Mono, monospace;
}

.m3-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(243, 149, 13, 0.45);
  background: rgba(243, 149, 13, 0.07);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.m3-link-icon { flex: 0 0 auto; }

/* --- Superficie de laboratorio ---------------------------------------- */
.m3-lab {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(243, 149, 13, 0.22);
  color: #f5f5f5;
  background:
    linear-gradient(rgba(143, 179, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, rgba(143, 179, 255, 0.045) 1px, transparent 1px) 0 0 / 22px 100%,
    radial-gradient(circle at 50% 0%, rgba(15, 44, 103, 0.95), #081a3a 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 10px 30px rgba(4, 18, 43, 0.25);
  min-width: 0;
}

.m3-lab code {
  font: 600 0.82rem/1.3 JetBrains Mono, monospace;
  color: #f5f5f5;
  overflow-wrap: anywhere;
}

.m3-behind-label {
  align-self: flex-start;
  color: #f3950d;
  font: 700 0.68rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.m3-caption {
  margin: 0;
  color: #b5c0d4;
  font-size: 0.88rem;
}

.m3-caption.small { font-size: 0.78rem; }
.m3-caption-themed { color: var(--muted); }

.m3-note {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(143, 179, 255, 0.3);
  background: rgba(143, 179, 255, 0.08);
}

.m3-note strong {
  display: block;
  color: #f3950d;
  font: 700 0.8rem/1.3 JetBrains Mono, monospace;
}

.m3-note p { margin: 4px 0 0; color: #f5f5f5; }
.m3-note.ok { border-color: rgba(94, 174, 82, 0.5); background: rgba(94, 174, 82, 0.1); }
.m3-note.ok strong { color: #5eae52; }
.m3-note.bad { border-color: rgba(205, 24, 24, 0.55); background: rgba(205, 24, 24, 0.1); }
.m3-note.bad strong { color: #ff8f8f; }

.m3-note-title {
  margin: 0;
  color: #f5f5f5;
  font-weight: 800;
}

.m3-summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(94, 174, 82, 0.5);
  background: rgba(94, 174, 82, 0.1);
  color: #f5f5f5;
  font-weight: 600;
}

.m3-summary > span:first-child { color: #5eae52; font-weight: 800; }

.m3-hint {
  margin: 0;
  color: #ffc46b;
  font-size: 0.88rem;
}

.m3-phase {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

/* --- Chips / tokens con tono por tipo de elemento --------------------- */
.m3-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.35);
  background: rgba(181, 192, 212, 0.08);
  color: #f5f5f5;
  font: 700 0.78rem/1.2 JetBrains Mono, monospace;
  white-space: nowrap;
}

.m3-chip.tone-key { border-color: rgba(243, 149, 13, 0.7); background: rgba(243, 149, 13, 0.16); color: #ffc46b; }
.m3-chip.tone-nonce { border-color: rgba(143, 179, 255, 0.7); background: rgba(143, 179, 255, 0.14); color: #c3d6ff; }
.m3-chip.tone-mic { border-color: rgba(94, 174, 82, 0.75); background: rgba(94, 174, 82, 0.16); color: #9fdc95; }
.m3-chip.tone-mac { border-color: rgba(181, 192, 212, 0.55); background: rgba(181, 192, 212, 0.1); color: #dfe6f2; }
.m3-chip.tone-id { border-style: dashed; border-color: rgba(243, 149, 13, 0.75); background: rgba(243, 149, 13, 0.08); color: #ffd18f; }
.m3-chip.tone-proc { border-color: rgba(245, 245, 245, 0.55); background: rgba(245, 245, 245, 0.08); }
.m3-chip.tone-air { border-style: dashed; color: #b5c0d4; }
.m3-chip.mini { padding: 2px 7px; font-size: 0.68rem; }
.m3-chip.big { padding: 10px 22px; font-size: 1.15rem; }
.m3-chip.dim { opacity: 0.45; }
.m3-chip.struck { text-decoration: line-through; opacity: 0.6; }

button.m3-token {
  cursor: pointer;
  white-space: normal;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button.m3-token:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 0 3px rgba(243, 149, 13, 0.15); }
.m3-token.dim { opacity: 0.6; }
.m3-token.seen { opacity: 1; }
.m3-token.active,
.m3-token.selected { box-shadow: 0 0 0 2px #f3950d, 0 0 18px rgba(243, 149, 13, 0.35); opacity: 1; }
.m3-token.matched { border-color: #5eae52; background: rgba(94, 174, 82, 0.16); color: #c6f0bf; cursor: default; }
.m3-token[draggable="true"] { cursor: grab; }

.m3-option {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.3);
  background: rgba(245, 245, 245, 0.05);
  color: #f5f5f5;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.m3-option:hover:not(:disabled) { border-color: rgba(243, 149, 13, 0.7); }
.m3-option.active { border-color: #f3950d; background: rgba(243, 149, 13, 0.14); color: #ffc46b; }
.m3-option.wrong { border-color: #cd1818; background: rgba(205, 24, 24, 0.14); color: #ff9c9c; }

.m3-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Dispositivos y carril de mensajes AP ↔ Cliente ------------------- */
.m3-dev {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
}

.m3-dev-icon { font-size: 1.5rem; line-height: 1; }
.m3-dev strong { color: #f5f5f5; font: 700 0.75rem/1.2 JetBrains Mono, monospace; }

.m3-lane-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 8px;
}

.m3-air {
  justify-self: center;
  color: #b5c0d4;
  font: 600 0.68rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.8;
}

.m3-lane {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 26px;
  padding: 4px 6px;
  border-left: 2px dashed rgba(181, 192, 212, 0.25);
  border-right: 2px dashed rgba(181, 192, 212, 0.25);
}

.m3-lane-row {
  display: block;
  width: 100%;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
}

button.m3-lane-row { cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
button.m3-lane-row:hover { background: rgba(243, 149, 13, 0.06); }
.m3-lane-row.active { border-color: rgba(243, 149, 13, 0.55); background: rgba(243, 149, 13, 0.1); }

.m3-arrow {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 12px;
}

.m3-arrow::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 4px;
  height: 2px;
  background: linear-gradient(90deg, rgba(243, 149, 13, 0.15), #f3950d);
}

.m3-arrow.to-ap::before { background: linear-gradient(270deg, rgba(143, 179, 255, 0.15), #8fb3ff); }

.m3-arrow::after {
  content: "";
  position: absolute;
  bottom: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.m3-arrow.to-client::after { right: -2px; border-left: 9px solid #f3950d; }
.m3-arrow.to-ap::after { left: -2px; border-right: 9px solid #8fb3ff; }

.m3-arrow-label {
  color: #f5f5f5;
  font: 700 0.78rem/1.2 JetBrains Mono, monospace;
}

.m3-arrow.to-client .m3-arrow-label { color: #ffc46b; }
.m3-arrow.to-ap .m3-arrow-label { color: #c3d6ff; }

.m3-arrow-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

/* --- connect-reveal ---------------------------------------------------- */
.m3-wifi-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.25);
  background: rgba(4, 18, 43, 0.75);
}

.m3-wifi-title { color: #b5c0d4; font: 700 0.72rem/1 JetBrains Mono, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.m3-wifi-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.m3-wifi-ssid { font-weight: 700; }
.m3-wifi-status { color: #5eae52; font-weight: 800; }

.m3-behind,
.m3-recap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed rgba(243, 149, 13, 0.35);
  background: rgba(15, 44, 103, 0.35);
}

.m3-video { display: flex; flex-direction: column; gap: 10px; }

.m3-video-cue {
  margin: 0;
  color: var(--orange);
  font: 700 0.95rem/1.3 JetBrains Mono, monospace;
}

.m3-video-cue.after { color: var(--green); }

/* --- hs-recall --------------------------------------------------------- */
.m3-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.m3-timeline::before {
  content: "";
  position: absolute;
  top: 19px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: rgba(181, 192, 212, 0.25);
}

.m3-timeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: #b5c0d4;
  cursor: pointer;
}

.m3-timeline-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(181, 192, 212, 0.4);
  background: #081a3a;
  color: #f5f5f5;
  font: 800 0.95rem/1 JetBrains Mono, monospace;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.m3-timeline-label { font: 600 0.72rem/1.2 JetBrains Mono, monospace; }
.m3-timeline-node:hover .m3-timeline-num { border-color: #f3950d; }
.m3-timeline-node.active .m3-timeline-num { border-color: #f3950d; box-shadow: 0 0 0 4px rgba(243, 149, 13, 0.18); }
.m3-timeline-node.done .m3-timeline-num { border-color: #5eae52; background: rgba(94, 174, 82, 0.2); color: #9fdc95; }
.m3-timeline-node.done .m3-timeline-label { color: #9fdc95; }

.m3-recall-ask { display: flex; flex-direction: column; gap: 8px; }
.m3-recall-options { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- flow-chain -------------------------------------------------------- */
.m3-flow-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.m3-flow-link {
  align-self: center;
  color: #f3950d;
  font: 800 1.3rem/1 JetBrains Mono, monospace;
}

.m3-flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 130px;
  max-width: 230px;
  flex: 1 1 130px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.3);
  background: rgba(245, 245, 245, 0.04);
  color: #f5f5f5;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.m3-flow-node small { color: #b5c0d4; font: 600 0.68rem/1.2 JetBrains Mono, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.m3-flow-node strong { font-size: 0.98rem; }
.m3-flow-node:hover { transform: translateY(-2px); }
.m3-flow-node.tone-key { border-color: rgba(243, 149, 13, 0.6); }
.m3-flow-node.tone-key strong { color: #ffc46b; font-family: JetBrains Mono, monospace; }
.m3-flow-node.tone-id { border-style: dashed; border-color: rgba(243, 149, 13, 0.7); }
.m3-flow-node.tone-id strong { color: #ffd18f; font-family: JetBrains Mono, monospace; }
.m3-flow-node.seen { background: rgba(243, 149, 13, 0.06); }
.m3-flow-node.active { box-shadow: 0 0 0 2px #f3950d, 0 0 20px rgba(243, 149, 13, 0.25); }

/* --- auth-scene -------------------------------------------------------- */
.m3-scene-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
}

.m3-scene-col,
.m3-scene-air {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-radius: 10px;
}

.m3-scene-col { border: 1px solid rgba(181, 192, 212, 0.2); background: rgba(4, 18, 43, 0.55); }

.m3-scene-air {
  justify-content: center;
  border: 1px dashed rgba(181, 192, 212, 0.22);
  background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(143, 179, 255, 0.06) 14px 16px);
}

/* --- key-merge / ecuación --------------------------------------------- */
.m3-merge-inputs,
.m3-eq-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.m3-plus { color: #b5c0d4; font: 800 1rem/1 JetBrains Mono, monospace; }

.m3-merge-funnel {
  display: flex;
  justify-content: center;
  gap: 10px;
  color: #b5c0d4;
  font: 600 0.75rem/1 JetBrains Mono, monospace;
}

.m3-merge-output,
.m3-eq-out {
  display: flex;
  justify-content: center;
}

.m3-merge-output.ready .m3-chip,
.m3-eq-out.ready .m3-chip { box-shadow: 0 0 24px rgba(243, 149, 13, 0.45); }

/* --- group-net --------------------------------------------------------- */
.m3-group-ap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.m3-group-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }

.m3-group-beams,
.m3-group-clients {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.m3-beam {
  position: relative;
  justify-self: center;
  width: 2px;
  height: 52px;
  background: rgba(181, 192, 212, 0.2);
}

.m3-beam.on { background: linear-gradient(180deg, #f3950d, rgba(243, 149, 13, 0.3)); }

.m3-packet {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(243, 149, 13, 0.7);
  background: #0f2c67;
  color: #ffc46b;
  font: 700 0.68rem/1.4 JetBrains Mono, monospace;
  white-space: nowrap;
}

.m3-group-client {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.55);
  text-align: center;
  min-width: 0;
}

.m3-group-client strong { font-size: 0.85rem; }
.m3-group-client.can { border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.1); }
.m3-group-client.cannot { opacity: 0.6; }
.m3-group-status { font-size: 0.75rem; font-weight: 800; }
.m3-group-client.can .m3-group-status { color: #9fdc95; }
.m3-group-client.cannot .m3-group-status { color: #ff9c9c; }

/* --- nonce-gen --------------------------------------------------------- */
.m3-nonce-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.m3-nonce-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.2);
  background: rgba(4, 18, 43, 0.55);
  min-width: 0;
}

.m3-nonce-col .m3-dev { align-self: center; }
.m3-nonce-list { display: flex; flex-direction: column; gap: 6px; }

.m3-nonce-value {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(143, 179, 255, 0.55);
  background: rgba(143, 179, 255, 0.1);
}

.m3-nonce-value.old { opacity: 0.45; border-color: rgba(181, 192, 212, 0.25); background: none; }
.m3-nonce-value.old code { text-decoration: line-through; }
.m3-nonce-tag { color: #c3d6ff; font: 700 0.65rem/1 JetBrains Mono, monospace; text-transform: uppercase; letter-spacing: 0.08em; }

/* --- mic-sim / mic-verify --------------------------------------------- */
.m3-mic-grid { display: grid; grid-template-columns: 1fr 0.7fr 1fr; gap: 10px; align-items: stretch; }

.m3-mic-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.6);
  min-width: 0;
}

.m3-mic-card.receiver.ok { border-color: rgba(94, 174, 82, 0.7); }
.m3-mic-card.receiver.bad { border-color: rgba(205, 24, 24, 0.75); }

.m3-mic-lines { display: flex; flex-direction: column; gap: 3px; }
.m3-mic-lines code.altered { color: #ff9c9c; background: rgba(205, 24, 24, 0.18); border-radius: 4px; padding: 0 4px; }
.m3-mic-formula { color: #b5c0d4; font: 600 0.72rem/1.3 JetBrains Mono, monospace; }
.m3-mic-value { display: flex; flex-direction: column; gap: 2px; }
.m3-mic-value code { color: #9fdc95; }

.m3-mic-channel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(181, 192, 212, 0.22);
  background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(143, 179, 255, 0.06) 14px 16px);
  padding: 10px 6px;
  text-align: center;
}

.m3-mic-channel .m3-packet { position: static; transform: none; white-space: normal; }
.m3-mic-channel.tampered .m3-packet { border-color: #cd1818; color: #ff9c9c; }
.m3-tamper { color: #ff9c9c; font-size: 0.75rem; font-weight: 700; }

.m3-verdict {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
}

.m3-verdict.ok { color: #9fdc95; background: rgba(94, 174, 82, 0.18); border: 1px solid rgba(94, 174, 82, 0.6); }
.m3-verdict.bad { color: #ff9c9c; background: rgba(205, 24, 24, 0.18); border: 1px solid rgba(205, 24, 24, 0.6); }

.m3-micverify { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }

.m3-micmsg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.6);
  min-width: 0;
}

.m3-micmsg.solved.ok { border-color: rgba(94, 174, 82, 0.7); }
.m3-micmsg.solved.bad { border-color: rgba(205, 24, 24, 0.7); }
.m3-micmsg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.m3-micmsg-head strong { font: 700 0.82rem/1.3 JetBrains Mono, monospace; color: #ffc46b; }
.m3-reasons { display: flex; flex-direction: column; gap: 6px; }
.m3-option.reason { font-weight: 600; font-size: 0.85rem; }
.m3-explain { margin: 0; font-size: 0.85rem; }
.m3-explain.ok { color: #9fdc95; }
.m3-explain.bad { color: #ff9c9c; }

/* --- Zonas para soltar (comunes) -------------------------------------- */
.m3-pool { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.m3-pool-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.m3-pool-items.cards { flex-direction: column; }
.m3-pool-items.centered { justify-content: center; }

.m3-drop,
.m3-eq-slot,
.m3-mslot,
.m3-discard {
  border-radius: 8px;
  border: 1px dashed rgba(181, 192, 212, 0.35);
  background: rgba(4, 18, 43, 0.45);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.m3-drop.ready,
.m3-eq-slot.ready,
.m3-mslot.ready,
.m3-discard.ready,
.m3-drop-row.ready,
.drag-over {
  border-color: #f3950d !important;
  background: rgba(243, 149, 13, 0.08) !important;
  cursor: pointer;
}

.drag-over { box-shadow: 0 0 0 3px rgba(243, 149, 13, 0.25); }

.m3-drop-placeholder {
  color: #b5c0d4;
  font: 600 0.75rem/1.3 JetBrains Mono, monospace;
  opacity: 0.8;
}

/* --- hs-builder -------------------------------------------------------- */
.m3-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: start;
}

.m3-fcard {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(243, 149, 13, 0.4);
  background: rgba(243, 149, 13, 0.07);
  color: #f5f5f5;
  font-weight: 600;
  font-size: 0.86rem;
  text-align: left;
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.m3-fcard:hover { transform: translateY(-1px); }
.m3-fcard.selected { box-shadow: 0 0 0 2px #f3950d, 0 0 18px rgba(243, 149, 13, 0.3); }

.m3-slots { display: flex; flex-direction: column; gap: 10px; }

.m3-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(15, 44, 103, 0.35);
}

.m3-slot.solved { border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.08); }

.m3-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.m3-slot-head strong { font: 800 0.85rem/1 JetBrains Mono, monospace; color: #f3950d; }

.m3-sender { display: flex; gap: 4px; border-radius: 8px; }
.m3-sender.bad { box-shadow: 0 0 0 2px rgba(205, 24, 24, 0.7); }

.m3-sender-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(181, 192, 212, 0.3);
  background: rgba(245, 245, 245, 0.04);
  color: #b5c0d4;
  font: 700 0.72rem/1.2 JetBrains Mono, monospace;
  cursor: pointer;
}

.m3-sender-btn.active { border-color: #f3950d; background: rgba(243, 149, 13, 0.16); color: #ffc46b; }
.m3-sender-btn:disabled { cursor: default; }
.m3-sender-btn:disabled.active { border-color: #5eae52; background: rgba(94, 174, 82, 0.16); color: #9fdc95; }

.m3-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 32px 8px 10px;
}

.m3-drop.filled { border-style: solid; border-color: rgba(243, 149, 13, 0.45); }
.m3-drop.locked { border-style: solid; border-color: rgba(94, 174, 82, 0.75); background: rgba(94, 174, 82, 0.08); }
.m3-drop.bad { border-color: rgba(205, 24, 24, 0.75); }
.m3-fcard-text { font-size: 0.84rem; font-weight: 600; }

.m3-lock,
.m3-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  font-weight: 800;
}

.m3-lock { color: #5eae52; }

.m3-remove {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(181, 192, 212, 0.35);
  background: rgba(4, 18, 43, 0.8);
  color: #b5c0d4;
  font-size: 0.7rem;
  cursor: pointer;
}

.m3-replay-end {
  align-self: center;
  color: #9fdc95;
  font-weight: 800;
}

/* --- identify-match ---------------------------------------------------- */
.m3-idgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }

.m3-idcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.25);
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.m3-idcard:hover:not(:disabled) { border-color: #f3950d; transform: translateY(-2px); }
.m3-idcard:disabled { cursor: default; }
.m3-idcard strong { color: #ffc46b; font: 800 0.85rem/1.2 JetBrains Mono, monospace; }
.m3-idcard ul { margin: 0; padding-left: 16px; color: #b5c0d4; font-size: 0.8rem; }
.m3-idcard.wrong,
.m3-capture-row.wrong { border-color: rgba(205, 24, 24, 0.7); opacity: 0.7; }
.m3-idcard.found,
.m3-capture-row.found { border-color: #5eae52; background: rgba(94, 174, 82, 0.14); opacity: 1; }

.m3-capture { gap: 0; padding: 0; overflow: hidden; }

.m3-capture-title {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(181, 192, 212, 0.2);
  background: rgba(15, 44, 103, 0.7);
  color: #ffc46b;
  font: 700 0.78rem/1.3 JetBrains Mono, monospace;
}

.m3-capture-rows { display: flex; flex-direction: column; }

.m3-capture-row,
.m3-field {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-bottom-color: rgba(181, 192, 212, 0.1);
  background: none;
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
}

.m3-capture-row:hover:not(:disabled),
.m3-field:hover:not(:disabled) { background: rgba(243, 149, 13, 0.07); }
.m3-capture-row:disabled,
.m3-field:disabled { cursor: default; }

.m3-capture-key { color: #b5c0d4; font: 600 0.78rem/1.3 JetBrains Mono, monospace; }

.m3-match { gap: 8px; }

.m3-match-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: stretch;
}

.m3-match-row .m3-token { justify-content: center; border-radius: 8px; padding: 10px; white-space: normal; text-align: center; }

.m3-match-def {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.25);
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  font-weight: 600;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.m3-match-def.ready { border-color: rgba(243, 149, 13, 0.6); }
.m3-match-def.matched { border-color: #5eae52; opacity: 0.55; cursor: default; }

/* --- slot-builder (PTK) ------------------------------------------------ */
.m3-eq-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 108px;
  min-height: 74px;
  padding: 8px;
  text-align: center;
}

.m3-eq-slot small { color: #b5c0d4; font-size: 0.7rem; line-height: 1.2; }
.m3-eq-slot.filled { border-style: solid; border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.08); }
.m3-eq-arrow { color: #f3950d; font: 800 1.4rem/1 JetBrains Mono, monospace; }
.m3-eq-result { display: inline-flex; align-items: center; gap: 10px; }

.m3-discard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  color: #b5c0d4;
  font-weight: 700;
  font-size: 0.85rem;
}

/* --- packet-sort ------------------------------------------------------- */
.m3-sorter-progress { display: flex; flex-direction: column; gap: 6px; color: #b5c0d4; font-size: 0.82rem; }

.m3-packet-card {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 460px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(243, 149, 13, 0.5);
  background: rgba(15, 44, 103, 0.75);
  cursor: grab;
}

.m3-packet-card p { margin: 0; font-weight: 600; }
.m3-packet-card.done { cursor: default; border-color: rgba(94, 174, 82, 0.6); color: #9fdc95; }

.m3-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.m3-bin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 12px;
  border: 2px dashed rgba(181, 192, 212, 0.35);
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.m3-bin:hover:not(:disabled) { border-color: #f3950d; background: rgba(243, 149, 13, 0.07); }
.m3-bin:disabled { cursor: default; opacity: 0.7; }
.m3-bin-icon { font-size: 1.6rem; line-height: 1; }
.m3-bin strong { font-family: JetBrains Mono, monospace; color: #ffc46b; }
.m3-bin small { color: #b5c0d4; }

.m3-bin-count {
  position: absolute;
  top: 8px;
  right: 10px;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(94, 174, 82, 0.2);
  color: #9fdc95;
  font: 800 0.75rem/1.4 JetBrains Mono, monospace;
}

/* --- nonce-hunt -------------------------------------------------------- */
.m3-fields { gap: 0; padding: 6px 0; }
.m3-field { grid-template-columns: 24px minmax(110px, 0.6fr) minmax(0, 1fr); border-radius: 0; }
.m3-field-check { color: #b5c0d4; }
.m3-field.marked { background: rgba(143, 179, 255, 0.1); }
.m3-field.marked .m3-field-check { color: #8fb3ff; }
.m3-field.wrong { border-color: rgba(205, 24, 24, 0.7); background: rgba(205, 24, 24, 0.1); }
.m3-field.found { border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.12); }

.m3-drop-row {
  border: 1px dashed rgba(181, 192, 212, 0.2);
  border-radius: 8px;
}

/* --- Misión final ------------------------------------------------------ */
.m3-mission-phases { margin-bottom: 4px; }

.m3-brief h3 { margin: 0; }
.m3-brief p { margin: 0; color: #dfe6f2; }

.m3-brief-objectives { display: flex; flex-direction: column; gap: 8px; }
.m3-brief-objectives > div { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.m3-brief-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #f3950d;
  color: #f3950d;
  font: 800 0.8rem/1 JetBrains Mono, monospace;
}

.m3-mrow.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.m3-mslot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 12px;
  min-height: 70px;
}

.m3-mslot small { color: #b5c0d4; font-size: 0.78rem; line-height: 1.3; }
.m3-mslot.filled { border-style: solid; border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.07); }
.m3-mslot.wide { align-items: center; text-align: center; }

.m3-mlane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 26px;
  padding: 6px 8px;
  border-left: 2px dashed rgba(181, 192, 212, 0.25);
  border-right: 2px dashed rgba(181, 192, 212, 0.25);
}

.m3-mstep { display: flex; flex-direction: column; gap: 6px; }

.m3-mstep.both {
  padding: 8px;
  border-radius: 8px;
  background: rgba(243, 149, 13, 0.05);
}

.m3-mstep-label { color: #ffc46b; font: 600 0.75rem/1.3 JetBrains Mono, monospace; }

.m3-chain-list { display: flex; flex-direction: column; gap: 10px; }

.m3-chain-step {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(181, 192, 212, 0.3);
  background: rgba(4, 18, 43, 0.45);
}

.m3-chain-step + .m3-chain-step::before {
  content: "↓";
  position: absolute;
  top: -15px;
  left: 20px;
  color: #f3950d;
  font-size: 0.8rem;
}

.m3-chain-step.done { border-style: solid; border-color: rgba(94, 174, 82, 0.6); }
.m3-chain-step strong { display: block; }
.m3-chain-step small { color: #b5c0d4; }

.m3-chain-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(243, 149, 13, 0.16);
  color: #f3950d;
  font: 800 0.75rem/1 JetBrains Mono, monospace;
}

.m3-chain-branch { margin-left: auto; color: #ffd18f; font-size: 0.8rem; font-weight: 700; }

/* --- Progreso del módulo, mapa y pantallas de fin ---------------------- */
.m3-module-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 20px 0;
}

.m3-module-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.m3-xp-total { color: var(--orange); font: 800 0.85rem/1.4 JetBrains Mono, monospace; }

button.m3-mission-row {
  width: calc(100% - 40px);
  margin: 0 20px 18px;
  border: 1px solid rgba(243, 149, 13, 0.4);
}

.m3-mission-row.locked { opacity: 0.65; cursor: not-allowed; border-style: dashed; }
.m3-mission-row.locked:hover { background: none; color: var(--text); }
.m3-mission-icon { flex: 0 0 auto; }
.m3-locked-label { margin-left: auto; color: var(--muted); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }

.m3-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.m3-track-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.25);
  background: rgba(var(--contrast-rgb), 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.m3-track-dot:hover:not(:disabled) { border-color: var(--orange); color: var(--text); }
.m3-track-dot:disabled { cursor: default; }

.m3-track-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(var(--contrast-rgb), 0.08);
  font: 800 0.7rem/1 JetBrains Mono, monospace;
}

.m3-track-dot.done { color: var(--green); border-color: rgba(164, 221, 0, 0.4); }
.m3-track-dot.done .m3-track-num { background: rgba(164, 221, 0, 0.16); }
.m3-track-dot.current { color: var(--orange); border-color: var(--orange); background: rgba(243, 149, 13, 0.1); }
.m3-track-dot.current .m3-track-num { background: var(--orange); color: #fff; }

.m3-complete-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }

.m3-mastery { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.m3-stars { color: var(--orange); letter-spacing: 0.1em; }
.m3-stars .off { color: var(--muted); opacity: 0.35; }

.m3-ctf,
.m3-bridge {
  width: 100%;
  max-width: 560px;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: left;
}

.m3-ctf { border: 1px solid rgba(181, 192, 212, 0.25); background: rgba(var(--contrast-rgb), 0.04); }
.m3-ctf strong { color: var(--text); }
.m3-ctf p,
.m3-ctf ul { margin: 6px 0 0; color: var(--muted); }
.m3-ctf ul { padding-left: 18px; }
.m3-ctf li strong { color: var(--orange); }

.m3-bridge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid rgba(243, 149, 13, 0.5);
  background: linear-gradient(135deg, rgba(243, 149, 13, 0.1), rgba(15, 44, 103, 0.12));
}

.m3-bridge p { margin: 0; color: var(--text); font-weight: 600; }
.m3-bridge-label { color: var(--orange); font: 700 0.72rem/1 JetBrains Mono, monospace; letter-spacing: 0.1em; text-transform: uppercase; }

.m3-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 26px;
  border-radius: 16px;
  border: 1px solid rgba(243, 149, 13, 0.6);
  background: radial-gradient(circle at 50% 20%, rgba(243, 149, 13, 0.22), rgba(15, 44, 103, 0.35));
}

.m3-badge-icon { font-size: 2.8rem; line-height: 1; }
.m3-badge strong { color: var(--orange); font: 800 1rem/1.2 JetBrains Mono, monospace; }
.m3-badge small { color: var(--muted); }

.m3-module-claim { margin: 0; color: var(--text); font-size: 1.05rem; font-weight: 700; }

.m3-mastery-list { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 560px; }

.m3-mastery-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(var(--contrast-rgb), 0.04);
  text-align: left;
}

/* --- Animaciones (solo si el usuario no pidió reducir movimiento) ----- */
@media (prefers-reduced-motion: no-preference) {
  .m3-behind.anim .m3-lane-row,
  .m3-recap.anim .m3-lane-row { animation: m3-slide-in 0.45s ease both; }

  .m3-wifi-status.anim { animation: m3-fade 0.4s ease 2.2s both; }
  .m3-replay.anim .m3-replay-end { animation: m3-fade 0.5s ease both; }

  .m3-merge-inputs.anim .m3-token { animation: m3-converge 0.7s ease both; }
  .m3-merge-output.anim .m3-chip,
  .m3-eq-row.anim .m3-eq-out .m3-chip { animation: m3-pop 0.6s cubic-bezier(.2, 1.4, .4, 1) 0.4s both; }
  .m3-eq-row.anim .m3-eq-slot { animation: m3-glow 0.9s ease both; }

  .m3-group-beams.anim .m3-beam.on .m3-packet { animation: m3-drop-packet 0.8s ease both; }
  .m3-mic-channel.anim .m3-packet { animation: m3-travel 0.9s ease both; }
  .m3-verdict.anim { animation: m3-pop 0.5s cubic-bezier(.2, 1.4, .4, 1) 0.8s both; }
  .m3-nonce-value.anim { animation: m3-pop 0.4s ease both; }

  .m3-idcard.anim,
  .m3-capture-row.anim,
  .m3-token.anim,
  .anim-pop { animation: m3-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }

  .m3-bin.anim { animation: m3-bin-hit 0.5s ease both; }
  .m3-packet-card.shake { animation: m3-shake 0.35s ease both; }
  .m3-badge.anim { animation: m3-badge-in 0.9s cubic-bezier(.2, 1.4, .4, 1) both; }
}

@keyframes m3-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m3-slide-in { from { opacity: 0; transform: translateY(-8px) scaleX(0.6); } to { opacity: 1; transform: none; } }
@keyframes m3-pop { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes m3-converge { 0% { transform: translateY(0); } 50% { transform: translateY(10px) scale(0.92); box-shadow: 0 0 22px rgba(243, 149, 13, 0.5); } 100% { transform: none; } }
@keyframes m3-glow { 0% { box-shadow: 0 0 0 rgba(243, 149, 13, 0); } 50% { box-shadow: 0 0 22px rgba(243, 149, 13, 0.55); } 100% { box-shadow: 0 0 0 rgba(243, 149, 13, 0); } }
@keyframes m3-drop-packet { from { top: 0%; opacity: 0; } to { top: 50%; opacity: 1; } }
@keyframes m3-travel { 0% { transform: translateX(-40%); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes m3-bin-hit { 0% { transform: scale(1); } 40% { transform: scale(1.04); border-color: #5eae52; background: rgba(94, 174, 82, 0.16); } 100% { transform: scale(1); } }
@keyframes m3-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes m3-badge-in { 0% { transform: scale(0.4) rotate(-12deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 760px) {
  .m3-builder { grid-template-columns: 1fr; }
  .m3-mic-grid { grid-template-columns: 1fr; }
  .m3-mic-channel { flex-direction: row; flex-wrap: wrap; min-height: 54px; }
  .m3-scene-grid { grid-template-columns: 1fr 1fr; }
  .m3-scene-air { grid-column: 1 / -1; order: 3; }
  .m3-flow-row { flex-direction: column; align-items: stretch; }
  .m3-flow-link { transform: rotate(90deg); align-self: center; }
  .m3-flow-node { max-width: none; flex-basis: auto; }
}

@media (max-width: 560px) {
  .m3-lab { padding: 12px; }
  .m3-lane,
  .m3-mlane { margin: 0 14px; padding: 4px; }
  .m3-mrow.two,
  .m3-nonce-grid,
  .m3-match-row { grid-template-columns: 1fr; }
  .m3-capture-row { grid-template-columns: 1fr; gap: 2px; }
  .m3-field { grid-template-columns: 22px 1fr; gap: 2px 8px; }
  .m3-field code { grid-column: 2; }
  .m3-track-name { display: none; }
  .m3-track-dot { padding: 4px; }
  .m3-group-client strong { font-size: 0.75rem; }
  .m3-eq-slot { min-width: 92px; }
  .m3-locked-label { white-space: normal; text-align: right; }
  .m3-timeline-num { width: 34px; height: 34px; }
  .m3-timeline::before { top: 16px; }
}

/* =====================================================================
   wispr :: MÓDULO 5 — Bluetooth
   Reutiliza las superficies .m3-lab, chips, notas y animaciones del
   Módulo 3; aquí solo van las piezas propias (radar, capas, emparejamiento,
   amenazas, entorno y misión). Tonos: autenticación naranja, autorización
   verde, cifrado azul.
   ===================================================================== */

.bt-fb {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 0.85rem;
}

.bt-fb strong { display: block; font-size: 0.82rem; }
.bt-fb p { margin: 2px 0 0; color: #f5f5f5; }
.bt-fb.ok { border-color: rgba(94, 174, 82, 0.6); background: rgba(94, 174, 82, 0.12); }
.bt-fb.ok strong { color: #9fdc95; }
.bt-fb.bad { border-color: rgba(205, 24, 24, 0.6); background: rgba(205, 24, 24, 0.12); }
.bt-fb.bad strong { color: #ff9c9c; }

.lesson-stage > .bt-fb p { color: var(--text); }

.bt-choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.m3-option.bt-choice { padding: 6px 12px; font-size: 0.82rem; }
.m3-option:focus-visible,
.bt-tech:focus-visible,
.bt-blip:focus-visible,
.bt-threat:focus-visible,
.bt-env-node:focus-visible,
.bt-layer-btn:focus-visible,
.bt-multi-item:focus-visible,
.bt-stage:focus-visible,
.bt-lane:focus-visible { outline: 2px solid #f3950d; outline-offset: 2px; }

/* --- bt-compare -------------------------------------------------------- */
.bt-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.bt-tech {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 12px;
  border: 1px solid rgba(181, 192, 212, 0.28);
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.bt-tech:hover { transform: translateY(-2px); border-color: rgba(243, 149, 13, 0.6); }
.bt-tech.active { border-color: #f3950d; box-shadow: 0 0 0 1px #f3950d, 0 0 26px rgba(243, 149, 13, 0.25); }
.bt-tech.bt-tech-ble.active { border-color: #8fb3ff; box-shadow: 0 0 0 1px #8fb3ff, 0 0 26px rgba(143, 179, 255, 0.25); }
.bt-tech-icon { font-size: 2.2rem; line-height: 1; }
.bt-tech strong { font-size: 1rem; text-align: center; }

.bt-meter { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 220px; }
.bt-meter-label { color: #b5c0d4; font: 600 0.68rem/1 JetBrains Mono, monospace; text-transform: uppercase; }
.bt-meter-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(181, 192, 212, 0.18); overflow: hidden; }
.bt-meter-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5eae52, #f3950d, #cd1818); background-size: 220px 100%; }

.bt-tech-detail { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid rgba(143, 179, 255, 0.3); background: rgba(143, 179, 255, 0.07); }
.bt-rows { display: flex; flex-direction: column; gap: 6px; }
.bt-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
.bt-device-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- bt-signal --------------------------------------------------------- */
.bt-lane {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.55);
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
}

.bt-lane.active { border-color: #f3950d; }
.bt-lane-label { font: 700 0.8rem/1.2 JetBrains Mono, monospace; color: #ffc46b; }
.bt-lane.burst .bt-lane-label { color: #c3d6ff; }
.bt-lane-state { color: #b5c0d4; font-size: 0.78rem; }

.bt-lane-track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  overflow: hidden;
  border-bottom: 1px dashed rgba(181, 192, 212, 0.25);
}

.bt-pulse { flex: 1; height: 12px; border-radius: 3px; background: rgba(243, 149, 13, 0.75); }
.bt-burst { position: absolute; width: 12%; height: 14px; border-radius: 3px; background: rgba(143, 179, 255, 0.85); opacity: 0.15; }

/* --- bt-radar ---------------------------------------------------------- */
.bt-radar-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: start; }

.bt-radar-screen {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 44, 103, 0.9), rgba(4, 18, 43, 0.95) 70%);
  border: 1px solid rgba(143, 179, 255, 0.3);
  overflow: visible;
}

.bt-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px dashed rgba(143, 179, 255, 0.25); transform: translate(-50%, -50%); }
.bt-ring.r1 { width: 33%; height: 33%; }
.bt-ring.r2 { width: 66%; height: 66%; }
.bt-ring.r3 { width: 99%; height: 99%; border-style: solid; border-color: rgba(143, 179, 255, 0.35); }

.bt-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(94, 174, 82, 0.28), transparent 25%);
  pointer-events: none;
  opacity: 0.6;
}

.bt-radar-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.4rem;
  line-height: 1;
}

.bt-radar-center small { font-size: 0.65rem; color: #b5c0d4; margin-top: 2px; }

.bt-blip {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 90px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(94, 174, 82, 0.6);
  background: rgba(4, 18, 43, 0.9);
  color: #f5f5f5;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.bt-blip small { font-size: 0.6rem; color: #dfe6f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.bt-blip.hidden,
.bt-blip.far { border-style: dashed; border-color: rgba(181, 192, 212, 0.4); color: #b5c0d4; opacity: 0.7; }
.bt-blip.far { border-color: rgba(205, 24, 24, 0.55); }
.bt-blip.active { box-shadow: 0 0 0 2px #f3950d; opacity: 1; }

.bt-scan-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bt-scan-list { display: flex; flex-direction: column; gap: 4px; }

.bt-scan-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.18);
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
}

.bt-scan-row code { grid-column: 2; font-size: 0.72rem; color: #b5c0d4; }
.bt-scan-row.active { border-color: #f3950d; }

/* --- bt-pairing -------------------------------------------------------- */
.bt-stage-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

.bt-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.5);
  color: #b5c0d4;
  cursor: pointer;
}

.bt-stage:disabled { opacity: 0.4; cursor: default; }
.bt-stage small { font-size: 0.7rem; text-align: center; }
.bt-stage-icon { font-size: 1.1rem; }
.bt-stage.active { border-color: #f3950d; color: #ffc46b; background: rgba(243, 149, 13, 0.1); }
.bt-stage.done { border-color: rgba(94, 174, 82, 0.6); color: #9fdc95; }

.bt-pair-diagram { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 4px; }
.bt-pair-dev { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 76px; }
.bt-pair-icon { font-size: 2rem; line-height: 1; }
.bt-pair-dev strong { font-size: 0.78rem; }
.bt-code { padding: 2px 8px; border-radius: 6px; background: #081a3a; border: 1px solid #f3950d; color: #ffc46b; font: 800 0.8rem/1.4 JetBrains Mono, monospace; letter-spacing: 0.06em; }

.bt-pair-link { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bt-pair-line { width: 100%; height: 0; border-top: 2px dashed rgba(181, 192, 212, 0.2); }
.bt-pair-badge { padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(181, 192, 212, 0.35); background: rgba(4, 18, 43, 0.85); font: 700 0.75rem/1.4 JetBrains Mono, monospace; white-space: nowrap; }

.link-none .bt-pair-line { opacity: 0.25; }
.link-request .bt-pair-line { border-top-color: rgba(243, 149, 13, 0.7); }
.link-verify .bt-pair-line { border-top-color: #f3950d; }
.link-verify .bt-pair-badge,
.link-request .bt-pair-badge { border-color: #f3950d; color: #ffc46b; }
.link-key .bt-pair-line { border-top: 2px solid #8fb3ff; }
.link-key .bt-pair-badge { border-color: #8fb3ff; color: #c3d6ff; }
.link-secure .bt-pair-line { border-top: 3px solid #5eae52; box-shadow: 0 0 12px rgba(94, 174, 82, 0.5); }
.link-secure .bt-pair-badge { border-color: #5eae52; color: #9fdc95; }

/* --- bt-layers --------------------------------------------------------- */
.bt-shield { display: flex; justify-content: center; }

.bt-shield-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 999px;
  border: 2px solid;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.bt-shield-ring.tone-authn { border-color: rgba(243, 149, 13, 0.55); }
.bt-shield-ring.tone-authz { border-color: rgba(94, 174, 82, 0.55); }
.bt-shield-ring.tone-crypto { border-color: rgba(143, 179, 255, 0.6); }

.bt-shield.focus-authn .bt-shield-ring.tone-authn { box-shadow: 0 0 22px rgba(243, 149, 13, 0.55), inset 0 0 14px rgba(243, 149, 13, 0.25); border-color: #f3950d; }
.bt-shield.focus-authz .bt-shield-ring.tone-authz { box-shadow: 0 0 22px rgba(94, 174, 82, 0.55), inset 0 0 14px rgba(94, 174, 82, 0.25); border-color: #5eae52; }
.bt-shield.focus-crypto .bt-shield-ring.tone-crypto { box-shadow: 0 0 22px rgba(143, 179, 255, 0.55), inset 0 0 14px rgba(143, 179, 255, 0.25); border-color: #8fb3ff; }

.bt-shield-core { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: rgba(4, 18, 43, 0.9); font-weight: 800; white-space: nowrap; }
.bt-shield-link { color: #f3950d; font-size: 1.3rem; }

.bt-layer-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.bt-layer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid;
  background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5;
  text-align: center;
  cursor: pointer;
}

.bt-layer-btn small { color: #b5c0d4; font-size: 0.75rem; }
.bt-layer-btn.tone-authn { border-color: rgba(243, 149, 13, 0.45); }
.bt-layer-btn.tone-authz { border-color: rgba(94, 174, 82, 0.45); }
.bt-layer-btn.tone-crypto { border-color: rgba(143, 179, 255, 0.5); }
.bt-layer-btn.tone-authn.active { background: rgba(243, 149, 13, 0.16); border-color: #f3950d; }
.bt-layer-btn.tone-authz.active { background: rgba(94, 174, 82, 0.16); border-color: #5eae52; }
.bt-layer-btn.tone-crypto.active { background: rgba(143, 179, 255, 0.16); border-color: #8fb3ff; }

.bt-layer-example { padding: 10px 14px; border-radius: 8px; border-left: 4px solid; background: rgba(4, 18, 43, 0.6); }
.bt-layer-example p { margin: 4px 0 0; }
.bt-layer-example.tone-authn { border-color: #f3950d; }
.bt-layer-example.tone-authz { border-color: #5eae52; }
.bt-layer-example.tone-crypto { border-color: #8fb3ff; }

/* --- threat-cards ------------------------------------------------------ */
.bt-threat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

.bt-threat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(205, 24, 24, 0.4);
  background: rgba(205, 24, 24, 0.06);
  color: #f5f5f5;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.bt-threat:hover { transform: translateY(-2px); }
.bt-threat strong { font-size: 0.82rem; }
.bt-threat-icon { font-size: 1.5rem; line-height: 1; }
.bt-threat.active { border-color: #f3950d; box-shadow: 0 0 18px rgba(243, 149, 13, 0.3); }
.bt-threat.seen { border-color: rgba(94, 174, 82, 0.55); background: rgba(94, 174, 82, 0.06); }
.bt-threat-check { position: absolute; top: 6px; right: 8px; color: #9fdc95; font-weight: 800; }

.bt-threat-detail { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; border: 1px solid rgba(243, 149, 13, 0.35); background: rgba(4, 18, 43, 0.65); }
.bt-threat-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; }
.bt-threat-key { color: #ffc46b; font: 700 0.75rem/1.4 JetBrains Mono, monospace; }
.bt-threat-row.defense .bt-threat-key { color: #9fdc95; }

/* --- scan-classify ----------------------------------------------------- */
.bt-scanner { gap: 0; padding: 0; overflow: hidden; }

.bt-scan-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(181, 192, 212, 0.12); }
.bt-scan-item.ok { background: rgba(94, 174, 82, 0.06); }
.bt-scan-item-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bt-scan-icon { font-size: 1.5rem; line-height: 1; }
.bt-clues { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bt-clues .m3-chip { white-space: normal; }

.bt-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.bt-bars span { width: 4px; border-radius: 1px; background: rgba(181, 192, 212, 0.25); }
.bt-bars span:nth-child(1) { height: 25%; }
.bt-bars span:nth-child(2) { height: 50%; }
.bt-bars span:nth-child(3) { height: 75%; }
.bt-bars span:nth-child(4) { height: 100%; }
.bt-bars span.on { background: #5eae52; }

.bt-sort-icon { font-size: 2rem; line-height: 1; }

/* --- sequence-build ---------------------------------------------------- */
.bt-seq-list { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 10px; border: 1px dashed transparent; }
.bt-seq-slot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px dashed rgba(181, 192, 212, 0.3); background: rgba(4, 18, 43, 0.45); }
.bt-seq-slot.next { border-color: rgba(243, 149, 13, 0.6); }
.bt-seq-slot.filled { border-style: solid; border-color: rgba(94, 174, 82, 0.6); }
.bt-seq-chip { padding: 8px 14px; font-size: 0.82rem; }

.bt-replay-track { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.bt-replay-step { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; padding: 8px; border-radius: 8px; border: 1px solid rgba(94, 174, 82, 0.6); background: rgba(94, 174, 82, 0.08); font-size: 1.2rem; }
.bt-replay-step small { font-size: 0.68rem; color: #dfe6f2; text-align: center; }
.bt-replay-end { align-self: center; color: #9fdc95; font-weight: 800; }

/* --- bt-environment ---------------------------------------------------- */
.bt-env-map {
  position: relative;
  min-height: 340px;
  border-radius: 12px;
  border: 1px solid rgba(181, 192, 212, 0.2);
  background:
    radial-gradient(circle at 50% 50%, rgba(243, 149, 13, 0.08), transparent 45%),
    rgba(4, 18, 43, 0.45);
}

.bt-env-station { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; font-size: 2rem; line-height: 1; }
.bt-env-station small { font-size: 0.7rem; color: #b5c0d4; margin-top: 4px; }

.bt-env-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 104px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(181, 192, 212, 0.35);
  background: rgba(8, 26, 58, 0.95);
  color: #f5f5f5;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.bt-env-node small { font-size: 0.66rem; line-height: 1.2; text-align: center; }
.bt-env-node.active { box-shadow: 0 0 0 2px #f3950d; }
.bt-env-node.safe { border-color: #5eae52; }
.bt-env-node.risk { border-color: #f3950d; background: rgba(243, 149, 13, 0.14); }
.bt-env-node.wrong { border-color: #cd1818; }
.bt-env-mark { position: absolute; top: -8px; right: -6px; padding: 1px 6px; border-radius: 999px; background: #081a3a; border: 1px solid currentColor; font-size: 0.7rem; }
.bt-env-node.safe .bt-env-mark { color: #9fdc95; }
.bt-env-node.risk .bt-env-mark { color: #ffc46b; }

.bt-inspector { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid rgba(243, 149, 13, 0.35); background: rgba(4, 18, 43, 0.65); }
.bt-inspector ul,
.bt-mdev ul { margin: 0; padding-left: 18px; color: #dfe6f2; font-size: 0.85rem; }

/* --- Misión ------------------------------------------------------------ */
.bt-brief-devices { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bt-mdev { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid rgba(181, 192, 212, 0.22); background: rgba(4, 18, 43, 0.6); }
.bt-mdev-head { display: flex; align-items: center; gap: 8px; }

.bt-multi { display: flex; flex-direction: column; gap: 6px; }

.bt-multi-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(181, 192, 212, 0.22);
  background: rgba(4, 18, 43, 0.55);
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
}

.bt-multi-item > div { display: flex; flex-direction: column; gap: 2px; }
.bt-multi-item.marked { border-color: #f3950d; background: rgba(243, 149, 13, 0.1); }
.bt-multi-item.marked .m3-field-check { color: #f3950d; }
.bt-multi-item.ok { border-color: rgba(94, 174, 82, 0.7); }
.bt-multi-item.bad { border-color: rgba(205, 24, 24, 0.7); }
.bt-multi-clue { color: #b5c0d4; font-size: 0.78rem; }
.bt-ok-text { color: #9fdc95; font-size: 0.78rem; }
.bt-bad-text { color: #ff9c9c; font-size: 0.78rem; }

.bt-events { gap: 10px; }
.bt-event { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(181, 192, 212, 0.2); background: rgba(4, 18, 43, 0.55); }
.bt-event.ok { border-color: rgba(94, 174, 82, 0.6); }
.bt-event code { white-space: normal; }

.m3-mission-phases .lesson-step { font-size: 0.78rem; }

/* --- Animaciones ------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .bt-pulse { animation: bt-stream 1.4s ease-in-out infinite; }
  .bt-burst { animation: bt-burst 2.7s ease-in-out infinite; }
  .bt-radar-screen.scanned .bt-sweep { animation: bt-sweep 2.6s linear infinite; }
  .bt-radar-screen.anim .bt-blip { animation: m3-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }
  .bt-pair-diagram.anim .bt-pair-badge,
  .bt-pair-diagram.anim .bt-code { animation: m3-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }
  .bt-pair-diagram.anim.link-request .bt-pair-line,
  .bt-pair-diagram.anim.link-secure .bt-pair-line { animation: bt-draw 0.6s ease both; }
  .bt-seq-replay.anim .bt-replay-step,
  .bt-seq-replay.anim .bt-replay-end { animation: m3-pop 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }
}

@keyframes bt-stream { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes bt-burst { 0%, 70%, 100% { opacity: 0.12; } 8%, 18% { opacity: 1; } }
@keyframes bt-sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes bt-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 760px) {
  .bt-radar-layout { grid-template-columns: 1fr; }
  .bt-lane { grid-template-columns: 1fr; gap: 6px; }
  .bt-threat-row { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 560px) {
  .bt-compare-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bt-tech { padding: 12px 6px; }
  .bt-tech strong { font-size: 0.85rem; }
  .bt-row { grid-template-columns: 1fr; gap: 0; }
  .bt-stage-track { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .bt-stage small { font-size: 0.58rem; }
  .bt-pair-dev { min-width: 60px; }
  .bt-pair-badge { font-size: 0.65rem; padding: 2px 6px; }
  .bt-layer-buttons { grid-template-columns: 1fr; }
  .bt-shield-ring { padding: 9px; }
  .bt-shield-core { padding: 10px 12px; gap: 6px; font-size: 0.85rem; }
  .bt-blip { padding: 3px 4px; font-size: 0.95rem; }
  .bt-blip small { display: none; }
  .bt-env-map { min-height: 420px; }
  .bt-env-node { width: 84px; font-size: 1.15rem; }
  .bt-env-node small { font-size: 0.58rem; }
  .bt-scan-item-head { grid-template-columns: 28px minmax(0, 1fr); }
  .bt-scan-item-head .bt-bars { grid-column: 2; }
}

/* =====================================================================
   wispr :: "Voces del CTF" — videos de experiencias en CTF
   Las tarjetas se ven como pantallas de consola (oscuras en ambos temas).
   ===================================================================== */

.stories-section { position: relative; }
.stories-dashboard { margin: 28px 0 8px; }

.stories-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stories-head h2 { margin: 6px 0 6px; }
.stories-lead { margin: 0; color: var(--muted); max-width: 56ch; }

.stories-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(205, 24, 24, 0.5);
  background: rgba(205, 24, 24, 0.1);
  color: #ff9c9c;
  font: 700 0.72rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.1em;
}

.stories-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #cd1818; box-shadow: 0 0 10px #cd1818; }

.stories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.story-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(243, 149, 13, 0.3);
  background: linear-gradient(160deg, #0f2c67, #081a3a 65%);
  color: #f5f5f5;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.story-card:disabled { cursor: default; }
.story-card.ready:hover,
.story-card.ready:focus-visible { transform: translateY(-6px); border-color: #f3950d; box-shadow: 0 18px 40px rgba(243, 149, 13, 0.22); }
.story-card:focus-visible { outline: 2px solid #f3950d; outline-offset: 3px; }

.story-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #04122b;
}

.story-art {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 8px 14px;
  background:
    linear-gradient(rgba(143, 179, 255, 0.06) 1px, transparent 1px) 0 0 / 100% 18px,
    radial-gradient(circle at 30% 20%, rgba(243, 149, 13, 0.35), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(94, 174, 82, 0.25), transparent 50%),
    #081a3a;
}

.story-art-initials {
  font: 800 2.8rem/1 JetBrains Mono, monospace;
  color: transparent;
  -webkit-text-stroke: 1px rgba(243, 149, 13, 0.55);
  letter-spacing: -0.04em;
}

.story-poster { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.story-probe { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.story-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(243, 149, 13, 0.12) 50%, transparent 100%);
  background-size: 100% 40%;
  background-repeat: no-repeat;
  pointer-events: none;
}

.story-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  padding-left: 4px;
  background: rgba(243, 149, 13, 0.92);
  color: #081a3a;
  font-size: 1.5rem;
  box-shadow: 0 0 0 8px rgba(243, 149, 13, 0.18), 0 0 30px rgba(243, 149, 13, 0.55);
  transition: transform 0.25s ease;
}

.story-card.pending .story-play { background: rgba(181, 192, 212, 0.25); color: #f5f5f5; box-shadow: 0 0 0 8px rgba(181, 192, 212, 0.08); opacity: 0.7; }
.story-card.ready:hover .story-play { transform: translate(-50%, -50%) scale(1.1); }

.story-index,
.story-tag {
  position: absolute;
  top: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(4, 18, 43, 0.82);
  font: 700 0.66rem/1.3 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
}

.story-index { left: 10px; color: #f3950d; }
.story-tag { right: 10px; color: #9fdc95; border: 1px solid rgba(94, 174, 82, 0.5); }

.story-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.story-name { font-size: 1.05rem; }
.story-tagline { margin: 0; color: #b5c0d4; font-size: 0.9rem; }
.story-role { color: #f3950d; font: 700 0.72rem/1.3 JetBrains Mono, monospace; }

.stories-questions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(243, 149, 13, 0.3);
  background: linear-gradient(135deg, rgba(243, 149, 13, 0.08), rgba(15, 44, 103, 0.18));
}

.stories-questions-label { color: var(--orange); font: 700 0.72rem/1 JetBrains Mono, monospace; letter-spacing: 0.12em; text-transform: uppercase; }
/* Color fijo (como .story-tagline): la sección va sobre fondo oscuro en los dos
   temas, y var(--text) en modo claro es casi negro. */
.stories-questions ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; color: #e6ecf8; font-weight: 600; }
.stories-questions li::marker { color: var(--orange); font-family: JetBrains Mono, monospace; }

.story-status {
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font: 700 0.75rem/1.3 JetBrains Mono, monospace;
}

.story-card.pending .story-status { display: none; }
.story-card.ready .story-status { color: #081a3a; background: #5eae52; }

/* Reproductor (fuera de #root) */
body.story-open { overflow: hidden; }

.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(4, 18, 43, 0.88);
  backdrop-filter: blur(6px);
}

.story-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(960px, 100%);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(243, 149, 13, 0.45);
  background: linear-gradient(160deg, #0f2c67, #081a3a);
  color: #f5f5f5;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.story-player-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.story-player-head > div { display: flex; flex-direction: column; gap: 2px; }
.story-player-head .story-index { position: static; padding: 0; background: none; }
.story-video { width: 100%; max-height: 72vh; border-radius: 10px; background: #000; }

@media (prefers-reduced-motion: no-preference) {
  .story-scan { animation: story-scan 3.6s linear infinite; }
  .stories-live-dot { animation: story-blink 1.4s ease-in-out infinite; }
  .story-overlay { animation: m3-fade 0.25s ease both; }
}

@keyframes story-scan { from { background-position: 0 -40%; } to { background-position: 0 140%; } }
@keyframes story-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (max-width: 900px) {
  .stories-grid { grid-template-columns: 1fr; max-width: 520px; }
}

/* =====================================================================
   wispr :: misión por pasos (Módulo 1 — Reconocimiento Wi-Fi)
   ===================================================================== */
.sm-scan { gap: 0; padding: 0; overflow: hidden; }
.sm-table-wrap { overflow-x: auto; }
.sm-table-wrap + .sm-table-wrap { border-top: 1px solid rgba(181, 192, 212, 0.15); }
.sm-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sm-table th { padding: 8px 12px; text-align: left; color: #f3950d; font: 700 0.68rem/1.2 JetBrains Mono, monospace; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.sm-table td { padding: 7px 12px; border-top: 1px solid rgba(181, 192, 212, 0.1); color: #f5f5f5; white-space: nowrap; }
.sm-table tbody tr:hover td { background: rgba(243, 149, 13, 0.06); }
.sm-single { display: flex; flex-direction: column; gap: 8px; }
.sm-detail { margin-left: 8px; vertical-align: middle; }

/* Contenido ancho (tablas del escaneo) no debe ensanchar la columna principal
   en pantallas pequeñas: los hijos de grid/flex tienen min-width:auto. */
.main-grid > main,
.lesson-page,
.lesson-stage { min-width: 0; }
.sm-scan { max-width: 100%; }

/* =========================================================================
   Pulido y simplificación (12 oct): dashboard del jugador, navegación y
   pestañas. Mismos colores, tipografías, logo y mascota; menos contenedores
   y sin datos repetidos. Va al final a propósito para ganar a las reglas
   anteriores sin tener que tocarlas.
   ========================================================================= */

/* Sin columna lateral de KPIs: el contenido usa todo el ancho. */
.player-main {
  min-width: 0;
}

/* --- Inicio del jugador --------------------------------------------------- */
.dash {
  gap: 22px;
}

.dash-hero {
  grid-template-columns: 150px minmax(0, 1fr) 300px;
  gap: 28px;
  min-height: 0;
  padding: 26px 30px;
}

.dash-mascot {
  width: 150px;
  height: auto;
  align-self: end;
  margin-bottom: -26px; /* apoya los pies en el borde inferior del panel */
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.4));
}

.dash-hero-copy h2 {
  margin: 0 0 8px;
}

.dash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 18px;
  color: #b9c3da;
  font-size: 0.95rem;
}

.dash-stats strong {
  color: #f4f7ff;
  font: 700 1rem/1 JetBrains Mono, monospace;
}

.dash-next {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--orange);
}

.dash-next .eyebrow {
  margin: 0;
}

.dash-next-title {
  color: #f4f7ff;
  font-size: 1.25rem;
  line-height: 1.2;
}

.dash-next .muted,
p.dash-next {
  color: #b9c3da;
  font-size: 0.88rem;
}

.dash-hero .hero-actions {
  margin-top: 18px;
}

.dash-lab {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 16px;
  color: #b9c3da;
  font-size: 0.82rem;
}

.dash-lab-detail {
  opacity: 0.75;
}

.dash-lab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dash-lab-ready .dash-lab-dot { background: var(--green); box-shadow: 0 0 8px rgba(164, 221, 0, 0.6); }
.dash-lab-blocked .dash-lab-dot { background: var(--red); }
.dash-lab-checking .dash-lab-dot { background: var(--orange); }

.dash-lab-refresh {
  min-height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: transparent;
  color: #dce7fb;
  line-height: 1;
}

.dash-lab-refresh:hover {
  border-color: rgba(164, 221, 0, 0.5);
  color: var(--green);
}

/* Anillo de progreso: proporcional al cuadro de bienvenida (antes 132 px se
   veía chico al lado del saludo). El texto escala con el anillo. */
.dash-hero .mission-ring {
  width: 236px;
  height: 236px;
  justify-self: center; /* centrado en su columna: separado del borde derecho */
}

.dash-hero .mission-ring::before {
  inset: 16px;
}

.dash-hero .mission-ring span {
  font-size: 3.2rem;
}

.dash-hero .mission-ring small {
  margin-top: 10px;
  font-size: 0.95rem;
}

/* Guía de 3 pasos: solo hasta el primer reto resuelto. */
.dash-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: paso;
}

.dash-steps li {
  counter-increment: paso;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.dash-steps li::before {
  content: counter(paso, decimal-leading-zero);
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font: 700 0.72rem/1 JetBrains Mono, monospace;
}

.dash-steps strong {
  color: var(--text);
}

/* Lista de próximos retos: filas, no tarjetas. */
.dash-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dash-queue-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.dash-rows {
  display: grid;
  border: 1px solid rgba(181, 192, 212, 0.16);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.dash-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto 72px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid rgba(181, 192, 212, 0.12);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.dash-row:first-child {
  border-top: 0;
}

.dash-row:hover,
.dash-row:focus-visible {
  background: rgba(164, 221, 0, 0.06);
}

.dash-row .badge {
  justify-self: start;
}

.dash-row-title {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-row-cat {
  color: var(--muted);
  font-size: 0.82rem;
}

.dash-row-pts {
  color: var(--orange);
  font: 700 0.9rem/1 JetBrains Mono, monospace;
  text-align: right;
}

/* Acción de texto: para acciones secundarias que no merecen un botón. */
.text-action {
  min-height: 32px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 700;
}

.text-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail-hero .text-action {
  color: #c9f25a;
}

/* --- Encabezado: chip de cuenta abre "Progreso" ------------------------------ */
.chip-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.chip-profile > div {
  min-width: 0;
}

button.chip-profile:hover strong,
.chip-active strong {
  color: var(--green);
}

.chip-active {
  border-color: rgba(164, 221, 0, 0.5);
}

/* --- Catálogo -------------------------------------------------------------- */
.card-topline {
  align-items: center;
}

.card-topline .card-category {
  margin: 0;
  text-align: right;
}

/* --- Detalle de un reto ---------------------------------------------------- */
.detail .panel .tool-grid {
  align-items: center;
  padding: 12px 0 0;
}

.tool-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.meta-strip .meta-solved {
  border-color: rgba(164, 221, 0, 0.5);
  color: var(--green);
}

.scope-note {
  margin: 12px 0 0;
  font-size: 0.82rem;
}

/* --- Progreso -------------------------------------------------------------- */
.history-row .fail {
  color: var(--red);
}

/* --- Responsivo ------------------------------------------------------------ */
@media (max-width: 860px) {
  .dash-hero {
    grid-template-columns: minmax(0, 1fr) 210px;
  }

  .dash-mascot {
    display: none;
  }

  .dash-hero .mission-ring {
    width: 180px;
    height: 180px;
  }

  .dash-hero .mission-ring::before {
    inset: 13px;
  }

  .dash-hero .mission-ring span {
    font-size: 2.4rem;
  }

  .dash-hero .mission-ring small {
    font-size: 0.8rem;
  }
}

@media (max-width: 680px) {
  .dash-hero {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 14px;
    padding: 20px;
  }

  .dash-hero .mission-ring {
    width: 96px;
    height: 96px;
    align-self: start;
  }

  .dash-hero .mission-ring::before {
    inset: 8px;
  }

  .dash-hero .mission-ring span {
    font-size: 1.35rem;
  }

  .dash-hero .mission-ring small {
    display: none;
  }

  .dash-steps {
    grid-template-columns: 1fr;
  }

  .dash-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
  }

  .dash-row .badge { grid-row: 1; grid-column: 1; }
  .dash-row-title { grid-row: 2; grid-column: 1; }
  .dash-row-cat { display: none; }
  .dash-row-pts { grid-row: 1 / span 2; grid-column: 2; }
}

/* Tarjetas del catálogo: título siempre a la misma altura; el pie se va abajo. */
.challenge-card {
  justify-content: flex-start;
  gap: 14px;
  min-height: 0;
}

.challenge-card .card-footer {
  margin-top: auto;
}

.challenge-card .card-desc {
  min-height: 0;
  -webkit-line-clamp: 3;
}

/* El detalle de un reto es texto para leer: líneas de largo cómodo. */
.player-main > .detail-page {
  max-width: 980px;
  margin-inline: auto;
}

.submit-panel button {
  white-space: nowrap;
}

@media (max-width: 680px) {
  .dash-hero-copy h2 {
    font-size: 1.6rem;
  }
}

/* El hero es oscuro en ambos temas: su texto no usa --muted (que oscurece en modo claro). */
.dash-hero .mission-ring small {
  color: #b9c3da;
}

/* Pedir un reto a la IA (13 oct): mismo patrón de fila que .task-form. */
.generator-panel h3 {
  margin-bottom: 4px;
}

.generator-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.generator-form select,
.generator-form input {
  flex: 1 1 170px;
  width: auto;
}

.generator-form button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.generator-published {
  margin-top: 14px;
}

@media (max-width: 680px) {
  .generator-form button {
    flex: 1 1 100%;
  }
}

/* =====================================================================
   wispr :: MÓDULO 2 — Seguridad Wi-Fi
   Reutiliza las superficies .m3-lab, chips, notas y animaciones de los
   módulos 3 y 5; aquí solo van las piezas propias (diagrama de
   comunicación, simulación de cifrado, decisiones) y los ajustes
   genéricos (bt-compare de 3 tarjetas, conceptos de la misión).
   Tonos: ok verde, warn naranja, bad rojo, info naranja.
   ===================================================================== */

.bt-compare-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bt-tech.tone-bad.active { border-color: #cd1818; box-shadow: 0 0 0 1px #cd1818, 0 0 26px rgba(205, 24, 24, 0.25); }
.bt-tech.tone-warn.active { border-color: #f3950d; box-shadow: 0 0 0 1px #f3950d, 0 0 26px rgba(243, 149, 13, 0.25); }
.bt-tech.tone-ok.active { border-color: #5eae52; box-shadow: 0 0 0 1px #5eae52, 0 0 26px rgba(94, 174, 82, 0.25); }

/* --- m2-flow ----------------------------------------------------------- */
.m2-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.m2-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.3); background: rgba(4, 18, 43, 0.6);
  color: #f5f5f5; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.m2-tab:hover { border-color: rgba(243, 149, 13, 0.6); }
.m2-tab.active.tone-bad { border-color: #cd1818; box-shadow: 0 0 18px rgba(205, 24, 24, 0.3); }
.m2-tab.active.tone-ok { border-color: #5eae52; box-shadow: 0 0 18px rgba(94, 174, 82, 0.3); }
.m2-tab.active.tone-info, .m2-tab.active.tone-warn { border-color: #f3950d; box-shadow: 0 0 18px rgba(243, 149, 13, 0.3); }
.m2-tab:focus-visible, .m2-node:focus-visible { outline: 2px solid #f3950d; outline-offset: 2px; }

.m2-flow { display: flex; align-items: center; gap: 6px; padding: 18px 8px 8px; }
.m2-flow.anim { animation: m2-fade 0.35s ease; }
.m2-node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 0 0 auto; min-width: 74px; padding: 10px 8px; border-radius: 12px;
  border: 1px solid rgba(143, 179, 255, 0.3); background: rgba(15, 44, 103, 0.55);
  color: #f5f5f5; cursor: pointer;
}
.m2-node.static { cursor: default; }
.m2-node:disabled { opacity: 1; }
.m2-node.active { border-color: #f3950d; box-shadow: 0 0 16px rgba(243, 149, 13, 0.3); }
.m2-node-icon { font-size: 1.7rem; line-height: 1; }
.m2-node small { color: #b5c0d4; text-align: center; font-size: 0.72rem; }

.m2-link { position: relative; flex: 1 1 0; min-width: 60px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 14px; }
.m2-link-line { display: block; width: 100%; height: 3px; border-radius: 3px; background: rgba(181, 192, 212, 0.35); }
.m2-link.tone-bad .m2-link-line { background: repeating-linear-gradient(90deg, #cd1818 0 10px, transparent 10px 16px); }
.m2-link.tone-ok .m2-link-line { background: #5eae52; box-shadow: 0 0 10px rgba(94, 174, 82, 0.6); }
.m2-link.tone-info .m2-link-line, .m2-link.tone-warn .m2-link-line { background: #f3950d; box-shadow: 0 0 10px rgba(243, 149, 13, 0.5); }
.m2-link-label { color: #b5c0d4; font-size: 0.7rem; text-align: center; line-height: 1.25; }
.m2-packet {
  position: absolute; top: 0; left: 0;
  padding: 1px 6px; border-radius: 6px; font: 700 0.66rem/1.4 JetBrains Mono, monospace;
  border: 1px solid currentColor; background: #081a3a; white-space: nowrap;
  animation: m2-travel 2.6s linear infinite;
}
.m2-link.tone-bad .m2-packet { color: #ff9c9c; }
.m2-link.tone-ok .m2-packet { color: #9fdc95; }
.m2-link.tone-info .m2-packet, .m2-link.tone-warn .m2-packet { color: #f3950d; }

@keyframes m2-travel { from { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { left: calc(100% - 3.2rem); opacity: 0; } }
@keyframes m2-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes m2-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.m2-observer { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(181, 192, 212, 0.35); background: rgba(4, 18, 43, 0.55); }
.m2-observer.tone-bad { border-color: rgba(205, 24, 24, 0.6); }
.m2-observer.tone-ok { border-color: rgba(94, 174, 82, 0.6); }
.m2-observer code { white-space: normal; word-break: break-word; }

/* --- m2-cipher --------------------------------------------------------- */
.m2-cipher-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.m2-cipher-row.anim { animation: m2-fade 0.35s ease; }
.m2-cbox { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; border: 1px solid rgba(143, 179, 255, 0.3); background: rgba(15, 44, 103, 0.45); }
.m2-cbox code { word-break: break-all; }
.m2-cbox.ok { border-color: rgba(94, 174, 82, 0.7); background: rgba(94, 174, 82, 0.12); }
.m2-cbox.bad { border-color: rgba(205, 24, 24, 0.7); background: rgba(205, 24, 24, 0.12); }
.m2-carrow { align-self: center; color: #f3950d; font: 700 0.8rem/1 JetBrains Mono, monospace; white-space: nowrap; }
.m2-cipher-actions { flex-wrap: wrap; }
.m2-terms { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 0.82rem; }
.m2-terms dt { color: #f3950d; font-weight: 700; }
.m2-terms dd { margin: 0; color: #b5c0d4; }

/* --- m2-decisions ------------------------------------------------------ */
.m2-scenario p { margin: 0; }
.m2-decision { gap: 10px; }
.m2-decision.ok { border-color: rgba(94, 174, 82, 0.55); }
.m2-decision.bad { border-color: rgba(205, 24, 24, 0.55); }
.m2-decision p { margin: 0; }
.m2-decision-options { display: flex; flex-direction: column; gap: 6px; }
.m2-decision-options .m3-option { text-align: left; }
.m2-effects { display: flex; flex-wrap: wrap; gap: 8px; }
.m2-effect { padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; border: 1px solid; background: rgba(4, 18, 43, 0.55); }
.m2-effect.tone-ok { border-color: rgba(94, 174, 82, 0.7); color: #9fdc95; }
.m2-effect.tone-warn { border-color: rgba(243, 149, 13, 0.7); color: #ffc46b; }
.m2-effect.tone-bad { border-color: rgba(205, 24, 24, 0.7); color: #ff9c9c; }

/* --- misión: conceptos dominados / a repasar ---------------------------- */
.m3-concepts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.m3-concept-col { padding: 12px 14px; border-radius: 10px; border: 1px solid; }
.m3-concept-col.ok { border-color: rgba(94, 174, 82, 0.55); background: rgba(94, 174, 82, 0.08); }
.m3-concept-col.bad { border-color: rgba(243, 149, 13, 0.55); background: rgba(243, 149, 13, 0.08); }
.m3-concept-col ul { margin: 6px 0 0; padding-left: 18px; }
.m3-concept-col li { margin: 2px 0; }

@media (prefers-reduced-motion: reduce) {
  .m2-packet { animation: none; left: calc(50% - 1.6rem); }
  .m2-flow.anim, .m2-cipher-row.anim { animation: none; }
}

@media (max-width: 760px) {
  .bt-compare-grid.cols-3 { grid-template-columns: 1fr; }
  .m3-concepts { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  /* El diagrama pasa a vertical: cada enlace queda entre dos nodos, de arriba abajo. */
  .m2-flow { flex-direction: column; align-items: stretch; padding-top: 8px; }
  .m2-node { flex-direction: row; justify-content: flex-start; gap: 10px; }
  .m2-link { flex-direction: row; min-height: 46px; padding: 0 0 0 30px; gap: 10px; }
  .m2-link-line { width: 3px; height: 40px; flex: 0 0 3px; }
  .m2-link.tone-bad .m2-link-line { background: repeating-linear-gradient(180deg, #cd1818 0 8px, transparent 8px 13px); }
  .m2-link-label { text-align: left; }
  .m2-packet { left: 40px; top: auto; animation-name: m2-pulse; }
  .m2-carrow { width: 100%; text-align: center; }
  .m2-terms { grid-template-columns: 1fr; }
}

/* Pedir un reto a la IA: cuánto valdrá (22 oct, puntos decrecientes al repetir). */
.generator-worth { margin: 8px 0 0; font-size: 0.85rem; font-weight: 600; color: #5eae52; }
.generator-worth.reduced { color: #f3950d; }
.generator-worth.none { color: var(--muted); font-weight: 500; }

/* =====================================================================
   wispr :: cronómetro del reto y marcador de puntos (22 oct)
   Versión compacta, sin emojis. Tarjeta oscura en ambos temas (como
   .m3-lab). Verde = bono activo · naranja = últimos 2 minutos · gris = sin
   bono. Penalizaciones con "−" en rojo y bonos con "+" en verde: el color
   nunca es la única señal.
   ===================================================================== */

@property --window {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.wclock {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  max-width: 760px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(243, 149, 13, 0.25);
  color: #f5f5f5;
  background:
    radial-gradient(circle at 10% 30%, rgba(164, 221, 0, 0.1), transparent 40%),
    linear-gradient(135deg, #081a3a, #0f2c67);
  box-shadow: 0 10px 26px rgba(4, 18, 43, 0.3);
}

.wclock.solved {
  border-color: rgba(94, 174, 82, 0.55);
  box-shadow: 0 0 26px rgba(94, 174, 82, 0.15), 0 10px 26px rgba(4, 18, 43, 0.3);
}

/* --- anillo ------------------------------------------------------------ */
.wclock-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wclock-ring {
  --ring: #a4dd00;
  position: relative;
  display: grid;
  place-content: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) var(--window), rgba(255, 255, 255, 0.1) 0);
  box-shadow: 0 0 18px rgba(164, 221, 0, 0.18);
  transition: --window 1s linear, box-shadow 0.4s ease;
}

.wclock-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 35%, #0f2c67, #081a3a 75%);
}

.wclock-ring > * {
  position: relative;
  text-align: center;
}

.wclock-time {
  font: 800 1.55rem/1 JetBrains Mono, monospace;
  color: #f5f5f5;
}

.wclock-ring small {
  margin-top: 4px;
  color: #b5c0d4;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wclock-ring.warn {
  --ring: #f3950d;
  animation: wclock-pulse 1.6s ease-in-out infinite;
}

.wclock-ring.lost,
.wclock-ring.off {
  --ring: #5b6b88;
  box-shadow: none;
}

.wclock-ring.done {
  --ring: #5eae52;
  --window: 100%;
  box-shadow: 0 0 20px rgba(94, 174, 82, 0.3);
}

.wclock-ring.done .wclock-time {
  color: #9fdc95;
}

@keyframes wclock-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(243, 149, 13, 0.2); }
  50% { box-shadow: 0 0 24px rgba(243, 149, 13, 0.5); }
}

.wclock-speed {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(181, 192, 212, 0.25);
  color: #b5c0d4;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.wclock-speed.on { color: #d8f59a; border-color: rgba(164, 221, 0, 0.45); background: rgba(164, 221, 0, 0.08); }
.wclock-speed.warn { color: #ffc46b; border-color: rgba(243, 149, 13, 0.55); background: rgba(243, 149, 13, 0.1); }

/* --- marcador ------------------------------------------------------------ */
.wclock-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.wclock-board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wclock-board-head .eyebrow {
  margin: 0;
  color: #f3950d;
}

.wclock-clean,
.wclock-practice {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.wclock-clean { color: #9fdc95; border: 1px solid rgba(94, 174, 82, 0.55); background: rgba(94, 174, 82, 0.12); }
.wclock-practice { color: #b5c0d4; border: 1px solid rgba(181, 192, 212, 0.3); }

.wclock-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wclock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: rgba(4, 18, 43, 0.4);
  font-size: 0.84rem;
}

.wclock-row-label { color: #f5f5f5; }

.wclock-row-pct {
  text-align: right;
  font: 700 0.72rem/1 JetBrains Mono, monospace;
  color: #b5c0d4;
}

.wclock-row-points {
  text-align: right;
  font: 800 0.9rem/1 JetBrains Mono, monospace;
}

.wclock-row.penalty { border-left-color: #cd1818; background: rgba(205, 24, 24, 0.08); }
.wclock-row.penalty .wclock-row-points,
.wclock-row.penalty .wclock-row-pct { color: #ff9c9c; }
.wclock-row.bonus { border-left-color: #5eae52; background: rgba(94, 174, 82, 0.09); }
.wclock-row.bonus .wclock-row-points,
.wclock-row.bonus .wclock-row-pct { color: #9fdc95; }
.wclock-row.idle .wclock-row-points { color: #6f7d97; }
.wclock-row.base .wclock-row-points { color: #f5f5f5; }

.wclock-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed rgba(243, 149, 13, 0.35);
  color: #b5c0d4;
  font-size: 0.82rem;
  font-weight: 600;
}

.wclock-total strong {
  font: 800 1.35rem/1 JetBrains Mono, monospace;
  color: #f3950d;
}

.wclock-total.won strong { color: #a4dd00; }

.wclock-rules {
  margin: 0;
  color: #8f9bb3;
  font-size: 0.7rem;
  line-height: 1.4;
}

/* --- versión compacta (terminal) ----------------------------------------- */
.wclock-mini {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 4px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(164, 221, 0, 0.4);
  border-left-width: 4px;
  background: #081a3a;
  color: #b5c0d4;
  font-size: 0.76rem;
}

.wclock-mini.warn { border-color: rgba(243, 149, 13, 0.6); }
.wclock-mini.lost,
.wclock-mini.off { border-color: rgba(181, 192, 212, 0.3); }

.wclock-mini-time {
  color: #f5f5f5;
  font: 800 0.95rem/1 JetBrains Mono, monospace;
}

.wclock-mini strong {
  margin-left: auto;
  color: #f3950d;
  font: 800 0.9rem/1 JetBrains Mono, monospace;
}

@media (prefers-reduced-motion: reduce) {
  .wclock-ring { transition: none; }
  .wclock-ring.warn { animation: none; }
}

@media (max-width: 680px) {
  .wclock {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .wclock-timer {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
  }

  .wclock-ring {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
  }

  .wclock-ring::before { inset: 6px; }
  .wclock-time { font-size: 1.2rem; }
  .wclock-speed { text-align: left; }

  /* El total va a la izquierda: en el celular el botón fijo del tema ocupa la
     esquina inferior derecha y podía tapar el número. */
  .wclock-total {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

@media (max-width: 420px) {
  .wclock-row { grid-template-columns: minmax(0, 1fr) 52px; }
  .wclock-row-pct { display: none; }
}

/* El cronómetro va dentro del encabezado del reto, a la derecha del texto.
   Se mide el ancho de la página del reto (no de la ventana) porque la barra
   lateral cambia el espacio disponible. Si no cabe, pasa debajo. */
.detail-page {
  container-type: inline-size;
}

.detail-hero {
  display: grid;
  gap: 18px;
}

.detail-hero-text {
  min-width: 0;
}

.wclock-solo {
  display: flex;
  justify-content: flex-start;
}

.detail-hero .wclock-ring {
  width: 132px;
  height: 132px;
  flex: 0 0 132px;
}

.detail-hero .wclock-time {
  font-size: 1.75rem;
}

@container (min-width: 620px) {
  .detail-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
  }

  .wclock-solo {
    justify-content: flex-end;
    padding-right: 12px;
  }
}

/* =====================================================================
   wispr :: recorrido de bienvenida con Wisp (22 oct)
   Capa fija que oscurece la página. El hueco iluminado (.wtour-spot) es una
   caja con una sombra enorme: todo lo que queda fuera se oscurece. La burbuja
   de Wisp es oscura en ambos temas, como los encabezados.
   ===================================================================== */

.wtour {
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.wtour-spot {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(2, 9, 24, 0.74);
  outline: 2px solid rgba(164, 221, 0, 0.85);
  outline-offset: 2px;
  pointer-events: none;
  animation: wtour-glow 2.4s ease-in-out infinite;
}

.wtour.centered .wtour-spot {
  inset: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: rgba(2, 9, 24, 0.74);
  animation: none;
}

@keyframes wtour-glow {
  0%, 100% { outline-color: rgba(164, 221, 0, 0.85); }
  50% { outline-color: rgba(164, 221, 0, 0.35); }
}

.wtour-card {
  position: fixed;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: min(460px, calc(100vw - 32px));
  padding: 18px 20px 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(164, 221, 0, 0.35);
  color: #f5f5f5;
  background:
    radial-gradient(circle at 12% 18%, rgba(164, 221, 0, 0.14), transparent 45%),
    linear-gradient(140deg, #0f2c67, #081a3a 70%);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  animation: wtour-in 0.28s ease-out;
}

.wtour.centered .wtour-card {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  animation-name: wtour-in-center;
}

@keyframes wtour-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes wtour-in-center {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.wtour-wisp {
  width: 92px;
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
  animation: wtour-float 3.2s ease-in-out infinite;
}

@keyframes wtour-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.wtour-body {
  min-width: 0;
}

.wtour-step {
  margin: 0 0 4px;
  color: #a4dd00;
  font: 700 0.72rem/1 JetBrains Mono, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wtour-card h3 {
  margin: 0 0 6px;
  color: #f4f7ff;
  font-size: 1.2rem;
}

.wtour-text {
  margin: 0;
  color: #d3dbea;
  font-size: 0.92rem;
  line-height: 1.5;
}

.wtour-rules {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.wtour-rules li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: rgba(4, 18, 43, 0.5);
  font-size: 0.84rem;
  color: #e6ecf7;
}

.wtour-rules strong {
  flex: 0 0 auto;
  font: 800 0.86rem/1 JetBrains Mono, monospace;
}

.wtour-rules .penalty { border-left-color: #cd1818; }
.wtour-rules .penalty strong { color: #ff9c9c; }
.wtour-rules .bonus { border-left-color: #5eae52; }
.wtour-rules .bonus strong { color: #9fdc95; }

.wtour-dots {
  display: flex;
  gap: 6px;
  margin: 14px 0 12px;
}

.wtour-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: width 0.2s ease;
}

.wtour-dots .done { background: rgba(164, 221, 0, 0.45); }
.wtour-dots .on { width: 20px; background: #a4dd00; }

.wtour-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wtour-nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.wtour-nav button {
  white-space: nowrap;
}

.wtour-card .wtour-skip {
  padding-left: 0;
  color: #9aa7bf;
}

.wtour-card .ghost-action {
  color: #f4f7ff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.wtour-replay {
  margin-top: 12px;
}

@media (max-width: 560px) {
  .wtour-card {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
  }

  .wtour-wisp {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wtour-spot,
  .wtour-card,
  .wtour-wisp,
  .wtour-dots span {
    animation: none;
    transition: none;
  }
}

/* --- Retos: "Por resolver" (máx. 15) y "Resueltos" (23 oct) ----------------- */
.challenge-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.challenge-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.challenge-section-head h3 {
  margin: 0;
}

/* auto-fill: con pocas tarjetas (p. ej. un solo resuelto) no se estiran. */
.challenge-section .challenge-grid {
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
}

.challenge-count {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 149, 13, 0.45);
  color: var(--orange);
  font: 700 0.78rem/1.4 JetBrains Mono, monospace;
}

.challenge-count.done {
  border-color: rgba(94, 174, 82, 0.5);
  color: #5eae52;
}

.challenge-section-head .ghost-action {
  margin-left: auto;
}

.pending-slots {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pending-slots.full {
  color: var(--orange);
  font-weight: 600;
}

.generator-form button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* --- Íconos (Lucide, ver icons.js y icon() en app.js) --- */
.ico {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  vertical-align: -0.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Íconos con significado de estado (antes eran emojis de color). */
.ico-circle-check { color: var(--green); }
.ico-circle-alert,
.ico-flag { color: var(--orange); }
.ico-circle-x,
.ico-octagon-alert,
.ico-ban { color: #ff5c5c; }
.m3-stars .ico-star,
.generator-worth .ico-star,
.metric-icon .ico-star { fill: currentColor; }
.m3-stars { display: inline-flex; gap: 0.15em; letter-spacing: 0; }
.theme-toggle .ico { width: 1.25em; height: 1.25em; vertical-align: middle; }

/* Íconos grandes del contenido: chip duotono. El color sale del tono de la
   tarjeta (tone-ok / tone-warn / tone-bad / tone-info); sin tono, naranja.
   Las prácticas no llevan tono en sus ítems, así el color no delata la respuesta. */
.lv-icon, .bt-tech-icon, .m2-node-icon, .bt-scan-icon, .bt-threat-icon, .m3-bin-icon,
.bt-sort-icon, .bt-pair-icon, .m3-dev-icon, .ico-chip {
  display: inline-grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 0.5em;
  line-height: 1;
  color: var(--ic, var(--orange));
  background: color-mix(in srgb, var(--ic, var(--orange)) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ic, var(--orange)) 35%, transparent);
}
.ico-chip { font-size: 1.4rem; }
:is(.lv-icon, .bt-tech-icon, .m2-node-icon, .bt-scan-icon, .bt-threat-icon, .m3-bin-icon,
.bt-sort-icon, .bt-pair-icon, .m3-dev-icon, .ico-chip, .metric-icon) .ico {
  width: 1em;
  height: 1em;
  vertical-align: 0;
  fill: currentColor;
  fill-opacity: 0.2;
}
.tone-ok { --ic: #5eae52; }
.tone-warn { --ic: var(--orange); }
.tone-bad { --ic: #e5484d; }
.tone-info { --ic: #4ea8ff; }
.bt-threat-icon { --ic: #e5484d; }
.metric-icon { box-shadow: inset 0 0 0 1px rgba(243, 149, 13, 0.35); }

/* Logros (insignia de misión, lección completada): chip sólido en degradado. */
.m3-badge-icon,
.lesson-complete-badge {
  display: inline-grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 0.5em;
  font-size: 2.2rem;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #ffb238, #e0700a);
  box-shadow: 0 10px 24px -10px rgba(243, 149, 13, 0.9);
}
.m3-badge-icon .ico,
.lesson-complete-badge .ico { width: 1em; height: 1em; vertical-align: 0; stroke-width: 2.2; }

/* --- Fotos de perfil (avatares de Wisp, img/avatars) --- */
.avatar.has-img {
  overflow: hidden;
  padding: 0;
}
.avatar.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  transform: scale(1.15);
}
/* En tamaño chico (encabezado, ranking, listas) se acerca a la cara: el cuerpo
   entero a 38 px no se distingue. */
.avatar.has-img:not(.big) img {
  transform: scale(1.75);
  transform-origin: 46% 24%;
}

/* Perfil: el encabezado ocupa la columna izquierda; el selector va arriba a la
   derecha y los envíos recientes debajo. En pantallas angostas se apila. */
@media (min-width: 1041px) {
  .profile-grid { align-content: start; }
  .profile-grid > .profile-hero { grid-row: span 2; align-self: start; }
}
.avatar-picker { padding: 22px; }
.avatar-picker h3 { margin-bottom: 4px; }
.avatar-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.avatar-option img,
.avatar-option-initial {
  width: 84px;
  height: 84px;
}
.avatar-option img { object-fit: contain; }
.avatar-option-initial {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, var(--green), var(--blue-800) 72%);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
}
.avatar-option:hover { transform: translateY(-2px); border-color: var(--orange); }
.avatar-option.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green), 0 8px 22px -10px rgba(164, 221, 0, 0.6);
}
.avatar-option:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .avatar-option { transition: none; }
  .avatar-option:hover { transform: none; }
}
