/* The playable keyboard (piano.js) and the tool pages: /piano-keys, /chords. */
.ip-keys { position: relative; display: flex; height: 160px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #FFFDF8; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ip-w { flex: 1; border: 0; border-right: 1px solid var(--line); background: transparent; position: relative; cursor: pointer; padding: 0; transition: background .12s; }
.ip-w:last-of-type { border-right: 0; }
.ip-b { position: absolute; top: 0; height: 60%; background: var(--keydark); border: 0; border-radius: 0 0 6px 6px; z-index: 2; cursor: pointer; padding: 0; transition: background .12s; }
.ip-label { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font: 700 13px "Figtree", -apple-system, system-ui, sans-serif; color: var(--muted); pointer-events: none; }
.ip-b .ip-label { color: #FFF8F1; bottom: 7px; font-size: 10px; }
.ip-w.ip-on { background: var(--lit); } .ip-w.ip-on .ip-label { color: var(--accent); }
.ip-b.ip-on { background: var(--accent); }
.ip-w.ip-hit { background: #F7C6A9 !important; } .ip-b.ip-hit { background: #8E3F1E !important; }
.ip-middle::after { content: ""; position: absolute; left: 50%; bottom: 32px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--accent); }

.tool { background: var(--paper); border: 1px solid var(--line); border-radius: 26px; padding: 22px; margin: 24px 0; box-shadow: 0 18px 50px rgba(91,60,30,.08); }
.tool .row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tool button.b { border: 0; border-radius: 999px; padding: 11px 18px; font: 700 15px "Figtree", -apple-system, system-ui, sans-serif; cursor: pointer; background: var(--pill); color: var(--ink); }
.tool button.b.dark { background: var(--ink); color: #FFF8F1; }
.tool button.b[aria-pressed="true"] { background: var(--lit); color: var(--accent); }
.tool .readout { margin: 14px 0 0; font-size: 15px; color: var(--muted); min-height: 1.5em; }
.notes-big { display: flex; gap: 10px; margin: 6px 0 4px; flex-wrap: wrap; }
.notes-big span { font-weight: 800; font-size: 30px; letter-spacing: -.5px; background: var(--lit); color: var(--accent); border-radius: 14px; padding: 6px 16px; }

/* Chord chart */
.chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 18px 0 40px; }
.chart a { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; color: var(--ink); }
.chart a:hover { text-decoration: none; border-color: var(--peach); }
.chart strong { display: block; font-size: 19px; }
.chart small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.chart svg { display: block; width: 100%; height: auto; margin-top: 8px; }

@media (max-width: 560px) {
  .ip-keys { height: 120px; }
  .ip-label { font-size: 11px; bottom: 8px; }
  .ip-b .ip-label { font-size: 8px; }
  .notes-big span { font-size: 24px; padding: 4px 12px; }
  .chart { grid-template-columns: repeat(2, 1fr); }
}

/* Song pages: the left hand lit in lilac, and the letter names that follow the music. */
.ip-w.ip-lh { background: #E6DDF4; } .ip-b.ip-lh { background: #8B7BC0; }
.letters { margin: 18px 0 4px; }
.letters .line { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.letters span { min-width: 34px; text-align: center; padding: 6px 8px; border-radius: 10px; background: #F6EFE6; font-weight: 800; font-size: 16px; color: var(--ink); transition: background .1s, color .1s; }
.letters span.long { min-width: 54px; }
.letters span.on { background: var(--accent); color: #FFF8F1; }
.tool label.tempo { font-size: 15px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.tool label.tempo input { accent-color: var(--accent); width: 130px; }
.song-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 15px; margin: -6px 0 22px; }
.song-meta b { color: var(--ink); }
@media (max-width: 560px) { .letters span { min-width: 28px; font-size: 14px; padding: 5px 6px; } .tool label.tempo { margin-left: 0; width: 100%; } }

/* The music staff (staff.js) */
.ivory-staff { display: block; width: 100%; height: auto; }
.ivory-staff .st-line { stroke: #8C7B6E; stroke-width: 1.2; }
.ivory-staff .st-clef { font-family: "Noto Music", serif; fill: var(--ink); }
.ivory-staff .st-acc { font-family: "Noto Music", serif; fill: var(--ink); transition: fill .15s; }
.ivory-staff .st-acc.on { fill: var(--accent); }
.ivory-staff .st-head { fill: var(--ink); transition: fill .15s; }
.ivory-staff .st-note:hover .st-head, .ivory-staff .st-note:focus .st-head { fill: var(--accent); }
.ivory-staff .st-note.on .st-head { fill: var(--accent); }
.ivory-staff .st-note.landmark .st-head { fill: var(--accent); }
.ivory-staff .st-label { font: 700 13px "Figtree", -apple-system, system-ui, sans-serif; fill: var(--muted); }
.ivory-staff .st-note:focus { outline: none; }
.ivory-staff.q-right .st-head { fill: #3E8E5A; }
.ivory-staff.q-wrong .st-head { fill: #C0412F; }
.quiz { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: center; }
.q-letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.q-letters .b { padding: 14px 0 !important; font-size: 18px !important; }
.q-score { margin: 12px 0 0; color: var(--muted); font-size: 16px; min-height: 1.5em; }
@media (max-width: 560px) { .quiz { grid-template-columns: 1fr; } .q-letters .b { padding: 12px 0 !important; } }
/* On a phone a long staff keeps a readable size and scrolls sideways. */
.tool .staff { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 560px) { .tool .staff .ivory-staff { min-width: 640px; } }

/* The circle of fifths (/circle-of-fifths) */
.cof-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.cof { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; font-family: "Figtree", -apple-system, system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
.cof-k { cursor: pointer; outline: none; }
.cof-k path { stroke: var(--paper); stroke-width: 2; transition: fill .2s; }
.cof-maj path { fill: #F6EFE6; } .cof-min path { fill: #EFE5D9; }
.cof-k:hover path, .cof-k:focus-visible path { fill: #F7DCCB; }
.cof-k.fam path { fill: #FCD9C4; }
.cof-k.sel path { fill: var(--accent); }
.cof text { text-anchor: middle; pointer-events: none; fill: var(--ink); }
.cof-big { font-weight: 800; font-size: 24px; } .cof-big.cof-two { font-size: 17px; }
.cof-mid { font-weight: 700; font-size: 16px; } .cof-small { font-weight: 700; font-size: 12px; }
.cof-sig { font-size: 11px; font-weight: 600; fill: var(--muted) !important; }
.cof-k.fam .cof-sig, .cof-k.sel .cof-sig { display: none; }
.cof-num { font-size: 11px; font-weight: 800; fill: var(--accent) !important; letter-spacing: .3px; }
.cof-k.sel text { fill: #FFF8F1 !important; }
.cof-hub { fill: var(--paper); stroke: var(--line); }
.cof-hub1 { font-weight: 800; font-size: 17px; } .cof-hub2 { font-size: 11px; fill: var(--muted) !important; }
.cof-panel h3 { margin: 0 0 4px; font-size: 26px; } .cof-panel h3 a { color: var(--ink); }
.cof-panel .cp-sig { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.cof-panel .cp-staff { max-width: 220px; }
.cof-panel .cp-label { margin: 10px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.cp-chords { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; border-radius: 12px; padding: 6px 10px 7px; background: var(--pill); font: 800 16px "Figtree", -apple-system, system-ui, sans-serif; color: var(--ink); cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; min-width: 48px; }
.chip small { font-size: 10px; font-weight: 700; color: var(--muted); }
.chip.on { background: var(--lit); color: var(--accent); }
.cof-panel .cp-scale { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 720px) { .cof-grid { grid-template-columns: 1fr; } }
@media print {
  html.print-chart header.site, html.print-chart footer.site { display: none; }
  html.print-chart article.guide > *:not(.cof-printable) { display: none; }
  html.print-chart .cof-printable { border: 0; box-shadow: none; }
  html.print-chart .cof-printable > :not(.cof-grid), html.print-chart .cof-panel { display: none; }
  html.print-chart .cof-grid { display: block; } html.print-chart .cof { max-width: 640px; }
  html.print-chart .cof-maj path { fill: #F6EFE6 !important; } html.print-chart .cof-min path { fill: #EFE5D9 !important; }
  html.print-chart .cof text { fill: var(--ink) !important; } html.print-chart .cof .cof-sig { display: inline !important; fill: var(--muted) !important; }
  html.print-chart .cof-num, html.print-chart .cof-hub1, html.print-chart .cof-hub2 { display: none; }
}

/* Key signatures (/key-signatures) */
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.sig-card { position: relative; background: #FFFDF8; border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px 10px; }
.sig-card p { margin: 2px 0 0; font-weight: 800; font-size: 15px; } .sig-card p a { color: var(--ink); }
.sig-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; padding-right: 34px; }
.sig-card button.b { position: absolute; right: 8px; bottom: 8px; padding: 6px 10px !important; font-size: 12px !important; }
.sig-answers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sig-answers .b { padding: 11px 0 !important; }
#sigQuiz { grid-template-columns: 260px 1fr; }
@media (max-width: 560px) { .sig-grid { grid-template-columns: repeat(2, 1fr); } #sigQuiz { grid-template-columns: 1fr; } }
.tool[data-order] .staff { max-width: 440px; }
#sigQuiz .q-staff { max-width: 300px; width: 100%; margin: 0 auto; }
