:root {
  color-scheme: light;
  --fondo: #f4f2eb;
  --papel: #fffefa;
  --verde: #24382b;
  --verde-fuerte: #36583d;
  --tinta: #222c24;
  --suave: #575d52;
  --borde: #dcded1;
  --madera: #eee3ca;
  --cuerda: #8b795e;
  --traste: #c4b89b;
  --nota: #f1bd64;
  --relativa: #684393;
  font-family: system-ui, sans-serif;
  color: var(--tinta);
  background: var(--fondo);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.ancho { width: min(100% - 24px, 950px); margin-inline: auto; }
.cabecera { background: var(--verde); color: #fffefa; }
.cabecera .ancho {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 2px 18px; padding-block: 15px;
}
.marca { display: flex; align-items: center; gap: 9px; }
.marca img { border-radius: 11px; }
h1 { margin: 0; font-size: clamp(1.55rem, 5vw, 2.25rem); line-height: 1.1; letter-spacing: -.035em; }
.afinacion { color: #e1e8d9; font-size: .875rem; }
main { padding-block: 22px 36px; }
button, input, select { font: inherit; color: inherit; }
button, input, select {
  min-height: 44px; padding: 7px 12px; background: var(--papel);
  border: 1px solid #aeb5a6; border-radius: 8px;
}
button { font-weight: 650; cursor: pointer; }
button:disabled { color: #686c60; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #365c47; outline-offset: 2px;
}
button:not(:disabled):hover { border-color: var(--verde-fuerte); }
select {
  appearance: none;
  padding-right: 27px;
  background-image: linear-gradient(45deg, transparent 50%, var(--verde) 50%), linear-gradient(135deg, var(--verde) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.modos {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px;
  border: 1px solid var(--borde); background: #e9eadf; border-radius: 11px;
}
.modos button { background: transparent; border-color: transparent; }
.modos button[aria-pressed="true"], .principal { background: var(--verde); color: #fffefa; border-color: var(--verde); }
.principal:not(:disabled):hover { background: var(--verde-fuerte); }
.pizarra, .exportacion { background: var(--papel); border: 1px solid var(--borde); border-radius: 13px; }
.pizarra { padding: clamp(6px, 2.8vw, 24px); }
.controles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  align-items: end; gap: 10px; margin-bottom: 18px;
}
label { display: block; min-width: 0; font-size: .875rem; font-weight: 650; }
label span { color: var(--suave); font-weight: 400; }
label select, label input { display: block; width: 100%; margin-top: 4px; font-size: 1rem; font-weight: 400; }
.texto { justify-self: end; background: transparent; border-color: transparent; }
.tablero {
  display: grid; grid-template-columns: clamp(29px, 8vw, 62px) repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(46px, auto);
}
.diapason-scroll { overflow-x: auto; }
main.ancho:has(.tablero.completo) { width: min(100% - 24px, 1800px); }
.tablero.completo {
  grid-template-columns: 42px repeat(25, minmax(36px, 1fr));
}
.tablero.completo .nota { font-size: .75rem; }
.tablero.completo .cuerda { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--papel); }
.tablero button.celda:active { background: #dcc89d; }
.tablero .traste, .tablero .cuerda { display: grid; place-items: center; color: var(--suave); }
.tablero .traste { align-self: end; padding-bottom: 6px; font-size: .875rem; font-variant-numeric: tabular-nums; }
.tablero .cuerda { align-content: center; font-size: .75rem; line-height: 1.1; }
.tablero .cuerda b { color: var(--tinta); }
.tablero .celda {
  display: grid; place-items: center; position: relative; padding: 0;
  height: 100%; min-width: 0; border: 0; border-inline-end: 1px solid var(--traste);
  border-radius: 0; background: var(--madera); user-select: none;
}
.tablero button.celda:not(:disabled):hover { background: #e6d4ad; border-color: var(--traste); }
.tablero button.celda:focus-visible { z-index: 1; outline-offset: -2px; }
.tablero .aire { border-inline-end: 3px solid #8b795e; background: #f3ecd9; }
.tablero .celda::before {
  content: ""; position: absolute; inset-inline: 0; top: 50%; height: 1px; background: var(--cuerda);
}
.tablero .grave::before { height: 2px; }
.tablero .fondo-guia::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #aa9879; bottom: 10%; left: calc(50% - 2.5px);
}
.nota {
  z-index: 0; min-width: 28px; padding: 4px 2px; border-radius: 50px;
  white-space: nowrap; font-size: clamp(.68rem, 2.8vw, .875rem); font-weight: 750;
  line-height: 1.2; text-align: center; background: var(--nota); color: #2f2618;
}
.nota.tonica {
  background: var(--verde-fuerte); color: #fffefa;
  outline: 1px solid var(--verde-fuerte); outline-offset: 2px;
}
.nota.relativa {
  background: var(--relativa); color: #fffefa;
  outline: 1px dashed var(--relativa); outline-offset: 2px;
}
.relativas { margin-top: 10px; }
.relativas button { font-size: .875rem; }
.relativas button[aria-pressed="true"] { border-color: var(--relativa); color: var(--relativa); }
.relativas p { margin: 10px 0 8px; color: var(--suave); font-size: .875rem; }
.relativas strong { color: var(--relativa); }
.posiciones { margin-top: 10px; }
.posiciones button { font-size: .875rem; }
.posiciones button[aria-pressed="true"] { background: var(--verde); color: var(--papel); }
#colores-posiciones { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 10px 0 0; }
#colores-posiciones .filtro-posicion {
  display: inline-flex; align-items: center; gap: 6px; padding-inline: 9px;
}
#colores-posiciones .filtro-posicion[aria-pressed="true"] {
  background: var(--verde); color: var(--papel); border-color: var(--verde);
}
.muestra-posicion { width: 13px; height: 13px; border-radius: 50%; }
.posiciones p { margin: 8px 0 0; color: var(--suave); font-size: .875rem; }
#detalle-posicion:empty { display: none; }
#detalle-posicion { font-weight: 650; color: var(--tinta); }
.nota.posicion { color: white; }
.nota.posicion.tonica { outline-color: var(--tinta); }
.nota.posicion.puente { box-shadow: inset 0 0 0 1px #fffefa; }
.detalle { min-height: 1.4em; margin-top: 12px; color: var(--suave); font-size: .875rem; }
.detalle strong { color: var(--verde-fuerte); }
.exportacion {
  display: flex; align-items: end; flex-wrap: wrap; gap: 10px 18px;
  padding: 14px clamp(8px, 2.8vw, 24px); margin-top: 12px;
}
.exportacion label { flex: 1 1 255px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; }
#estado-exportacion { flex-basis: 100%; margin: 0; color: var(--suave); font-size: .875rem; }
#estado-exportacion:empty { display: none; }
@media (max-width: 420px) {
  main { padding-top: 14px; }
  .controles { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 9px; }
  .tablero { grid-auto-rows: minmax(44px, auto); }
  .tablero .traste { font-size: .75rem; }
  select { font-size: .875rem !important; }
}
