/* RESONAR · La Caja de Ritmos de la Luna
   Identidad: estilo/resonar.css (copiado de webar/estilo). Textos, deslizadores y acordes siempre sobre fondo liso. */

:root {
  --tinta: var(--r-tinta); --tinta-2: var(--r-tinta-2); --papel: var(--r-papel); --crema: var(--r-crema);
  --boton: #a9472a; --boton-texto: #fff; --boton-sec: #fbf4e4; --boton-sec-texto: var(--r-tinta);
  --activo: var(--r-verde-accion); --activo-texto: #fff;
  --panel-oscuro: #2e2014; --panel-oscuro-texto: #f7eedb;
  --cartulina: url("../img/cartulina.webp");
  --alto-transporte: 104px;
  --radio: 14px;
  --ancho: 1180px;
  color-scheme: light;
}
html[data-contraste="alto"] {
  --tinta: #fff; --tinta-2: #ffd400; --papel: #000; --crema: #000;
  --boton: #000; --boton-texto: #ffd400; --boton-sec: #000; --boton-sec-texto: #fff;
  --activo: #ffd400; --activo-texto: #000; --panel-oscuro: #000; --panel-oscuro-texto: #fff;
  --cartulina: none; --r-foco: #00e5ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: calc(var(--alto-transporte) + 16px); }
body {
  font: var(--r-peso-texto) var(--r-tam-base)/var(--r-interlineado) var(--r-fuente); color: var(--tinta);
  min-height: 100vh; padding-bottom: calc(var(--alto-transporte) + env(safe-area-inset-bottom) + 24px);
  background: url("../img/curvas_nivel.svg") repeat 0 0 / 600px 600px, var(--cartulina) repeat 0 0 / 256px 256px, var(--r-fondo);
}
body.r-fondo-curvas { background: url("../img/curvas_nivel.svg") repeat 0 0 / 600px 600px, var(--cartulina) repeat 0 0 / 256px 256px, var(--r-fondo); }
html[data-contraste="alto"] body { background: #000; color: #fff; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; font-weight: 900; }
p { margin: 0 0 .5em; }
a { color: inherit; }
.visualmente-oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--r-tinta); color: var(--r-crema); padding: 12px 16px; border-radius: 8px; }
.saltar:focus { left: 8px; }
:focus-visible { outline: 4px solid var(--r-foco); outline-offset: 3px; box-shadow: 0 0 0 7px #000; }
.nota { font-size: .95rem; color: var(--tinta-2); margin: 0; }

/* ---------- botones (mínimo 48 px, siempre con texto; volumen leve que se hunde) ---------- */
.btn {
  font: 700 1rem/1.15 var(--r-fuente); min-height: 48px; min-width: 48px; padding: 8px 16px; border-radius: 12px;
  border: 2px solid rgba(38, 22, 10, .85); background-color: var(--boton); color: var(--boton-texto); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none;
  touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(0, 0, 0, .1));
  box-shadow: 0 2px 0 rgba(38, 22, 10, .55), 0 3px 6px rgba(0, 0, 0, .14);
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35); }
.btn-sec { background-color: var(--boton-sec); color: var(--boton-sec-texto); }
.btn-pri { background-color: var(--boton); color: var(--boton-texto); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 22px; height: 22px; flex: none; }
html[data-contraste="alto"] .btn { background: #000; color: #fff; border: 3px solid #fff; box-shadow: none; background-image: none; }
html[data-contraste="alto"] .btn-pri { color: #ffd400; }
html[data-contraste="alto"] .btn[aria-pressed="true"], html[data-contraste="alto"] .btn[aria-checked="true"] { background: #ffd400; color: #000; border-color: #ffd400; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* interruptor (Toca con ellos) */
.btn-interruptor { background-color: var(--boton-sec); color: var(--boton-sec-texto); }
.interruptor { width: 40px; height: 24px; border-radius: 12px; background: #b9a888; border: 2px solid var(--r-tinta); position: relative; flex: none; }
.interruptor::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 1.5px solid var(--r-tinta); transition: left .12s; }
.btn-interruptor[aria-pressed="true"] .interruptor { background: var(--r-verde-accion); }
.btn-interruptor[aria-pressed="true"] .interruptor::after { left: 18px; }
html[data-contraste="alto"] .interruptor { background: #000; border-color: #fff; }
html[data-contraste="alto"] .btn-interruptor[aria-pressed="true"] .interruptor { background: #000; border-color: #000; }
html[data-contraste="alto"] .btn-interruptor[aria-pressed="true"] .interruptor::after { background: #000; border-color: #000; }

/* ---------- cabecera ---------- */
.barra {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px; background: var(--r-tinta); color: var(--r-crema);
  border-bottom: 5px solid #8c5430; box-shadow: inset 0 -2px 0 #a5683a;
}
html[data-contraste="alto"] .barra { background: #000; color: #fff; border-bottom: 2px solid #fff; box-shadow: none; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.btn-resonar { flex: none; font-weight: 900; letter-spacing: .03em; text-decoration: none; gap: 6px; }
.btn-resonar span { font-size: 1.25em; line-height: 1; }
.marca img { border-radius: 9px; flex: none; }
.marca-texto { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.marca-titulo { font-weight: 900; font-size: 1.15rem; }
.marca-sub { font-size: .8rem; opacity: .85; letter-spacing: .04em; }
.barra-acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn-barra { min-height: 48px; padding: 6px 12px; font-size: .95rem; background-color: var(--boton-sec); color: var(--boton-sec-texto); }
a.btn-barra { text-decoration: none; }
.btn-barra[aria-pressed="false"] { opacity: .92; }
/* canal al que llega «Llévalo a la Caja» desde Anatomía del Sonido */
.canal.destacado { outline: 4px solid var(--r-foco); outline-offset: 3px; }
#btn-sonidos[aria-pressed="false"] .ondas { display: none; }
#btn-sonidos[aria-pressed="false"] svg { opacity: .6; }
.txt-corto { display: none; }
@media (max-width: 1020px) { .btn-barra .txt-largo { display: none; } .btn-barra .txt-corto { display: inline; } }
@media (max-width: 700px) {
  .barra { flex-wrap: wrap; padding-inline: 12px; }
  .marca { flex: 1 1 0; } .barra-acciones { flex: 1 1 100%; justify-content: stretch; }
  .btn-resonar { padding: 4px 10px; font-size: .9rem; }
  .barra-acciones .btn { flex: 1 1 auto; padding: 4px 5px; font-size: .84rem; white-space: nowrap; flex-direction: column; gap: 2px; min-width: 0; }
  .barra { position: static; }
}
@media (max-width: 380px) { .no-corto { display: none; } .marca img { display: none; } }

/* ---------- cabeza: pestañas + pieza ---------- */
main { max-width: var(--ancho); margin: 0 auto; padding: 14px 16px 0; }
main:focus { outline: none; }
.cabeza-app { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; margin-bottom: 14px; }
.pestanas-principales { display: flex; gap: 8px; flex: 1 1 320px; }
.pestana {
  flex: 1; min-height: 60px; font: 900 1.3rem/1 var(--r-fuente); border-radius: 16px 16px 12px 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--r-tinta);
  border: 3px solid var(--r-tinta); background: var(--r-papel);
  box-shadow: 0 3px 0 rgba(38, 22, 10, .5);
}
.pestana svg { width: 28px; height: 28px; }
.pestana[aria-selected="true"] {
  color: #fff; background: url("../estilo/curvas_nivel_claras.svg") repeat 0 0 / 300px 300px, linear-gradient(180deg, #a9472a, #8e3a21);
  box-shadow: inset 0 -5px 0 var(--r-tiple), 0 3px 0 rgba(38, 22, 10, .5);
}
html[data-contraste="alto"] .pestana { background: #000; color: #fff; border-color: #fff; box-shadow: none; }
html[data-contraste="alto"] .pestana[aria-selected="true"] { background: #ffd400; color: #000; }

.r-cartela-ancha { background: var(--r-papel); border: 3px solid var(--r-tinta); border-radius: var(--radio); }
html[data-contraste="alto"] .r-cartela-ancha { background: #000; border-color: #fff; }
.pieza { flex: 2 1 420px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; }
.pieza-elegir { display: flex; gap: 8px; }
.opcion { background-color: var(--boton-sec); color: var(--boton-sec-texto); }
.opcion[aria-pressed="true"], .opcion[aria-checked="true"] { background-color: var(--activo); color: var(--activo-texto); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35); transform: translateY(1px); }
.opcion[aria-pressed="true"]::before, .opcion[aria-checked="true"]::before { content: "✓"; font-weight: 900; }
.opcion-pieza { font-size: 1.1rem; min-width: 128px; }
.pieza-datos { margin: 0; color: var(--tinta-2); font-size: .95rem; flex: 1 1 220px; }

/* ---------- paneles ---------- */
.panel { animation: aparecer .18s ease-out; }
@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.fila-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.fila-acciones .separador { flex: 1; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- mezclador ---------- */
.mezclador { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 400px) { .mezclador { grid-template-columns: 1fr; } }
.canal {
  --color: #c08326; position: relative; padding: 18px 14px 14px; border-radius: 18px;
  border: 9px solid transparent;
  background: linear-gradient(var(--r-papel), var(--r-papel)) padding-box, var(--r-marco-madera) border-box;
  box-shadow: var(--r-sombra-pieza);
  display: grid; gap: 10px;
}
.canal::before {   /* franja de color con curvas de nivel, como el borde de las tarjetas */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; border-radius: 9px 9px 0 0;
  background: url("../estilo/curvas_nivel_claras.svg") repeat 0 0 / 200px 200px, var(--color);
}
.canal-cabeza { display: flex; gap: 12px; align-items: center; }
.r-arco-mini {
  position: relative; flex: none; width: 74px; height: 104px; display: grid; place-items: end center; padding-bottom: 6px;
  border: 5px solid transparent; border-radius: 37px 37px 10px 10px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 196, 120, .45), transparent 70%) padding-box,
              radial-gradient(circle at 50% 40%, #2c1d13, #160e08 75%) padding-box, var(--r-marco-madera) border-box;
}
.r-arco-mini img { width: 34px; height: auto; max-height: 86px; object-fit: contain; transform-origin: 50% 90%;
  }   /* el latido lo pone js/main.js con transform */
/* solo mientras suena, lo que se mueve va en su propia capa (transform, sin repintar ni medir) */
body.sonando .canal:not(.silencio) .r-arco-mini img, body.sonando .vumetro i { will-change: transform; }
.canal.silencio .r-arco-mini img { filter: grayscale(1) brightness(.6); }
.vumetro { position: absolute; right: -14px; bottom: 4px; width: 9px; height: 80px; border-radius: 5px; background: #e6dcc6; border: 2px solid var(--r-tinta); overflow: hidden; }
.vumetro i { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transform: scaleY(0); transform-origin: 50% 100%; background: linear-gradient(0deg, var(--r-verde-accion), #9bb04a 70%, #e0a52b); }
.canal-nombres { min-width: 0; padding-left: 8px; }
.canal-nombre { display: flex; align-items: center; gap: 8px; font-size: 1.45rem; margin: 0; }
.canal-nombre .r-forma { width: 24px; height: 24px; filter: drop-shadow(0 0 0 #2e2014); }
.canal-papel { margin: 0; color: var(--tinta-2); font-size: .98rem; }
/* nombre que se puede tocar para ver el origen del instrumento (área de toque de 48 px sin agrandar la fila) */
.btn-origen { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; margin: -9px -6px; padding: 0 6px;
  background: none; border: 0; border-radius: 10px; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline dotted 2px; text-underline-offset: 5px; text-decoration-color: var(--color); }
.btn-origen:hover { background: rgba(46, 32, 20, .07); }
.btn-origen:focus-visible { outline: 3px solid var(--r-tinta); outline-offset: 1px; }
.canal.origen-abierto { z-index: 12; }
.origen-tarjeta { position: absolute; z-index: 12; left: 10px; top: 64px; width: min(320px, calc(100% - 20px));
  background: var(--r-papel); color: var(--r-tinta); border: 3px solid var(--r-tinta); border-left: 8px solid var(--color);
  border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.origen-tarjeta:focus { outline: 3px solid var(--color); outline-offset: 2px; }
.origen-titulo { margin: 0 0 4px; font-weight: 900; font-size: .95rem; letter-spacing: .02em; }
.origen-texto { margin: 0 0 8px; font-size: 1rem; line-height: 1.4; }
.origen-cerrar { padding: 4px 14px; font-size: .95rem; }
html[data-contraste="alto"] .origen-tarjeta { background: #000; color: #fff; border-color: #fff; box-shadow: none; }
html[data-contraste="alto"] .btn-origen { text-decoration-color: #ffd400; }
.canal-estado { margin: 2px 0 0; font-size: .9rem; font-weight: 700; color: #8e3a21; min-height: 1.2em; }
.canal-botones { display: grid; grid-template-columns: 1.5fr 1fr; gap: 8px; }
.btn-onoff { justify-content: flex-start; background-color: var(--boton-sec); color: var(--boton-sec-texto); font-size: 1.05rem; }
.btn-onoff .led { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--r-tinta); background: #9b8f78; flex: none; }
.btn-onoff[aria-pressed="true"] { background-color: var(--activo); color: var(--activo-texto); }
.btn-onoff[aria-pressed="true"] .led { background: #c7f06a; box-shadow: 0 0 8px #c7f06a; }
.btn-solo { background-color: var(--boton-sec); color: var(--boton-sec-texto); }
.btn-solo[aria-pressed="true"] { background-color: #c08326; color: #1d1208; }
html[data-contraste="alto"] .btn-onoff[aria-pressed="true"] .led { background: #000; box-shadow: none; border-color: #000; }
html[data-contraste="alto"] .btn-solo[aria-pressed="true"] { background: #ffd400; color: #000; }
.canal-musico { margin: 0; font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; }
.etq-interpreta { font-size: .85rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--tinta-2); }
.musico-nombre { font-weight: 900; }
.canal.suena .canal-nombre .r-forma { animation: none; }
html[data-contraste="alto"] .canal { background: #000; border: 3px solid #fff; box-shadow: none; }
html[data-contraste="alto"] .canal::before { background: none; height: 0; }
html[data-contraste="alto"] .r-arco-mini { background: #000; border: 3px solid #fff; }
html[data-contraste="alto"] .vumetro { background: #000; border-color: #fff; }
html[data-contraste="alto"] .vumetro i { background: #ffd400; }
html[data-contraste="alto"] .canal-estado { color: #ffd400; }

/* deslizador grande y fácil con el dedo (la barra de tiempo) */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 48px; background: transparent; margin: 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; border: 2px solid var(--r-tinta);
  background: linear-gradient(180deg, #d9c7a2, #efe3c8); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .25); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 7px; border: 2px solid var(--r-tinta); background: linear-gradient(180deg, #d9c7a2, #efe3c8); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%;
  border: 3px solid var(--r-tinta); background: radial-gradient(circle at 35% 30%, #f0c27b, #a5683a 70%); box-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
input[type="range"]::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--r-tinta); background: radial-gradient(circle at 35% 30%, #f0c27b, #a5683a 70%); }
input[type="range"]:focus-visible { outline: 4px solid var(--r-foco); outline-offset: 2px; box-shadow: none; }
html[data-contraste="alto"] input[type="range"]::-webkit-slider-runnable-track { background: #000; border-color: #fff; box-shadow: none; }
html[data-contraste="alto"] input[type="range"]::-webkit-slider-thumb { background: #ffd400; border-color: #fff; box-shadow: none; }
html[data-contraste="alto"] input[type="range"]::-moz-range-track { background: #000; border-color: #fff; }
html[data-contraste="alto"] input[type="range"]::-moz-range-thumb { background: #ffd400; border-color: #fff; }

/* ---------- coplas (pestaña) ---------- */
.intro-coplas { padding: 10px 14px; margin-bottom: 14px; }
.titulo-panel { font-size: 1.5rem; margin: 0 0 2px; }
.lista-coplas { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.copla-tarjeta { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 14px 16px; background: var(--r-papel);
  border: 3px solid var(--r-tinta); border-left: 12px solid #34507A; border-radius: var(--radio); box-shadow: var(--r-sombra-pieza); }
.copla-tarjeta.suena { background: #f3dca8; border-left-color: #a9472a; }
.copla-versos { margin: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.copla-versos p { margin: 0 0 .7em; }
.copla-versos p:last-child { margin-bottom: 0; }
.copla-versos span { display: block; }
.copla-dice { margin: 0; font-size: 1rem; color: var(--tinta-2); }
.copla-dice strong { color: var(--r-tinta); }
.btn-copla { align-self: flex-start; min-height: 52px; min-width: 176px; font-size: 1.1rem; margin-top: auto; }
.btn-copla .i-pausa, .btn-copla[aria-pressed="true"] .i-play { display: none; }
.btn-copla[aria-pressed="true"] .i-pausa { display: inline; }
.btn-copla[aria-pressed="true"] { background-color: var(--activo); color: var(--activo-texto); }
html[data-contraste="alto"] .copla-tarjeta { background: #000; border-color: #fff; border-left-color: #ffd400; box-shadow: none; }
html[data-contraste="alto"] .copla-tarjeta.suena { background: #000; border-color: #ffd400; }
html[data-contraste="alto"] .copla-dice strong { color: #fff; }
body[data-pestana="coplas"] .pieza { display: none; }

/* ---------- aprender ---------- */
.estudio-controles { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px;
  background: var(--r-papel); border: 3px solid var(--r-tinta); border-radius: var(--radio); }
html[data-contraste="alto"] .estudio-controles { background: #000; border-color: #fff; }
.grupo { border: 0; margin: 0; padding: 0; min-width: 0; }
.grupo legend { font-weight: 900; font-size: 1rem; padding: 0; margin-bottom: 6px; }
.grupo-ancho { flex: 1 1 340px; }
.segmentado { display: flex; gap: 6px; }
.segmentado.envolver { flex-wrap: wrap; }
.segmentado .r-forma { width: 20px; height: 20px; }
.vel-carga { margin-top: 6px; max-width: 250px; }
.vel-carga progress { width: 100%; height: 14px; accent-color: #a9472a; }
.grupo-toca { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.estudio-controles .nota { max-width: 46ch; }

.linea-acordes { padding: 14px 16px 12px; margin-bottom: 14px; }
.acorde-ahora { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.acorde-grande, .acorde-luego { display: flex; flex-direction: column; line-height: 1; }
.acorde-grande strong { font-size: clamp(3.4rem, 12vw, 5.2rem); font-weight: 900; color: var(--r-tinta); }
.acorde-luego { margin-left: auto; text-align: right; }
.acorde-luego strong { font-size: clamp(1.8rem, 6vw, 2.5rem); font-weight: 900; color: var(--tinta-2); }
.etq { font-size: .85rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--tinta-2); }
.largo { font-size: 1rem; font-weight: 700; color: var(--tinta-2); margin-top: 4px; }
.cuenta { display: flex; gap: 10px; }
.cuenta span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font: 900 1.4rem var(--r-fuente);
  border: 3px solid var(--r-tinta); background: #fffaf0; color: var(--tinta-2); }
.cuenta span:first-child { border-width: 4px; }
.cuenta span.activo { background: #34507A; color: #fff; transform: scale(1.08); }
.cuenta span.activo:first-child { background: #a9472a; }
@media (prefers-reduced-motion: reduce) { .cuenta span.activo { transform: none; } }
/* pestañita con la sección que suena: se lee completa y no tapa ni el acorde ni el cabezal */
.franja-seccion { margin: 10px 0 -3px 10px; height: 22px; line-height: 1; }
.franja-seccion span { display: inline-block; max-width: 100%; height: 22px; padding: 3px 10px 0; border: 3px solid var(--r-tinta); border-bottom: 0; border-radius: 9px 9px 0 0;
  background: #f3dca8; color: #8e3a21; font-size: .8rem; line-height: 1; font-weight: 900; white-space: nowrap; box-sizing: border-box; }
.franja-seccion span:empty { visibility: hidden; }
html[data-contraste="alto"] .franja-seccion span { background: #000; border-color: #fff; color: #ffd400; }
.compas.en-curso em { visibility: hidden; }
.franja { position: relative; overflow: hidden; margin-top: 0; contain: layout paint; height: 74px; border-radius: 10px; border: 3px solid var(--r-tinta); background: #fffaf0; }
.franja-cinta { position: absolute; left: 30%; top: 0; bottom: 0; display: flex; will-change: transform; }
.compas { flex: none; width: 112px; display: flex; flex-direction: column; justify-content: flex-end; padding: 4px 6px 8px;
  border-left: 2px solid rgba(46, 32, 20, .35); }
.compas .acs { display: flex; align-items: flex-end; }
.compas b { font-size: 1.6rem; font-weight: 900; min-width: 0; white-space: nowrap; }
.compas.varios b { font-size: 1.2rem; }
.compas.varios b + b { border-left: 2px dotted rgba(46, 32, 20, .5); padding-left: 5px; }
.compas.sin-acorde b { opacity: .55; }
.compas.repite b { opacity: .35; }
.compas em { font-style: normal; font-size: .78rem; font-weight: 900; color: #8e3a21; white-space: nowrap; margin-bottom: auto; }
.compas.inicio-seccion { border-left: 4px solid #8e3a21; }
.compas.actual { background: #f3dca8; }
.compas.actual.repite b { opacity: 1; }
.franja-cabezal { position: absolute; left: 30%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #a9472a; }
.franja-cabezal::before { content: ""; position: absolute; top: 0; left: -7px; border: 9px solid transparent; border-top-color: #a9472a; }
html[data-contraste="alto"] .franja, html[data-contraste="alto"] .cuenta span { background: #000; border-color: #fff; color: #fff; }
html[data-contraste="alto"] .cuenta span.activo { background: #ffd400; color: #000; }
html[data-contraste="alto"] .compas.actual { background: #ffd400; color: #000; }
html[data-contraste="alto"] .compas em { color: #ffd400; }
html[data-contraste="alto"] .compas.actual em { color: #000; }
html[data-contraste="alto"] .franja-cabezal { background: #00e5ff; }
html[data-contraste="alto"] .acorde-grande strong { color: #fff; }

.vista3d { margin-bottom: 16px; }
.vista3d-marco { position: relative; height: min(64vh, 520px); min-height: 320px; overflow: hidden; }
.vista3d-marco canvas { display: block; width: 100%; height: 100%; border-radius: inherit; touch-action: none; }
.vista3d-cargando { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #f3e8d0; font-weight: 700; }
.vista3d-etiqueta { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; white-space: nowrap; max-width: 92%;
  overflow: hidden; text-overflow: ellipsis; background: var(--r-papel); color: var(--r-tinta); border: 2px solid var(--r-tinta);
  border-radius: 10px; padding: 4px 12px; font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 6px; }
.vista3d-etiqueta .r-forma { width: 18px; height: 18px; flex: none; }
.vista3d-pie { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 8px;
  background: var(--r-papel); border: 2px solid var(--r-tinta); border-radius: 12px; padding: 6px 10px; }
html[data-contraste="alto"] .vista3d-pie, html[data-contraste="alto"] .vista3d-etiqueta { background: #000; color: #fff; border-color: #fff; }

.diagramas-seccion { background: var(--r-papel); border: 3px solid var(--r-tinta); border-radius: var(--radio); padding: 14px; margin-bottom: 16px; }
html[data-contraste="alto"] .diagramas-seccion { background: #000; border-color: #fff; }
.fila-titulo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fila-titulo h2 { margin: 0; font-size: 1.35rem; }
.diagramas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.diagrama { margin: 0; text-align: center; background: #fffaf0; border: 2px solid rgba(46, 32, 20, .5); border-radius: 12px; padding: 8px 6px 4px; }
.diagrama svg { width: 100%; max-width: 168px; height: auto; }
.diagrama figcaption { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 8px; }
.diagrama-corto { font-size: 1.6rem; font-weight: 900; }
.diagrama-cifrado { font-weight: 900; color: var(--tinta-2); }
.diagrama-largo { flex-basis: 100%; font-size: .9rem; color: var(--tinta-2); }
html[data-contraste="alto"] .diagrama { background: #000; border-color: #fff; }

/* ---------- transporte (fijo abajo) ---------- */
.transporte {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; color: var(--panel-oscuro-texto);
  background: var(--panel-oscuro); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 6px solid #8c5430; box-shadow: 0 -6px 20px rgba(0, 0, 0, .3), inset 0 2px 0 #a5683a;
}
html[data-contraste="alto"] .transporte { border-top: 3px solid #fff; box-shadow: none; }
.transporte-fila { max-width: var(--ancho); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.btn-play { width: 84px; height: 72px; border-radius: 18px; flex-direction: column; gap: 0; font-size: .95rem; background-color: #c08326; color: #1d1208; }
.btn-play svg { width: 34px; height: 34px; }
.btn-play.esperando { opacity: .6; cursor: progress; }
/* avance de la carga de la música: línea sobre el borde del transporte */
.carga-musica { position: absolute; left: 0; right: 0; top: -6px; height: 6px; overflow: hidden; background: #4a2e1a; }
.carga-musica i { display: block; height: 100%; background: #ffd400; transform: scaleX(0); transform-origin: 0 50%; }
html[data-contraste="alto"] .carga-musica { background: #333; }
.btn-play .i-pausa, .btn-play.sonando .i-play { display: none; }
.btn-play.sonando .i-pausa { display: inline; }
.btn-inicio { flex-direction: column; gap: 0; min-height: 72px; padding: 4px 10px; font-size: .88rem; }
.tiempo { flex: 1; min-width: 0; }
.tiempo-info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: .95rem; }
.seccion-actual { font-weight: 900; }
.tiempo-num { margin-left: auto; font-variant-numeric: tabular-nums; }
.chip-lento, .chip-bucle { background: #c08326; color: #1d1208; border-radius: 999px; padding: 0 10px; font-size: .85rem; }
.chip-bucle { background: #f3e8d0; }
.tiempo-barra { position: relative; }
.tiempo-secciones { position: absolute; left: 17px; right: 17px; top: 3px; height: 8px; pointer-events: none; }
.tiempo-secciones span { position: absolute; top: 0; height: 8px; border-left: 2px solid #f3e8d0; }
.tiempo-secciones i { display: none; }
.transporte input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(180deg, #6e5038, #8c6a4e); border-color: #f3e8d0; }
html[data-contraste="alto"] .btn-play { background: #ffd400; color: #000; }
html[data-contraste="alto"] .chip-lento, html[data-contraste="alto"] .chip-bucle { background: #fff; color: #000; }
@media (max-width: 520px) {
  :root { --alto-transporte: 92px; }
  .transporte { padding-inline: 10px; }
  .transporte-fila { gap: 8px; }
  .btn-play { width: 68px; height: 64px; } .btn-inicio { min-height: 64px; padding: 2px 6px; }
  .tiempo-info { font-size: .85rem; gap: 4px 6px; }
}

.aviso-flotante { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--alto-transporte) + 70px);
  background: var(--r-papel); color: var(--r-tinta); border: 3px solid var(--r-tinta); border-radius: 12px; padding: 10px 16px;
  max-width: min(92vw, 560px); font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
html[data-contraste="alto"] .aviso-flotante { background: #000; color: #fff; border-color: #fff; }

/* ---------- inicio y recorrido ---------- */
.inicio { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: url("../estilo/curvas_nivel_claras.svg") repeat 0 0 / 600px 600px, rgba(38, 24, 12, .92); }
.inicio-caja { width: min(460px, 100%); padding: 22px; text-align: center; color: var(--r-tinta); display: grid; gap: 6px; justify-items: center; }
.inicio-caja h2 { font-size: 1.8rem; margin: 6px 0 0; }
.inicio-caja progress { width: 100%; height: 14px; accent-color: #a9472a; }
.btn-grande { min-height: 60px; font-size: 1.3rem; padding: 10px 40px; margin-top: 8px; }
html[data-contraste="alto"] .inicio { background: #000; }
html[data-contraste="alto"] .inicio-caja { background: #000; color: #fff; border: 3px solid #fff; }

.recorrido { position: fixed; inset: 0; z-index: 95; }
.recorrido-foco { position: fixed; border-radius: 16px; border: 4px solid #ffd400; box-shadow: 0 0 0 9999px rgba(20, 12, 6, .72); pointer-events: none; transition: all .2s; }
@media (prefers-reduced-motion: reduce) { .recorrido-foco { transition: none; } }
.recorrido-caja { position: fixed; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 32px)); background: var(--r-papel);
  color: var(--r-tinta); border: 4px solid var(--r-tinta); border-radius: 16px; padding: 16px 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.recorrido-caja h2 { font-size: 1.5rem; margin-bottom: 4px; }
.recorrido-paso { font-weight: 900; color: #8e3a21; margin: 0; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.recorrido-caja .fila { justify-content: flex-end; margin-top: 10px; }
html[data-contraste="alto"] .recorrido-caja { background: #000; color: #fff; border-color: #fff; }
html[data-contraste="alto"] .recorrido-paso { color: #ffd400; }

.pie-guardar { text-align: center; margin: 0 0 8px; }
.pie-guardar .btn { font-size: .95rem; }
.pie { text-align: center; font-size: .9rem; color: var(--tinta-2); margin: 18px auto 8px; background: var(--r-papel); border-radius: 10px; padding: 6px 12px; width: fit-content; max-width: 100%; }
html[data-contraste="alto"] .pie { background: #000; }
html[data-contraste="alto"] .r-marco-madera { background: #000 !important; border: 3px solid #fff !important; color: #fff; }

/* ---------- impresión: solo los diagramas ---------- */
.impresion { display: none; }
@media print {
  body > *:not(.impresion) { display: none !important; }
  body { background: #fff !important; padding: 0; color: #000; }
  .impresion { display: block !important; font-size: 12pt; }
  .impresion h1 { font-size: 18pt; } .impresion h2 { font-size: 14pt; margin-top: 12pt; }
  .impresion .diagramas { grid-template-columns: repeat(4, 1fr); }
  .impresion .diagrama { break-inside: avoid; background: #fff; }
}
.r-forma--luna { -webkit-mask-image: url("../estilo/formas/luna.svg"); mask-image: url("../estilo/formas/luna.svg"); }

/* ---------- computador: en Aprender, la vista 3D a la izquierda y los acordes a la derecha ---------- */
@media (min-width: 1000px) {
  #panel-aprender:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .estudio-controles { grid-column: 1 / -1; }
  .vista3d { grid-column: 1; grid-row: 2 / span 2; }
  .vista3d-marco { height: min(calc(100vh - 470px), 600px); min-height: 340px; }
  .linea-acordes { grid-column: 2; grid-row: 2; }
  .diagramas-seccion { grid-column: 2; grid-row: 3; }
  .linea-acordes .acorde-luego { margin-left: auto; }
  .diagramas { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
/* ---------- celular: cabecera más compacta ---------- */
@media (max-width: 520px) {
  main { padding-top: 10px; }
  .cabeza-app { gap: 8px; margin-bottom: 10px; }
  .pestanas-principales { gap: 6px; }
  .pestana { min-height: 54px; font-size: 1.05rem; gap: 6px; padding: 0 4px; }
  .pestana svg { width: 22px; height: 22px; }
  .pieza { padding: 6px 10px; }
  .opcion-pieza { min-width: 0; flex: 1; }
  .pieza-elegir { flex: 1 1 100%; }
  .pieza-datos { font-size: .85rem; }
  .fila-acciones .btn { flex: 1 1 auto; }
  .fila-acciones .separador { display: none; }
}

/* ---------- celular: la vista de frente un poco más alta ---------- */
/* lo que queda fuera de la pantalla no se dibuja hasta acercarse */
@media (max-width: 999px) { .diagramas-seccion { content-visibility: auto; contain-intrinsic-size: auto 620px; } }
@media (pointer: coarse) { .recorrido-foco { transition: none; } }   /* su sombra cubre la pantalla: animarla repinta todo */

@media (max-width: 600px) { .vista3d-marco { height: min(112vw, 470px); min-height: 0; } }

/* ---------- celular: mezclador compacto (nombre y papel, quién interpreta, y encendido + solo) ---------- */
@media (max-width: 600px) {
  .mezclador { gap: 8px; }
  .canal {
    padding: 10px 8px 6px; border-width: 5px; border-radius: 14px; gap: 2px 6px; align-items: center;
    grid-template-columns: 48px minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas: "mini nombre nombre" "mini musico musico" "mini on solo";
  }
  .canal::before { height: 6px; border-radius: 9px 9px 0 0; }
  .canal-cabeza, .canal-botones { display: contents; }
  .canal-mini { grid-area: mini; align-self: stretch; }
  .r-arco-mini { width: 48px; height: auto; min-height: 96px; border-width: 3px; border-radius: 24px 24px 8px 8px; padding-bottom: 4px; }
  .r-arco-mini img { width: 22px; max-height: 70px; }
  .vumetro { right: 2px; bottom: 6px; width: 4px; height: 60%; border-width: 0; border-radius: 2px; background: rgba(243, 232, 208, .25); }
  .canal-nombres { grid-area: nombre; padding-left: 2px; }
  .canal-nombre { font-size: 1.2rem; gap: 6px; }
  .canal-nombre .r-forma { width: 18px; height: 18px; }
  .canal-papel, .canal-estado { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0; margin: 0; }
  .canal-estado:empty { display: none; }
  .canal-nombres:has(.canal-estado:not(:empty)) .canal-papel { display: none; }
  .canal-musico { grid-area: musico; font-size: .85rem; padding-left: 2px; }
  .etq-interpreta { font-size: .72rem; }
  .btn-origen { margin: -10px -6px -10px -4px; }
  .origen-tarjeta { left: 8px; top: 50px; width: calc(100% - 16px); }
  .btn-onoff { grid-area: on; font-size: .95rem; padding: 6px 10px; gap: 6px; margin-top: 4px; }
  .btn-onoff .led { width: 14px; height: 14px; }
  .btn-solo { grid-area: solo; padding: 6px 10px; font-size: .95rem; margin-top: 4px; }
  html[data-contraste="alto"] .vumetro { background: #333; }
}
