/* teoriamusical-herramientas — tools.css */

/* ── Variables scoped a los wrappers (no contaminan el resto del sitio) ── */
.tm-metronomo-wrap,
.tm-afinador-wrap {
  --bg2:     #faf7f2;
  --bg3:     #f5f2ea;
  --border:  #e8e0cc;
  --gold:    #8b6914;
  --gold-lt: #b5872a;
  --gold-bg: #fdf8ee;
  --rust:    #a0522d;
  --red:     #c0392b;
  --teal:    #2a7a6e;
  --green:   #27ae60;
  --text:    #2c2416;
  --muted:   #6b5c3e;
  --shadow:  rgba(44,36,22,0.08);
}

/* Ocultar cabeceras internas (redundantes con el H1 de la página) */
.met-header,
.afin-header { display: none; }

/* METRÓNOMO ──────────────────────────────────────────────────────────────── */

  .tm-metronomo-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 0 40px;
  }

  /* ── GRID ── */
  .met-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .ctrl-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    grid-column: span 1;
    box-shadow: 0 2px 8px var(--shadow);
  }
  .ctrl-box.full { grid-column: span 2; }
  .ctrl-box.accent-box {
    border-color: var(--gold);
    box-shadow: 0 2px 12px rgba(139,105,20,0.12);
  }

  .box-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  }

  /* ── BPM ── */
  .bpm-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
  }
  .bpm-num {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 96px;
    font-weight: 700;
    line-height: 1;
    color: var(--gold);
    min-width: 160px;
    text-align: center;
    cursor: default;
    transition: color 0.1s;
    letter-spacing: -2px;
  }
  .bpm-btn {
    width: 42px; height: 42px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
    user-select: none;
  }
  .bpm-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }
  .bpm-btn:active { background: var(--gold); color: #fff; border-color: var(--gold); }

  .tempo-name {
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-style: italic;
    color: var(--rust);
    letter-spacing: 0.5px;
    margin-bottom: 14px;
  }

  .bpm-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    margin-bottom: 6px;
  }
  .bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(139,105,20,0.4);
  }
  .bpm-range-labels {
    display: flex;
    justify-content: space-between;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: var(--muted);
  }

  /* ── PENDULUM ── */
  .pendulum-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .pendulum-svg-wrap {
    width: 100%;
    max-width: 160px;
    aspect-ratio: 1/1.3;
    position: relative;
    margin: 0 auto;
    overflow: visible;
  }
  #pendulum-svg { width: 100%; height: 100%; overflow: visible; }
  .pend-rod { stroke: var(--border); stroke-width: 2.5; }
  .pend-ball {
    fill: var(--gold);
    filter: drop-shadow(0 2px 4px rgba(139,105,20,0.35));
    transition: fill 0.05s;
  }
  .pend-pivot { fill: var(--bg3); stroke: var(--border); stroke-width: 2; }

  /* ── BEAT BUTTONS ── */
  .beat-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
  }
  .beat-dot-wrap { cursor: pointer; }
  .beat-dot {
    width: 48px; height: 52px;
    border-radius: 8px;
    background: var(--bg3);
    border: 2px solid var(--border);
    transition: background 0.1s, border-color 0.1s, transform 0.06s, box-shadow 0.1s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    position: relative;
  }
  .beat-dot-num {
    font-family: ui-monospace, monospace;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
    pointer-events: none;
  }
  .dot-accent-label {
    font-family: ui-monospace, monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    pointer-events: none;
  }

  .beat-dot[data-accent="strong"] { border-color: var(--gold); background: var(--gold-bg); }
  .beat-dot[data-accent="strong"] .beat-dot-num { color: var(--gold); }
  .beat-dot[data-accent="strong"] .dot-accent-label { color: var(--gold); }
  .beat-dot[data-accent="medium"] { border-color: var(--rust); background: #f5ebe4; }
  .beat-dot[data-accent="medium"] .beat-dot-num { color: var(--rust); }
  .beat-dot[data-accent="medium"] .dot-accent-label { color: var(--rust); }
  .beat-dot[data-accent="weak"] { border-color: var(--border); background: var(--bg3); }
  .beat-dot[data-accent="muted"] { border-color: var(--border); background: var(--bg3); opacity: 0.4; }
  .beat-dot[data-accent="muted"] .beat-dot-num { color: var(--muted); }

  .beat-dot.active { transform: scale(1.08); box-shadow: 0 3px 10px rgba(44,36,22,0.15); }
  .beat-dot.active[data-accent="strong"] { background: var(--gold); border-color: var(--gold); }
  .beat-dot.active[data-accent="strong"] .beat-dot-num,
  .beat-dot.active[data-accent="strong"] .dot-accent-label { color: #fff; }
  .beat-dot.active[data-accent="medium"] { background: var(--rust); border-color: var(--rust); }
  .beat-dot.active[data-accent="medium"] .beat-dot-num,
  .beat-dot.active[data-accent="medium"] .dot-accent-label { color: #fff; }
  .beat-dot.active[data-accent="weak"] { background: var(--muted); border-color: var(--muted); }
  .beat-dot.active[data-accent="weak"] .beat-dot-num,
  .beat-dot.active[data-accent="weak"] .dot-accent-label { color: #fff; }
  .beat-dot.active[data-accent="muted"] { background: var(--bg3); transform: none; opacity: 0.4; }

  /* ── PLAY ── */
  .play-row { display: flex; gap: 10px; justify-content: center; align-items: center; }
  .btn-play {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(139,105,20,0.35);
    flex-shrink: 0;
  }
  .btn-play:hover { background: var(--gold-lt); box-shadow: 0 6px 20px rgba(139,105,20,0.45); transform: scale(1.05); }
  .btn-play:active { transform: scale(0.95); }
  .btn-play svg { pointer-events: none; }

  .btn-tap {
    padding: 10px 20px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    text-transform: uppercase;
  }
  .btn-tap:hover { border-color: var(--teal); color: var(--teal); background: #e8f4f3; }
  .btn-tap:active { background: var(--teal); color: #fff; }

  .btn-reset {
    padding: 10px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: ui-monospace, monospace;
    font-size: 10px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  .btn-reset:hover { border-color: var(--red); color: var(--red); }

  /* ── COMPÁS ── */
  .pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
  .pill {
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg3);
    border: 1px solid var(--border);
    font-family: ui-monospace, monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
    color: var(--text);
  }
  .pill:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }
  .pill.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 500; }
  .meter-pill { white-space: normal; }

  /* ── SUBDIVISIÓN ── */
  .subdiv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .subdiv-btn {
    padding: 8px 4px;
    border-radius: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: center;
    user-select: none;
  }
  .subdiv-btn:hover { border-color: var(--teal); color: var(--teal); background: #e8f4f3; }
  .subdiv-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }
  .subdiv-icon { font-size: 16px; display: block; margin-bottom: 2px; }
  .subdiv-label { font-size: 9px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }

  /* ── VOLUMEN ── */
  .vol-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .vol-label {
    font-family: ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    width: 54px;
    flex-shrink: 0;
  }
  .vol-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
  }
  .vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--rust);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  }
  .vol-num { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); width: 28px; text-align: right; }

  /* ── STATS ── */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .stat-item {
    background: var(--bg3);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    border: 1px solid var(--border);
  }
  .stat-val { font-family: ui-monospace, monospace; font-size: 18px; color: var(--green); display: block; font-weight: 500; }
  .stat-lbl { font-family: ui-monospace, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); display: block; margin-top: 2px; }

  /* ── MODO ENSAYO ── */
  .practice-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .prac-field label {
    display: block;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .prac-field input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 14px;
    padding: 7px 10px;
    outline: none;
    transition: border-color 0.15s;
  }
  .prac-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(139,105,20,0.15); }
  .prac-progress-wrap {
    height: 5px;
    background: var(--bg3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
    border: 1px solid var(--border);
  }
  .prac-progress-bar { height: 100%; background: linear-gradient(90deg, var(--rust), var(--gold)); border-radius: 3px; width: 0%; transition: width 0.3s; }
  .btn-prac-start {
    width: 100%;
    padding: 10px;
    background: var(--bg3);
    border: 1px solid var(--rust);
    border-radius: 6px;
    color: var(--rust);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .btn-prac-start:hover, .btn-prac-start.active { background: var(--rust); color: #fff; }

  /* ── CAJA DE RITMOS ── */
  .dr-instruments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .dr-row { display: flex; align-items: center; gap: 6px; }
  .dr-inst-label { font-family: ui-monospace, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); width: 44px; flex-shrink: 0; }
  .dr-steps { display: flex; gap: 3px; flex: 1; }
  .dr-step {
    flex: 1;
    height: 26px;
    border-radius: 3px;
    background: var(--bg3);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    min-width: 0;
  }
  .dr-step.on                  { background: var(--gold);  border-color: var(--gold); }
  .dr-step.on.inst-snare       { background: var(--rust);  border-color: var(--rust); }
  .dr-step.on.inst-hhc         { background: var(--teal);  border-color: var(--teal); }
  .dr-step.on.inst-hho         { background: var(--green); border-color: var(--green); }
  .dr-step.playing { outline: 2px solid rgba(44,36,22,0.25); outline-offset: 1px; }
  .dr-vol-slider { width: 52px; -webkit-appearance: none; appearance: none; height: 3px; border-radius: 2px; background: var(--border); outline: none; cursor: pointer; flex-shrink: 0; }
  .dr-vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); cursor: pointer; border: 2px solid #fff; }
  .dr-patterns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

  /* ── ATAJOS ── */
  .shortcuts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .shortcut-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
  .key-badge {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--text);
    flex-shrink: 0;
    box-shadow: 0 1px 0 var(--border);
  }

  /* ── MOBILE: eliminar retardo de 300 ms en controles táctiles ── */
  .bpm-btn, .btn-play, .btn-tap, .btn-reset,
  .pill, .subdiv-btn, .btn-prac-start, .met-hdr-btn,
  .beat-dot, .beat-dot-wrap, .dr-step { touch-action: manipulation; }

  /* ── RESPONSIVE ── */
  @media (max-width: 480px) {
    .met-grid { grid-template-columns: 1fr; }
    .ctrl-box.full { grid-column: span 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .subdiv-grid { grid-template-columns: repeat(4, 1fr); }
    .subdiv-btn { padding: 10px 4px; }
    .subdiv-icon { font-size: 18px; }
    .subdiv-label { font-size: 10px; }
    .bpm-num { font-size: 72px; }
    .practice-row { grid-template-columns: 1fr 1fr 1fr; }
    .shortcuts-grid { grid-template-columns: 1fr; }
  }

  /* ── TOOLBAR (Share + Fullscreen) ── */
  .met-toolbar,
  .afin-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 10px;
  }
  .met-hdr-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
  }
  .met-hdr-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }
  .met-hdr-btn.copied { border-color: var(--green); color: var(--green); background: #edf8f2; }
  .met-hdr-btn svg { flex-shrink: 0; }

  /* ── FULLSCREEN ── */
  /* ── METRÓNOMO FULLSCREEN — móvil (pantalla completa) ── */
  .tm-metronomo-wrap.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg2);
    overflow-y: auto;
    padding: 20px;
    max-width: none;
    border-radius: 0;
  }
  .tm-metronomo-wrap.is-fullscreen #box-volumenes,
  .tm-metronomo-wrap.is-fullscreen #box-stats,
  .tm-metronomo-wrap.is-fullscreen #box-ensayo,
  .tm-metronomo-wrap.is-fullscreen #box-cajaritmos,
  .tm-metronomo-wrap.is-fullscreen #box-atajos { display: none; }
  .tm-metronomo-wrap.is-fullscreen .bpm-num { font-size: 128px; }
  .tm-metronomo-wrap.is-fullscreen .btn-play { width: 80px; height: 80px; }
  .tm-metronomo-wrap.is-fullscreen .btn-play svg { width: 32px; height: 32px; }

  /* ── METRÓNOMO FULLSCREEN — escritorio (modal centrado) ── */
  @media (min-width: 768px) {
    .tm-metronomo-wrap.is-fullscreen {
      top: 50%;
      right: auto;
      bottom: auto;
      left: 50%;
      transform: translate(-50%, -50%);
      width: min(880px, 95vw);
      max-height: 90vh;
      border-radius: 14px;
      box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    }
    .tm-metronomo-wrap.is-fullscreen .bpm-num { font-size: 96px; }
    .tm-metronomo-wrap.is-fullscreen .btn-play { width: 64px; height: 64px; }
    .tm-metronomo-wrap.is-fullscreen .btn-play svg { width: 26px; height: 26px; }
  }

  /* ── FLASH ── */
  @keyframes beatFlash {
    0%   { color: var(--gold); }
    40%  { color: var(--rust); }
    100% { color: var(--gold); }
  }
  .beat-flash { animation: beatFlash 0.12s ease; }

/* AFINADOR ───────────────────────────────────────────────────────────────── */

  .tm-afinador-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 0 40px;
  }

  .tm-afinador-wrap .ctrl-box { margin-bottom: 14px; grid-column: unset; }

  /* ── NOTA PRINCIPAL ── */
  .note-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
  }
  .note-col { display: flex; flex-direction: column; align-items: center; padding: 20px 10px 12px; min-width: 0; }
  .note-col + .note-col { border-left: 1px solid var(--border); }
  .note-col-label { font-family: ui-monospace, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 6px; }
  .note-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 80px;
    font-weight: 700;
    line-height: 1;
    color: var(--gold);
    transition: color 0.15s;
    letter-spacing: -3px;
    min-height: 80px;
    display: flex; align-items: center; justify-content: center;
  }
  .note-name.in-tune  { color: var(--green); }
  .note-name.flat     { color: var(--red); }
  .note-name.sharp    { color: var(--red); }
  .note-name.silent   { color: var(--border); }
  .note-name.written  { color: var(--rust); font-size: 70px; }
  .note-name.written.in-tune { color: var(--green); }
  .note-name.written.flat    { color: var(--red); }
  .note-name.written.sharp   { color: var(--red); }
  .note-name.written.silent  { color: var(--border); }
  .note-octave { font-family: ui-monospace, monospace; font-size: 18px; color: var(--muted); min-height: 24px; }
  .note-freq { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 20px; }
  .note-display.no-transp { grid-template-columns: 1fr; }
  .note-display.no-transp .note-col + .note-col { display: none; }

  /* ── GAUGE ── */
  .gauge-wrap { width: 100%; margin: 20px 0 8px; position: relative; overflow: visible; }
  .gauge-svg { width: 100%; height: auto; display: block; }
  .gauge-track { fill: none; stroke: var(--bg3); stroke-width: 10; stroke-linecap: round; }
  .gauge-fill  { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke 0.1s; }
  .gauge-center-line { stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 4 3; }
  .gauge-needle { stroke-width: 3; stroke-linecap: round; transition: transform 0.08s ease-out, stroke 0.1s; transform-origin: 150px 150px; }
  .gauge-needle-dot { transition: fill 0.1s; }
  .cents-display { text-align: center; font-family: ui-monospace, monospace; font-size: 28px; font-weight: 500; color: var(--muted); transition: color 0.1s; min-height: 36px; letter-spacing: 1px; }
  .cents-display.in-tune { color: var(--green); }
  .cents-display.flat    { color: var(--red); }
  .cents-display.sharp   { color: var(--red); }
  .cents-labels { display: flex; justify-content: space-between; font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted); padding: 0 4px; margin-top: 4px; }

  /* ── BOTÓN MIC ── */
  .mic-row { display: flex; justify-content: center; margin: 8px 0 4px; }
  .btn-mic {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--bg3);
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    font-family: ui-monospace, monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
  }
  .btn-mic:hover { border-color: var(--gold); color: var(--gold); }
  .btn-mic.active { background: var(--gold) !important; border-color: var(--gold) !important; color: #fff !important; animation: pulse 1.8s ease-in-out infinite; }
  .btn-mic.active .mic-icon { color: #fff !important; }
  .mic-icon { font-size: 22px; line-height: 1; }

  @keyframes pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(139,105,20,0.4); }
    50%       { box-shadow: 0 6px 28px rgba(139,105,20,0.7); }
  }

  /* ── REFERENCIA A4 ── */
  .ref-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
  .ref-label { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
  .ref-btn {
    width: 36px; height: 36px;
    border-radius: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    font-size: 20px;
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
  }
  .ref-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-bg); }
  .ref-btn:active { background: var(--gold); color: #fff; border-color: var(--gold); }
  .ref-value { font-family: 'Playfair Display', Georgia, serif; font-size: 26px; font-weight: 700; color: var(--gold); min-width: 90px; text-align: center; letter-spacing: -0.5px; }

  /* ── NOTAS DE REFERENCIA ── */
  .ref-notes-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .ref-note-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
  }
  .ref-note-btn:hover { border-color: var(--gold); background: var(--gold-bg); transform: translateY(-1px); }
  .ref-note-btn.playing { background: var(--gold); border-color: var(--gold); }
  .ref-note-btn.playing .ref-note-name { color: #fff; }
  .ref-note-btn.playing .ref-note-oct  { color: rgba(255,255,255,0.75); }
  .ref-note-name { font-family: 'Playfair Display', Georgia, serif; font-size: 18px; font-weight: 700; color: var(--text); line-height: 1; }
  .ref-note-oct  { font-family: ui-monospace, monospace; font-size: 9px; color: var(--muted); text-transform: uppercase; }

  /* ── TRANSPOSICIÓN ── */
  .transp-instruments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
  .transp-pill {
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg3);
    border: 1px solid var(--border);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    color: var(--text);
    user-select: none;
    white-space: nowrap;
  }
  .transp-pill:hover { border-color: var(--rust); color: var(--rust); background: #f5ebe4; }
  .transp-pill.active { background: var(--rust); border-color: var(--rust); color: #fff; }
  .transp-semitones { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 4px; }
  .transp-val { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700; color: var(--rust); min-width: 70px; text-align: center; }

  /* ── STATS AFINADOR ── */
  .stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

  /* ── RESPONSIVE AFINADOR ── */
  @media (max-width: 480px) {
    .note-name { font-size: 60px; }
    .note-name.written { font-size: 50px; }
    .ref-notes-grid { grid-template-columns: repeat(4, 1fr); }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
  }

  /* ── CUERDAS ── */
  .afin-strings { display: flex; gap: 5px; }
  .afin-string-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 4px 8px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    transition: background 0.2s, border-color 0.2s;
  }
  .afin-string-wire {
    width: 60%;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.2s;
  }
  .afin-string-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.1;
    white-space: nowrap;
    transition: color 0.2s;
  }
  .afin-string-oct { font-family: ui-monospace, monospace; font-size: 8px; vertical-align: super; }
  .afin-string-cents {
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: var(--muted);
    min-height: 13px;
    line-height: 1;
    transition: color 0.2s;
  }
  .afin-string-item.s-intune { background: #edf8f2; border-color: var(--green); }
  .afin-string-item.s-intune .afin-string-wire  { background: var(--green); }
  .afin-string-item.s-intune .afin-string-name  { color: var(--green); }
  .afin-string-item.s-intune .afin-string-cents { color: var(--green); }
  .afin-string-item.s-flat,
  .afin-string-item.s-sharp { background: #fdf0ef; border-color: var(--red); }
  .afin-string-item.s-flat .afin-string-wire,
  .afin-string-item.s-sharp .afin-string-wire  { background: var(--red); }
  .afin-string-item.s-flat .afin-string-name,
  .afin-string-item.s-sharp .afin-string-name  { color: var(--red); }
  .afin-string-item.s-flat .afin-string-cents,
  .afin-string-item.s-sharp .afin-string-cents { color: var(--red); }

  /* ── FULLSCREEN: backdrop en escritorio ── */
  body.has-fullscreen { overflow: hidden; }
  body.has-fullscreen::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(20, 14, 5, 0.75);
    z-index: 9998;
  }

  /* ── FULLSCREEN: toolbars sticky ── */
  .tm-afinador-wrap.is-fullscreen .afin-toolbar,
  .tm-metronomo-wrap.is-fullscreen .met-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg2);
    padding: 6px 0;
    margin-bottom: 6px;
  }

  /* ── AFINADOR FULLSCREEN — móvil (pantalla completa) ── */
  .tm-afinador-wrap.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg2);
    overflow-y: auto;
    padding: 20px;
    max-width: none;
    border-radius: 0;
  }
  .tm-afinador-wrap.is-fullscreen #afin-box-transp,
  .tm-afinador-wrap.is-fullscreen #afin-box-refnotes,
  .tm-afinador-wrap.is-fullscreen #afin-box-stats,
  .tm-afinador-wrap.is-fullscreen #afin-strings-panel { display: none; }
  .tm-afinador-wrap.is-fullscreen .note-name { font-size: 120px; letter-spacing: -4px; }
  /* Con transpositor (2 col): la columna mide ~147 px en 375 px → "Sol♯" a 120 px no cabe */
  .tm-afinador-wrap.is-fullscreen .note-display:not(.no-transp) .note-name        { font-size: 72px; letter-spacing: -2px; }
  .tm-afinador-wrap.is-fullscreen .note-display:not(.no-transp) .note-name.written { font-size: 64px; }
  .tm-afinador-wrap.is-fullscreen .cents-display { font-size: 36px; }
  .tm-afinador-wrap.is-fullscreen .btn-mic { width: 88px; height: 88px; }

  /* ── AFINADOR FULLSCREEN — escritorio (modal centrado) ── */
  @media (min-width: 768px) {
    .tm-afinador-wrap.is-fullscreen {
      top: 50%;
      right: auto;
      bottom: auto;
      left: 50%;
      transform: translate(-50%, -50%);
      width: min(700px, 95vw);
      max-height: 90vh;
      border-radius: 14px;
      box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    }
    .tm-afinador-wrap.is-fullscreen .note-name { font-size: 80px; letter-spacing: -3px; }
    /* Desktop tiene columnas de ~310 px: 80 px cabe sin problema */
    .tm-afinador-wrap.is-fullscreen .note-display:not(.no-transp) .note-name        { font-size: 80px; letter-spacing: -3px; }
    .tm-afinador-wrap.is-fullscreen .note-display:not(.no-transp) .note-name.written { font-size: 72px; }
    .tm-afinador-wrap.is-fullscreen .cents-display { font-size: 28px; }
    .tm-afinador-wrap.is-fullscreen .btn-mic { width: 72px; height: 72px; }
  }
