/* Layout: una colonna stretta come il manico del violoncello. Quattro corde dall'acuto al grave, poi il laboratorio dei battimenti e tre passi di accordatura. */
:root {
  color-scheme: dark;
  --bg: #0A0A0A;
  --surface: #141414;
  --fg: #ECECEC;
  --muted: #8E8E8E;
  --line: #2B2B2B;
  --accent: #F0A93A;
  --accent-soft: #231C04;
  --accent-ink: #1A1300;
  --ok: #F0A93A;      /* giallo oro: nota precisa (lo stesso oro del titolo) */
  --flat: #E5412F;    /* rosso: fuori tono (bassa) */
  --sharp: #E5412F;   /* rosso: fuori tono (alta) */
  --ok-soft: rgba(240, 169, 58, 0.20);
  --brand: #F0A93A;   /* il titolo è oro: contrasto ~14:1 sul nero, ben leggibile anche alla luce */
  --btn-red: #B8940A;
  --glow: 0 6px 18px -6px rgba(240, 169, 58, 0.65);
  --warn: #F0A93A;
  --btn: linear-gradient(180deg, #343434 0%, #1A1A1A 100%);
  --btn-on: linear-gradient(180deg, #F7BA46 0%, #C97A16 100%);
  --btn-line: #444444;
  /* Primario: Lexend Giga (titolo, nomi delle note, numeri, pulsanti, etichette).
     Testi lunghi: Lexend, la sorella a larghezza normale della stessa famiglia. */
  --font-logo: "Lexend Giga", "Eurostile", "Gotham", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-logo);
  --font-mono: var(--font-logo);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 300;
  padding-top: max(24px, env(safe-area-inset-top, 0px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
h1, h2 { font-family: var(--font-logo); font-weight: 300; text-wrap: balance; margin: 0; }
h1 { font-family: var(--font-logo); font-weight: 300; font-size: clamp(22px, 7.6vw, 34px); line-height: 1.15; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brand); text-wrap: balance; }
h2 { font-size: 14px; line-height: 1.5; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); }
p { margin: 0; }
.lede { color: var(--muted); max-width: 46ch; }
.eyebrow { font-family: var(--font-logo); font-weight: 300; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
header { display: flex; flex-direction: column; gap: 10px; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Riferimento */
.ref { display: flex; flex-direction: column; gap: 12px; }
.ref-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stepper button { width: 44px; border: 0; background: var(--btn); font-family: var(--font-logo); font-weight: 300; font-size: 18px; }
.stepper button:first-child { border-radius: 7px 0 0 7px; }
.stepper button:last-child { border-radius: 0 7px 7px 0; }
.stepper button:active { background: var(--btn-on); color: var(--accent-ink); }
.stepper output { min-width: 96px; display: grid; place-items: center; font-family: var(--font-logo); font-weight: 300; font-size: 14px; font-variant-numeric: tabular-nums; border-inline: 1px solid var(--line); padding: 10px 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--btn); padding: 10px 12px; font-family: var(--font-logo); font-weight: 300; font-size: 11px; letter-spacing: 0.02em; min-height: 44px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--btn-on); color: var(--accent-ink); font-weight: 400; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); font-size: 13px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

details.presets { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
details.presets summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--btn-line); border-radius: 8px; background: var(--btn); font-family: var(--font-logo); font-weight: 300; font-size: 11px; letter-spacing: 0.02em; user-select: none; }
details.presets summary::-webkit-details-marker { display: none; }
details.presets summary::after { content: "▾"; color: var(--muted); transition: transform 0.15s; }
details.presets[open] summary::after { transform: rotate(180deg); }
details.presets summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.presets .seg { margin-top: 10px; }

/* Corde */
.strings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.string {
  display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 250px;
  width: 100%; text-align: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px 2px 12px; position: relative; overflow: hidden;
}
/* la corda: una linea verticale dietro le scritte, più spessa per le corde gravi */
.string::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: var(--w, 2px); transform: translateX(-50%); background: var(--line); }
.string > span { position: relative; background: inherit; }
.string[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.string[aria-pressed="true"]::before { background: var(--accent); }
.string .letter { font-family: var(--font-logo); font-weight: 200; font-size: 40px; line-height: 1; padding: 4px 6px; }
.string .name { font-family: var(--font-logo); font-weight: 400; font-size: 13px; padding: 2px 2px; }
.string .freq { font-family: var(--font-logo); font-weight: 300; font-size: 8.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 2px 4px; margin-bottom: 8px; }
.string .act { margin-top: auto; font-family: var(--font-logo); font-weight: 300; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--btn-line); color: var(--fg); background: var(--btn); border-radius: 999px; padding: 8px 4px; width: 100%; text-align: center; }
.string[aria-pressed="true"] .act { background: var(--btn-on); color: var(--accent-ink); border-color: var(--btn-red); box-shadow: var(--glow); }
.string .name small { font-weight: 300; color: var(--muted); font-family: var(--font-logo); font-size: 8.5px; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 10px; max-width: 52ch; }

/* Laboratorio */
.lab { display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 16px; }
.pulse-wrap { display: grid; place-items: center; height: 120px; }
.pulse { width: 96px; height: 96px; border-radius: 50%; background: var(--accent); opacity: 0.25; transform: scale(0.55); transition: background 0.2s; }
.pulse.live { opacity: 1; }
.pulse.off { background: var(--fg); }
.readout { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.readout .num { font-family: var(--font-logo); font-weight: 300; font-size: 24px; font-variant-numeric: tabular-nums; }
.readout .verdict { color: var(--muted); font-size: 13px; }
.slider-row { display: flex; flex-direction: column; gap: 8px; }
.slider-row label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.slider-row label b { font-family: var(--font-logo); font-weight: 300; font-size: 11px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }
.lab-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--btn-line); background: var(--btn); color: var(--fg); border-radius: 8px; padding: 12px 16px; font-family: var(--font-logo); font-weight: 400; font-size: 11px; letter-spacing: 0.02em; min-height: 44px; }
.btn[aria-pressed="true"] { background: var(--btn-on); border-color: var(--btn-red); color: var(--accent-ink); box-shadow: var(--glow); }
.btn.ghost { background: transparent; color: var(--fg); }

/* Termometro dell'intonazione */
.tuner { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 16px; }
.tuner.ok { --st: var(--ok); }
.tuner.flat { --st: var(--flat); }
.tuner.sharp { --st: var(--sharp); }
.tn-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.tn-note { font-family: var(--font-logo); font-weight: 200; font-size: 34px; line-height: 1; min-width: 3ch; }
.tn-side { text-align: right; display: flex; flex-direction: column; gap: 4px; min-width: 0; font-family: var(--font-logo); font-weight: 300; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tn-side b { font-weight: 300; font-size: 14px; color: var(--fg); }
.therm-track { position: relative; height: 20px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.therm-zone { position: absolute; top: 0; bottom: 0; left: 47%; width: 6%; background: var(--ok-soft); }
.therm-fill { position: absolute; top: 3px; bottom: 3px; left: 50%; width: 0; background: var(--st, var(--muted)); border-radius: 7px; transition: left 0.12s linear, width 0.12s linear, background 0.15s; }
.therm-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%); background: var(--fg); opacity: 0.55; }
.therm-ticks { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--font-logo); font-weight: 300; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tn-cents { text-align: center; font-family: var(--font-logo); font-weight: 300; font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tn-verdict { text-align: center; color: var(--muted); font-size: 13px; min-height: 1.5em; }
.tuner.on .tn-cents, .tuner.on .tn-verdict { color: var(--st); }
.trace { display: block; width: 100%; height: 84px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.level { position: relative; height: 4px; border-radius: 2px; background: var(--line); }
.level-fill { height: 100%; width: 0; border-radius: 2px; background: var(--muted); transition: width 0.06s linear; }
.level-thr { position: absolute; top: -3px; bottom: -3px; width: 2px; left: 30%; background: var(--fg); opacity: 0.7; }
.btn:disabled { opacity: 0.4; cursor: default; }
.tn-cfg { text-align: left; }
.tn-cet { text-align: center; margin-top: -8px; font-family: var(--font-logo); font-weight: 300; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip { min-height: 44px; border: 1px solid var(--btn-line); border-radius: 8px; background: var(--btn); font-family: var(--font-logo); font-weight: 300; font-size: 11px; font-variant-numeric: tabular-nums; }
.chip.hit { border-color: var(--st, var(--fg)); box-shadow: inset 0 0 0 1px var(--st, var(--fg)); }
.chip[aria-pressed="true"] { background: var(--btn-on); border-color: var(--btn-red); color: var(--accent-ink); }
.tn-hint { margin: -6px 0 0; color: var(--muted); font-size: 11.5px; text-align: center; }
.tn-stat { margin-top: 8px; font-family: var(--font-logo); font-weight: 300; font-size: 9.5px; color: var(--muted); min-height: 1.2em; font-variant-numeric: tabular-nums; }
details.presets .ref-row { width: 100%; justify-content: space-between; }

/* Passi */
ol.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; counter-reset: s; }
ol.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
ol.steps li::before { content: counter(s); font-family: var(--font-logo); font-weight: 200; font-size: 22px; line-height: 1; color: var(--accent); }
ol.steps b { font-weight: 500; }
.steps-note { color: var(--muted); font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) { .pulse, .therm-fill, .level-fill { transition: none; } }


/* ===== Nuove parti: schede, accordatura guidata, doppia corda ===== */
.view { display: flex; flex-direction: column; gap: 0; }
.view[hidden] { display: none; }
.cfg { margin: 0; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-right, 0px));
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 54px;
  border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  font-family: var(--font-logo); font-weight: 300; font-size: 8px; letter-spacing: 0.02em; text-transform: uppercase;
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--fg); }
.tabs button[aria-current="page"] svg { stroke: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tuner.gd.ok, .tuner.ok { --st: var(--ok); }
.tuner.gd.flat, .tuner.flat { --st: var(--flat); }
.tuner.gd.sharp, .tuner.sharp { --st: var(--sharp); }
.therm { display: block; }

.dots { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dots li { text-align: center; font-family: var(--font-logo); font-weight: 300; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.dots li::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); }
.dots li.cur { color: var(--fg); }
.dots li.cur::before { background: var(--accent); }
.dots li.done { color: var(--ok); }
.dots li.done::before { background: var(--ok); }
.gd-instr { color: var(--fg); font-size: 13.5px; min-height: 4.2em; }

.beatbox { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 12px; }
.pulse-wrap.sm { height: 72px; }
.pulse-wrap.sm .pulse { width: 56px; height: 56px; }
.beatbox .readout { text-align: left; }
.devs { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-family: var(--font-logo); font-weight: 300; font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.btn:disabled { opacity: 0.4; cursor: default; }

#installBtn[hidden], #installIos[hidden] { display: none; }

[hidden]:not([hidden=until-found i]) { display: none !important; }
.tuner > .seg { width: 100%; }
.tuner > .seg > button { flex: 1 1 0; padding-inline: 6px; }

#dbName { font-size: 28px; }
.lede { font-size: 13px; }

.seg.quick, .lab > .seg { width: 100%; }
.seg.quick > button, .lab > .seg > button { flex: 1 1 0; padding-inline: 6px; }

/* ===== Colori e termometro ===== */
.therm-track { position: relative; }
.therm-grad { position: absolute; inset: 0; opacity: 0.5; border-radius: inherit; }
.therm-zone, .therm-fill, .therm-mid { z-index: 1; }

.therm.v { display: flex; flex-direction: row-reverse; justify-content: center; align-items: stretch; gap: 10px; height: 240px; }
.therm.v .therm-track { width: 46px; height: 100%; flex: none; }
.therm.v .therm-zone { left: 0; right: 0; width: auto; }
.therm.v .therm-fill { left: 3px; right: 3px; width: auto; bottom: auto; top: 50%; transition: top 0.12s linear, height 0.12s linear, background 0.15s; }
.therm.v .therm-mid { left: 0; right: 0; width: auto; top: 50%; bottom: auto; height: 2px; transform: translateY(-50%); }
.therm.v .therm-ticks { flex-direction: column; justify-content: space-between; margin: 0; text-align: right; min-width: 3ch; }

.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme { display: flex; flex-direction: column; gap: 8px; text-align: left; min-height: 44px; padding: 10px; border: 1px solid var(--btn-line); border-radius: 8px; background: var(--btn); }
.theme .sw { display: block; height: 14px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.08); }
.theme .nm { font-family: var(--font-logo); font-weight: 300; font-size: 10px; letter-spacing: 0.03em; }
.theme[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.colors-custom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.colorpick { display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--font-logo); font-weight: 300; font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.colorpick input { width: 100%; height: 44px; padding: 0; border: 1px solid var(--btn-line); border-radius: 8px; background: var(--btn); cursor: pointer; }

/* ===== Titolo a tutta larghezza e testo centrato ===== */
header { align-items: center; text-align: center; }
h1 { display: block; width: 100%; font-size: 7.4vw; text-align: center; white-space: nowrap; text-wrap: nowrap; overflow: visible; }
#titleText { display: inline-block; margin-right: -0.05em; }
main { text-align: center; }
.lede, .note, .steps-note { margin-left: auto; margin-right: auto; }
.ref { align-items: center; }
.ref-row, .lab-actions { justify-content: center; }
.slider-row { width: 100%; }
.check { justify-content: center; }
details.presets { align-items: center; }
.theme { text-align: center; }
ol.steps li { grid-template-columns: 1fr; gap: 4px; justify-items: center; text-align: center; }
.gd-instr { text-align: center; }

/* ===== Corde-termometro (Suoni) ===== */
.string { min-height: 430px; }
.string::before { display: none; }
.string > .sthm { background: transparent; }
.sthm { display: block; flex: 1 1 220px; min-height: 220px; width: var(--cw, 10px); margin: 4px 0; border-radius: 999px; position: relative; }
.sthm .sg { position: absolute; inset: 0; border-radius: inherit; opacity: 0.5; transition: opacity 0.15s, box-shadow 0.15s; }
.sthm .szero { position: absolute; left: -8px; right: -8px; top: 50%; height: 2px; margin-top: -1px; border-radius: 1px; background: var(--ok); }
.sthm .smk { position: absolute; left: -6px; right: -6px; height: 4px; margin-top: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 8px rgba(255, 255, 255, 0.55); transition: top 0.15s; }
.string[aria-pressed="true"] .sg { opacity: 1; box-shadow: 0 0 16px rgba(255, 255, 255, 0.2); }
.string .dev { font-family: var(--font-logo); font-weight: 300; font-size: 8.5px; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; min-height: 1.2em; }
@keyframes pluck { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(1.2px); } 75% { transform: translateX(-1.2px); } }
@media (prefers-reduced-motion: no-preference) { .string[aria-pressed="true"] .sthm { animation: pluck 0.09s linear infinite; } }

/* titolo: la spaziatura deve scalare con il carattere (altrimenti la misura a 100px non vale a 50px) */
h1 { letter-spacing: 0; }
#titleText { letter-spacing: 0.05em; }
/* blocchi che devono usare tutta la larghezza anche dentro colonne centrate */
.ref > .therm, .ref > .themes, .ref > .colors-custom, .ref > .slider-row { width: 100%; }
.theme:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ===== Quando l'app emette la nota perfetta, tutto si illumina d'oro (mai di rosso) ===== */
:root {
  --gold: #F0A93A;
  --gold-soft: #231C04;
  --gold-line: #B8940A;
  --gold-ink: #1A1300;
  --btn-gold: linear-gradient(180deg, #F7BA46 0%, #C97A16 100%);
  --glow-gold: 0 6px 18px -6px rgba(240, 169, 58, 0.65);
}
/* le quattro corde */
.string[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); }
.string[aria-pressed="true"] .act { background: var(--btn-gold); color: var(--gold-ink); border-color: var(--gold-line); box-shadow: var(--glow-gold); }
.string[aria-pressed="true"] .sg { box-shadow: 0 0 18px rgba(240, 169, 58, 0.45); }
/* coppie e "tutte" */
.seg.quick button[aria-pressed="true"] { background: var(--btn-gold); color: var(--gold-ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
/* laboratorio dei battimenti: pulsante e cerchio */
#labPlay[aria-pressed="true"], #droneBtn[aria-pressed="true"], #gdDrone[aria-pressed="true"] {
  background: var(--btn-gold); color: var(--gold-ink); border-color: var(--gold-line); box-shadow: var(--glow-gold);
}
#pulse { background: var(--gold); }
#pulse.off { background: var(--fg); }
/* la colonna della corda che suona è tutta d'oro, qualunque sia la palette scelta per il termometro */
.string[aria-pressed="true"] .sg { background: linear-gradient(180deg, #FFDF8A 0%, #F0A93A 50%, #C97A16 100%) !important; opacity: 1; }

/* titolo oro: un leggero alone lo tiene vivo anche con luce forte sullo schermo */
/* Titolo a gradiente: più chiaro in alto, oro pieno al centro, più scuro in basso */
h1 { filter: drop-shadow(0 0 14px rgba(240, 169, 58, 0.22)); }
#titleText {
  background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 28%, #EA9A2A 55%, #C97A16 80%, #8F500C 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ===== Selettore colori condiviso ===== */
.picker { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }
details.presets .picker .seg, .picker .seg { margin-top: 0; }
details.presets .picker .ref-row { justify-content: center; }
details.presets.colors-d { width: 100%; margin-top: 14px; align-items: center; }
details.presets.colors-d > .picker { margin-top: 4px; }

/* ===== Studio ===== */
.row-sel { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.row-sel select { background: var(--card, #141414); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-family: var(--font-logo); font-size: 14px; }
.st-head, .st-row { display: grid; grid-template-columns: 1.1fr 1.2fr 1.2fr 1fr; gap: 6px; align-items: center; text-align: center; }
.st-head { font-family: var(--font-logo); font-weight: 300; font-size: 8px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0 8px 6px; }
.st-rows { display: flex; flex-direction: column; gap: 4px; }
.st-row { width: 100%; padding: 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: #141414; color: var(--fg); font-family: var(--font-logo); font-weight: 300; font-size: 12px; }
.st-row .st-n { font-weight: 500; }
.st-row .st-c { color: var(--muted); }
.st-root .st-n, .st-root .st-r { color: var(--gold); }
.st-row[aria-pressed="true"] { border-color: var(--gold); background: var(--accent-soft); }
.st-row[aria-pressed="true"] .st-n { color: var(--gold); }

/* ===== Suoni in ascolto: la corda riconosciuta si illumina d'oro quando è in tono ===== */
.str-live { min-height: 1.5em; color: var(--fg); }
.string.hit .sg { opacity: 1; box-shadow: 0 0 18px rgba(240, 169, 58, 0.45); }
.sthm .smk { transition: top 0.12s linear, opacity 0.15s; }
.strings.listening .string:not(.hit) .sg { opacity: 0.5; }

/* ===== Passaggio tra schede scorrendo col pollice ===== */
html, body { overscroll-behavior-x: none; }
@media (prefers-reduced-motion: no-preference) {
  .view.in-next { animation: inNext 0.22s ease-out; }
  .view.in-prev { animation: inPrev 0.22s ease-out; }
}
@keyframes inNext { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes inPrev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* ===== Termometri più brillanti: la scala di colori è quasi piena, la barra viva si stacca con luce propria ===== */
.therm-grad { opacity: 0.92; }
.therm-fill { filter: brightness(1.18) saturate(1.1); box-shadow: 0 0 10px var(--st, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.therm-mid { background: #fff; opacity: 0.9; }
.sthm .sg { opacity: 0.88; }
.strings.listening .string:not(.hit) .sg { opacity: 0.88; }

.therm-zone { background: rgba(255, 255, 255, 0.0); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }

/* ===== Stile essenziale: la selezione è solo la scritta d'oro ===== */
.string[aria-pressed="true"] { background: #15130C; border-color: rgba(240, 169, 58, 0.7); }
.string[aria-pressed="true"] .act { background: #15130C !important; } /* opaco: la corda dietro non traspare */
.st-row[aria-pressed="true"] { background: #15130C; }
/* Titoli delle sezioni: un velo di gradiente dorato, discreto */
h2 {
  background: linear-gradient(180deg, #FFDF8A 0%, #E9A236 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #F6CB86;
}
/* Riquadri: un filo d'oro finissimo sul bordo superiore, come un'incisione */
.lab, .tuner, .string { box-shadow: inset 0 1px 0 rgba(240, 169, 58, 0.32); }
.string[aria-pressed="true"] { box-shadow: inset 0 1px 0 rgba(240, 169, 58, 0.6); }

/* Gruppi di tasti: il contenitore non ritaglia più gli angoli, così il filo d'oro segue la curva anche sul primo e sull'ultimo tasto */
.seg { overflow: visible; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 7px 0 0 7px; }
.seg button:last-child { border-radius: 0 7px 7px 0; }
.seg button:only-child { border-radius: 7px; }

/* Selezione = scritta d'oro, ben leggibile. Nessun contorno, riempimento o alone sui tasti. */
:is(.btn[aria-pressed="true"], .seg button[aria-pressed="true"], .seg button[aria-checked="true"], .chip[aria-pressed="true"],
    .seg.quick button[aria-pressed="true"], #labPlay[aria-pressed="true"], #droneBtn[aria-pressed="true"], #gdDrone[aria-pressed="true"],
    .string[aria-pressed="true"] .act, .stepper button:active) {
  background: var(--btn) !important; border-color: var(--btn-line) !important; box-shadow: none !important;
  color: #F0A93A !important; font-weight: 500 !important;
}
.btn.ghost[aria-pressed="true"], .chip[aria-pressed="true"] { background: transparent !important; }
.seg button:not([aria-pressed="true"]):not([aria-checked="true"]) { color: #BDBDBD; }
.string[aria-pressed="true"] .act { background: transparent !important; border-color: transparent !important; }
.string[aria-pressed="true"] { background: var(--surface); border-color: rgba(240, 169, 58, 0.35); }
.st-row[aria-pressed="true"] { background: var(--surface); border-color: rgba(240, 169, 58, 0.35); }

/* ===== Syncopate: titoli di sezione, etichette e tasti, in maiuscolo =====
   Gerarchia: titolo (15) > etichetta (11) > tasto (8,5). La voce scelta è in grassetto dorato.
   Titolo dell'app, note, numeri e lettura restano in Lexend Giga. */
:root { --font-sync: "Syncopate", "Eurostile", "Gotham", var(--font-logo); }
h2 { font-family: var(--font-sync); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; line-height: 1.45; }
.eyebrow { font-family: var(--font-sync); font-weight: 400; font-size: 11px; letter-spacing: 0.12em; }
.btn, .seg button, .chip, .string .act, details.presets summary {
  font-family: var(--font-sync); font-weight: 400; font-size: 8.5px; letter-spacing: 0.04em; text-transform: uppercase;
}
:is(.btn[aria-pressed="true"], .seg button[aria-pressed="true"], .seg button[aria-checked="true"], .chip[aria-pressed="true"],
    .seg.quick button[aria-pressed="true"], #labPlay[aria-pressed="true"], #droneBtn[aria-pressed="true"], #gdDrone[aria-pressed="true"],
    .string[aria-pressed="true"] .act) { font-weight: 700 !important; }

/* ===== Syncopate per tutti i numeri: letture, scale, Hz, cent, rapporti, nomi delle note con ottava =====
   Syncopate è più larga di Lexend Giga e non ha pesi leggeri: corpi ridotti, peso regolare, cifre tabulari. */
.tn-note, .tn-side, .tn-side b, .tn-cents, .tn-cet, .tn-stat, .therm-ticks, .devs, .readout .num, .slider-row label b,
.stepper output, .string .name, .string .name small, .string .freq, .string .dev, .st-head, .st-row, #cfgLine {
  font-family: var(--font-sync); font-weight: 400; font-variant-numeric: tabular-nums;
}
.tn-note { font-size: 26px; letter-spacing: 0.02em; }
.tn-side { font-size: 8px; letter-spacing: 0.03em; }
.tn-side b { font-size: 12px; }
.tn-cents { font-size: 17px; letter-spacing: 0.02em; }
.tn-cet, .tn-stat, .devs { font-size: 8px; letter-spacing: 0.03em; }
.therm-ticks { font-size: 7.5px; letter-spacing: 0.02em; }
.readout .num { font-size: 17px; letter-spacing: 0.02em; }
.slider-row label b { font-size: 9px; letter-spacing: 0.03em; }
.stepper output { font-size: 12px; letter-spacing: 0.03em; }
.string .name { font-size: 10px; letter-spacing: 0.03em; }
.string .name small { font-size: 7.5px; }
.string .freq, .string .dev { font-size: 7.5px; letter-spacing: 0.02em; }
.st-head { font-size: 7.5px; letter-spacing: 0.04em; }
.st-row { font-size: 10px; letter-spacing: 0.02em; }
#cfgLine { font-size: 9px; letter-spacing: 0.1em; }

/* ===== Titolo dell'app in Syncopate Bold, con lo stesso gradiente dorato; i nomi delle note con ottava in maiuscolo ===== */
h1 { font-family: var(--font-sync); font-weight: 700; }
#titleText { font-family: var(--font-sync); font-weight: 700; letter-spacing: 0.02em; margin-right: -0.02em; }
.tn-note, .string .name { text-transform: uppercase; }

/* ===== Studio: tastiera a cerchio ===== */
.pk { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 20px auto 8px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pk::before { content: ""; position: absolute; inset: 11%; border-radius: 50%; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 38%, rgba(240, 169, 58, 0.07), transparent 62%); }
.pk-center { position: absolute; inset: 24%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; pointer-events: none; }
.pk-name { font-family: var(--font-sync); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.pk-ratio { font-family: var(--font-sync); font-size: 13px; letter-spacing: 0.06em; color: var(--fg); }
.pk-hint { font-family: var(--font-body, "Lexend", system-ui, sans-serif); font-weight: 300; font-size: 11.5px; line-height: 1.4; color: var(--muted); max-width: 20ch; }
.pkey { position: absolute; width: 15.5%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid var(--line);
  background: linear-gradient(180deg, #343434 0%, #1A1A1A 100%); color: #BDBDBD; padding: 0; cursor: pointer; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; -webkit-tap-highlight-color: transparent; }
.pkey.acc { background: linear-gradient(180deg, #232323 0%, #0F0F0F 100%); }
.pkey .k1 { font-family: var(--font-sync); font-size: 10px; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }
.pkey .k2 { font-family: var(--font-sync); font-size: 6.5px; text-transform: uppercase; color: var(--muted); line-height: 1; }
.pkey[aria-pressed="true"] { color: var(--gold); }
.pkey[aria-pressed="true"] .k1 { font-weight: 700; color: var(--gold); }
.pkey[aria-pressed="true"] .k2 { color: var(--gold); }
.pkey[aria-pressed="true"]::after { content: ""; position: absolute; bottom: 12%; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.pk-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.chordbar { display: flex; flex-wrap: wrap; gap: 8px; }
.chordbar .btn { flex: 1 1 auto; }
.pk-head, .pk-row { grid-template-columns: 1.2fr 1fr 1.2fr 1.1fr; }
.pk-row { cursor: default; }

/* ===== Oro bianco: il "bianco" delle scritte è un platino caldo; cent e hertz delle corde più grandi ===== */
:root { --fg: #EDE5D2; --fg-dim: #B9B1A0; }
.string .freq, .string .dev { font-size: clamp(8px, 2.3vw, 9.5px); font-weight: 400; letter-spacing: 0.01em; white-space: nowrap; }
.string .freq { color: var(--fg-dim); }
.string .dev { font-weight: 700; }

/* Suoni: i cent di ogni corda hanno un solo colore (oro ambra); cent e hertz appena più grandi */
.string .dev, .string.hit .dev { color: var(--gold) !important; }
.string .freq, .string .dev { font-size: clamp(8.5px, 2.45vw, 10px); }

/* Termometro: il riquadro dell'andamento è molto più alto, per vedere l'onda dell'intonazione */
.trace { height: clamp(190px, 30vh, 280px); }

/* Tasti a rombo: la stessa forma dell'icona, con filetto d'oro. Si accendono con il testo oro e il filetto più vivo. */
.pkey.rh { width: 19%; aspect-ratio: 1; border: 0; border-radius: 0; background: none; }
.pkey.rh .rsh { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pkey.rh .k1 { position: relative; font-size: 8px; letter-spacing: 0; }
.pkey.rh .k2 { position: relative; font-size: 6px; }
.pkey.rh[aria-pressed="true"]::after { bottom: 20%; }

/* Titolo in Michroma (largo, tratto regolare); il resto resta in Syncopate */
:root { --font-title: "Michroma", "Syncopate", "Eurostile", system-ui, sans-serif; }
h1 { font-family: var(--font-title); font-weight: 400; }
#stSys button { flex: 1 1 0; min-width: 0; }
#titleText { font-family: var(--font-title); font-weight: 400; letter-spacing: 0.04em; margin-right: -0.04em; }

/* Studio: i nomi delle note (tabella dei gradi, elenco delle note che suonano) sono sempre maiuscoli */
.st-row .st-n, .st-rows .st-n { text-transform: uppercase; letter-spacing: 0.04em; }
.row-sel select { text-transform: uppercase; }

/* ===== v34 · Corde: quattro tubi uguali, con un sensore che scorre verso il pitch ===== */
.sthm { width: 14px; }
.sthm .szero { left: -9px; right: -9px; }
.sthm .smk {
  left: -6px; right: -6px; height: 12px; margin-top: -6px; border-radius: 6px;
  background: #0B0B0B; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 6px rgba(255, 255, 255, 0.35);
  transition: opacity 0.35s, border-color 0.2s, box-shadow 0.25s, transform 0.25s;
}
.sthm .smk::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.sthm .smk.rest { opacity: 0.32; box-shadow: none; }
.sthm .smk.live { opacity: 1; border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 12px var(--sc, rgba(255, 255, 255, 0.6)); }
.sthm .smk.live::after { background: var(--sc, #fff); }
.string.hit .sthm .smk { border-color: var(--gold); transform: scale(1.15); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 16px rgba(240, 169, 58, 0.85); }
.string.hit .sthm .smk::after { background: var(--gold); }
@media (prefers-reduced-motion: no-preference) { .string.hit .sthm .smk { animation: sensorOk 1.1s ease-in-out infinite; } }
@keyframes sensorOk { 0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 0 10px rgba(240,169,58,.6); } 50% { box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 0 22px rgba(240,169,58,1); } }
#tuner { margin-top: 14px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Accorda: due modi, percorso guidato e doppia corda */
.subtabs { width: 100%; margin-bottom: 14px; }
.subtabs button { flex: 1 1 0; }
.seg.subtabs button[aria-selected="true"] { color: var(--gold); font-weight: 700; }

/* ===== Avvio (circa 4,6 s, un tocco lo salta): il rombo nasce dalle quinte, nell'ordine dell'accordatura.
   Il La scende e vibra. Scende il Re e vibra con il La: mentre la quinta La–Re si accorda, si disegna la fascia
   di rombo tra le due corde, poi il La tace. Lo stesso per Re–Sol e Sol–Do, finché il rombo si chiude sul Do.
   Alla fine il logo respira una volta, piano, e compare il nome.
   Fluidità: corde, fasce, bagliore e respiro sono livelli separati che si muovono solo con transform e opacity,
   quindi il telefono li anima con la scheda grafica senza ridisegnarli. Si ridisegna solo il contorno che cresce.
   L'animazione parte (classe .go) quando l'app ha finito di avviarsi; se lo script non parte, dopo 6 s sparisce da sola. ===== */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #0A0A0A; pointer-events: none; }
.splash:not(.go) { animation: spBg 0.3s ease-in 6s both; }
.splash .sp-logo { position: relative; width: min(58vw, 270px); aspect-ratio: 372 / 412; will-change: transform; }
.splash .sp-l { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.splash .sp-band, .splash .sp-glow { opacity: 0; will-change: opacity; }
.splash .sp-str { position: absolute; opacity: 0; will-change: transform, opacity; }
.splash .sp-str i { display: block; width: 100%; height: 100%; border-radius: 999px; background: #fff; will-change: transform; }
.splash .sp-name { position: absolute; left: 0; right: 0; top: calc(50% + min(32vw, 150px) + 14px); text-align: center;
  font-family: var(--font-title); font-size: clamp(16px, 5.4vw, 26px); letter-spacing: 0.12em; text-transform: uppercase;
  background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 28%, #EA9A2A 55%, #C97A16 80%, #8F500C 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #F0A93A; opacity: 0; }
/* le tre fasce hanno lo stesso contorno, 136 unità per lato */
.splash .e1 { stroke-dasharray: 0 272; stroke-dashoffset: -136; }
.splash .e2 { stroke-dasharray: 136 136; stroke-dashoffset: 136; }
.splash .e3 { stroke-dasharray: 0 272 0 300; }

/* s4 = La, s3 = Re, s2 = Sol, s1 = Do */
.splash.go .s4 { animation: spDrop 0.55s cubic-bezier(.25,.8,.35,1) 0.10s both; }
.splash.go .s3 { animation: spDrop 0.55s cubic-bezier(.25,.8,.35,1) 0.70s both; }
.splash.go .s2 { animation: spDrop 0.55s cubic-bezier(.25,.8,.35,1) 1.50s both; }
.splash.go .s1 { animation: spDrop 0.55s cubic-bezier(.25,.8,.35,1) 2.30s both; }
.splash.go .s4 i { animation: spVib 1.20s linear 0.50s both; }
.splash.go .s3 i { animation: spVib 1.55s linear 1.10s both; }
.splash.go .s2 i { animation: spVib 1.55s linear 1.90s both; }
.splash.go .s1 i { animation: spVib 1.25s linear 2.70s both; }
.splash.go .e1 { animation: spEdgeMid 0.75s cubic-bezier(.4,0,.2,1) 1.10s both; }
.splash.go .e2 { animation: spEdge 0.75s cubic-bezier(.4,0,.2,1) 1.90s both; }
.splash.go .e3 { animation: spEdgeIn 0.75s cubic-bezier(.4,0,.2,1) 2.70s both; }
.splash.go .b1 { animation: spBand 0.9s ease-out 1.45s both; }
.splash.go .b2 { animation: spBand 0.9s ease-out 2.25s both; }
.splash.go .b3 { animation: spBand 0.9s ease-out 3.05s both; }
.splash.go .sp-logo { animation: spBreath 1.1s ease-in-out 3.55s both; }
.splash.go .sp-glow { animation: spHalo 1.1s ease-in-out 3.55s both; }
.splash.go .sp-name { animation: spName 0.6s ease-out 3.75s both; }
.splash.go { animation: spBg 0.5s ease-in 4.55s both; }

@keyframes spDrop {
  0% { opacity: 0; transform: translate3d(0, -18%, 0); }
  60% { opacity: 1; transform: translate3d(0, 1.2%, 0); }
  82% { transform: translate3d(0, -0.5%, 0); }
  100% { opacity: 1; transform: none; }
}
/* spostamento in percentuale della larghezza della corda, così resta proporzionato su ogni schermo */
@keyframes spVib {
  0% { transform: translate3d(0,0,0); }       5% { transform: translate3d(-0.45vw,0,0); } 10% { transform: translate3d(0.45vw,0,0); }
  15% { transform: translate3d(-0.45vw,0,0); } 20% { transform: translate3d(0.45vw,0,0); } 25% { transform: translate3d(-0.43vw,0,0); }
  30% { transform: translate3d(0.43vw,0,0); }  35% { transform: translate3d(-0.42vw,0,0); }  40% { transform: translate3d(0.42vw,0,0); }
  45% { transform: translate3d(-0.39vw,0,0); } 50% { transform: translate3d(0.39vw,0,0); } 55% { transform: translate3d(-0.34vw,0,0); }
  60% { transform: translate3d(0.30vw,0,0); }  65% { transform: translate3d(-0.27vw,0,0); } 70% { transform: translate3d(0.22vw,0,0); }
  75% { transform: translate3d(-0.19vw,0,0); } 80% { transform: translate3d(0.15vw,0,0); } 85% { transform: translate3d(-0.11vw,0,0); }
  90% { transform: translate3d(0.08vw,0,0); }  95% { transform: translate3d(-0.03vw,0,0); } 100% { transform: translate3d(0,0,0); }
}
@keyframes spEdgeMid { from { stroke-dasharray: 0 272; stroke-dashoffset: -136; } to { stroke-dasharray: 272 272; stroke-dashoffset: 0; } }
@keyframes spEdge { from { stroke-dashoffset: 136; } to { stroke-dashoffset: 0; } }
@keyframes spEdgeIn { from { stroke-dasharray: 0 272 0 300; } to { stroke-dasharray: 136 0 136 300; } }
@keyframes spBand { from { opacity: 0; } to { opacity: 1; } }
@keyframes spBreath { 0%, 100% { transform: none; } 45% { transform: scale(1.035); } }
@keyframes spHalo { 0% { opacity: 0; } 45% { opacity: 0.6; } 100% { opacity: 0.4; } }
@keyframes spName { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: none; } }
@keyframes spBg { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .splash.go .sp-str, .splash.go .sp-str i, .splash.go .sp-band, .splash.go .sp-glow, .splash.go .sp-name, .splash.go .sp-e, .splash.go .sp-logo { animation: none; opacity: 1; }
  .splash .e1, .splash .e2, .splash .e3 { stroke-dasharray: none; stroke-dashoffset: 0; }
  .splash.go .sp-glow { opacity: 0.4; }
  .splash.go { animation: spBg 0.3s ease-in 0.9s both; }
}

/* ===== v42 · Termometri su canvas: Filamento o Quadrante (gauge.js) ===== */
.gauge { display: block; width: 100%; }
.gauge-cv { display: block; width: 100%; height: 66px; }
.gauge.g-dial .gauge-cv { height: auto; aspect-ratio: 3 / 1; max-height: 170px; }
.string > .sthc { display: block; flex: 1 1 230px; min-height: 230px; width: 100%; margin: 4px 0; background: transparent; }
@media (prefers-reduced-motion: no-preference) { .string[aria-pressed="true"] .sthc { animation: pluck 0.09s linear infinite; } }
.gstyle { width: 100%; margin-bottom: 12px; }
.gstyle button { flex: 1 1 0; }
/* Taratura · Termometro: due riquadri con l'anteprima dello stile */
.gchoice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.gopt { display: grid; gap: 6px; justify-items: center; padding: 10px 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--btn); color: var(--fg); text-align: center; min-width: 0; }
.gopt canvas { display: block; width: 100%; height: 64px; }
.gopt canvas { height: 92px; }
.gopt .gname { font-family: var(--font-sync); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.gopt .gdesc { font-size: 11px; line-height: 1.35; color: var(--muted); }
.gopt[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(240, 169, 58, 0.35); }
.gopt[aria-pressed="true"] .gname { color: var(--gold); font-weight: 700; }
.gopt:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Corda in tono: il riquadro si accende d'oro, come nella pagina di prova dei termometri */
.string.hit { border-color: rgba(240, 169, 58, 0.75); background: linear-gradient(180deg, rgba(240, 169, 58, 0.08), rgba(240, 169, 58, 0.03)); box-shadow: inset 0 1px 0 rgba(240, 169, 58, 0.6), 0 0 14px rgba(240, 169, 58, 0.18); transition: border-color 0.25s, background 0.25s, box-shadow 0.25s; }
.string.hit .letter { color: #FFE3A6; }
.string.hit > span:not(.act) { background: transparent; }
.gtitle { width: 100%; margin: 6px 0 -2px; text-align: left; }
.gopt.col canvas { height: 120px; }

/* Accorda: diapason a portata di mano, prima di iniziare */
.acc-ref { display: grid; gap: 8px; width: 100%; margin-bottom: 12px; }
.acc-ref-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper.sm button { min-width: 40px; min-height: 38px; }
.stepper.sm output { min-width: 76px; }
.seg.acc-presets { width: 100%; }
.seg.acc-presets button { flex: 1 1 0; min-width: 0; padding-left: 0; padding-right: 0; font-variant-numeric: tabular-nums; }

/* ===== Metronomo ===== */
.metro { align-items: stretch; }
.mt-hero { position: relative; width: min(64vw, 250px); aspect-ratio: 1; margin: 4px auto 0; display: grid; place-items: center; }
.mt-rh { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mt-rh polygon { fill: rgba(240, 169, 58, 0.04); stroke: rgba(240, 169, 58, 0.55); stroke-width: 1.6; vector-effect: non-scaling-stroke; transition: fill 0.25s, stroke 0.25s; }
.mt-read { position: relative; display: grid; justify-items: center; gap: 2px; }
.mt-read output { font-family: var(--font-sync); font-size: clamp(44px, 15vw, 64px); line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 35%, #EA9A2A 70%, #C97A16 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #F0A93A; }
.mt-unit { font-family: var(--font-sync); font-size: 9px; letter-spacing: 0.14em; color: var(--muted); }
.mt-name { font-size: 12.5px; color: var(--fg-dim, #CFC8BA); margin-top: 2px; }
.mt-count { position: absolute; bottom: 15%; font-family: var(--font-sync); font-size: 11px; color: var(--gold); letter-spacing: 0.1em; min-height: 1em; }
/* lampo a ogni battito: oro sul forte, bianco sugli altri, appena accennato sui muti */
@keyframes mtFlashG { from { fill: rgba(240, 169, 58, 0.32); stroke: #FFD21F; } to { fill: rgba(240, 169, 58, 0.04); stroke: rgba(240, 169, 58, 0.55); } }
@keyframes mtFlashW { from { fill: rgba(255, 255, 255, 0.12); stroke: #fff; } to { fill: rgba(240, 169, 58, 0.04); stroke: rgba(240, 169, 58, 0.55); } }
@keyframes mtFlashM { from { stroke: rgba(255, 255, 255, 0.35); } to { stroke: rgba(240, 169, 58, 0.55); } }
.mt-hero.hit-strong .mt-rh polygon { animation: mtFlashG 0.32s ease-out; }
.mt-hero.hit .mt-rh polygon { animation: mtFlashW 0.26s ease-out; }
.mt-hero.hit-mute .mt-rh polygon { animation: mtFlashM 0.26s ease-out; }
@media (prefers-reduced-motion: reduce) { .mt-hero .mt-rh polygon { animation-duration: 0.01s !important; } }
/* fila dei battiti: un rombo per battito, il suo livello si cambia toccandolo */
.mt-beats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 4px; width: 100%; }
.mt-beat { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 0 6px; border: 0; background: none; color: var(--muted); min-width: 0; }
.mt-beat i { display: block; width: clamp(12px, 5vw, 20px); aspect-ratio: 1; transform: rotate(45deg); border: 1.6px solid rgba(255, 255, 255, 0.55); transition: transform 0.08s, background 0.08s, box-shadow 0.12s; }
.mt-beat span { font-family: var(--font-sync); font-size: 8.5px; }
.mt-beat[data-lvl="3"] i { background: linear-gradient(180deg, #FFE27A, #F7A21E); border-color: #FFD21F; }
.mt-beat[data-lvl="2"] i { background: rgba(240, 169, 58, 0.45); border-color: rgba(255, 210, 31, 0.8); }
.mt-beat[data-lvl="0"] i { border-style: dashed; border-color: rgba(255, 255, 255, 0.22); }
.mt-beat.on i { transform: rotate(45deg) scale(1.3); box-shadow: 0 0 12px rgba(255, 255, 255, 0.55); }
.mt-beat.on[data-lvl="3"] i, .mt-beat.on[data-lvl="2"] i { box-shadow: 0 0 16px rgba(240, 169, 58, 0.9); }
.mt-beat.on span { color: var(--fg); }
.mt-poly { display: flex; justify-content: space-between; gap: 4px; padding: 0 8px; }
.mt-poly i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); transition: background 0.08s, box-shadow 0.12s; }
.mt-poly i.on { background: #5E86C4; box-shadow: 0 0 10px rgba(94, 134, 196, 0.8); }
.mt-tempo { display: grid; gap: 10px; }
.mt-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mt-steps .btn { padding-left: 0; padding-right: 0; }
.mt-tempo input[type=range] { width: 100%; }
.mt-state { margin: 0; min-height: 1.4em; text-align: center; font-size: 12.5px; color: var(--fg-dim, #CFC8BA); }
.seg.mt-meters, .seg.mt-subs, .seg.mt-polys { width: 100%; }
.seg.mt-meters button, .seg.mt-subs button, .seg.mt-polys button { flex: 1 1 0; min-width: 0; padding-left: 0; padding-right: 0; }
.mt-box { display: grid; gap: 10px; width: 100%; padding: 4px 0 8px 12px; border-left: 1px solid rgba(240, 169, 58, 0.3); }
.tabs button span { white-space: nowrap; }

/* ===== Barra del metronomo: resta sopra il menu in ogni scheda tranne la sua ===== */
.mtbar {
  position: fixed; left: 0; right: 0; z-index: 11; display: none; align-items: center; gap: 6px;
  bottom: calc(67px + env(safe-area-inset-bottom, 0px));
  max-width: 540px; margin: 0 auto; padding: 6px max(10px, env(safe-area-inset-left, 0px)) 6px max(10px, env(safe-area-inset-right, 0px));
  background: rgba(20, 20, 20, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
@media (min-width: 541px) { .mtbar { border: 1px solid var(--line); border-radius: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } }
body.mt-on:not([data-tab="metro"]) .mtbar { display: flex; }
body.mt-on:not([data-tab="metro"]) { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.mtb-go {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 40px;
  border: 0; background: transparent; color: var(--fg); text-align: left; padding: 0 4px; border-radius: 8px;
}
.mtb-go svg { width: 22px; height: 22px; flex: none; overflow: visible; }
.mtb-go polygon { fill: rgba(240, 169, 58, 0.06); stroke: var(--gold); stroke-width: 1.4; transition: fill 0.18s; }
.mtbar.hit .mtb-go polygon { animation: mtbW 0.24s ease-out; }
.mtbar.hit-strong .mtb-go polygon { animation: mtbG 0.3s ease-out; }
@keyframes mtbW { from { fill: rgba(255, 255, 255, 0.85); } to { fill: rgba(240, 169, 58, 0.06); } }
@keyframes mtbG { from { fill: var(--gold); } to { fill: rgba(240, 169, 58, 0.06); } }
body.mt-paused .mtb-go polygon { stroke: var(--muted); }
.mtb-n { font-family: var(--font-logo); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; color: var(--muted); }
.mtb-n b { font-family: var(--font-num, var(--font-logo)); font-weight: 400; font-size: 17px; color: var(--fg); letter-spacing: 0.02em; margin-right: 2px; }
.mtb-s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mtb-b {
  flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--fg); font-size: 18px; line-height: 1;
}
.mtb-stop { color: var(--gold); border-color: var(--gold-line); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .mtbar .mtb-go polygon { animation: none !important; } }

/* Rombo sfumato: il grigio del bordo scende al nero del centro (disegnato in studio.js).
   Note in oro bianco; la nota accesa prende l'oro caldo del titolo. */
.pkey.rh .rsh { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55)); }
.pkey.rh .k1 { color: #EDE3CC; font-size: 8.5px; letter-spacing: 0.02em; }
.pkey.rh .k2 { color: #A79E8C; }
.pkey.rh[aria-pressed="true"] .k1 {
  font-weight: 700;
  background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 28%, #EA9A2A 55%, #C97A16 80%, #8F500C 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #F0A93A;
}
.pkey.rh[aria-pressed="true"] .k2 { color: #E0A436; }
.pkey.rh[aria-pressed="true"]::after { display: none; }

/* ottava dentro il cerchio */
.pk-center { inset: 21% 24% 37% 24%; }
.pk-oct { position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; z-index: 2; }
.pk-oct button { width: 42px; height: 42px; border: 0; background: none; padding: 0;
  color: #CFC8BA; font-family: var(--font-sync); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.pk-oct button:active { color: var(--gold); }
.pk-oct button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.pk-oct button:disabled { opacity: 0.25; }
.pk-oct-v { display: grid; justify-items: center; min-width: 58px; line-height: 1.1; }
.pk-oct-v small { font-family: var(--font-sync); font-size: 6.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pk-oct-v b { font-family: var(--font-sync); font-weight: 700; font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ===== Metronomo: BPM al centro esatto del rombo, il nome del tempo sotto, fuori dal rombo ===== */
.mt-read { display: block; position: relative; }
.mt-read output { display: block; text-align: center; }
.mt-unit { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 8px; }
.mt-name { text-align: center; margin: 10px 0 0; font-family: var(--font-sync); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mtb-n b { font-family: var(--font-sync); font-size: 15px; }

/* Cerchi come i rombi: nessun puntino, la nota accesa prende l'oro caldo del titolo */
.pkey:not(.rh)[aria-pressed="true"]::after { display: none; }
.pkey:not(.rh) .k1 { color: #EDE3CC; }
.pkey:not(.rh)[aria-pressed="true"] .k1 {
  font-weight: 700;
  background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 28%, #EA9A2A 55%, #C97A16 80%, #8F500C 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #F0A93A;
}

/* ♯ e ♭ disegnati nello stile di Syncopate (il carattere non li contiene) */
.accg { display: inline-block; width: 0.6em; height: 0.86em; margin-left: 0.14em; vertical-align: -0.02em; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: butt; stroke-linejoin: round; }
.accg path { vector-effect: none; }
.pkey .k2 .accg { stroke-width: 1.6; }
.pkey[aria-pressed="true"] .accg { stroke: #F0A93A; }

/* =====================================================================
   v58 · Ogni sezione in una schermata
   L'app occupa lo schermo: barra sottile in alto (logo, nome della sezione, diapason),
   la sezione al centro, il menu in basso. Il titolo resta solo nell'animazione d'avvio.
   ===================================================================== */
html, body { height: 100%; }
body {
  overflow: hidden;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
}
body.mt-on:not([data-tab="metro"]) { padding-bottom: calc(122px + env(safe-area-inset-bottom, 0px)); }
main { height: 100%; gap: 10px; }
.view { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.view.fit { overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding-bottom: 0; }
.view .subtabs { margin-bottom: 0; flex: none; }

/* barra in alto */
.topbar { flex: none; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; text-align: left; }
.tb-logo { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px 0 0; border: 0; background: none; color: var(--fg); border-radius: 10px; cursor: pointer; }
.tb-logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.tb-sec { font-family: var(--font-sync); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.tb-chev { width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity 0.2s, transform 0.2s; }
.tb-logo.has-sheet .tb-chev { opacity: 1; }
.tb-logo[aria-expanded="true"] .tb-chev { transform: rotate(180deg); stroke: var(--gold); }
.tb-logo:focus-visible, .tb-cfg:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tb-cfg { font-family: var(--font-sync); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: none; white-space: nowrap; min-height: 32px; }

/* pannello che sale dal basso */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sh-back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.22s; }
.sh-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 540px; margin: 0 auto; max-height: 84%;
  display: flex; flex-direction: column; background: #141414; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0;
  transform: translateY(100%); transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.open .sh-back { opacity: 1; }
.sheet.open .sh-panel { transform: none; }
.sh-top { display: flex; align-items: center; justify-content: space-between; padding: 14px max(16px, env(safe-area-inset-left, 0px)) 6px max(18px, env(safe-area-inset-left, 0px)); flex: none; }
.sh-title { font-family: var(--font-sync); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.sh-x { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 16px; border-radius: 50%; }
.sh-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.vsheet { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.sh-h { margin: 14px 0 0; font-family: var(--font-sync); font-weight: 700; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg); }
.vsheet .note { margin: 0; }
@media (prefers-reduced-motion: reduce) { .sh-panel, .sh-back { transition: none; } }

/* ----- Studio ----- */
#v-study .ssub { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
#v-study .ssub[hidden] { display: none; }
.st-bar { flex: none; display: flex; align-items: center; gap: 8px; }
.st-bar[hidden] { display: none; }
.st-bar #stSys { flex: 1 1 auto; min-width: 0; }
.st-bar #stSys button { padding-left: 4px; padding-right: 4px; }
.st-ton { display: flex; align-items: center; gap: 6px; flex: none; }
.st-ton .eyebrow { display: none; }
#stTonic { min-height: 44px; background: var(--btn); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px;
  font-family: var(--font-sync); font-size: 10px; text-transform: uppercase; max-width: 34vw; }
.sq-fit { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
.sq-fit .pk { margin: 0; width: 300px; height: 300px; max-width: 100%; aspect-ratio: auto; }
.chordbar { flex: none; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chordbar::-webkit-scrollbar { display: none; }
.chordbar .btn { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; }
.st-actions { flex: none; display: flex; justify-content: center; }
.st-actions .btn { min-height: 40px; }
#st-deg .st-rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#st-deg .st-row { padding-top: 0; padding-bottom: 0; min-height: 0; flex: 1 1 0; align-items: center; }
#st-deg .st-rows { display: flex; flex-direction: column; }
#st-str { justify-content: center; gap: 26px !important; }
.st-block { display: grid; gap: 10px; }
.seg.quick.big button { min-height: 64px; font-size: 10px; }
#st-lab { justify-content: center; }
#st-lab .lab { gap: 16px; }
.note.sm { font-size: 12px; flex: none; }
.chordbar .pk-stop { color: var(--muted); }

/* ----- Accorda in una schermata (v59): Corde e Quinte, con la Guida sopra ----- */
#v-guided { gap: 8px; }
.acc-top { flex: none; display: flex; gap: 8px; align-items: stretch; }
.acc-top .subtabs { flex: 1 1 auto; width: auto; }
.guide-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; }
.guide-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.guide-btn[aria-pressed="true"] { color: var(--gold); border-color: var(--gold-line); }
.guide-btn[aria-pressed="true"] svg { fill: var(--gold); stroke: var(--gold); }
#v-guided .acc-ref { flex: none; margin: 0; gap: 0; }
#v-guided .acc-ref-top { min-height: 40px; }
#v-guided.guiding .acc-ref { display: none; }

.guide { flex: none; display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--gold-line); border-radius: 10px; background: rgba(240, 169, 58, 0.05); }
.guide[hidden] { display: none; }
.gd-head { display: flex; align-items: center; gap: 10px; }
.gd-head .dots { flex: 1 1 auto; gap: 6px; }
.gd-head .dots li { font-family: var(--font-sync); font-size: 8px; gap: 4px; }
.gd-head .dots li.done { color: var(--gold); }
.gd-head .dots li.done::before { background: var(--gold); }
.gd-step { flex: none; font-family: var(--font-sync); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.guide .gd-instr { min-height: 0; font-size: 12.5px; line-height: 1.45; }
.gd-acts { display: flex; gap: 6px; justify-content: center; }
.gd-acts .btn { min-height: 34px; padding: 6px 12px; }

#v-guided .sub { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#v-guided .sub[hidden] { display: none; }
.str-area { flex: 1 1 auto; min-height: 0; display: flex; }
.str-area .strings { flex: 1 1 auto; min-height: 0; }
.str-area .strings[hidden] { display: none; }
.str-area .string { min-height: 0; }
.str-area .string > .sthc { flex: 1 1 0; min-height: 60px; }
.trace-box { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.trace-box[hidden] { display: none; }
.trace-box .trace { flex: 1 1 auto; height: auto; min-height: 0; }

.tuner.compact { flex: none; gap: 8px; padding: 10px 12px; }
.tuner.compact .tn-top { align-items: baseline; }
.tuner.compact .tn-note { font-size: 22px; min-width: 0; }
.tuner.compact .tn-cents { font-size: 15px; }
.tuner.compact .tn-side { text-align: right; }
.tuner.compact .gauge-cv { height: 46px; }
.tuner.compact .gauge.g-dial .gauge-cv { max-height: 96px; }
.tn-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tuner.compact .tn-verdict { font-size: 12.5px; text-align: left; }
.acts4 { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.acts4 .btn { min-height: 40px; padding: 6px 4px; }
.tuner.compact .lab-actions .btn { min-height: 40px; }

/* Quinte: la scheda riempie lo spazio, il battito in mezzo si allarga */
.tuner.dbl { flex: 1 1 auto; min-height: 0; justify-content: space-between; }
.dbl-mid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.dbl-mid .pulse-wrap { height: auto; flex: 1 1 auto; min-height: 60px; max-height: 150px; }
.dbl-mid .pulse { width: min(96px, 18vh); height: min(96px, 18vh); }
/* rifiniture: più spazio alle corde, Guida più bassa */
.str-area .string .letter { font-size: clamp(22px, 4.6vh, 40px); padding: 2px 4px; }
.str-area .string { padding-top: 6px; padding-bottom: 6px; }
.tuner.compact { gap: 6px; padding: 8px 12px; }
.tuner.compact .gauge-cv { height: 40px; }
.guide { gap: 6px; padding: 8px 10px; }
.guide .gd-instr { font-size: 12px; }
.gd-acts .btn { min-height: 30px; padding: 4px 12px; font-size: 8px; }
#v-guided.guiding #dblPairs { display: none; }
.tuner.dbl { gap: 6px; padding: 10px 12px; }
.dbl-mid .pulse-wrap { min-height: 44px; }
.dbl-mid .pulse { width: min(96px, 14vh); height: min(96px, 14vh); }
.tuner.dbl .readout .verdict { font-size: 12.5px; line-height: 1.35; }
.dbl-mid { flex-direction: row; align-items: center; justify-content: center; gap: 14px; }
.dbl-mid .pulse-wrap { flex: 0 0 auto; width: min(110px, 16vh); height: min(110px, 16vh); min-height: 0; max-height: none; }
.dbl-mid .readout { flex: 0 1 auto; text-align: left; align-items: flex-start; }
.tuner.dbl .tn-cents { font-size: 15px; }

/* =====================================================================
   v61 · Palcoscenico
   Scala armonica di Fibonacci: caratteri 8 · 13 · 21 · 34 · 55 · 89, spazi 5 · 8 · 13 · 21 · 34, righe da 55.
   Syncopate solo nel peso normale: il risalto lo dà l'oro, mai il grassetto.
   ===================================================================== */
:root { --f8: 8px; --f13: 13px; --f21: 21px; --f34: 34px; --f55: 55px; --f89: 89px; --row: 55px; --tabsH: 68px; --levaH: 34px; }
html { font-synthesis: none; }
h2 { font-size: var(--f13); }

/* barra in alto */
.topbar { min-height: var(--row); }
.tb-logo img { width: 21px; height: 21px; border-radius: 5px; }
.tb-sec { font-size: var(--f8); letter-spacing: 0.24em; font-weight: 400; }
.tb-cfg { font-size: var(--f8); border: 0; padding: 0 2px; min-height: 44px; }

/* menu: icona 24, scritta 9, riga 55 */
.tabs { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabs button { min-height: var(--row); gap: var(--s8, 8px); font-family: var(--font-sync); font-weight: 400; font-size: 9px; letter-spacing: 0.06em; }
.tabs svg { width: 24px; height: 24px; stroke-width: 1.6; }
.tabs button[aria-current="page"] { color: var(--gold); }
.tabs button[aria-current="page"] svg { stroke: var(--gold); }

/* la leva d'oro sopra il menu */
.leva { position: fixed; left: 0; right: 0; z-index: 10; bottom: calc(var(--tabsH) + env(safe-area-inset-bottom, 0px)); height: var(--levaH);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 0; background: var(--bg); color: var(--muted); cursor: pointer; }
.leva[hidden] { display: none; }
.leva i { display: block; width: 34px; height: 3px; border-radius: 2px; background: var(--gold); transition: width 0.2s; }
.leva:hover i, .leva:focus-visible i { width: 55px; }
.leva span { font-family: var(--font-sync); font-size: var(--f8); letter-spacing: 0.2em; text-transform: uppercase; }
.leva:focus-visible { outline: none; }
body { padding-bottom: calc(var(--tabsH) + env(safe-area-inset-bottom, 0px)); }
body.has-leva { padding-bottom: calc(var(--tabsH) + var(--levaH) + env(safe-area-inset-bottom, 0px)); }
body.mt-on:not([data-tab="metro"]) { padding-bottom: calc(var(--tabsH) + 54px + env(safe-area-inset-bottom, 0px)); }
body.has-leva.mt-on:not([data-tab="metro"]) { padding-bottom: calc(var(--tabsH) + var(--levaH) + 54px + env(safe-area-inset-bottom, 0px)); }
.mtbar { bottom: calc(var(--tabsH) + env(safe-area-inset-bottom, 0px)); }
body.has-leva .mtbar { bottom: calc(var(--tabsH) + var(--levaH) + env(safe-area-inset-bottom, 0px)); }

/* i modi come parole: Corde · Quinte · Guida, Tastiera · Gradi · Corde · Battimenti */
.seg.subtabs { width: auto; border: 0 !important; background: none !important; box-shadow: none !important; justify-content: center; gap: var(--f34); overflow: visible; }
.seg.subtabs button, .guide-btn { flex: 0 0 auto !important; min-height: 44px; padding: 0 2px !important; border: 0 !important; border-bottom: 1px solid transparent !important; border-radius: 0 !important;
  background: none !important; box-shadow: none !important; color: var(--muted); font-family: var(--font-sync); font-weight: 400 !important; font-size: var(--f8) !important; letter-spacing: 0.2em; text-transform: uppercase; cursor: pointer; }
.seg.subtabs button[aria-selected="true"], .guide-btn[aria-pressed="true"] { color: var(--gold) !important; border-bottom-color: var(--gold) !important; }
.guide-btn svg { display: none; }
.acc-top { justify-content: center; gap: var(--f34); align-items: center; }
.acc-top .subtabs { flex: 0 0 auto; }
#stMode { gap: var(--f21); }
.vsheet .acc-ref { margin: 0; }

/* Accorda: lo schermo si scalda appena quando sei in tono */
#v-guided { position: relative; isolation: isolate; }
#v-guided::before { content: ""; position: absolute; inset: -20px -16px 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.6s;
  background: radial-gradient(70% 55% at 50% 42%, rgba(240, 169, 58, 0.15), rgba(240, 169, 58, 0) 70%); }
#v-guided:has(.tuner.on.ok)::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #v-guided::before { transition: none; } }
.str-area .string .letter { font-family: var(--font-sync); font-size: clamp(21px, 4.4vh, 34px); font-weight: 400; }
.tuner.compact .tn-note { font-size: var(--f21); }
.tuner.compact .tn-cents { font-size: var(--f21); }
.tuner.compact .tn-verdict { font-size: var(--f13); }

/* Metronomo: palcoscenico e racconto */
#v-metro { padding-bottom: 0; scrollbar-width: none; }
#v-metro::-webkit-scrollbar { display: none; }
.mt-mini { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: var(--f13); height: var(--row); background: var(--bg); border-bottom: 1px solid var(--line);
  margin-bottom: calc(-1 * var(--row)); transform: translateY(-100%); opacity: 0; pointer-events: none; transition: transform 0.25s, opacity 0.25s; }
#v-metro.deep .mt-mini { transform: none; opacity: 1; pointer-events: auto; }
.mt-mini svg { width: 34px; height: 34px; flex: none; }
.mt-mini svg polygon { fill: rgba(240, 169, 58, 0.06); stroke: var(--gold-line); stroke-width: 3; }
.mtm-bpm { font-family: var(--font-sync); font-size: var(--f21); background: linear-gradient(180deg, #FFDF8A, #F7BA46 35%, #EA9A2A 70%, #C97A16); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--gold); }
.mtm-name { flex: 1; min-width: 0; color: var(--muted); font-size: var(--f8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-stage { min-height: 100%; display: flex; flex-direction: column; }
.mt-stage .mt-hero { flex: 0 0 auto; width: min(78vw, 42vh, 340px); max-width: 100%; margin: auto auto 0; }
.mt-stage .mt-read output { font-size: clamp(55px, 22vw, 89px); font-weight: 400; }
.mt-stage .mt-unit { font-size: var(--f8); letter-spacing: 0.24em; margin-top: var(--f13); }
.mt-under { flex: none; display: grid; gap: 8px; justify-items: center; padding-top: var(--f21); min-height: 55px; }
.mt-under .mt-name { margin: 0; }
.mt-under .mt-state { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.mt-ctl { flex: none; display: flex; align-items: center; justify-content: center; gap: var(--f34); margin: auto 0 0; padding: var(--f13) 0 var(--f21); }
.mt-step { width: 55px; height: 55px; border-radius: 50%; border: 0; background: none; color: var(--fg-dim, #CFC8BA); font-family: var(--font-sync); font-size: var(--f21); cursor: pointer; }
.mt-play { width: 89px; height: 89px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(180deg, #FFE27A, #F7A21E 60%, #D07A0C); box-shadow: 0 0 34px rgba(247, 169, 58, 0.3); }
.mt-play svg { width: 26px; height: 26px; }
.mt-play .mt-ico { fill: #1A1300; }
.mt-play.sm { width: 44px; height: 44px; box-shadow: none; flex: none; }
.mt-play.sm svg { width: 14px; height: 14px; }
.mt-v { fill: #ECE7DD; transform-box: fill-box; transform-origin: center; transition: transform 0.08s; }
.mt-v.on { transform: scale(2.2); fill: #FFFFFF; }
.mt-v.on.strong { fill: #FFC23D; }
.mt-p2 { fill: none; stroke: #4DA3FF; stroke-opacity: 0.5; stroke-width: 1; vector-effect: non-scaling-stroke; }
.mt-pv { fill: #4DA3FF; fill-opacity: 0.55; transform-box: fill-box; transform-origin: center; transition: transform 0.08s; }
.mt-pv.on { fill-opacity: 1; transform: scale(1.9); }
.mt-story { padding: var(--f21) 0 var(--f34); display: flex; flex-direction: column; }
.mt-story .ref { margin-bottom: 0; }
.chap-h { margin: var(--f34) 0 var(--f13); font-family: var(--font-sync); font-weight: 400; font-size: var(--f8); letter-spacing: 0.2em; color: var(--gold); text-transform: uppercase; }
.mt-story > .chap-h:first-child { margin-top: var(--f13); }

/* Strumento: lo strumento in cima, poi accordatura e preferenze */
.instr { display: grid; gap: var(--f13); margin-bottom: var(--f21); }
.instr-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--f13); }
.instr-name { font-family: var(--font-sync); font-size: var(--f21); text-transform: uppercase;
  background: linear-gradient(180deg, #FFDF8A, #F7BA46 35%, #EA9A2A 70%, #C97A16); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--gold); }
.instr-btns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.instr-btns button { min-height: var(--row); border-radius: 13px; border: 1px solid var(--line); background: none; color: var(--fg-dim, #CFC8BA);
  font-family: var(--font-sync); font-size: 7px; letter-spacing: 0.04em; text-transform: uppercase; display: grid; place-content: center; gap: 4px; padding: 0 2px; }
.instr-btns button[aria-pressed="true"] { border-color: var(--gold-line); color: var(--gold); background: rgba(240, 169, 58, 0.07); }
.instr-btns button:disabled { opacity: 0.5; cursor: default; }
.instr-btns small { font-size: 6px; color: var(--muted); letter-spacing: 0.1em; }
/* Corde: le quattro corde sono il palcoscenico; la lettura sotto è una riga, senza scheda né seconda scala */
#sub-free .string { background: none !important; border: 0 !important; box-shadow: none !important; }
#sub-free .string .act { display: none; }
#tuner { background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 4px !important; gap: 8px !important; flex: none; }
#tuner .therm { display: none; }
#tuner .tn-top { align-items: baseline; }
#tuner .tn-note { font-size: var(--f21); min-width: 0; }
#tuner .tn-cents { font-size: var(--f21); }
#tuner .tn-side { text-align: right; }
#tuner .tn-verdict { font-size: var(--f13); text-align: left; }
#tuner .lab-actions .btn { min-height: 40px; }

/* ===== Metronomo · numeri grandi (v62) ===== */
.mt-big { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 21px;
  padding: calc(env(safe-area-inset-top, 0px) + 21px) 16px calc(env(safe-area-inset-bottom, 0px) + 34px); cursor: pointer; }
.mt-big-num { font-family: var(--font-sync); font-size: min(62vw, 46vh); line-height: 1; font-variant-numeric: tabular-nums; color: var(--fg); min-height: 1em; transition: opacity 0.12s; }
.mt-big-info { font-size: 11px; letter-spacing: 0.2em; }
.mt-big-hint { margin: 0; text-align: center; }
.mt-big .mt-play { margin-top: 8px; }
/* primo battito: oro come il rombo, gli altri bianchi, i silenzi appena visibili */
.mt-big.hit-strong .mt-big-num { background: linear-gradient(180deg, #FFDF8A 0%, #F7BA46 35%, #EA9A2A 70%, #C97A16 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.mt-big.hit-strong { animation: mtBigG 0.38s ease-out; }
.mt-big.hit { animation: mtBigW 0.3s ease-out; }
.mt-big.hit-mute .mt-big-num { opacity: 0.16; }
.mt-big.count .mt-big-num { color: var(--muted); }
.mt-big.count.hit-strong .mt-big-num { -webkit-text-fill-color: currentColor; background: none; color: var(--gold); }
@keyframes mtBigG { from { background: #2A1C06; } to { background: var(--bg); } }
@keyframes mtBigW { from { background: #1B1B1B; } to { background: var(--bg); } }
@media (prefers-reduced-motion: reduce) { .mt-big.hit-strong, .mt-big.hit { animation: none; } }
.mt-gap-out { font-family: var(--font-logo); font-weight: 300; font-size: 13px; color: var(--fg); font-variant-numeric: tabular-nums; }
#mtGap { width: 100%; }
.mt-hero { cursor: pointer; }

/* ===== Metronomo · catena, esercizi, diario (v64) ===== */
.mt-chain { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mt-chip { display: inline-flex; align-items: baseline; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--btn-line); border-radius: 8px;
  background: var(--btn); color: var(--fg); font-family: var(--font-logo); font-weight: 300; font-size: 14px; font-variant-numeric: tabular-nums; }
.mt-chip small { font-size: 8.5px; color: var(--muted); }
.mt-chip.on { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(240, 169, 58, 0.35); }
.mt-pre-new { display: flex; gap: 8px; width: 100%; }
.mt-pre-new input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--btn-line); border-radius: 8px;
  background: var(--surface); color: var(--fg); font-family: var(--font-body); font-size: 15px; }
.mt-pre-new input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.mt-pres { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.mt-pre { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mt-pre.on { border-color: var(--gold-line, rgba(240, 169, 58, 0.55)); }
.mt-pre-open { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; padding: 10px 12px; text-align: left; border: 0; background: var(--btn); color: var(--fg); }
.mt-pre-open b { font-family: var(--font-logo); font-weight: 300; font-size: 13px; letter-spacing: 0.03em; overflow-wrap: anywhere; }
.mt-pre.on .mt-pre-open b { color: var(--gold); }
.mt-pre-open span { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.mt-pre-del { flex: none; min-width: 52px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: var(--btn); color: var(--muted); font-size: 13px; }
.mt-pre-del.armed { color: #1A1300; background: var(--gold); font-family: var(--font-logo); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.mt-dsum { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; width: 100%; }
.mt-dsum > div { display: grid; justify-items: center; gap: 4px; padding: 13px 8px; border: 1px solid var(--line); border-radius: 8px; }
.mt-dsum b { font-family: var(--font-sync); font-weight: 400; font-size: 34px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.mt-dsum span { font-family: var(--font-logo); font-weight: 300; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mt-dsum small { font-size: 11px; color: var(--muted); }
.mt-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
.mt-day { display: grid; justify-items: center; gap: 5px; }
/* ogni giorno è un rombo che si riempie d'oro verso l'obiettivo */
.mt-day i { position: relative; width: 24px; aspect-ratio: 1; transform: rotate(45deg); border: 1.5px solid rgba(255, 255, 255, 0.2); overflow: hidden; }
.mt-day i::after { content: ""; position: absolute; inset: 0; transform: rotate(-45deg) scale(1.5); transform-origin: center;
  background: linear-gradient(0deg, #F7A21E 0, #FFC23D calc(var(--r, 0) * 100%), transparent calc(var(--r, 0) * 100%)); }
.mt-day.some i { border-color: rgba(240, 169, 58, 0.6); }
.mt-day.full i { border-color: #FFD21F; box-shadow: 0 0 10px rgba(240, 169, 58, 0.6); }
.mt-day b { min-height: 1em; font-family: var(--font-logo); font-weight: 300; font-size: 10px; color: var(--fg); font-variant-numeric: tabular-nums; }
.mt-day span { font-family: var(--font-logo); font-weight: 300; font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.mt-day.today span { color: var(--gold); }
.mt-dlist { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; }
.mt-dlist li { display: grid; gap: 2px; padding: 9px 0; border-top: 1px solid var(--line); text-align: left; }
.mt-dlist .w { font-family: var(--font-logo); font-weight: 300; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.mt-dlist .d { font-size: 13px; color: var(--fg); overflow-wrap: anywhere; }

/* ===== Metronomo · il tuo tempo (v65) ===== */
.mt-live-cv { display: block; width: 100%; height: 160px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.mt-live-verdict { margin: 0; min-height: 1.2em; font-family: var(--font-sync); font-size: 20px; letter-spacing: 0.06em; color: var(--fg); text-align: center; }
.mt-live-verdict[data-k="ok"] { color: var(--gold); }
.mt-live-verdict[data-k="early"] { color: #E8DCC2; }
.mt-live-verdict[data-k="late"] { color: #D2735C; }
.mt-live-stats { min-height: 1.4em; font-variant-numeric: tabular-nums; }

/* ===== Metronomo · la figura A+B (v66) ===== */
.mt-fig { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* nella vista gesto i BPM salgono in cima, più piccoli, e lasciano spazio alla traiettoria */
.mt-hero .mt-read { transition: transform 0.35s ease; }
.mt-hero.gesture .mt-read { transform: translateY(-36%) scale(0.58); }
.mt-hero.gesture .mt-read { position: absolute; top: 0; }
.mt-hero.gesture .mt-count { opacity: 0; }

/* ===== Metronomo · i BPM sotto la figura (v70) ===== */
.mt-tempo-row { display: flex; align-items: center; justify-content: center; gap: var(--f21); }
.mt-stage .mt-tempo-row .mt-read { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 120px; transform: none; top: auto; }
.mt-stage .mt-tempo-row .mt-read output { font-size: 34px; }
.mt-stage .mt-tempo-row .mt-unit { position: static; transform: none; margin-top: 0; font-size: 8px; }
.mt-under { padding-top: var(--f13); gap: 6px; }
.mt-under .mt-name { font-size: 9px; letter-spacing: 0.2em; }
/* lo spazio tra la figura e i BPM segue la figura: un ottavo della sua larghezza (circa 42 px a 340 px),
   più il rombo del battere che sporge sotto il cerchio; sotto i BPM la riga resta vicina, come una didascalia */
.mt-stage { --fig: min(78vw, 42vh, 340px); }
.mt-under { padding-top: calc(var(--fig) / 8 + 8px); gap: 8px; }
.mt-ctl { padding-top: calc(var(--fig) / 8); }

/* ===== Metronomo · Leggio (v72) ===== */
.mt-stand { position: fixed; inset: 0; z-index: 61; background: var(--bg); display: grid; cursor: pointer;
  grid-template-rows: auto 1fr auto; grid-template-columns: 1fr; align-items: center; justify-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 13px) max(13px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 21px) max(13px, env(safe-area-inset-left, 0px)); }
.mts-info { justify-self: start; display: grid; gap: 4px; }
.mts-bpm { display: flex; align-items: baseline; gap: 8px; }
.mts-bpm b { font-family: var(--font-sync); font-weight: 400; font-size: 21px; color: var(--gold); font-variant-numeric: tabular-nums; }
.mts-bpm small { font-family: var(--font-sync); font-size: 8px; letter-spacing: 0.2em; color: var(--muted); }
.mts-meter { font-family: var(--font-logo); font-weight: 300; font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: #8C857A; }
.mts-fig { width: min(100%, calc(100dvh - 160px)); aspect-ratio: 1; max-width: 100%; display: block; }
.mts-play { justify-self: end; opacity: 0.85; }
.mts-hint { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 34px); text-align: center; font-size: 12px; color: var(--muted);
  opacity: 0; transition: opacity 0.6s; pointer-events: none; }
.mt-stand.hint .mts-hint { opacity: 1; }
/* in orizzontale: la figura prende tutta l'altezza, i BPM e il tasto stanno di lato */
@media (orientation: landscape) {
  .mt-stand { grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr; column-gap: 21px; }
  .mts-info { grid-column: 1; justify-self: end; text-align: right; justify-items: end; }
  .mts-info .mts-bpm b { font-size: 55px; }
  .mts-fig { grid-column: 2; grid-row: 1; width: auto; height: calc(100dvh - 34px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
  .mts-play { grid-column: 3; grid-row: 1; justify-self: start; }
}
.mt-hero { -webkit-touch-callout: none; user-select: none; }
.mts-meter { text-wrap: balance; max-width: 26ch; }

/* ===== Revisione v73 ===== */
/* Quinte e Battimenti senza cornice, come le corde: il palcoscenico non ha riquadri */
#sub-double .tuner.dbl, #st-lab .lab { background: none; border: 0; box-shadow: none; padding-inline: 0; }
/* gli accordi pronti vanno a capo invece di uscire dallo schermo */
#st-keys .chordbar { flex-wrap: wrap; overflow: visible; justify-content: center; }
/* nel modo Corde la riga nota/cent/Hz ripeteva ciò che dicono già le quattro corde */
#sub-free .tn-top { display: none; }
/* la riga in alto a destra c'è solo dove serve */
.tb-cfg:empty { display: none; }
#sub-double #dbl { background: none; border: 0; box-shadow: none; padding-inline: 0; }
#st-keys .chordbar .btn { padding: 8px 10px; }
/* ===== v74 · logo più leggibile: 34 px nella barra da 55, nome della sezione a 10 px ===== */
.tb-logo { gap: var(--f13); }
.tb-logo img { width: var(--f34); height: var(--f34); border-radius: 8px; }
.tb-sec { font-size: 10px; }
