/* MundoInstrumento · herramientas (xilófono online, afinador y acordes de ukelele).
   Usa las variables de styles.css; el modo oscuro llega solo por ellas, salvo los colores propios de abajo. */
.hx { --neg: #26313d; --neg-line: transparent; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.6rem); margin: 1.2rem 0 1.6rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hx { --neg: #070b10; --neg-line: rgba(255, 255, 255, .22); } }
:root[data-theme="dark"] .hx { --neg: #070b10; --neg-line: rgba(255, 255, 255, .22); }
.hx ul, .hx ol { list-style: none; margin: 0; padding: 0; }
.hx .hx-ac-grid > li, .hx .hx-canc-lista > li { margin: 0; }
.hx h3 { margin: 1.8rem 0 .5rem; font-size: 1.2rem; }
.hx p { margin-bottom: .8rem; }
.hx .note { margin: .6rem 0 0; }
.hx-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hx-sub { margin-top: 1.6rem; }
.hx-sub-p { color: var(--ink-2); }

/* controles comunes */
.hx-controles { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.4rem; margin-bottom: 1rem; }
.hx-grupo { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hx-lbl { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hx-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.hx-seg button { padding: .45rem .85rem; border-radius: 10px; font-weight: 700; font-size: .88rem; color: var(--ink); line-height: 1.2; transition: background-color .15s, color .15s; }
.hx-seg button:hover { background: var(--surface); }
.hx-seg button[aria-pressed="true"] { background: var(--solid); color: #fff; }
.hx-vol input { width: 120px; accent-color: var(--accent); }
.hx select:not(.is-enhanced) { padding: .55rem 2.2rem .55rem 1rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center / 16px; color: var(--ink); font-weight: 700; appearance: none; -webkit-appearance: none; max-width: 100%; }
.hx .dd-list { left: 0; right: auto; }
.hx-estado { margin: .9rem 0 .2rem; padding: .65rem .9rem; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-weight: 600; font-size: .95rem; }
.hx button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hx button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ------------------------------------------------------------ xilófono -- */
.hx-c { --lc: #e53935; } .hx-d { --lc: #ef6c00; } .hx-e { --lc: #f7c514; --lt: #3a2a00; } .hx-f { --lc: #3d9a40; }
.hx-g { --lc: #0090a0; } .hx-a { --lc: #3f51b5; } .hx-b { --lc: #8e24aa; } .hx-neg { --lc: var(--neg); }
.hx-xilo-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding: 6px 2px 10px; margin: 0 -2px; }
.hx-xilo-grid { --hn: 210px; --sn: 6.5px; --hs: 128px; --ss: 3.5px; display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); column-gap: 4px; row-gap: 10px; min-width: 620px; padding: 18px 14px 16px; border-radius: 18px; background: linear-gradient(180deg, transparent 33%, rgba(120, 80, 40, .14) 33%, rgba(120, 80, 40, .14) calc(33% + 3px), transparent calc(33% + 3px), transparent 82%, rgba(120, 80, 40, .14) 82%, rgba(120, 80, 40, .14) calc(82% + 3px), transparent calc(82% + 3px)), var(--surface-2); border: 1px solid var(--line); }
.hx-lam { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; width: 100%; padding: 0 0 26px; border-radius: 9px; background-color: var(--lc); background-image: linear-gradient(90deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .1)); color: var(--lt, #fff); font-weight: 800; font-size: .9rem; line-height: 1.1; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), 0 2px 5px rgba(14, 42, 64, .18); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .07s, filter .07s; }
.hx-lam::before, .hx-lam::after { content: ""; position: absolute; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: rgba(0, 0, 0, .28); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.hx-lam::before { top: 12px; } .hx-lam::after { bottom: 10px; }
.hx-lam:not(.hx-neg) { grid-row: 2; align-self: start; height: calc(var(--hn) - var(--k) * var(--sn)); }
.hx-lam.hx-neg { grid-row: 1; align-self: end; height: calc(var(--hs) - var(--k) * var(--ss)); padding-bottom: 22px; width: 86%; justify-self: center; font-size: .78rem; border: 1px solid var(--neg-line); }
.hx-lam kbd { font: inherit; font-size: .7rem; font-weight: 700; opacity: .78; }
.hx-lam:hover { filter: brightness(1.08); }
.hx-lam.is-hit { transform: translateY(3px) scale(.97); filter: brightness(1.3); }
.hx-lam:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.hx-lam.is-next { box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 6px var(--ink), 0 0 18px 6px var(--lc); animation: hx-pulso 1s ease-in-out infinite; z-index: 1; }
@keyframes hx-pulso { 50% { filter: brightness(1.22); } }
.is-metal .hx-lam { background-image: linear-gradient(90deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .05) 30%, rgba(255, 255, 255, .3) 55%, rgba(0, 0, 0, .14)); }
.hx-desliza { display: none; font-size: .82rem; color: var(--muted); margin: 0; }
.hx-canc-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }
.hx-canc-ctl .hx-grupo { margin-right: .4rem; }
.hx-canciones { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: .2rem; }
.hx-canc-lista { display: grid; gap: .2rem; }
.hx-cancion { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.hx-cancion:last-child { border-bottom: 0; }
.hx-cancion h4 { display: inline; font-family: var(--display); font-size: 1.08rem; color: var(--ink); margin-right: .6rem; }
.hx-tocar { margin: 0 0 .2rem; vertical-align: middle; }
.hx-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .6rem 0 0; }
.hx-chip { position: relative; display: inline-block; min-width: 2.5em; padding: .22em .45em; border-radius: 6px; background: var(--lc); color: var(--lt, #fff); font-size: .8rem; font-weight: 800; text-align: center; line-height: 1.3; }
.hx-chip.hx-neg { border: 1px solid var(--neg-line); }
.hx-chip.hx-alta::after { content: ""; position: absolute; top: -4px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ink); border: 1.5px solid var(--surface); }
@media (max-width: 719px) {
  .hx-xilo-grid { --hn: 180px; --sn: 5px; --hs: 112px; --ss: 3px; min-width: 640px; padding: 14px 10px 12px; }
  .hx-desliza { display: block; }
  .hx-vol input { width: 100px; }
}
@media (hover: none) { .hx-lam kbd { display: none; } .hx-lam { padding-bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .hx-lam.is-next { animation: none; } .hx-lam, .hx-acorde { transition: none; } }

/* ------------------------------------------------------------ afinador -- */
.hx-afin-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 1.6rem; align-items: center; }
.hx-afin-med { text-align: center; padding: .8rem .6rem .6rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); transition: background-color .2s, border-color .2s; }
.hx-medidor { width: 100%; max-width: 320px; margin: 0 auto; overflow: visible; }
.hx-arco { fill: none; stroke: var(--line-2); stroke-width: 10; stroke-linecap: round; }
.hx-arco-ok { fill: none; stroke: var(--ok); stroke-width: 10; }
.hx-ticks line { stroke: var(--muted); stroke-width: 1.5; }
.hx-med-t { fill: var(--muted); font-size: 11px; font-weight: 700; font-family: var(--sans); }
.hx-aguja { transform-box: view-box; transform-origin: 120px 128px; transition: transform .14s ease-out; }
.hx-aguja line { stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.hx-eje { fill: var(--ink); }
.hx-afin-med:not(.is-on) .hx-aguja { opacity: .35; }
.hx-afin-med.is-ok { background: var(--ok-soft); border-color: var(--ok); }
.hx-afin-med.is-ok .hx-aguja line, .hx-afin-med.is-ok .hx-eje { stroke: var(--ok); fill: var(--ok); }
.hx-afin-nota { font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 600; color: var(--ink); margin: .2rem 0 0 !important; line-height: 1.1; }
.hx-afin-med.is-ok .hx-afin-nota { color: var(--ok-text); }
.hx-afin-cents { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; margin: .2rem 0 0 !important; }
.hx-afin-msg { font-weight: 700; font-size: 1.05rem; color: var(--ink); min-height: 3.2em; }
.hx-afin-det { color: var(--ink-2); font-size: .92rem; }
.hx-cuerdas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.hx-cuerda { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .75rem .3rem; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink); transition: border-color .15s, background-color .15s, box-shadow .15s; }
.hx-cuerda:hover { border-color: var(--solid); }
.hx-c-num { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hx-c-nom { font-family: var(--display); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.hx-c-cif { font-weight: 800; color: var(--accent-2); font-size: .9rem; }
.hx-cuerda[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.hx-cuerda.is-detect { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hx-check { display: inline-flex; align-items: center; gap: .5rem; margin-top: .9rem; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
.hx-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
@media (max-width: 719px) {
  .hx-afin-main { grid-template-columns: 1fr; }
  .hx-afin-msg { min-height: 0; }
  .hx-cuerdas { gap: .4rem; }
  .hx-c-num { font-size: .64rem; letter-spacing: 0; }
}

/* ------------------------------------------------------------- acordes -- */
.hx-ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: .7rem; margin-top: 1rem; }
.hx-ac-grid > li[hidden], .hx-ac-tabla tr[hidden] { display: none; }
.hx-acorde { display: flex; flex-direction: column; align-items: center; width: 100%; height: 100%; padding: .6rem .4rem .75rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; }
.hx-acorde:hover { border-color: var(--solid); transform: translateY(-1px); box-shadow: var(--shadow); }
.hx-acorde.is-hit { animation: hx-toque .35s ease-out; }
@keyframes hx-toque { 30% { transform: scale(.96); border-color: var(--accent); } }
.hx-diag { width: 100%; max-width: 104px; height: auto; color: var(--ink); }
.hx-d-punto { fill: var(--solid); }
.hx-d-dedo { fill: #fff; font-size: 10px; font-weight: 800; text-anchor: middle; font-family: var(--sans); }
.hx-d-aire { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.hx-d-x { fill: var(--ink); font-size: 13px; text-anchor: middle; font-weight: 700; }
.hx-ac-nom { font-weight: 700; font-size: .86rem; line-height: 1.2; text-align: center; margin-top: .2rem; }
.hx-ac-cif { font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: var(--accent-2); line-height: 1.1; }
.hx-ac-tabla { font-size: .9rem; }
.hx-ac-tabla th, .hx-ac-tabla td { padding: .6rem .7rem; }
.hx-ac-tabla thead th { background: var(--solid); color: #fff; font-weight: 600; white-space: nowrap; text-align: center; }
.hx-ac-tabla thead th:first-child { text-align: left; }
.hx-ac-tabla th[scope="row"] { width: auto; white-space: nowrap; background: none; }
.hx-ac-tabla tbody tr:nth-child(even) { background: var(--row-alt); }
.hx-ac-tabla td { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hx-ac-tabla td:last-child { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; }
@media (max-width: 719px) {
  .hx-ac-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
  .hx-ac-cif { font-size: 1.05rem; }
  .hx-ac-tabla { font-size: .8rem; }
  .hx-ac-tabla th, .hx-ac-tabla td { padding: .5rem .4rem; }
  .hx-chip { font-size: .74rem; min-width: 2.3em; }
}
@media print { .hx { box-shadow: none; } .hx-controles, .hx-canc-ctl, .hx-tocar, .hx-estado, [data-mic] { display: none !important; } }
