/* Tonart-Finder – tool-spezifisches Stylesheet, baut auf tokens.css + shared.css auf */

:root{
  --key-white: #f3f1ea;
  --key-white-active: var(--accent);
  --key-black: #0c0d10;
  --key-black-active: var(--accent-hover);
  --circle-root: var(--accent);
  --circle-third: #6f8f7c;
  --circle-fifth: #7a8ba6;
  --dim-color: var(--danger);
}

/* ---------- Klaviatur ---------- */
.piano-section{
  margin-bottom: 30px;
}

.piano{
  position: relative;
  width: 490px;
  max-width: 100%;
  height: 150px;
  margin: 0 auto 14px;
  overflow: visible;
}

.key{
  position: absolute;
  top: 0;
  border: 1px solid #000;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  user-select: none;
  transition: background 0.08s ease, transform 0.05s ease;
}
.key:active{ transform: translateY(1px); }

.key.white{
  width: 70px;
  height: 150px;
  background: var(--key-white);
  color: #33342f;
  z-index: 1;
}
.key.white.active{
  background: var(--key-white-active);
  color: var(--accent-text);
  font-weight: 700;
}

.key.black{
  width: 44px;
  height: 92px;
  background: var(--key-black);
  color: #cfcfcf;
  z-index: 2;
  border-radius: 0 0 5px 5px;
}
.key.black.active{
  background: var(--key-black-active);
  color: var(--accent-text);
  font-weight: 700;
}

/* Positionen der 7 weißen Tasten (70px Breite) */
.key.white[data-idx="0"]{ left: 0px; }
.key.white[data-idx="1"]{ left: 70px; }
.key.white[data-idx="2"]{ left: 140px; }
.key.white[data-idx="3"]{ left: 210px; }
.key.white[data-idx="4"]{ left: 280px; }
.key.white[data-idx="5"]{ left: 350px; }
.key.white[data-idx="6"]{ left: 420px; }

/* Positionen der schwarzen Tasten */
.key.black[data-after="0"]{ left: 49px; }  /* C# */
.key.black[data-after="1"]{ left: 119px; } /* D# */
.key.black[data-after="3"]{ left: 259px; } /* F# */
.key.black[data-after="4"]{ left: 329px; } /* G# */
.key.black[data-after="5"]{ left: 399px; } /* A# */

@media (max-width: 520px){
  .piano{ width: 350px; height: 118px; }
  .key.white{ width: 50px; height: 118px; padding-bottom: 6px; }
  .key.black{ width: 32px; height: 72px; }
  .key.white[data-idx="0"]{ left: 0px; }
  .key.white[data-idx="1"]{ left: 50px; }
  .key.white[data-idx="2"]{ left: 100px; }
  .key.white[data-idx="3"]{ left: 150px; }
  .key.white[data-idx="4"]{ left: 200px; }
  .key.white[data-idx="5"]{ left: 250px; }
  .key.white[data-idx="6"]{ left: 300px; }
  .key.black[data-after="0"]{ left: 35px; }
  .key.black[data-after="1"]{ left: 85px; }
  .key.black[data-after="3"]{ left: 185px; }
  .key.black[data-after="4"]{ left: 235px; }
  .key.black[data-after="5"]{ left: 285px; }
}

.selected-notes{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 28px;
}

.note-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.note-chip button{
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 50%;
  font-size: 0.8rem;
  line-height: 1;
}
.note-chip button:hover{ color: var(--danger); background: rgba(179,71,71,0.15); }

.hint-text{
  text-align: center;
  color: var(--text-muted);
  font-size: 0.76rem;
  margin: 10px 0 0;
}

/* ---------- Ergebnisse ---------- */
.section-title{
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 12px;
  font-weight: 600;
}

#keyList{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-card{
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.key-card[hidden]{ display: none; }

.key-card summary{
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.key-card summary::-webkit-details-marker{ display:none; }
.key-card summary::before{
  content: "▸";
  color: var(--accent);
  transition: transform 0.15s ease;
  display: inline-block;
}
.key-card[open] summary::before{ transform: rotate(90deg); }

.key-card summary .key-scale{
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.badge-mode{
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}
.badge-mode.dur{ border-color: rgba(76,175,109,0.5); color: var(--accent); }
.badge-mode.moll{ border-color: rgba(122,139,166,0.5); color: var(--circle-fifth); }

.chords-row{
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 14px 18px;
  border-top: 1px solid var(--border);
}

.chord-tower{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
}

.chord-tower .roman{
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.tower-circles{
  display: flex;
  flex-direction: column-reverse; /* Grundton unten */
  align-items: center;
}

.note-circle{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #10120f;
  border: 2px solid var(--surface);
  margin-top: -10px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease;
}
.note-circle:first-child{ margin-top: 0; }
.note-circle:hover{ filter: brightness(1.12); }
.note-circle:active{ transform: scale(0.94); }

.note-circle.root{ background: var(--circle-root); z-index: 3; }
.note-circle.third{ background: var(--circle-third); z-index: 2; }
.note-circle.fifth{ background: var(--circle-fifth); z-index: 1; }
.note-circle.dim .third,
.note-circle.dim{ }
.chord-tower.dim .note-circle.fifth{ background: var(--dim-color); }

.chord-tower .chord-name{
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

.chord-tower button.play-chord{
  margin-top: 4px;
  padding: 3px 10px;
  font-size: 0.68rem;
}

@media (prefers-reduced-motion: reduce){
  .key, .note-circle{ transition: none !important; }
}