/* Stile coerente con simonecastellan.com — minimale, monocromatico, luce. */
:root {
  --bg: #ffffff;
  --text: #3c4043;
  --ink: #1a1a1a;
  --muted: #5f6368;
  --muted-2: #80868b;
  --faint: #9aa0a6;
  --pill: #f1f3f4;
  --pill-hover: #e6e8ea;
  --line: #c2c6cc;
  --line-soft: #dadce0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 18px calc(48px + env(safe-area-inset-bottom));
  text-align: center;
}

.card {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

/* Bottoni pillola */
.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.btn-secondary { background: var(--pill); }
.btn-secondary:hover { background: var(--pill-hover); }

/* Tondi +/- e play */
.step {
  appearance: none;
  border: none;
  background: var(--pill);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s ease;
}
.step.sm { width: 30px; height: 30px; font-size: 15px; }
.step:hover { background: var(--pill-hover); }
.step:active { background: var(--line-soft); }
.play { font-size: 12px; }

/* Carica audio */
.upload { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-name { font-size: 11px; color: var(--faint); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Player compatto: play + avanzamento + volume */
.player { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; }
.transport { display: flex; align-items: center; gap: 12px; }
.pbar { flex: 1; }
.times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.vol { display: flex; align-items: center; gap: 10px; }
.vol-ic { font-size: 12px; opacity: .55; }
.range {
  appearance: none; -webkit-appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
  cursor: pointer;
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}
.range::-moz-range-thumb {
  width: 13px; height: 13px;
  border: none; border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}

/* Tastiera */
.keyboard {
  position: relative;
  width: 100%;
  height: 96px;
  display: flex;
  gap: 3px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.key {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  transition: background .08s ease, color .08s ease;
}
.key.white {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 0 0 6px 6px;
  color: var(--muted-2);
  z-index: 1;
}
.key.white:hover { background: var(--pill); }
.key.black {
  position: absolute;
  top: 0;
  height: 60%;
  width: 9%;
  background: var(--ink);
  border-radius: 0 0 5px 5px;
  color: #cfcfcf;
  font-size: 8px;
  z-index: 2;
}
.key.black:hover { background: #333; }
.key.on.white { background: var(--ink); color: #fff; border-color: var(--ink); }
.key.on.black { background: #555; color: #fff; }
/* Note dell'accordo: evidenziazione tenue (solo visiva) */
.key.ghost.white { background: #e3e7ef; color: var(--muted); border-color: #cfd5df; }
.key.ghost.black { background: #6a7280; color: #fff; }

/* Modalità (segmented) */
.seg {
  display: inline-flex;
  gap: 3px;
  background: var(--pill);
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Riga Stop / Ottava */
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.oct { display: inline-flex; align-items: center; gap: 8px; }
.oct-label { font-size: 12px; font-weight: 600; color: var(--ink); min-width: 46px; }

/* Tonalità stimata */
.result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  min-height: 20px;
}
.key-guess { font-size: 14px; color: var(--muted); }
.key-guess b { color: var(--ink); font-weight: 600; }
.key-guess .conf { color: var(--faint); font-size: 12px; margin-left: 4px; }
.reset-link {
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--faint);
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 0 1px;
}
.reset-link:hover { color: var(--muted); }

/* Footer */
.site-footer {
  position: fixed;
  left: 0; right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 12px;
  color: #6b7075;
  letter-spacing: .2px;
  pointer-events: none;
}
.site-footer a { color: #6b7075; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; pointer-events: auto; }
.site-footer a:hover { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 460px) {
  h1 { font-size: 18px; }
  .keyboard { height: 84px; }
  .seg-btn { padding: 6px 11px; }
  .btn { padding: 8px 13px; }
}
