/* Hoja de estilos
   Dirección: instrumento de precisión, todo en una sola pantalla en escritorio.
   Tinta y papel de calco como base, un color por modo.
   Tipografía: Literata (notas, cifrados, títulos; serif de proporciones normales y óptico variable) + Instrument Sans (interfaz). Accidentales en Noto Music.
   Fuentes alojadas en /fonts (OFL), sin peticiones externas. */

@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/literata-latin.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/instrument-sans-latin.woff2) format('woff2'); }
@font-face { font-family: 'Noto Music'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/noto-music.woff2) format('woff2'); unicode-range: U+25CC, U+2669-266F, U+1D000-1D0F5, U+1D100-1D245; }

@property --m { syntax: '<color>'; inherits: true; initial-value: #46B9C6; }
@property --m-ink { syntax: '<color>'; inherits: true; initial-value: #46B9C6; }
@property --m-solid { syntax: '<color>'; inherits: true; initial-value: #46B9C6; }

/* ---------- color por modo (dark: md · claro: ml fondo, mk texto) ---------- */
[data-modo="mayor"]     { --md: #E2B04A; --ml: #D9A22B; --mk: #7A5200; }  /* oro de la tónica */
[data-modo="menor"]     { --md: #AEBFDC; --ml: #7F94BC; --mk: #34456B; }  /* plata azulada */
[data-modo="jonico"]    { --md: #7FAEF0; --ml: #5C8FDB; --mk: #1F4E96; }  /* cielo */
[data-modo="dorico"]    { --md: #46B9C6; --ml: #1FA3B3; --mk: #0B6672; }  /* agua fría */
[data-modo="frigio"]    { --md: #A98BEF; --ml: #8C69DA; --mk: #5230A6; }  /* violeta sombrío */
[data-modo="lidio"]     { --md: #CBDD55; --ml: #A9BF1D; --mk: #566200; }  /* lima de amanecer */
[data-modo="mixolidio"] { --md: #6CCB8B; --ml: #35A864; --mk: #14693A; }  /* verde firme */
[data-modo="eolico"]    { --md: #7C93F5; --ml: #5A73E3; --mk: #2B3FA8; }  /* índigo */
[data-modo="locrio"]    { --md: #EA6A8F; --ml: #D13F6B; --mk: #9A1B45; }  /* granate */

html { --serif: 'Literata', 'Noto Music', Georgia, serif; }
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1319; --sf: #151A22; --sf2: #1D232D; --line: rgba(231,233,228,.13); --line2: rgba(231,233,228,.26);
  --ink: #E7E9E4; --mut: #9AA3AF; --on-solid: #0E1217;
  --kw-off: #2A313C; --kb-off: #0C0F14; --kline: #0F1319;
  --kt-w: #0E1217; --kt-b: #F4F6F8; --kdia-w: #0E1217; --kdia-b: #fff;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #E7EBE9; --sf: #F4F6F5; --sf2: #DCE2E0; --line: rgba(18,23,29,.14); --line2: rgba(18,23,29,.3);
  --ink: #12171D; --mut: #4A5461; --on-solid: #FFFFFF;
  --kw-off: #FBFCFB; --kb-off: #2B333C; --kline: #AEB8B5;
  --kt-w: #12171D; --kt-b: #fff; --kdia-w: #12171D; --kdia-b: #fff;
}
html[data-theme="dark"] [data-modo] { --m: var(--md); --m-ink: var(--md); --m-solid: var(--md);
  --kw-on: color-mix(in srgb, var(--m) 62%, #EEF0F2); --kb-on: color-mix(in srgb, var(--m) 50%, #0C0F14); --hero: color-mix(in srgb, var(--m) 11%, var(--bg)); }
html[data-theme="light"] [data-modo] { --m: var(--ml); --m-ink: var(--mk); --m-solid: var(--mk);
  --kw-on: color-mix(in srgb, var(--m) 58%, #fff); --kb-on: color-mix(in srgb, var(--m-solid) 72%, #141A20); --hero: color-mix(in srgb, var(--m) 15%, var(--bg)); }

body { transition: --m .7s ease, --m-ink .7s ease, --m-solid .7s ease; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip;
  font: 400 1rem/1.45 'Instrument Sans', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
svg { display: block; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--m-ink); outline-offset: 2px; border-radius: 6px; }
.salto { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; }
.salto:focus { top: .6rem; }

.acc { font-family: 'Noto Music', var(--serif); font-size: 1.22em; font-weight: 400; margin: 0 .06em 0 .03em; line-height: 0; letter-spacing: 0; white-space: nowrap; }
/* calidad del acorde: sans de proporciones normales, casi del tamaño de la raíz, separada de ella */
.q { font: 600 .74em/1 'Instrument Sans', sans-serif; letter-spacing: .01em; vertical-align: .24em; margin-left: .2em; white-space: nowrap; }
.q .acc { font-size: 1.25em; }
.nota__n .acc, .cn b .acc, .deg__sym .acc, .det__sym .acc, .esc .acc, .tn > span .acc, .blq__gr .acc, .gesto .acc, .pc__s .acc, .teclado__info strong .acc, .titulo .acc { font-size: 1.03em; }

/* ---------- barra superior ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 8px 22px; border-bottom: 1px solid var(--line); }
.marca { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); min-height: 2.4rem; }
.marca__logo { width: 1.5rem; height: 1.5rem; }
.marca__nombre { font: 500 1.6rem/1.2 var(--serif); letter-spacing: 0; }
.campos { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; margin-left: 12px; }
.campo { display: flex; align-items: center; gap: 8px; }
.campo__t { font-size: .875rem; font-weight: 600; color: var(--mut); }
.sel { position: relative; display: block; }
.sel select { appearance: none; -webkit-appearance: none; min-height: 2.5rem; width: 100%; padding: 0 2.1rem 0 .8rem; border-radius: 10px; border: 1px solid var(--line2); background: var(--sf); color: var(--ink); font: 500 1.18rem/1.2 var(--serif); cursor: pointer; transition: border-color .2s; }
.sel select:hover { border-color: var(--ink); }
.sel select option, .sel select optgroup { font: 500 1rem 'Instrument Sans', sans-serif; background: var(--sf); color: var(--ink); }
.sel--ton select { width: 6.2rem; }
.sel--modo select { width: 12.5rem; padding-left: 1.9rem; }
.sel__chev { position: absolute; right: .75rem; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.sel__pt { position: absolute; left: .8rem; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--m); z-index: 1; pointer-events: none; transition: background .5s; }
.enh { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.5rem; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--line2); font: 500 1.09rem/1.2 var(--serif); transition: background .2s; }
.enh:hover { background: var(--sf2); }
.enh svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.herram { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.sonido { display: flex; align-items: center; gap: 2px; }
.btn-i { position: relative; display: inline-flex; align-items: center; gap: .45rem; min-height: 2.5rem; min-width: 2.5rem; padding: 0 .6rem; border-radius: 10px; justify-content: center; color: var(--ink); font-size: 1rem; font-weight: 500; transition: background .2s, color .2s; }
.btn-i:hover { background: var(--sf2); }
.btn-i svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-i.on { background: var(--m-solid); color: var(--on-solid); }
.btn-i .ico-on { display: none; }
.btn-i.on .ico-on { display: block; } .btn-i.on .ico-off { display: none; }
html[data-theme="dark"] .ico-luna { display: none; } html[data-theme="light"] .ico-sol { display: none; }
.btn-i__t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vol input { width: 72px; accent-color: var(--m-solid); height: 2.5rem; cursor: pointer; }
.vol { display: flex; }

/* ---------- principal ---------- */
main { width: 100%; max-width: 1560px; margin-inline: auto; padding: 12px 22px 12px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.grados { display: flex; flex-direction: column; gap: 12px; flex: 1; }

/* banda del modo: título y escala a la izquierda, nota y gesto característicos a la derecha */
.banda { background: var(--hero); border-radius: 16px; padding: 16px 24px 16px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px 32px; transition: background .7s ease; }
.banda__id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.banda__tit { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.titulo { font: 500 2.26rem/1.2 var(--serif); letter-spacing: 0; color: var(--ink); white-space: nowrap; }
.titulo .acc { margin-left: .04em; }
.hero__acc { display: flex; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.4rem; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--line2); font-weight: 600; font-size: .95rem; transition: background .2s, color .2s, border-color .2s, transform .15s; }
.btn:hover:not(:disabled) { background: var(--sf2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn svg.ic-arp { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn svg.ic-add { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.btn--p { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--p:hover:not(:disabled) { background: var(--ink); opacity: .86; }
.btn--g { border-color: transparent; color: var(--mut); }
.btn:disabled { opacity: .4; }
.btn--s { min-height: 2.1rem; padding: 0 .85rem; font-size: .9rem; }

.regla { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 14px; }
.nota { position: relative; border-top: 3px solid var(--line2); padding: 9px 2px 0 0; gap: 2px; display: flex; flex-direction: column; }
.nota--ton { border-top-color: var(--m-solid); }
.nota__f { font-size: .875rem; font-weight: 600; color: var(--mut); line-height: 1.2; }
.nota--ton .nota__f, .nota--car .nota__f, .nota--car .nota__n { color: var(--m-ink); }
.nota__n { font: 500 1.64rem/1.2 var(--serif); letter-spacing: 0; white-space: nowrap; }
.nota--car::before { content: ''; position: absolute; top: -9px; left: 0; width: 14px; height: 14px; background: var(--m-solid); transform: rotate(45deg) scale(.82); transform-origin: 0 0; margin-left: 7px; box-shadow: 0 0 0 3px var(--hero); transition: box-shadow .7s; }
.paso { position: absolute; top: -.7rem; left: 0; transform: translateX(-50%); font-size: .8125rem; font-weight: 600; color: var(--mut); background: var(--hero); padding: 0 .28rem; transition: background .7s; line-height: 1.1rem; }

.banda__info { display: flex; flex-direction: column; gap: 10px; min-width: 0; border-left: 1px solid var(--line2); padding-left: 28px; justify-content: space-between; }
.banda__id { justify-content: center; }
.info__nota { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 36px; align-items: start; }
.blq h2 { font-size: .875rem; font-weight: 600; color: var(--mut); margin-bottom: 4px; }
.blq__gr { font: 500 2.34rem/1.2 var(--serif); color: var(--m-ink); display: inline-block; }
.blq__p { font-size: .95rem; line-height: 1.3; display: inline; margin-left: .5rem; }
.blq--vac .blq__p { color: var(--mut); margin: 0; display: block; }
.blq__gs { font: 500 1.6rem/1.2 var(--serif); }
.gestos { display: flex; flex-wrap: wrap; gap: 0 20px; }
.blq__gs--l { font-size: 1.3rem; line-height: 1.2; }
.gesto { display: flex; align-items: center; gap: .6rem; font: 500 1.18rem/1.2 var(--serif); color: var(--m-ink); margin-top: 2px; }
.flecha { width: 30px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--mut); }

.brillo__b { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.brillo__b button { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; font-size: .875rem; font-weight: 500; color: var(--mut); padding: 0; min-height: 30px; }
.brillo__s { display: block; height: 7px; border-radius: 4px; background: var(--m); transition: height .2s; }
.brillo__b button:hover .brillo__s { height: 10px; }
.brillo__b button[aria-current="true"] { color: var(--ink); font-weight: 700; }
.brillo__b button[aria-current="true"] .brillo__s { height: 10px; box-shadow: 0 0 0 1.5px var(--hero), 0 0 0 3px var(--ink); }

/* ---------- tarjetas de grado (resumen) ---------- */
.lista { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.deg { position: relative; background: var(--sf); border: 1px solid var(--line); border-radius: 14px; min-width: 0; transition: background .25s, border-color .25s, box-shadow .25s, transform .2s; }
.deg:hover { border-color: var(--line2); }
.deg.is-sel { background: color-mix(in srgb, var(--m) 12%, var(--sf)); border-color: var(--m); box-shadow: inset 0 4px 0 var(--m-solid); }
.deg__cab { width: 100%; height: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 12px; border-radius: 14px; }
.deg__cif { font-size: 1rem; font-weight: 700; color: var(--m-ink); line-height: 1.2; }
.deg__sym { font: 500 1.95rem/1.2 var(--serif); letter-spacing: 0; white-space: nowrap; }
.deg__ea { font-size: .95rem; font-weight: 500; color: var(--mut); line-height: 1.25; }
.deg.is-sel .deg__ea { color: var(--ink); }
.deg__ins { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; min-height: 1.5rem; align-content: flex-start; }

.ins { display: inline-flex; align-items: center; min-height: 1.5rem; padding: 0 .6rem; border-radius: 999px; font-size: .875rem; font-weight: 600; border: 1px solid var(--line2); color: var(--ink); line-height: 1; white-space: nowrap; }
.ins--centro { background: var(--m-solid); color: var(--on-solid); border-color: transparent; }
.ins--car { border-color: var(--m-ink); color: var(--m-ink); border-width: 1.5px; }
.ins--sec { border-style: dashed; color: var(--mut); font-weight: 500; }
.ins--fun { border-color: transparent; background: var(--sf2); color: var(--ink); font-weight: 500; }
.deg--sec .deg__sym { color: color-mix(in srgb, var(--ink) 72%, var(--sf)); }
.deg--sec .deg__cif { color: var(--mut); }
.deg--cnota { border-color: var(--m); }
.deg--solo .deg__sym { font-size: 2.6rem; }

.anim .deg { animation: sube .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 40ms); }
.banda.anim .nota { animation: aparece .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 50ms); }
@keyframes sube { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- panel de detalle del grado ---------- */
.detalle { flex: 1; background: var(--sf); border: 1px solid var(--line); border-radius: 16px; padding: 16px 26px 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: inset 5px 0 0 var(--m-solid); transition: box-shadow .7s; min-height: 0; }
.det__cab { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; }
.det__id { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.det__act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.det__cols { display: grid; grid-template-columns: minmax(16rem, .95fr) minmax(0, 1.25fr) minmax(0, 1.45fr); gap: 0 28px; }
.det__col--ten { display: flex; gap: 12px 28px; flex-wrap: wrap; }
.det__sub { min-width: 0; }
.det__col { min-width: 0; border-left: 1px solid var(--line); padding-left: 30px; }
.det__col:first-child { border-left: 0; padding-left: 0; }
.det__h { font-size: .9375rem; font-weight: 600; color: var(--mut); margin-bottom: 10px; line-height: 1.25; }
.det__h strong { color: var(--ink); font-weight: 700; }
.det__h--v { margin-top: 16px; }
.det__tit { font-size: 1rem; font-weight: 600; color: var(--mut); }
.det__tit b { color: var(--m-ink); font-weight: 700; }
.det__sym { font: 500 2.26rem/1.2 var(--serif); letter-spacing: 0; white-space: nowrap; }
.det__ins { display: flex; flex-wrap: wrap; gap: 5px; }
.det__var { font-size: .9375rem; color: var(--mut); line-height: 1.3; cursor: help; border-bottom: 1px dotted var(--line2); }
.det__var b { color: var(--ink); font-weight: 600; }
.det__p { font-size: 1.05rem; line-height: 1.5; color: var(--ink); max-width: 60ch; }

.cn-l { display: flex; flex-wrap: nowrap; gap: 6px 18px; }
.cn { display: flex; flex-direction: column; }
.cn b { font: 500 1.72rem/1.2 var(--serif); }
.cn small { font-size: 1rem; color: var(--mut); font-weight: 600; line-height: 1.2; }
.vars { display: grid; gap: 2px; font-size: .9375rem; line-height: 1.3; color: var(--mut); margin-top: 6px; }
.vars b { color: var(--ink); font-weight: 600; }

.esc { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.esc li { font: 500 1.43rem/1.2 var(--serif); text-align: center; padding: 10px 0 11px; border-radius: 10px; white-space: nowrap; color: var(--mut); border: 1px dashed var(--line2); }
.esc .esc--ac { color: var(--ink); background: color-mix(in srgb, var(--m) 24%, transparent); border: 1px solid transparent; }
.esc .esc--r { background: var(--m-solid); color: var(--on-solid); }

.tns { display: flex; flex-wrap: wrap; gap: 8px; }
.tn { position: relative; display: inline-flex; align-items: baseline; gap: .4rem; min-height: 2.2rem; padding: 4px .7rem 5px; border-radius: 9px; border: 1px solid var(--m-ink); cursor: pointer; transition: background .15s, transform .12s, box-shadow .15s; }
.tn:hover { background: color-mix(in srgb, var(--m) 18%, transparent); }
.tn:active { transform: translateY(1px); }
/* marca de seleccionada: insignia en la esquina, no ocupa ancho (los conmutadores no cambian de tamaño al marcarse) */
.tn__ck { display: none; position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 3.5px; border-radius: 50%; background: var(--ink); color: var(--bg); box-shadow: 0 0 0 2px var(--sf); fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.tn[aria-pressed="true"] .tn__ck { display: block; }
.tn__no { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; align-self: center; flex: none; }
.tn--ok[aria-pressed="true"] { background: var(--m-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 30%, transparent); }
.tn--ok[aria-pressed="true"] b, .tn--ok[aria-pressed="true"] > span { color: var(--on-solid); }
.tn--av[aria-pressed="true"] { background: color-mix(in srgb, var(--ink) 15%, transparent); border-color: var(--ink); }
.tn--av[aria-pressed="true"] b, .tn--av[aria-pressed="true"] > span { color: var(--ink); }
.tn.suena { background: var(--m-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 35%, transparent); }
.tn.suena b, .tn.suena > span { color: var(--on-solid); }
.tn--av.suena { background: var(--sf2); box-shadow: none; }
.tn--av.suena b, .tn--av.suena > span { color: var(--ink); }
.tn b { font-size: .9375rem; font-weight: 700; color: var(--m-ink); }
.tn > span:not(.sr) { font: 500 1.26rem/1.2 var(--serif); }
.tn--av { border-style: dashed; border-color: var(--line2); color: var(--mut); background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--ink) 6%, transparent) 5px 6px); }
.tn--av b { color: var(--mut); }
.vacio { color: var(--mut); font-size: .95rem; }

.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; background: color-mix(in srgb, var(--bg) 50%, transparent); }
.seg button { min-height: 2rem; padding: 0 .85rem; border-radius: 8px; font-weight: 600; font-size: .95rem; color: var(--mut); transition: background .2s, color .2s; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.seg button:not([aria-checked="true"]):hover { color: var(--ink); }


/* ---------- teclado (franja inferior) ---------- */
.teclado { position: sticky; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line); }
.teclado__in { max-width: 1560px; margin-inline: auto; padding: 6px 22px 8px; }
.teclado__top { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 20px; flex-wrap: wrap; margin-bottom: 4px; }
.teclado__info { display: flex; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; font-size: 1rem; min-height: 1.6rem; }
.teclado__info strong { font: 500 1.26rem/1.2 var(--serif); }
.teclado__info span { font-weight: 500; }
.teclado__svg { width: 100%; }
.teclado__svg svg { width: 100%; height: auto; overflow: visible; }
.leyenda { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: .875rem; color: var(--mut); }
.leyenda li { display: flex; align-items: center; gap: .4rem; }
.lg { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.lg--esc { background: var(--kw-on); box-shadow: inset 0 0 0 1px var(--line2); }
.lg--ton { background: var(--m-solid); }
.lg--car { width: 11px; height: 11px; background: var(--ink); transform: rotate(45deg) scale(.85); border-radius: 1px; }

.k rect { stroke: var(--kline); stroke-width: 1; transition: fill .25s ease, filter .12s; }
.k--w rect { fill: var(--kw-off); }
.k--b rect { fill: var(--kb-off); stroke: none; }
.k--w.in-sc rect { fill: var(--kw-on); }
.k--b.in-sc rect { fill: var(--kb-on); }
.k.ton rect { fill: var(--m-solid) !important; }
.k.sonando rect { filter: brightness(1.28) saturate(1.2); }
.k.sonando-t rect { stroke: var(--ink); stroke-width: 3px; }
.k.sonando-av rect { stroke: var(--ink); stroke-width: 2px; stroke-dasharray: 4 3; opacity: .75; }
.k__t { display: none; font: 600 13px/1 'Instrument Sans', sans-serif; pointer-events: none; }
.k.lab .k__t { display: block; }
.k--w .k__t { fill: var(--kt-w); }
.k--b .k__t { fill: var(--kt-b); font-size: 12.5px; }
.k.ton .k__t { fill: var(--on-solid); }
.k__t .acc { font-size: 1.45em; font-weight: 400; }
.k__car { display: none; }
.k.car .k__car { display: block; }
.k--w .k__car { fill: var(--kdia-w); } .k--b .k__car { fill: var(--kdia-b); }
.k.ton .k__car { fill: var(--on-solid); }

/* ---------- constructor de progresiones ---------- */
.constructor { background: var(--sf); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px 10px 18px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 18px; align-items: center; }
.cons__tit { font: 500 1.26rem/1.2 var(--serif); }
.cons__fila { position: relative; display: flex; gap: 8px; align-items: stretch; height: 4.4rem; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 7px; scrollbar-width: thin; }
.cons__ctl { display: grid; gap: 6px; justify-items: end; align-content: center; }
.cons__btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tempo { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; color: var(--mut); padding-left: 6px; }
.tempo input { width: 90px; accent-color: var(--m-solid); height: 2rem; cursor: pointer; }
.tempo output { color: var(--ink); min-width: 4.2ch; font-weight: 600; }
.seg--s button { min-height: 1.9rem; }

.pc { position: relative; flex: 0 0 auto; display: flex; align-items: stretch; background: var(--sf2); border: 1px solid transparent; border-radius: 12px; transition: transform .2s ease, background .2s, border-color .2s, box-shadow .2s; user-select: none; }
.pc:hover { border-color: var(--line2); }
.pc__g { width: 20px; display: grid; place-items: center; color: var(--mut); cursor: grab; touch-action: none; border-radius: 12px 0 0 12px; }
.pc__g svg { width: 8px; height: 14px; fill: currentColor; }
.pc__p { width: 1.9rem; align-self: center; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); margin: 0 2px 0 -2px; flex: none; transition: opacity .2s; }
.pc__p:hover { opacity: .8; }
.pc__p svg { width: 12px; height: 12px; fill: currentColor; }
.pc.suena .pc__p { background: var(--on-solid); color: var(--m-solid); }
.pc__main { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 0; padding: 2px 6px 2px 2px; min-width: 4.6rem; text-align: left; border-radius: 8px; cursor: pointer; }
.pc__s { font: 500 1.47rem/1.2 var(--serif); white-space: nowrap; letter-spacing: 0; }
.pc__ac { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 3px 4px 3px 0; }
.pc__t, .pc__x { width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 8px; color: var(--mut); }
.pc__t:hover, .pc__x:hover { color: var(--ink); background: var(--line); }
.pc__t svg, .pc__x svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pc--ten { background: color-mix(in srgb, var(--m) 20%, var(--sf2)); }
.pc--av { background: transparent; border: 1px dashed var(--line2); }
.pc--av .pc__s { color: var(--mut); }
.pc--aus { opacity: .55; border: 1px dashed var(--line2); background: transparent; }
.pc.suena { background: var(--m-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 35%, transparent); }
.pc.suena .pc__s, .pc.suena .pc__g, .pc.suena .pc__t, .pc.suena .pc__x { color: var(--on-solid); }
.pc.arrastrando { z-index: 5; transition: none; box-shadow: 0 12px 26px rgba(0, 0, 0, .35); cursor: grabbing; border-color: var(--m); }
.cons__fila.arrastrando .pc:not(.arrastrando) { pointer-events: none; }
.cons__fila.arrastrando, .cons__fila.arrastrando * { cursor: grabbing; }
.pc-ind { position: absolute; top: 2px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--m-solid); pointer-events: none; transition: left .12s ease; z-index: 4; }
.pc-vacio { color: var(--mut); align-self: center; font-size: .95rem; }

.menu { position: fixed; z-index: 70; background: var(--sf); border: 1px solid var(--line2); border-radius: 14px; padding: 12px 14px 14px; box-shadow: 0 16px 48px rgba(0, 0, 0, .3); max-width: min(380px, calc(100vw - 16px)); }
.menu__tit { font-size: .9375rem; font-weight: 600; color: var(--mut); margin-bottom: 8px; }
.menu__tit strong { color: var(--ink); font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.menu__tit--2 { margin-top: 12px; }
.menu__opts { display: flex; flex-wrap: wrap; gap: 6px; }
.menu .tn > span:not(.sr) { font: 500 1.26rem/1.2 var(--serif); }
.menu .tn:first-child > span { font: 600 .95rem 'Instrument Sans', sans-serif; }
.menu .tn--clr[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.menu .tn--clr[aria-pressed="true"] > span { color: var(--bg); }

.aviso { position: fixed; left: 50%; top: 66px; transform: translate(-50%, -12px); background: var(--ink); color: var(--bg); padding: .65rem 1.1rem; border-radius: 10px; font-weight: 600; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 90; max-width: calc(100vw - 2rem); text-align: center; }
.aviso.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tamaños según el alto de la pantalla (siempre una sola pantalla en escritorio) ---------- */
@media (min-width: 1180px) and (min-height: 880px) { html { font-size: 17px; } }
@media (min-width: 1180px) and (max-height: 779px) {
  html { font-size: 15px; }
  main { gap: 8px; padding-block: 8px; }
  .top { padding-block: 6px; }
  .regla { margin-top: 8px; }
  .banda { padding: 10px 22px; }
  .deg__cab { padding: 10px 13px 9px; gap: 2px; }
  .deg__ins { margin-top: 5px; min-height: 1.4rem; }
  .detalle { padding: 12px 24px 12px; gap: 10px; }
  .det__h { margin-bottom: 6px; }
  .det__h--v { margin-top: 9px; }
  .esc li { padding: 7px 0 8px; }
  .tn { min-height: 2rem; padding-block: 2px; }
  .btn { min-height: 2.1rem; }
  .cons__fila { height: 3.8rem; }
  .constructor { padding: 8px 16px 6px 18px; }
  .teclado__in { padding-top: 4px; padding-bottom: 6px; }
  .teclado__top { margin-bottom: 2px; }
}

/* ---------- ancho medio: la pantalla pasa a desplazarse ---------- */
@media (max-width: 1179px) {
  .lista { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .det__cols { grid-template-columns: 1fr 1fr; gap: 14px 24px; }
  .det__col, .det__col:first-child { border-left: 0; padding-left: 0; }
  .det__col--esc { grid-column: 1 / -1; order: 5; }
}
@media (max-width: 899px) {
  .top { flex-wrap: wrap; }
  .campos { order: 3; flex: 1 1 100%; margin-left: 0; }
  .banda { grid-template-columns: 1fr; }
  .banda__info { border-left: 0; padding-left: 0; border-top: 1px solid var(--line2); padding-top: 10px; }
}

/* ---------- movil: versión propia con pestañas inferiores (vertical y horizontal de teléfono) ---------- */
.tabs, .sheet { display: none; }
@media (max-width: 699px), (max-height: 520px) and (max-width: 1000px) {
  :root { --tabh: 60px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --pad: 14px; }
  html { font-size: 16px; }
  body { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--tabh) + var(--safe-b)); }

  /* barra superior: logo + tónica + escala (+ enarmónica), todo a 48 px */
  .top { position: sticky; top: 0; z-index: 40; background: var(--bg); gap: 8px; flex-wrap: nowrap; padding: calc(var(--safe-t) + 8px) calc(var(--pad) + var(--safe-r)) 8px calc(var(--pad) + var(--safe-l)); }
  .marca { min-width: 44px; min-height: 48px; justify-content: center; }
  .marca__nombre { display: none; }
  .marca__logo { width: 28px; height: 28px; }
  .campos { order: 0; flex: 1 1 auto; margin: 0; gap: 8px; min-width: 0; flex-wrap: nowrap; }
  .campo { flex: 0 0 auto; display: block; }
  .campo--modo { flex: 1 1 auto; min-width: 0; }
  .campo__t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sel select { min-height: 48px; font-size: 1.2rem; }
  .sel--ton select { width: 5.8rem; }
  .sel--modo select { width: 100%; }
  .enh { min-height: 48px; min-width: 48px; padding: 0 .75rem; flex: 0 0 auto; }

  main { flex: 0 0 auto; padding: 14px calc(var(--pad) + var(--safe-r)) 18px calc(var(--pad) + var(--safe-l)); gap: 16px; }

  /* una sección por pestaña */
  body[data-tab="escala"] #grados, body[data-tab="escala"] #constructor,
  body[data-tab="acordes"] .banda, body[data-tab="acordes"] #constructor, body[data-tab="acordes"] .teclado,
  body[data-tab="progresion"] .banda, body[data-tab="progresion"] #grados, body[data-tab="progresion"] .teclado { display: none; }

  /* escala: banda y piano */
  .banda { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .banda__tit { gap: 10px 14px; }
  .titulo { font-size: 2.1rem; white-space: normal; }
  .btn, .btn--s { min-height: 48px; font-size: 1rem; padding: 0 1.1rem; }
  .regla { margin-top: 10px; }
  .nota__n { font-size: 1.3rem; }
  .nota__f { font-size: .875rem; }
  .paso { font-size: .75rem; padding: 0 .1rem; }
  .banda__info { border-left: 0; padding-left: 0; border-top: 1px solid var(--line2); padding-top: 14px; gap: 14px; }
  .info__nota { grid-template-columns: auto minmax(0, 1fr); gap: 10px 28px; }
  .brillo__b { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; gap: 8px 6px; }
  .brillo__b button { min-height: 48px; justify-content: flex-end; font-size: .9375rem; }
  .brillo__s { height: 8px; }
  .teclado { position: static; background: transparent; border-top: 0; }
  .teclado__in { padding: 4px calc(var(--pad) + var(--safe-r)) 24px calc(var(--pad) + var(--safe-l)); }
  .teclado__top { flex-direction: column; gap: 8px; margin-bottom: 8px; }
  .teclado__info { flex-wrap: wrap; overflow: visible; font-size: 1rem; }
  .leyenda { display: flex; gap: 6px 16px; }
  .k__t { font-size: 11px; } .k--b .k__t { font-size: 10px; }

  /* acordes: carrusel de grados con snap y detalle debajo */
  .grados { gap: 14px; }
  .lista { display: flex; grid-template-columns: none; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; gap: 10px; margin-inline: calc(-1 * var(--pad)); padding: 4px var(--pad) 10px; scroll-padding-inline: var(--pad); scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .lista::-webkit-scrollbar { display: none; }
  .deg { flex: 0 0 min(66vw, 250px); scroll-snap-align: center; scroll-snap-stop: always; }
  .deg__cab { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 4px; min-height: 9.2rem; padding: 14px 14px 12px; }
  .deg__cif { min-width: 0; }
  .deg__sym { font-size: 2.2rem; }
  .deg__ea { margin-left: 0; }
  .deg__ins { flex-basis: auto; margin-top: 8px; min-height: 1.6rem; }
  .deg__ins:empty { display: block; }
  .ins { min-height: 1.75rem; padding: 0 .75rem; font-size: .9375rem; }
  .detalle { padding: 18px 16px 20px; gap: 18px; border-radius: 16px; margin: 0; }
  .det__cab { flex-direction: column; align-items: stretch; gap: 12px; }
  .det__id { gap: 8px 12px; }
  .det__sym { font-size: 2.5rem; }
  .det__var { display: block; flex-basis: 100%; }
  .det__act { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .det__act .seg { grid-column: 1 / -1; display: flex; }
  .det__act .seg button { flex: 1; }
  .det__act .btn { padding: 0 .4rem; }
  .det__cols { grid-template-columns: 1fr; gap: 18px; }
  .det__col, .det__col:first-child { border-left: 0; padding-left: 0; }
  .det__col + .det__col { border-top: 1px solid var(--line); padding-top: 18px; }
  .det__col--ten { flex-direction: column; gap: 16px; }
  .det__h { font-size: 1rem; margin-bottom: 10px; }
  .cn b { font-size: 2rem; }
  .cn small { font-size: 1rem; }
  .esc { gap: 5px; }
  .esc li { font-size: 1.35rem; padding: 11px 0 12px; }
  .tns { gap: 10px; }
  .tn { min-height: 48px; align-items: center; padding: 6px 1rem; border-radius: 12px; }
  .tn > span:not(.sr) { font-size: 1.45rem; }
  .tn b { font-size: 1rem; }
  .seg button { min-height: 44px; min-width: 44px; font-size: 1rem; }

  /* progresión */
  .constructor { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .cons__tit { font-size: 1.7rem; }
  .cons__fila { height: 7.2rem; margin-inline: -4px; padding-inline: 4px; }
  .pc__g { width: 26px; }
  .pc__s { font-size: 1.5rem; }
  .pc__main { min-height: 60px; min-width: 4.6rem; padding-right: 6px; }
  .pc__t, .pc__x { width: 44px; height: 44px; }
  .pc__p { width: 44px; height: 44px; margin: 0 6px 0 0; }
  .pc__p svg { width: 15px; height: 15px; }
  .pc__ac { padding: 2px 2px 2px 0; }
  .cons__ctl { justify-items: stretch; gap: 12px; }
  .cons__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; justify-content: stretch; }
  .cons__btns:last-child { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tempo { grid-column: 1 / -1; padding: 0; gap: 12px; font-size: 1rem; }
  .tempo input { flex: 1; width: auto; height: 44px; }
  .tempo output { min-width: 5.2ch; text-align: right; }
  .pc-vacio { font-size: 1rem; padding: 8px 0; }

  /* menú de tensiones: hoja inferior */
  .menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(var(--tabh) + var(--safe-b) + 8px); max-width: none; max-height: 62dvh; overflow: auto; border-radius: 18px; padding: 16px; }
  .menu .btn { min-height: 48px; flex: 1; }
  .menu .tn { min-height: 48px; }

  /* barra de pestañas */
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--sf); box-shadow: inset 0 1px 0 var(--line2); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l); }
  .tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tabh); font-size: .8125rem; font-weight: 600; color: var(--mut); transition: color .2s; }
  .tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabs button::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--m-solid); opacity: 0; transition: opacity .2s; }
  .tabs button[aria-current="page"], .tabs button[aria-expanded="true"] { color: var(--ink); }
  .tabs button[aria-current="page"]::before, .tabs button[aria-expanded="true"]::before { opacity: 1; }
  .tabs__n { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; border-radius: 999px; background: var(--m-solid); color: var(--on-solid); font-size: .75rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }

  /* ajustes: sonido, volumen, tema y enlace al alcance del pulgar */
  .sheet { display: block; position: fixed; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: calc(var(--tabh) + var(--safe-b) + 8px); z-index: 55; background: var(--sf); border: 1px solid var(--line2); border-radius: 18px; padding: 8px; box-shadow: 0 16px 48px rgba(0, 0, 0, .35); max-height: 70dvh; overflow: auto; }
  .sheet[hidden] { display: none; }
  .sheet .herram { flex-direction: column; align-items: stretch; margin: 0; gap: 2px; }
  .sheet .sonido { flex-direction: column; align-items: stretch; gap: 2px; }
  .sheet .btn-i { width: 100%; min-height: 52px; justify-content: flex-start; padding: 0 14px; gap: 14px; font-size: 1rem; border-radius: 12px; }
  .sheet .btn-i__t { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  .sheet .vol { align-items: center; gap: 12px; padding: 4px 14px 10px 14px; font-size: 1rem; color: var(--mut); font-weight: 600; }
  .sheet .vol .sr { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  .sheet .vol input { flex: 1; width: auto; height: 44px; }

  .aviso { top: auto; bottom: calc(var(--tabh) + var(--safe-b) + 14px); transform: translate(-50%, 12px); }
  .aviso.on { transform: translate(-50%, 0); }
}
/* teléfono en horizontal: más ancho útil, barras más bajas */
@media (max-height: 520px) and (max-width: 1000px) {
  :root { --tabh: 48px; }
  .top { position: static; padding-top: calc(var(--safe-t) + 4px); padding-bottom: 4px; }
  .tabs button { flex-direction: row; gap: 8px; }
  .banda { grid-template-columns: 1.2fr 1fr; }
  .banda__info { border-left: 1px solid var(--line2); padding-left: 22px; border-top: 0; padding-top: 0; }
  .deg { flex-basis: 200px; }
  .det__cols { grid-template-columns: 1fr 1fr; }
  .det__col--esc { grid-column: 1 / -1; order: 5; }
  .det__col + .det__col { border-top: 0; padding-top: 0; }
}

/* ---------- pantalla de inicio: pregunta la escala antes de mostrar nada ---------- */
.inicio { display: none; }
html[data-vista="inicio"] .inicio { display: grid; }
html[data-vista="inicio"] .top, html[data-vista="inicio"] main, html[data-vista="inicio"] .teclado, html[data-vista="inicio"] .tabs,
html[data-vista="inicio"] .sheet, html[data-vista="inicio"] .menu, html[data-vista="inicio"] .salto { display: none !important; }
html[data-vista="inicio"] body { padding-bottom: 0; }
.inicio { position: relative; flex: 1; min-height: 100vh; min-height: 100dvh; place-items: center; background: var(--hero); transition: background .7s ease, opacity .24s ease, transform .24s ease;
  padding: calc(28px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px)); }
.inicio.sale { opacity: 0; transform: translateY(-10px); }
.inicio__in { width: min(580px, 100%); display: grid; gap: 20px; }
.inicio__franja { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.inicio__franja i { display: block; height: 8px; border-radius: 4px; background: var(--m); }
.inicio__marca { display: flex; align-items: center; gap: .6rem; }
.inicio__marca .marca__logo { width: 1.7rem; height: 1.7rem; }
.inicio__nombre { font: 500 1.7rem/1.2 var(--serif); }
.inicio__h1 { font-size: 1rem; font-weight: 500; line-height: 1.4; color: var(--mut); margin-top: -10px; }
.inicio__tit { font: 500 clamp(2rem, 5.2vw, 3rem)/1.2 var(--serif); text-wrap: balance; }
.inicio__sub { color: var(--mut); font-size: 1.0625rem; line-height: 1.5; max-width: 44ch; }
.inicio__campos { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 14px; }
.inicio .campo { display: grid; gap: 8px; }
.inicio .campo__t { position: static; width: auto; height: auto; clip: auto; overflow: visible; font-size: .9375rem; }
.inicio .sel select { min-height: 56px; font-size: 1.4rem; }
.inicio .sel--ton select, .inicio .sel--modo select { width: 100%; }
.inicio .sel--modo select { padding-left: 2.2rem; }
.inicio .sel--modo:not([data-modo]) select { padding-left: 1rem; }
.inicio .sel__pt { opacity: 0; left: .95rem; transition: opacity .2s, background .5s; }
.inicio .sel[data-modo] .sel__pt { opacity: 1; }
.inicio select:invalid { color: var(--mut); }
.inicio__vista { min-height: 2.8rem; display: flex; align-items: center; color: var(--mut); font-size: 1rem; }
.inicio__vista.listo { font: 500 2rem/1.2 var(--serif); color: var(--ink); }
.inicio__ir { min-height: 56px; width: 100%; font-size: 1.1rem; }
.inicio__tema { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); min-width: 48px; min-height: 48px; }
.inicio__como { justify-self: start; min-height: 48px; padding: 0 .25rem; font-weight: 600; font-size: 1rem; color: var(--mut); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: .3em; }
.inicio__como:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ---------- ¿Cómo funciona? ---------- */
.como { padding: 0; border: 1px solid var(--line2); border-radius: 22px; background: var(--sf); color: var(--ink); width: min(620px, calc(100vw - 24px)); max-height: min(92vh, 92dvh); box-shadow: 0 24px 70px rgba(0, 0, 0, .4); overflow: hidden; margin: auto; }
.como[open] { display: flex; flex-direction: column; animation: entra .3s cubic-bezier(.2, .7, .2, 1) both; }
.como::backdrop { background: rgba(8, 10, 14, .6); }
.como__in { display: flex; flex-direction: column; min-height: 0; max-height: min(92vh, 92dvh); overflow: auto; padding: 18px 26px calc(18px + env(safe-area-inset-bottom, 0px)); }
.como__cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; position: sticky; top: -18px; background: var(--sf); padding: 4px 0 8px; z-index: 1; }
.como__cab h2 { font: 500 1.6rem/1.2 var(--serif); }
.como__x { min-width: 48px; min-height: 48px; margin-right: -8px; }
.como__lista { display: grid; gap: 10px; counter-reset: paso; }
.como__lista li { position: relative; padding-left: 44px; counter-increment: paso; }
.como__lista li::before { content: counter(paso); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--m-solid); color: var(--on-solid); font-weight: 700; font-size: .9375rem; }
.como__lista h3 { font: 500 1.125rem/1.3 var(--serif); margin-bottom: 1px; }
.como__lista p { color: var(--mut); font-size: .9375rem; line-height: 1.45; }
.como__pie { margin-top: 12px; }
.como__pie .btn { width: 100%; min-height: 50px; font-size: 1.05rem; }
@media (max-width: 699px) { .como__in { padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); } .como__cab h2 { font-size: 1.55rem; } }

html.entrando .top, html.entrando main, html.entrando .teclado, html.entrando .tabs { animation: entra .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-height: 520px) and (max-width: 1000px) {
  .inicio { align-items: center; }
  .inicio__in { width: min(900px, 100%); grid-template-columns: 1fr 1fr; column-gap: 36px; row-gap: 14px; align-items: center; }
  .inicio__franja, .inicio__marca, .inicio__tit, .inicio__sub { grid-column: 1; }
  .inicio__campos, .inicio__vista, .inicio__ir { grid-column: 2; }
  .inicio__franja { grid-row: 1; } .inicio__marca { grid-row: 2; } .inicio__tit { grid-row: 3; } .inicio__sub { grid-row: 4; }
  .inicio__campos { grid-row: 1 / span 2; align-self: end; } .inicio__vista { grid-row: 3; } .inicio__ir { grid-row: 4; }
}

/* ---------- huecos de anuncios (desactivados por defecto: data-ads="off" => nada ocupa espacio) ----------
   Cada hueco reserva un tamaño fijo para evitar saltos de layout. Solo se muestra donde cabe sin romper la pantalla única,
   lejos de botones y sin tapar piano ni menús. */
.ad-slot { display: none; }
.ad-slot__t { display: block; font-size: .75rem; line-height: 1.2; letter-spacing: .02em; color: var(--mut); margin-bottom: 4px; text-align: center; }
.ad-slot__box { margin-inline: auto; display: grid; place-items: center; color: var(--mut); font-size: .875rem; font-weight: 600; border: 1px dashed transparent; border-radius: 8px; overflow: hidden; }
html[data-ads="prueba"] .ad-slot__box { border-color: var(--line2); background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--ink) 5%, transparent) 8px 9px); }
html[data-ads="prueba"] .ad-slot__box::after { content: attr(data-tam); }
html[data-ads="on"] .ad-slot__box { border-color: color-mix(in srgb, var(--line) 60%, transparent); }
.ad-slot[data-pos="riel"] .ad-slot__box { width: 160px; height: 600px; }
.ad-slot[data-pos="franja"] .ad-slot__box { width: 728px; max-width: 100%; height: 90px; }
.ad-slot[data-pos="inicio"] .ad-slot__box { width: 300px; height: 250px; }
.ad-slot[data-pos="movil"] .ad-slot__box { width: 320px; max-width: 100%; height: 50px; }

/* escritorio ancho y alto: un solo raíl derecho 160x600, fuera del área de trabajo (el contenido cede ese ancho) */
@media (min-width: 1360px) and (min-height: 860px) {
  html:not([data-ads="off"])[data-vista="app"] .ad-slot[data-pos="riel"] { display: block; position: fixed; right: 20px; top: 96px; width: 160px; z-index: 5; }
  html:not([data-ads="off"])[data-vista="app"] main { padding-right: 206px; }
}
/* escritorio algo más estrecho pero muy alto: una franja fina sobre el piano */
@media (min-width: 1180px) and (max-width: 1359px) and (min-height: 1000px) {
  html:not([data-ads="off"])[data-vista="app"] .ad-slot[data-pos="franja"] { display: block; margin: 0 auto 14px; }
}
/* pantalla de inicio: bajo el formulario, solo si cabe */
html[data-vista="inicio"] .inicio { align-content: center; row-gap: 24px; }
@media (min-height: 960px) {
  html:not([data-ads="off"])[data-vista="inicio"] .ad-slot[data-pos="inicio"] { display: block; }
}
@media (max-width: 699px) {
  html:not([data-ads="off"])[data-vista="inicio"] .ad-slot[data-pos="inicio"] { display: none; }
}
@media (max-width: 699px) and (min-height: 760px) {
  html:not([data-ads="off"])[data-vista="inicio"] .ad-slot[data-pos="inicio"] { display: block; }
  .ad-slot[data-pos="inicio"] .ad-slot__box { width: 320px; height: 100px; }
}
/* móvil: banner 320x50 al final del contenido, lejos de los botones y de la barra de pestañas (sin toques accidentales) */
@media (max-width: 699px), (max-height: 520px) and (max-width: 1000px) {
  html:not([data-ads="off"])[data-vista="app"] .ad-slot[data-pos="movil"] { display: block; margin: 36px auto 40px; padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .sel select { border: 2px solid ButtonText; }
}
