/* =====================================================================
 * estilos.css — Aspecto de iM3 Play
 * ---------------------------------------------------------------------
 * VOZ: herramienta de práctica cercana y clara, como un estuche bien ordenado.
 * IDEA: la madera del instrumento — tapa de abeto (fondo claro) y
 *       palosanto (cabecera, barra y modo oscuro).
 * DIBUJO: el propio instrumento: aguja del afinador, mástil, teclado, pentagrama.
 * COLOR Y TIPO: abeto + palosanto, acento azul cian para la raíz
 *       y las acciones; verde solo para "afinado". Tipografía del sistema
 *       (funciona sin conexión).
 * DISEÑO: una columna para el pulgar; pestañas abajo; objetivos de 44 px.
 * ===================================================================== */

/* ---------- Variables de color (claro / oscuro automático) ---------- */
:root {
  /* El navegador elige claro u oscuro según el móvil */
  color-scheme: light dark;
  /* Fondo general: abeto claro / palosanto profundo */
  --fondo: light-dark(#f6f1e8, #15100d);
  /* Tarjetas */
  --tarjeta: light-dark(#ffffff, #221915);
  /* Texto principal */
  --tinta: light-dark(#241915, #f3e9dc);
  /* Texto secundario */
  --suave: light-dark(#6d5d53, #b7a597);
  /* Bordes finos */
  --borde: light-dark(#e6dccd, #3a2c25);
  /* Palosanto de cabecera y barra inferior */
  --madera: #2b1d18;
  /* Texto sobre madera */
  --sobre-madera: #f3e6d2;
  /* Acento (raíz, botón principal): azul cian (más oscuro en claro para que se lea el texto blanco) */
  --acento: light-dark(#007a85, #05d6e6);
  /* Raíz en dibujos (diagramas, mástil, teclado): cian vivo, que destaca tanto sobre
     el papel claro como sobre la madera oscura y no se confunde con el marrón de las notas */
  --raiz: #05d6e6;
  /* Borde de la raíz para que tenga contorno nítido sobre fondos claros */
  --raiz-borde: light-dark(#007a85, #05d6e6);
  /* Texto escrito encima de la raíz */
  --sobre-raiz: #00262a;
  /* Texto sobre el acento */
  --sobre-acento: light-dark(#ffffff, #00262a);
  /* Color de notas secundarias (resto de notas del acorde/escala) */
  --nota: light-dark(#3b2a22, #e8d6c2);
  /* Afinado / correcto */
  --ok: light-dark(#138a3e, #3ddc7a);
  /* Fallo / lejos */
  --mal: light-dark(#c2410c, #ff8a4c);
  /* Diapasón del mástil */
  --diapason: light-dark(#5a3a2a, #3d2a20);
}
/* Si la app fuerza un tema, lo respetamos */
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

/* ---------- Base ---------- */
/* Tamaños fiables y sin desbordes horizontales */
* { box-sizing: border-box; min-width: 0; }
/* Página */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overflow-x: clip;
  /* Sitio para la barra inferior y la zona segura del iPhone */
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  /* Quitamos el resaltado azul al tocar en Android */
  -webkit-tap-highlight-color: transparent;
}
/* Títulos */
h1, h2, h3 { line-height: 1.1; margin: 0; text-wrap: balance; }
h3 { font-size: 18px; margin-bottom: 8px; }
/* Texto solo para lectores de pantalla */
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Cabecera ---------- */
.cabecera {
  /* Fija arriba */
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--madera); color: var(--sobre-madera);
  /* Respeta el notch del iPhone */
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.cabecera h1 { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
/* Selector de instrumento en la cabecera */
.sel-inst select {
  background: rgba(255, 255, 255, .1); color: var(--sobre-madera);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px;
  padding: 8px 12px; min-height: 40px; font-size: 15px; max-width: 46vw;
}
.sel-inst option { color: #241915; }

/* ---------- Contenido ---------- */
main {
  max-width: 760px; margin: 0 auto;
  padding: 14px max(12px, env(safe-area-inset-left)) 24px max(12px, env(safe-area-inset-right));
  display: grid; gap: 12px;
}

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 18px;
  padding: 16px; display: grid; gap: 12px;
  /* Sombra suave tipo tapa de madera barnizada */
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03), 0 6px 18px -12px rgba(43, 29, 24, .35);
}
/* Etiquetas pequeñas encima de grupos */
.etiqueta { font-size: 13px; color: var(--suave); font-weight: 600; }
/* Texto de ayuda */
.ayuda { color: var(--suave); font-size: 14px; margin: 0; }
/* Errores */
.error { color: var(--mal); font-size: 14px; margin: 0; }
/* Línea de detalle */
.detalle { color: var(--suave); font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Botones y controles ---------- */
.btn {
  appearance: none; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--tinta);
  border-radius: 12px; min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:active { transform: scale(.98); }
/* Botón principal grande */
.btn.grande { background: var(--acento); color: var(--sobre-acento); border-color: transparent; min-height: 54px; font-size: 18px; width: 100%; }
.btn.grande.rojo { background: var(--mal); }
/* Botón redondo (+ / −) */
.btn.redondo { width: 56px; height: 56px; border-radius: 50%; font-size: 26px; padding: 0; flex: none; }
/* Botón de acción destructiva */
.btn.peligro { color: var(--mal); border-color: currentColor; }
/* Foco visible para teclado */
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
/* Fila de botones que se reparte el ancho */
.fila { display: flex; flex-wrap: wrap; gap: 8px; }
.fila .btn { flex: 1 1 auto; }
/* Chips (raíces, tipos, cuerdas) */
.chip {
  appearance: none; border: 1px solid var(--borde); background: transparent; color: var(--tinta);
  border-radius: 999px; min-height: 44px; min-width: 44px; padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.chip.activo, .chip[aria-pressed=true] { background: var(--acento); color: var(--sobre-acento); border-color: transparent; }
.chip.activo.icono, .chip.icono.activo { background: var(--ok); }
/* Campos con etiqueta */
.campo { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--suave); }
select, input, textarea {
  font: inherit; font-size: 16px; color: var(--tinta); background: var(--fondo);
  border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; resize: vertical; }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--acento); min-height: 36px; }
/* Interruptor con casilla */
.interruptor { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 44px; }
.interruptor input { width: 22px; height: 22px; min-height: 0; accent-color: var(--acento); }
/* Rejillas de 2 y 3 columnas */
.rejilla2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rejilla3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
/* Control segmentado */
.segmentos { display: flex; background: var(--fondo); border: 1px solid var(--borde); border-radius: 12px; padding: 3px; gap: 3px; }
.segmentos button {
  flex: 1; appearance: none; border: 0; background: transparent; color: var(--suave); font: inherit; font-weight: 650;
  min-height: 42px; border-radius: 9px; cursor: pointer;
}
.segmentos button[aria-selected=true] { background: var(--tarjeta); color: var(--tinta); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.segmentos.peq button { min-height: 38px; font-size: 14px; }
/* Zonas con desplazamiento horizontal (mástil, teclado, pentagrama) */
.scroll, pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.desliza { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.desliza .chip { flex: none; }

/* ---------- Barra de pestañas inferior ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--madera);
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 12px;
  color: rgba(243, 230, 210, .65); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current=page] { color: var(--sobre-madera); background: rgba(255, 255, 255, .1); }
.tabbar a[aria-current=page] svg { stroke: #05d6e6; }

/* ---------- Aviso flotante ---------- */
#aviso {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--tinta); color: var(--fondo); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 20; max-width: 90vw; text-align: center;
}
#aviso.ver { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Inicio ---------- */
.portada { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; background: var(--madera); color: var(--sobre-madera); border: 0; }
.portada h2 { font-size: 30px; }
.portada p { margin: 4px 0 8px; color: #d8c6b2; }
.portada-txt { display: grid; gap: 8px; }
.portada input { background: rgba(255, 255, 255, .08); color: var(--sobre-madera); border-color: rgba(255, 255, 255, .2); }
.portada input::placeholder { color: #b9a693; }
/* Anillo de progreso del día (conic-gradient) */
.anillo {
  --p: 0; width: 132px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#05d6e6 calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0);
}
.anillo > div { width: 108px; aspect-ratio: 1; border-radius: 50%; background: var(--madera); display: grid; place-content: center; text-align: center; }
.anillo b { font-size: 26px; font-variant-numeric: tabular-nums; }
.anillo span { font-size: 11px; color: #cdb9a3; max-width: 90px; }
/* Accesos directos */
.accesos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.acceso, .mas-item {
  display: grid; gap: 2px; padding: 14px; border-radius: 16px; text-decoration: none; color: var(--tinta);
  background: var(--tarjeta); border: 1px solid var(--borde); min-height: 78px;
}
.acceso b, .mas-item b { font-size: 16px; }
.acceso span, .mas-item span { font-size: 13px; color: var(--suave); }
.lista-mas { display: grid; gap: 10px; }
/* Rutina */
.rutina { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rutina a { display: flex; gap: 12px; align-items: center; color: var(--tinta); text-decoration: none; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.rutina .min { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--fondo); font-weight: 700; color: var(--acento); }

/* ---------- Afinador ---------- */
.medidor { position: relative; }
.arco { width: 100%; max-width: 420px; display: block; margin: 0 auto; }
.arco-fondo { fill: none; stroke: var(--borde); stroke-width: 14; stroke-linecap: round; }
.arco-ok { fill: none; stroke: var(--ok); stroke-width: 14; }
.marca-arco { stroke: var(--suave); stroke-width: 2; }
.txt-arco { fill: var(--suave); font-size: 11px; }
/* Aguja que gira desde su base */
.aguja { transform-origin: 150px 150px; transition: transform .12s ease-out; }
.aguja line { stroke: var(--tinta); stroke-width: 4; stroke-linecap: round; }
.aguja circle { fill: var(--tinta); }
.medidor[data-estado=ok] .aguja line, .medidor[data-estado=ok] .aguja circle { stroke: var(--ok); fill: var(--ok); }
.medidor[data-estado=lejos] .aguja line { stroke: var(--mal); }
.lectura { text-align: center; margin-top: -24px; }
.nota-grande { font-size: clamp(44px, 14vw, 72px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.medidor[data-estado=ok] .nota-grande { color: var(--ok); }
/* Botones de cuerdas */
.cuerdas { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.cuerda-btn { display: grid; gap: 4px; padding: 6px; border-radius: 14px; border: 2px solid transparent; }
.cuerda-btn.detectada { border-color: var(--ok); }
.cuerda-btn .chip { width: 100%; }
@media (prefers-reduced-motion: reduce) { .aguja { transition: none; } }

/* ---------- Metrónomo ---------- */
.pulsos { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 34px; }
.pulsos span { width: 30px; height: 30px; border-radius: 50%; background: var(--borde); transition: transform .06s, background .06s; }
.pulsos span.primero { box-shadow: inset 0 0 0 3px var(--acento); }
.pulsos span.on { background: var(--acento); transform: scale(1.2); }
.bpm-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bpm { display: grid; justify-items: center; }
.bpm output { font-size: clamp(56px, 18vw, 84px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.bpm span { color: var(--suave); font-size: 14px; }
.bpm small { color: var(--acento); font-weight: 700; font-size: 14px; min-height: 1.2em; }

/* ---------- Diccionario ---------- */
.raices { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.raices .chip { padding: 8px 2px; font-size: 15px; }
.titulo-acorde { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.titulo-acorde h2 { font-size: 40px; font-weight: 800; }
.titulo-acorde span { color: var(--suave); flex: 1; }
.notas-fila { display: flex; flex-wrap: wrap; gap: 8px; }
.nota-chip { display: grid; justify-items: center; padding: 6px 12px; border-radius: 12px; background: var(--fondo); min-width: 54px; }
.nota-chip b { font-size: 18px; }
.nota-chip small { color: var(--suave); }
.nota-chip:first-child b { color: var(--acento); }
.diagramas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.diag-btn { appearance: none; background: var(--fondo); border: 1px solid var(--borde); border-radius: 14px; padding: 8px; cursor: pointer; }
.diag { width: 100%; max-width: 200px; display: block; margin: 0 auto; }
.diatonicos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.diat { appearance: none; display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--borde); background: var(--fondo); color: var(--tinta); font: inherit; cursor: pointer; }
.diat b { font-size: 17px; }
.diat small { color: var(--suave); font-size: 12px; min-height: 1em; }

/* ---------- Dibujos SVG compartidos ---------- */
.linea { stroke: var(--tinta); stroke-width: 1.3; }
.linea.gruesa { stroke-width: 3.5; }
.cejuela { fill: var(--tinta); }
.punto { fill: var(--nota); }
.punto.raiz { fill: var(--raiz); stroke: var(--raiz-borde); stroke-width: 2; }
.aire { fill: none; stroke: var(--nota); stroke-width: 2; }
.aire.raiz { stroke: var(--raiz-borde); stroke-width: 2.5; }
.txt-x { fill: var(--suave); font-size: 16px; font-weight: 700; }
.txt-traste { fill: var(--suave); font-size: 12px; }
.txt-nota { fill: var(--suave); font-size: 11px; font-weight: 600; }
.txt-punto { fill: var(--fondo); font-size: 10px; font-weight: 700; pointer-events: none; }
/* Mástil */
.mastil { display: block; width: 100%; }
.madera { fill: var(--diapason); }
.incrust { fill: #e9dcc7; opacity: .8; }
.traste { stroke: #c9c3bb; stroke-width: 2.5; }
.cuerda { stroke: #e7d9b8; }
.toque { fill: transparent; cursor: pointer; }
.mastil .punto { fill: #f6efe3; }
.mastil .punto.raiz { fill: var(--raiz); stroke: #e9fdff; stroke-width: 1.5; }
.mastil .txt-punto { fill: #2b1d18; }
.mastil .txt-punto.raiz { fill: var(--sobre-raiz); }
.mastil .txt-traste { fill: var(--suave); }
.marca { fill: none; stroke-width: 4; }
.marca.ok { stroke: var(--ok); }
.marca.mal { stroke: var(--mal); }
/* Piano */
.piano { display: block; width: 100%; }
.tecla { cursor: pointer; }
.tecla.blanca { fill: #fdfbf7; stroke: #2b1d18; stroke-width: 1; }
.tecla.negra { fill: #1d1411; }
.tecla.on { fill: #bff3f7; }
.tecla.negra.on { fill: #007a85; }
.tecla.raiz { fill: var(--raiz); }
.txt-tecla.raiz, .negra-txt.raiz { fill: var(--sobre-raiz); }
.txt-tecla { fill: #6d5d53; font-size: 12px; font-weight: 700; pointer-events: none; }
.txt-tecla.on { fill: #2b1d18; }
.negra-txt { fill: #fff; font-size: 10px; }
/* Pentagrama */
.pentagrama { display: block; width: 100%; height: auto; }
.clave { fill: var(--tinta); font-size: 52px; font-family: "Noto Music", "Bravura", "Apple Symbols", "Segoe UI Symbol", serif; }
.clave.fa { font-size: 34px; }
.alteracion { fill: var(--tinta); font-size: 16px; }
.cabeza { fill: var(--tinta); }
.cabeza.hueca { fill: none; stroke: var(--tinta); stroke-width: 1.8; }
.plica { stroke: var(--tinta); stroke-width: 1.4; fill: none; }
.puntillo { fill: var(--tinta); }
.pentagrama-grande { max-width: 280px; margin: 0 auto; width: 100%; }

/* ---------- Transcribir ---------- */
.nivel { height: 8px; border-radius: 4px; background: var(--borde); overflow: hidden; }
.nivel span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.lista-notas { margin: 0; padding-left: 28px; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.lista-notas small { color: var(--suave); }
.tab, .resultado {
  margin: 0; padding: 12px; background: var(--fondo); border-radius: 12px; font: 14px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre; min-height: 3em;
}

/* ---------- Transponer ---------- */
.capos { display: grid; gap: 8px; }
.capo { display: grid; gap: 2px; padding: 10px 12px; background: var(--fondo); border-radius: 12px; }
.capo:first-child { box-shadow: inset 4px 0 0 var(--acento); }
.capo small { color: var(--suave); }

/* ---------- Ejercicios ---------- */
.menu-ej { display: grid; gap: 10px; }
.ej { appearance: none; text-align: left; font: inherit; color: var(--tinta); cursor: pointer; gap: 4px; }
.ej b { font-size: 17px; }
.ej span { color: var(--suave); font-size: 14px; }
.cab-ej { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.marcador { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--acento); }
.titulo-ej { font-size: 24px; }
.respuestas { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.respuestas.notas { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.btn.correcto { background: var(--ok); color: #fff; border-color: transparent; }
.btn.incorrecto { background: var(--mal); color: #fff; border-color: transparent; }
.feedback { text-align: center; font-weight: 650; min-height: 1.5em; margin: 0; color: var(--suave); }
.feedback.ok { color: var(--ok); }
.feedback.mal { color: var(--mal); }
.consigna { text-align: center; font-size: 18px; margin: 0; }
.consigna .nota-grande { display: block; margin-top: 6px; }
.dos-acordes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sel-acorde { display: grid; gap: 6px; }
.diag-peq { max-width: 170px; margin: 8px auto 0; }
.cuenta { display: grid; justify-items: center; }
.cuenta output { font-size: 64px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cuenta span { color: var(--suave); }

/* ---------- Vídeos ---------- */
.temas { display: grid; gap: 8px; }
.tema {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px;
  padding: 10px 14px; border-radius: 12px; background: var(--fondo); color: var(--tinta); text-decoration: none; font-weight: 600;
}
.tema span { color: var(--acento); }
.form-video { display: grid; gap: 8px; }

/* ---------- Listas, progreso, ajustes ---------- */
.lista { list-style: none; margin: 0; padding: 0; display: grid; }
.lista li { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--borde); flex-wrap: wrap; }
.lista li:last-child { border-bottom: 0; }
.lista a { color: var(--acento); font-weight: 600; flex: 1; }
.lista b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.cifras b { display: block; font-size: 32px; font-weight: 800; color: var(--acento); font-variant-numeric: tabular-nums; }
.cifras span { font-size: 12px; color: var(--suave); }
.barras7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; align-items: end; }
.b7 { display: grid; grid-template-rows: 1fr auto auto; height: 100%; justify-items: center; gap: 2px; }
.b7 span { align-self: end; width: 70%; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--borde); }
.b7 span.meta { background: var(--acento); }
.b7 small { font-weight: 700; font-size: 12px; }
.b7 i { font-style: normal; font-size: 11px; color: var(--suave); }
.instrumentos { display: flex; flex-wrap: wrap; gap: 8px; }
.pasos { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.version { text-align: center; color: var(--suave); font-size: 13px; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 420px) {
  /* El anillo se pone encima en móviles estrechos */
  .portada { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .portada-txt { width: 100%; }
  .rejilla3 { grid-template-columns: 1fr 1fr; }
  .titulo-acorde h2 { font-size: 34px; }
}
/* Tablet / escritorio: un poco más de aire */
@media (min-width: 760px) {
  main { padding-top: 24px; gap: 16px; }
  .accesos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Ritmos y punteados ---------- */
/* Rejilla de pasos: una celda por subdivisión */
.rejilla { display: grid; grid-template-columns: repeat(var(--n), minmax(38px, 1fr)); gap: 4px; min-width: calc(var(--n) * 42px); }
.celda { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 10px; background: var(--fondo); border: 1px solid var(--borde); }
.celda b { font-size: 22px; line-height: 1; min-height: 22px; color: var(--suave); }
.celda.fuerte b { color: var(--tinta); }
.celda small { font-size: 12px; color: var(--suave); min-height: 1em; }
/* Las celdas que caen en el pulso, un poco más marcadas */
.celda.pulso { border-color: var(--suave); }
/* Paso que está sonando */
.celda.on { background: var(--acento); border-color: transparent; }
.celda.on b, .celda.on small { color: var(--sobre-acento); }
.h-ritmo { font-size: 28px; }
.consejo { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--fondo); font-size: 14px; }
.leyenda summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.leyenda ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.leyenda li b { display: inline-block; min-width: 2.2em; }
/* Tarjetas de sugerencias */
.sugerencia { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.sugerencia:last-child { border-bottom: 0; }
.sugerencia.mejor { box-shadow: inset 4px 0 0 var(--acento); padding-left: 12px; }
.sugerencia small { color: var(--suave); }
.mini { font: 15px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 2px; margin: 4px 0; }
.motivos { display: block; }

/* ---------- Resucitó ---------- */
.resucito h2 { font-size: 30px; }
.resucito p { margin: 0; }
.marco-externo iframe { width: 100%; height: 72vh; border: 0; border-radius: 12px; background: #fff; }
.cantos li { display: grid; gap: 8px; }
.canto-info { display: grid; gap: 2px; }
.canto-info small { color: var(--suave); }
.canto-info code { font-size: 14px; color: var(--tinta); background: var(--fondo); padding: 4px 8px; border-radius: 8px; }
/* Golpes suaves (d, u) con flecha más pequeña */
.celda.suave b { font-size: 16px; line-height: 22px; color: var(--tinta); }

/* ---------- Transcripción en texto y separador ---------- */
/* Barra de progreso de procesos largos */
.progreso { height: 8px; border-radius: 4px; background: var(--borde); overflow: hidden; }
.progreso span { display: block; height: 100%; width: 0; background: var(--acento); transition: width .2s; }
/* Tabla de notas: tiempo · notas (+ acorde) · posición en el instrumento */
.tabla-notas { display: grid; max-height: 460px; overflow-y: auto; border: 1px solid var(--borde); border-radius: 12px; }
.fila-nota { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 2px 10px; padding: 8px 10px; border-bottom: 1px solid var(--borde); }
.fila-nota:last-child { border-bottom: 0; }
.fila-nota .t { color: var(--suave); font-variant-numeric: tabular-nums; font-size: 13px; grid-row: span 2; padding-top: 2px; }
.fila-nota .n b { font-size: 17px; margin-right: 6px; letter-spacing: .5px; }
.fila-nota .n em { font-style: normal; color: var(--acento); font-weight: 700; }
.fila-nota .p { font-size: 13px; color: var(--suave); }
/* Mezclador de pistas */
.pistas { display: grid; gap: 8px; }
.pista { display: grid; gap: 4px; padding: 10px; border-radius: 12px; background: var(--fondo); }
.opciones-sep { display: grid; gap: 4px; }
.lista-avisos { margin: 0; padding-left: 18px; display: grid; gap: 2px; }

/* ---------- Pantalla de bienvenida (al abrir la app) ---------- */
/* Ocupa toda la pantalla por encima de todo, con el azul noche del logo */
.bienvenida {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: 1fr auto auto; justify-items: center; align-items: center; gap: 28px;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom));
  background: radial-gradient(120% 80% at 50% 40%, #123a63 0%, #071a31 55%, #030a15 100%);
  color: #cfe3f5; transition: opacity .35s ease;
}
/* Logo centrado, grande pero sin desbordar */
.bienvenida img { width: min(78vw, 420px); height: auto; align-self: center; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .45)); }
/* Botón de inicio azul cian */
.bienvenida .iniciar {
  appearance: none; border: 2px solid #a8f6fb; border-radius: 999px; cursor: pointer;
  min-width: min(80vw, 340px); min-height: 64px; padding: 0 32px;
  font: 800 22px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: 5px; color: #00262a;
  background: linear-gradient(180deg, #5eeef6 0%, #05d6e6 55%, #00aebd 100%);
  box-shadow: 0 0 28px rgba(5, 214, 230, .5), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.bienvenida .iniciar:active { transform: scale(.98); }
.bienvenida .iniciar:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
/* Aviso de derechos al pie */
.bienvenida .derechos { margin: 0; font-size: 13px; letter-spacing: .6px; color: #8fa6bd; text-align: center; }
/* Al ocultarse se desvanece */
.bienvenida.fuera { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .bienvenida { transition: none; } }
/* Pie de derechos en Ajustes */
.derechos-pie { text-align: center; color: var(--suave); font-size: 12px; margin: 0; }
