/* The piano page (piano.html), on top of style.css. */
:root {
  --rh: #076678; /* right hand: fingering, keys */
  --lh: #8f3f71; /* left hand */
  --key-white: #fdf8e6;
  --key-black: #3c3836;
  --key-in: var(--accent-soft);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rh: #6fc2d6;
    --lh: #e08cc0;
    --key-white: #e9e4d8;
    --key-black: #1b1a16;
    --key-in: #f2c9a0;
  }
}
:root[data-theme="dark"] {
  --rh: #6fc2d6;
  --lh: #e08cc0;
  --key-white: #e9e4d8;
  --key-black: #1b1a16;
  --key-in: #f2c9a0;
}

/* Grand staff */
.notation .glyph { fill: var(--ink); }
.notation .head .nhead { stroke-linejoin: round; }
.notation .finger { font: 700 12px/1 system-ui, sans-serif; }
.notation .finger-R { fill: var(--rh); }
.notation .finger-L { fill: var(--lh); }
.notation .mark .nhead, .notation .landing .nhead { fill: none; stroke: currentColor; stroke-width: 0.12; }
.notation .head.n-perfect .nhead, .notation .head.n-good .nhead,
.notation .head.n-ok .nhead, .notation .head.n-miss .nhead, .notation .head.n-apart .nhead { stroke-width: 0.25; }

/* The MIDI piano isn't there (or no MIDI in this browser). */
.midi-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--ok);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

/* Hand positions */
.hands-card h3 { margin-bottom: 10px; }
.hands { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; }
.hand { margin: 0; max-width: 100%; }
.hand figcaption { margin-bottom: 6px; }
.hand-R figcaption strong { color: var(--rh); }
.hand-L figcaption strong { color: var(--lh); }
.hands-key { flex-basis: 100%; margin: 0; }
.keyboard { display: block; max-width: 100%; height: auto; }
.keyboard .white { fill: var(--key-white); stroke: var(--staff); stroke-width: 1; }
.keyboard .black { fill: var(--key-black); stroke: var(--key-black); }
.keyboard .white.in-scale { fill: var(--key-in); }
.keyboard .black.in-scale { fill: color-mix(in srgb, var(--key-black) 70%, var(--accent)); }
.keyboard .down { fill: var(--perfect) !important; transition: none; }
.keyboard .white, .keyboard .black { transition: fill 0.25s; }
.keyboard .finger-mark circle { fill: var(--surface); stroke-width: 2; }
.hand-R .finger-mark circle { stroke: var(--rh); }
.hand-L .finger-mark circle { stroke: var(--lh); }
.keyboard .finger-mark text { font: 700 13px/1 system-ui, sans-serif; fill: var(--ink); }
.keyboard .finger-mark.tonic circle { stroke-width: 3.5; }
.keyboard .finger-mark.tonic text { font-weight: 850; }
.keyboard .middle-c { font-size: 10px; fill: var(--muted); }

/* Touch: the lane under the staves and the evenness readout */
.notation .touch-base { stroke: var(--staff); stroke-width: 1; }
.notation .touch-mid { stroke: var(--staff); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.6; }
.notation .touch-label { font-size: 10px; fill: var(--muted); }
.notation .touch-bar { transition: opacity 0.3s; }
.notation .touch-bar.touch-R { fill: var(--rh); }
.notation .touch-bar.touch-L { fill: var(--lh); }
.notation .touch-bar.old { opacity: 0.25; }
.notation .touch-mean { stroke-width: 1.2; stroke-dasharray: 5 3; }
.notation .touch-mean.touch-R { stroke: var(--rh); }
.notation .touch-mean.touch-L { stroke: var(--lh); }
.touch-row { display: flex; align-items: center; gap: 6px; margin: -6px 0 14px; font-size: 14px; cursor: help; }
.touch-row svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.touch-stat { display: inline-flex; gap: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.touch-item.even { color: var(--perfect); }
.touch-item.fair { color: var(--ok); }
.touch-item.uneven { color: var(--bad); }

/* The hand drawing beside each keyboard, and its finger crossings */
.hand-row { display: flex; align-items: flex-end; gap: 12px; }
.hand-R .hand-row { flex-direction: row-reverse; justify-content: flex-end; } /* thumbs towards the keys */
.hand-pic { flex: none; display: block; overflow: visible; }
.hand-pic .hand-outline rect { fill: none; stroke-width: 4; stroke-linejoin: round; }
.hand-R .hand-pic .hand-outline rect { stroke: var(--rh); }
.hand-L .hand-pic .hand-outline rect { stroke: var(--lh); }
.hand-pic .hand-fill rect { fill: var(--surface); transition: fill 0.2s; }
.hand-R .hand-pic .finger.next rect { fill: color-mix(in srgb, var(--rh) 35%, var(--surface)); }
.hand-L .hand-pic .finger.next rect { fill: color-mix(in srgb, var(--lh) 35%, var(--surface)); }
.hand-pic .finger.down rect { fill: var(--perfect); transition: none; }
.hand-pic .finger-num { font: 700 13px/1 system-ui, sans-serif; fill: var(--ink); }
.hand-pic .finger-num.next, .hand-pic .finger-num.down { font-weight: 850; }
.keyboard .finger-mark.next circle { stroke-width: 4; }
.hand-R .keyboard .finger-mark.next circle { fill: color-mix(in srgb, var(--rh) 30%, var(--surface)); }
.hand-L .keyboard .finger-mark.next circle { fill: color-mix(in srgb, var(--lh) 30%, var(--surface)); }
.crossings { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); }
.crossings li { padding: 1px 6px; border-radius: 6px; transition: background 0.2s, color 0.2s; }
.hand-R .crossings li.now { background: color-mix(in srgb, var(--rh) 18%, transparent); color: var(--text); }
.hand-L .crossings li.now { background: color-mix(in srgb, var(--lh) 18%, transparent); color: var(--text); }
@media (max-width: 560px) {
  .hand-row { flex-wrap: wrap; }
}
