/* home.css — song library, tuner, note detect, scale practice */

body { padding-bottom: 80px; }

/* ── Intro ──────────────────────────────────────────────────────────── */

.intro {
  padding: 44px 0 6px;
  max-width: 620px;
}
.intro h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.intro p {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.6;
}

.intro-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ── Tool strip ─────────────────────────────────────────────────────── */

.tools {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-panel {
  margin-top: 10px;
  display: none;
}
.tool-panel.open { display: block; }

/* note detect */
.nd-display {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.nd-note-big {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-width: 100px;
}
.nd-freq { font-family: var(--mono); font-size: 13px; color: var(--dim); }
.nd-string-hint { font-size: 12px; color: var(--dimmer); margin-top: 2px; }

/* tuner */
.tuner-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.tuner-head .hint { font-size: 12px; color: var(--dimmer); }

.tuner-strings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 22px;
}

.tuner-string {
  display: grid;
  grid-template-columns: 54px 1fr 62px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.tuner-string.active { background: var(--surface-2); border-color: var(--line); }

.ts-header { display: flex; align-items: baseline; gap: 7px; }
.ts-name { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.ts-target { font-size: 11px; color: var(--dimmer); font-family: var(--mono); }

.ts-meter-wrap { display: flex; align-items: center; gap: 7px; }
.ts-flat-label, .ts-sharp-label { font-size: 11px; color: var(--dimmer); }

.ts-meter {
  position: relative;
  flex: 1;
  height: 5px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.ts-zone { position: absolute; top: 0; bottom: 0; }
.ts-zone.flat  { left: 0;   width: 42%; }
.ts-zone.sharp { right: 0;  width: 42%; }
.ts-zone.good  { left: 42%; width: 16%; background: rgba(94,171,132,.28); }
.ts-center-line { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--dimmer); }

.ts-needle {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--dimmer);
  transform: translateX(-50%);
  transition: left .07s linear;
}

.ts-cents  { font-family: var(--mono); font-size: 11px; color: var(--dimmer); min-width: 40px; text-align: right; }
.ts-status { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--dimmer); text-align: right; }

/* ── Song grid ──────────────────────────────────────────────────────── */

.songs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
}

.song {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 16px 14px;
  transition: border-color .12s ease, background .12s ease;
  position: relative;
}
.song:hover { border-color: var(--surface-3); background: var(--surface-2); }

.song-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.song-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.song-artist { font-size: 12px; color: var(--dim); margin-top: 2px; }

.song-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--dimmer);
  font-family: var(--mono);
}

.diff { display: inline-flex; gap: 3px; align-items: center; }
.diff i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--surface-3);
  display: block;
}
.diff i.on { background: var(--dim); }

.song-range {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dimmer);
}

.song-warn {
  margin-top: 10px;
  font-size: 11px;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 6px;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--dimmer);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
}

/* ── Scale practice ─────────────────────────────────────────────────── */

.scale-card { padding: 0; overflow: hidden; }

.scale-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.scale-title { font-size: 14px; font-weight: 600; }
.scale-subtitle { font-size: 12px; color: var(--dim); }
.scale-tab-legend { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dimmer); }

.scale-fretboard-wrap { padding: 4px 12px 0; }
#scale-fretboard { width: 100%; height: 190px; display: block; }

.scale-status-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.scale-current-wrap { display: flex; align-items: baseline; gap: 8px; }
.scale-current-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dimmer); }
.scale-current-note { font-family: var(--mono); font-size: 15px; font-weight: 600; }

.scale-feedback { font-size: 12px; font-weight: 600; min-width: 60px; }
.scale-feedback.correct { color: var(--good); }
.scale-feedback.wrong   { color: var(--bad); }
.scale-feedback.done    { color: var(--accent); }

.scale-progress { margin-left: auto; font-size: 12px; color: var(--dimmer); font-family: var(--mono); }

/* A permanent readout of the input, so silence is never a mystery: you can
 * always see whether the page is connected and what it last heard. */
.scale-io-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dimmer);
  flex-wrap: wrap;
}
.scale-io-row .spacer { flex: 1; }
.scale-io-sep { opacity: .5; }
.scale-io-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.scale-io-last { font-family: var(--mono); font-weight: 600; color: var(--text); }
.scale-io-status { color: var(--dim); }
.scale-io-hint { font-size: 11px; }

.scale-controls, .scale-selector {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  align-items: center;
}
.scale-selector { padding-top: 10px; padding-bottom: 14px; }

/* Position picker: which of the shapes along the neck. Small and numeric,
 * because on a guitar they really are just 1 through 5. */
.scale-pos-label {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.scale-positions { display: flex; gap: 4px; }
.scale-positions .pos-btn {
  appearance: none;
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--dim);
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}
.scale-positions .pos-btn:hover { background: var(--surface-3); color: var(--text); }
.scale-positions .pos-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* index-app.js builds buttons with .ctrl-btn — map it onto the shared style */
.ctrl-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--r);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.ctrl-btn:hover:not(:disabled) { background: var(--surface-3); }
.ctrl-btn:disabled { opacity: .4; cursor: default; }
.ctrl-btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0d10; font-weight: 600; }
.ctrl-btn.primary:hover:not(:disabled) { background: #82adee; }
.ctrl-btn.active, .ctrl-btn.toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dimmer);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* keep cards the same height whether or not they carry a cross-play warning */
.song { display: flex; flex-direction: column; min-height: 118px; }
.song-warn { margin-top: auto; padding-top: 10px; }

/* ── Piano tools ────────────────────────────────────────────────────── */

.midi-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--dim);
}

.tool-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--dimmer);
  line-height: 1.65;
}
.tool-note strong { color: var(--dim); font-weight: 600; }
.tool-note .k {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--dim);
  white-space: nowrap;
}

.nd-chord {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 3px;
  min-height: 20px;
}

.mini-kb {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
}
.mini-kb canvas { display: block; width: 100%; height: 104px; }
.mini-kb.tall   { margin: 12px; }
.mini-kb.tall canvas { height: 150px; }

/* the piano scale card reuses the guitar scale card's classes */
#piano-scales-section .scale-head { border-bottom: 1px solid var(--line); }

.hint-link {
  margin-left: auto;
  font-size: 13px;
  color: var(--accent);
}
.hint-link:hover { text-decoration: underline; }
