/* Additions for the restored Chord Lab. Layered on top of the original app CSS. */

.preset-fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  flex: 0 1 auto;
}

.preset-fieldset legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.preset-fieldset .preset-chip {
  min-width: 0;
  min-height: 0;
  padding: 9px 14px;
  border: 1px solid #8a5ba1;
  border-radius: 999px;
  background: #211429;
  color: #f0d0ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.preset-fieldset .preset-chip:hover {
  border-color: #e0b4f4;
  background: #2d1a36;
}

.preset-fieldset .preset-chip.selected {
  border-color: #f2bd45;
  background: #3b321d;
  color: #ffe39a;
  box-shadow: inset 0 0 0 1px #f2bd4566;
}

.chord-readout {
  margin: 0 22px 6px;
  padding: 10px 14px;
  border: 1px solid #4e9fc4;
  border-radius: 9px;
  background: #08251e;
  color: #a9ddf6;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}

.chord-readout small {
  display: block;
  margin-top: 4px;
  color: #93afa1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}

/* Keys audible right now get a white edge; the layer colour stays underneath. */
.piano-key.is-sounding rect {
  stroke: #fff;
  stroke-width: 3;
}

.piano-key.is-sounding text {
  fill: #061b16;
}

.playback-row.chord-playback {
  grid-template-columns: repeat(4, minmax(110px, 1fr)) auto auto auto;
  align-items: stretch;
}

.chord-playback .hold-button {
  grid-column: auto;
  min-height: 48px;
  padding: 10px 16px;
  min-width: 130px;
}

.chord-playback .stop-button,
.chord-playback .reset-button {
  min-width: 96px;
}

.harmonization-grid button.current {
  border-color: #f2bd45;
  outline: 2px solid #f2bd4566;
}

@media (max-width: 1050px) {
  .playback-row.chord-playback {
    grid-template-columns: repeat(2, 1fr) auto auto auto;
  }

  .preset-chips {
    justify-content: flex-start;
  }

  .preset-fieldset {
    flex: 1 1 100%;
  }
}

@media (max-width: 720px) {
  .playback-row.chord-playback {
    grid-template-columns: 1fr 1fr;
  }

  .chord-playback .hold-button {
    grid-column: 1 / -1;
  }

  .chord-readout {
    margin: 0 12px 6px;
  }
}

.chord-warning {
  display: block;
  margin-top: 6px;
  color: #ffcf8a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
}

.ust-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 14px;
}

.ust-bar label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #cbded4;
  font-size: 11px;
  font-weight: 800;
}

.ust-bar select {
  border: 1px solid #5b8ca2;
  border-radius: 7px;
  background: #061c16;
  color: #f0f7f3;
  padding: 10px;
}

.ust-bar output {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 8px;
  background: #123d47;
  color: #a9ddf6;
  font-size: 11px;
  font-weight: 800;
}

.ust-grid button.plain {
  border-color: #4d7467;
  opacity: .78;
}

.ust-grid button.current {
  border-color: #f2bd45;
  outline: 2px solid #f2bd4566;
}

.ust-grid .ust-degree {
  color: #79a99a;
  font-size: 9px;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.progression-bar {
  grid-template-columns: 140px 1fr 1fr;
}

.progression-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.progression-row button {
  min-height: 46px;
  border-radius: 9px;
  border: 1px solid #5c8274;
  background: #153e33;
  color: #eaf4ef;
  font-weight: 800;
}

.progression-row .play-progression {
  background: #e8b742;
  border-color: #ffdb7a;
  color: #12251e;
}

.progression-row button.is-playing {
  outline: 3px solid #fff;
}

@media (max-width: 720px) {
  .progression-bar,
  .progression-row {
    grid-template-columns: 1fr;
  }

  .ust-bar {
    flex-wrap: wrap;
  }

  .ust-bar output {
    margin-left: 0;
  }
}

/* The three journey pills are real controls now. */
.journey button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px 8px 8px;
  border: 1px solid #315f51;
  border-radius: 999px;
  background: #0c2e26;
  color: #c8dad1;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.journey button:hover {
  border-color: #f2bd45;
  color: #ffe39a;
  background: #143a2f;
}

.journey button.active {
  border-color: #f2bd45;
  background: #3b321d;
  color: #ffe39a;
  box-shadow: inset 0 0 0 1px #f2bd4566;
}

.journey button b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f2bd45;
  color: #14261f;
}

.journey-flash {
  animation: journeyFlash 1.1s ease-out;
}

@keyframes journeyFlash {
  0% { box-shadow: 0 0 0 0 #f2bd45cc; }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* "Build The Chord" is an accordion: the piano and the chord library keep the
   screen, the layer controls expand only when you want them. */
.control-panel.accordion {
  padding: 0;
  overflow: hidden;
}

.accordion-toggle {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 22px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.accordion-toggle:hover {
  background: #10362e;
}

.accordion-toggle .step-label {
  margin: 0;
}

.accordion-title {
  font: 700 21px Georgia, serif;
  color: #fff1c5;
}

.accordion-hint {
  color: #93afa1;
  font-size: 11px;
}

.accordion-chevron {
  color: #f2bd45;
  font-size: 13px;
  transition: transform .18s ease;
}

.accordion-toggle[aria-expanded="true"] .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 22px 22px;
}

@media (max-width: 720px) {
  .accordion-toggle {
    grid-template-columns: auto 1fr auto;
    row-gap: 6px;
  }

  .accordion-hint {
    grid-column: 1 / -1;
  }
}

/* Compact chord chips: the library should read as a list, not as billboards. */
.ust-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 7px;
}

.ust-grid button {
  padding: 8px 9px;
  gap: 1px;
  border-radius: 8px;
}

.ust-grid strong {
  font: 700 15px Georgia, serif;
}

.ust-grid .ust-degree {
  font-size: 8px;
  letter-spacing: .08em;
}

.ust-grid button > span:not(.ust-degree) {
  font-size: 10px;
  color: #9ec6b5;
}

.ust-grid button > em {
  font-size: 9px;
  color: #f4ce75;
}

@media (max-width: 720px) {
  .ust-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }
}

/* Explain-first modal */
.chord-dialog {
  width: min(620px, 92vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid #4e9fc4;
  border-radius: 16px;
  background: linear-gradient(145deg, #113a30, #0a261f);
  color: #edf7f1;
  box-shadow: 0 30px 80px #000a;
}

.chord-dialog::backdrop {
  background: #02100cbb;
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #2d5c4d;
}

.dialog-head h3 {
  margin: 0;
  font: 700 24px Georgia, serif;
  color: #fff1c5;
}

.dialog-x {
  border: 1px solid #4d7467;
  border-radius: 8px;
  background: #0b2821;
  color: #e9f5ef;
  width: 34px;
  height: 34px;
  font-size: 18px;
  line-height: 1;
}

.dialog-body {
  padding: 14px 20px 4px;
  overflow: auto;
  max-height: 58vh;
  font-size: 13px;
  line-height: 1.55;
}

.dialog-body h4 {
  margin: 14px 0 6px;
  color: #a9ddf6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.dialog-body p {
  margin: 0 0 8px;
  color: #d4e5db;
}

.dialog-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 4px 0 10px;
}

.dialog-note {
  padding: 8px 10px;
  border: 1px solid #406c5d;
  border-radius: 9px;
  background: #09251e;
}

.dialog-note b {
  display: block;
  font: 700 16px Georgia, serif;
  color: #ffe39a;
}

.dialog-note small {
  color: #9eb7ab;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.dialog-facts {
  margin: 0;
  padding-left: 18px;
  color: #cbded4;
}

.dialog-facts li {
  margin-bottom: 4px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid #2d5c4d;
}

.dialog-actions button {
  flex: 1;
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid #5c8274;
  background: #153e33;
  color: #eaf4ef;
  font-weight: 800;
}

.dialog-actions .dialog-apply {
  background: #e8b742;
  border-color: #ffdb7a;
  color: #12251e;
}
