#sight-activities { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
#sight-activities button { font-size: 15px; padding: 10px 16px; }
#sight-activities button[aria-pressed="true"] { background: var(--yellow); color: var(--board); border-color: var(--yellow); }
#chord-progressions { padding: 28px 0; }
.cp-settings { border: 1px solid var(--line); border-radius: 12px; background: #ffffff03; padding: 16px 20px; }
.cp-settings summary { cursor: pointer; font-weight: 600; font-size: 18px; }
.cp-settings summary span { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 12px; }
.cp-controls { display: grid; grid-template-columns: repeat(3,minmax(0,240px)); gap: 16px; margin-top: 20px; }
.cp-controls label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
#chord-progressions select { width: 100%; color: var(--ink); background: #163b32; border: 1px solid #ffffff45; border-radius: 6px; min-height: 42px; font: inherit; font-size: 15px; padding: 8px; }
#chord-progressions :is(input,select,summary):focus-visible, #cp-score:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.cp-pool { margin-top: 20px; }
.cp-pool legend { font-size: 14px; padding-bottom: 8px; }
#cp-chords { flex-wrap: wrap; }
#cp-chords label { flex: 0 1 auto; min-width: 110px; min-height: 46px; gap: 9px; }
#cp-chords strong { font-size: 18px; font-weight: 600; }
#cp-chords span { font-size: 12px; color: var(--muted); margin-left: 4px; }
.cp-display { margin-top: 14px; }
.cp-display label { flex: 0 1 auto; }
.cp-tone-names { display: none; }
#cp-score[data-note-names="false"] :is(.cp-key-label,.cp-tone-names) { display: none; }
.cp-generation { display: flex; gap: 20px; align-items: center; margin: 16px 0; }
.cp-generation button { flex-shrink: 0; }
.cp-backing { margin: 8px 0 0; }
#cp-bpm { white-space: nowrap; font-size: 29px; font-variant-numeric: tabular-nums; }
#cp-bpm small { font-size: 12px; color: var(--muted); }
#cp-tempo, #cp-volume { width: 100%; min-height: 36px; margin: 6px 0 0; accent-color: var(--yellow); cursor: pointer; }
#cp-volume { margin-top: 0; }
#cp-volume-value { font-variant-numeric: tabular-nums; }
#cp-phase { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
#cp-beats { display: flex; gap: 6px; }
#cp-beats span { width: 43px; height: 43px; display: grid; place-items: center; font-size: 24px; border-radius: 50%; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
#cp-beats .current { color: var(--board); background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
#cp-status { margin: 12px 0; min-height: 20px; }
#cp-score { display: grid; grid-template-columns: repeat(var(--cp-columns,1),minmax(0,1fr)); gap: 16px; max-height: 72vh; overflow: auto; align-content: start; overscroll-behavior: contain; scroll-margin-top: 12px; }
.cp-measure { min-width: 0; margin: 0; padding: 12px 16px 20px; color: #233b32; background: #fffdf4; border: 4px solid transparent; border-radius: 12px; }
.cp-measure.current { border-color: #087564; background: #c6e9dc; }
.cp-measure.current :is(.cp-measure-number,.cp-numeral) { color: #087564; }
.cp-chord-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.cp-chord-heading h2 { margin: 0; font: 600 38px/1.15 'Segoe UI',sans-serif; }
.cp-measure-number, .cp-numeral { min-width: 28px; color: #627369; font-size: 15px; }
.cp-numeral { text-align: right; }
.cp-keyboard { width: 100%; max-width: 500px; height: auto; display: block; margin: 0 auto; }
.cp-key { stroke: #233b32; stroke-width: 2.2; stroke-linejoin: round; }
.cp-key.white { fill: #fffdf4; }
.cp-key.black { fill: #233b32; }
.cp-key.played { fill: #f7cd72; }
.cp-key-label { font: 600 36px 'Segoe UI',sans-serif; fill: #20372e; pointer-events: none; }
.cp-hint { font-size: 12px; }
@media(max-width:1100px) { .cp-player { flex-wrap: wrap; } }
@media(max-width:600px) {
  #sight-activities { gap: 6px; } #sight-activities button { font-size: 13px; padding: 9px 10px; }
  .cp-controls { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .cp-controls label:first-child { grid-column: 1 / -1; }
  .cp-settings { padding: 14px; } .cp-settings summary span { display: none; }
  .cp-generation { flex-direction: column; align-items: stretch; gap: 0; }
  .cp-player .rhythm-transport { min-width: 0; flex: 1 1 100%; }
  .cp-player .rhythm-metronome { order: 1; } .cp-player .rhythm-tempo { order: 2; flex: 1; min-width: 170px; }
  .cp-player .rhythm-beat-panel { order: 3; }
}
/* Keep phone landscape compact without changing tablet or melodic breakpoints.
   Keep this query in sync with ChordProgressions.smallScreen. */
@media (max-width:600px), (max-width:1000px) and (max-height:500px) and (orientation:landscape) {
  .cp-controls { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .cp-controls label:first-child { grid-column: auto; }
  .cp-controls .cp-systems-setting { display: none; }
  /* One four-bar phrase per row. The SVG window and key geometry stay intact. */
  #cp-score { max-height: 65vh; gap: 5px; }
  .cp-measure { container-type: inline-size; display: flex; flex-direction: column; padding: 6px 3px 8px; border-radius: 8px; }
  .cp-chord-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 7px; }
  .cp-chord-heading h2 { grid-row: 2; grid-column: 1 / -1; text-align: center; font-size: clamp(18px,5vw,25px); line-height: 1.25; }
  .cp-measure-number, .cp-numeral { min-width: 0; font-size: 10px; line-height: 1.2; }
  .cp-keyboard { flex: 0 0 auto; overflow: visible; }
  .cp-key { vector-effect: non-scaling-stroke; stroke-width: .5px; }
  .cp-key-label { display: none; }
  .cp-tone-names { display: block; position: relative; width: 100%; max-width: 500px; height: 18px; flex: 0 0 18px; margin: auto auto 0; color: #20372e; font: 600 10px/1.3 'Segoe UI',sans-serif; }
  .cp-tone-names span { position: absolute; top: 5px; transform: translateX(-50%); white-space: nowrap; }
}
/* On the smallest cards, stagger the middle name vertically, never sideways. */
@container (max-width:70px) {
  .cp-tone-names { height: 31px; flex-basis: 31px; }
  .cp-tone-names span:nth-child(2) { top: 18px; }
}
