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

* { 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: 24px 20px calc(64px + env(safe-area-inset-bottom));
  text-align: center;
}

.card {
  width: 100%;
  max-width: 440px;
}

/* Intestazione */
header { margin-bottom: 24px; }
h1 {
  font-size: 26px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.2px;
}
.subtitle {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* Controllo BPM */
.bpm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.step {
  appearance: none;
  border: none;
  background: var(--pill);
  color: var(--ink);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s ease;
}
.step:hover { background: var(--pill-hover); }
.step:active { background: var(--line-soft); }

.bpm-field {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.bpm-input {
  appearance: textfield;
  -moz-appearance: textfield;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 52px;
  font-weight: 600;
  letter-spacing: -1px;
  width: 3.2ch;
  text-align: center;
  padding: 0;
}
.bpm-input:focus { outline: none; }
.bpm-input::-webkit-outer-spin-button,
.bpm-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bpm-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Bottoni — pillole come sul sito */
.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.btn-secondary { background: var(--pill); color: var(--ink); }
.btn-secondary:hover { background: var(--pill-hover); }

.tap {
  width: 170px;
  height: 170px;
  font-size: 28px;
  letter-spacing: 2px;
  padding: 0;
  display: flex;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  transition: width .35s ease, height .35s ease, font-size .35s ease,
              border-radius .35s ease, letter-spacing .35s ease;
}
.tap.compact {
  width: 100%;
  height: 48px;
  font-size: 15px;
  letter-spacing: 1px;
  border-radius: 999px;
  margin: 0;
}
.tap.beat { background: var(--line-soft); }
.tap-hint {
  font-size: 12px;
  color: var(--faint);
  margin: 10px 0 0;
  min-height: 1em;
  transition: color .15s ease;
}

/* Pulsante Avanzate */
.adv-btn {
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-top: 20px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 1px;
  border-radius: 0;
  transition: color .15s ease;
}
.adv-btn:hover { color: var(--ink); }

/* Sezione avanzata — slide-down animato */
.advanced {
  margin-top: 0;
  width: 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}
.advanced.open {
  max-height: 900px;
  opacity: 1;
  margin-top: 26px;
}

/* Tabella tempi */
.grid { width: 100%; }
.grid-head, .grid-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
  align-items: center;
}
.grid-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted-2);
  padding: 0 6px 10px;
}
.grid-head span { text-align: center; }
.grid-head .col-note { text-align: left; }

.grid-row {
  border-top: 1px solid var(--line-soft);
}
.grid-row .note {
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding-left: 6px;
}
.grid-row .note small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
  letter-spacing: .2px;
}
.cell {
  appearance: none;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  padding: 13px 4px;
  cursor: pointer;
  border-radius: 10px;
  transition: background .12s ease, color .12s ease;
}
.cell:hover { background: var(--pill); color: var(--ink); }
.cell:active, .cell.copied { background: var(--ink); color: #fff; }

/* Selettore unità */
.unit-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--pill);
  border-radius: 999px;
  padding: 4px;
  margin-top: 22px;
}
.unit {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.unit.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: .1px;
}

/* Toast di conferma copia */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(56px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Footer fisso, come il credit del sito */
.site-footer {
  position: fixed;
  left: 0; right: 0;
  bottom: 16px;
  text-align: center;
  font-size: 12px;
  color: #6b7075;
  letter-spacing: .2px;
}
.site-footer a { color: #6b7075; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.site-footer a:hover { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 460px) {
  h1 { font-size: 22px; }
  .subtitle { font-size: 15px; }
  .bpm-input { font-size: 46px; }
  .cell { font-size: 14px; padding: 13px 2px; }
  .grid-row .note { font-size: 14px; }
}
