/* =========================================================================
   MIDISSIMO - foglio di stile
   Palette calda e leggermente desaturata, come la ricerca di un villaggio
   tranquillo: verde salvia, legno, crema. Niente nero puro.
   ========================================================================= */

:root {
  --bg:        #1d2321;
  --bg-2:      #262e2b;
  --panel:     #2f3833;
  --panel-2:   #3a453e;
  --line:      #465149;
  --text:      #eef1ec;
  --text-dim:  #a7b3a8;
  --accent:    #8fbf6a;
  --accent-2:  #d9a441;
  --danger:    #d97a6c;
  --radius:    10px;
  --shadow:    0 2px 10px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Il verde acceso come pulsante primario, coerente con il tema. */
button { font: inherit; color: inherit; cursor: pointer; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}

/* ------------------------------------------------------------- intestazione */

header.top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  padding: 26px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

header.top h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: .3px;
}

header.top h1 .dot { color: var(--accent); }

header.top p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  max-width: 60ch;
}

/* ---------------------------------------------------------------- griglia */

.layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------------- pannelli */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel + .panel { margin-top: 18px; }

.panel-head {
  padding: 11px 15px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-dim);
  font-weight: 600;
}

.panel-body { padding: 15px; }

/* ------------------------------------------------------------- lista brani */

#track-list { display: flex; flex-direction: column; }

.track {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background .12s;
}

.track:last-child { border-bottom: 0; }
.track:hover { background: var(--panel-2); }

.track.is-active {
  background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.track-num {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 12px;
  min-width: 20px;
}

.track-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.track-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub { font-size: 12px; color: var(--text-dim); }

.track-dur {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ schermata brano */

.brano-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 4px;
}

#track-title { margin: 0; font-size: 25px; }

#status { color: var(--accent-2); font-size: 13px; min-height: 18px; }

#track-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 12px;
  background: var(--bg-2);
  border-radius: 8px;
  min-width: 88px;
}

.fact-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
}

.fact-v { font-weight: 600; font-size: 15px; }

.progression {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.prog-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
}

.prog-seq { display: flex; gap: 5px; flex-wrap: wrap; }

.chord {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- playback */

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
}

#play {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #16210f;
  font-size: 21px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform .1s, background .15s;
}

#play:hover { transform: scale(1.06); }
#play:active { transform: scale(0.97); }
#play.is-playing { background: var(--accent-2); }

#play::before { content: "▶"; }
#play.is-playing::before { content: "❚❚"; font-size: 15px; }

.seek-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
}

#seek { flex: 1; }

#time-now { min-width: 40px; }
#time-total { min-width: 40px; text-align: right; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}

input[type=range]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* selettore sorgente: MIDI oppure originale */
.source-switch { display: flex; gap: 5px; }

.source-switch button {
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  transition: background .12s;
}

.source-switch button.is-active {
  background: var(--accent);
  color: #16210f;
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------- timeline */

#timeline {
  position: relative;
  height: 30px;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  margin: 4px 0 12px;
}

.tl-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: .5;
  transition: opacity .1s;
}

.tl-seg:hover { opacity: .95; }

#chord-now {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
  font-variant-numeric: tabular-nums;
}

/* riquadro dei tasti */
#piano {
  position: relative;
  height: 46px;
  background:
    linear-gradient(180deg, #232b27 0%, #1b211e 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.piano-block {
  position: absolute;
  top: 8px;
  bottom: 8px;
  background: var(--panel-2);
  border-radius: 3px;
  min-width: 2px;
}

.piano-block.is-live {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(143, 191, 106, .4);
}

/* -------------------------------------------------------------------- mixer */

.mix-row {
  display: grid;
  grid-template-columns: 88px 1fr 128px;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.mix-row:last-child { border-bottom: 0; }

.mix-mute {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  transition: background .12s, opacity .12s;
}

.mix-mute.is-active { background: var(--accent); color: #16210f; border-color: var(--accent); }
.mix-mute.is-muted { opacity: .45; text-decoration: line-through; }

.mix-vol { width: 100%; }

.mix-sound {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
}

.perc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}

.perc-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------------------------------------------------------------- originale */

.orig-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.orig-row audio { flex: 1; min-width: 240px; height: 36px; }

#orig-time { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------- note */

.notes { font-size: 12.5px; color: var(--text-dim); line-height: 1.65; }
.notes strong { color: var(--text); font-weight: 600; }

#end-note {
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: 7px;
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  font-size: 13px;
}

/* ------------------------------------------------------------------ footer */

footer {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
}

footer a { color: var(--accent); }

@media (max-width: 560px) {
  .mix-row { grid-template-columns: 72px 1fr; }
  .mix-sound { grid-column: 1 / -1; }
  .fact { min-width: 70px; }
}
