/* The Scale Hand lab (2026-09-28): a 3D hand playing the Scales & Arpeggios
   drill's fingering next to the numbers the drill shows today. The chrome
   follows the Falling Staff lab; the stage is a three.js canvas with a 2D
   overlay (js/scale-hand-lab.js). Its own file, per the rule. */
:root {
  --bg: #15171c; --bg2: #1d2027; --bg3: #262a33; --line: #343945;
  --ink: #ecebe4; --dim: #a7aab4; --soft: #c9c6bb;
  --gold: #e2b452; --gold2: #f0cf85; --red: #c9534a; --green: #63b47a; --blue: #3b82c4;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.5 -apple-system, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--gold2); }
h1, h2, h3 { font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif; font-weight: 700; line-height: 1.15; margin: 0; }
p { margin: 0 0 .7em; }
code { color: var(--gold2); font-size: 13px; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 20px 80px; }

.mast { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 18px; padding: 18px 0 8px; border-bottom: 1px solid var(--line); }
.mast h1 { font-size: 30px; color: var(--gold2); }
.mast .sub { color: var(--dim); }
.mast .links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; }
.mast .links a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.mast .links a:hover { border-color: var(--gold); }

.brief { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
@media (max-width: 980px) { .brief { grid-template-columns: 1fr; } }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.card h2 { font-size: 20px; margin-bottom: 8px; color: var(--gold2); }
.card h3 { font-size: 16px; margin: 12px 0 6px; }
.card ol, .card ul { margin: 0 0 8px; padding-left: 20px; }
.card li { margin: 3px 0; }
.real { font-size: 13.5px; color: var(--soft); }

/* ------------------------------------------------------------ the bench */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .bench { grid-template-columns: 1fr; } }
.pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pick button { font: 700 15px/1 Georgia, serif; color: var(--soft); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px 8px; cursor: pointer; }
.pick button b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--bg3); color: var(--gold2); font-size: 13px; }
.pick button:hover { border-color: var(--gold); }
.pick button.on { background: var(--gold); color: #2a2010; border-color: var(--gold); }
.pick button.on b { background: #2a2010; color: var(--gold2); }
.frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #18282e; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.frame #drill { display: none; background: #15171c; }
.frame[data-design="A"] #drill { display: block; }
.frame[data-design="A"] #hand3d, .frame[data-design="A"] #over { visibility: hidden; }
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; gap: 12px; padding: 9px 13px; pointer-events: none;
  font: 500 13px/1.3 -apple-system, "Segoe UI", sans-serif; color: rgba(255, 255, 255, .8); text-shadow: 0 1px 3px #000; }
.hud b { color: #ffd75e; }
.hud .mid { position: absolute; left: 50%; top: 9px; transform: translateX(-50%); max-width: 56%; text-align: center; background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; padding: 4px 14px; color: #ffe9a6; font-weight: 700; white-space: nowrap; }
.hud .mid:empty { display: none; }
.frame[data-design="A"] .hud { display: none; }
.status { position: absolute; inset: auto 0 0 0; margin: 0 auto 14px; width: max-content; max-width: 90%; background: rgba(0, 0, 0, .7); border-radius: 999px; padding: 6px 14px; font-size: 13.5px; color: var(--soft); }
.status[hidden] { display: none; }
.status.error { color: #ffb4ab; }
.seek { height: 9px; border-radius: 5px; background: var(--bg3); margin: 8px 0 0; cursor: pointer; overflow: hidden; }
.seek i { display: block; height: 100%; width: 0; background: var(--gold); }
.under { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; font-size: 13.5px; color: var(--dim); }
.under .go { font: 700 15px/1 -apple-system, "Segoe UI", sans-serif; border: 0; border-radius: 9px; padding: 10px 18px; cursor: pointer; background: linear-gradient(180deg, #5fb1ff, #3b82c4); color: #fff; }
.under .go.on { background: var(--bg3); color: var(--ink); }
.under .plain { font: inherit; font-size: 13.5px; color: var(--ink); background: var(--bg3); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; cursor: pointer; }
.under b { color: var(--gold2); }
.design-line { margin-top: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; color: var(--soft); font-size: 15px; }
.design-line b { color: var(--gold2); } .design-line i { color: var(--dim); margin-left: 6px; }

.side h3 { font-size: 14px; letter-spacing: .5px; text-transform: uppercase; color: var(--dim); font-family: inherit; margin: 14px 0 6px; }
.side h3:first-child { margin-top: 0; }
.side .row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.side select { flex: 1; font: inherit; color: var(--ink); background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.seg.col { flex-direction: column; }
.seg button { font: inherit; font-size: 13.5px; color: var(--soft); background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; text-align: left; }
.seg button:hover { border-color: var(--gold); }
.seg button.on { background: #2f3a4d; color: #fff; border-color: var(--blue); }
.midi, .keys-help { font-size: 12.5px; color: var(--dim); margin-top: 10px; }
.keys-help b { color: var(--soft); }

/* ------------------------------------------------------- the write-up */
.section { margin: 30px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.section > h2 { font-size: 26px; color: var(--gold2); margin-bottom: 6px; }
.section > .lede { color: var(--soft); max-width: 1050px; margin-bottom: 12px; font-size: 16.5px; }
.designs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 980px) { .designs { grid-template-columns: 1fr; } }
.design h3 { font-size: 18px; margin-top: 0; }
.design h3 b { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 6px; border-radius: 50%; background: var(--gold); color: #2a2010; font-size: 14px; }
.design h3 i { display: block; font: 400 13px/1.4 -apple-system, "Segoe UI", sans-serif; color: var(--dim); margin-top: 4px; }
.design .pros li::marker { content: "+  "; color: var(--green); }
.design .cons li::marker { content: "−  "; color: var(--red); }
.design .pros, .design .cons { font-size: 14px; }

@media (max-width: 600px) {
  .wrap { padding: 0 12px 60px; }
  .mast h1 { font-size: 24px; }
  /* a phone gets a square stage (the camera closes in on the hand), and the
     HUD keeps only the note count: the run is named in the panel below */
  .frame { aspect-ratio: 1 / 1; }
  .hud .mid, #hud-run { display: none; }
  .hud { justify-content: flex-end; }
}
