/* Scale practice — builds on styles.css and chords.css (stage, transport, tones, trainer). Design system: brand/design-guide.md */

.sp-stage { grid-template-rows: auto auto auto auto auto; gap: 20px; min-height: 0; }

/* now / scale / neck strip */
.sp-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.3fr); gap: 24px; align-items: end; }
.sp-now .cp-label { color: var(--amber); }
.sp-now-row { display: flex; align-items: baseline; gap: 12px; }
.sp-note { min-width: 1.2ch; color: var(--text); font: 600 clamp(56px, 9cqw, 84px)/1 var(--font-ui); letter-spacing: -0.02em; }
.sp-degree { padding: 2px 10px; border: 1px solid var(--amber); border-radius: var(--radius-small); color: var(--amber); font-size: clamp(16px, 2.4cqw, 20px); font-weight: 700; line-height: 1.3; }
.sp-degree:empty { display: none; }
.sp-where { display: block; margin-top: 8px; color: var(--text-muted); font-size: 14px; }
.sp-scale { display: grid; gap: 4px; }
.sp-scale-notes { font-size: clamp(20px, 2.8cqw, 24px); font-weight: 600; letter-spacing: 0.04em; line-height: 1.2; word-spacing: 0.1em; }
.sp-scale-formula { color: var(--text-quiet); font-size: 13px; }

.neck-map { display: grid; grid-template-columns: 0.6fr repeat(22, 1fr); height: 24px; overflow: hidden; border: 1px solid var(--on-stage-line); border-radius: 6px; background: var(--on-stage); }
.nm-cell { position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; border-right: 1px solid var(--on-stage-line); }
.nm-cell.is-open { border-right: 3px solid rgba(232, 220, 196, 0.6); }
.nm-cell.is-in { background: rgba(83, 127, 155, 0.55); }
.nm-cell i { width: 4px; height: 4px; border-radius: 50%; background: rgba(232, 220, 196, 0.4); }

/* fretboard: rosewood grain, nickel frets, bronze/silver strings; roots ivory, current amber, next dashed */
.fretboard { width: 100%; }
/* The app's icon rule outlines every <svg>; the fretboard sets its own strokes.
   Drawn at its real pixel size (see fretboard.js), so it's never scaled; a narrower panel just redraws it. */
.fb-svg { display: block; width: auto; height: auto; max-width: 100%; stroke: none; fill: none; }
.fb-wood { fill: #3a2317; stroke: none; } /* shows only until the grain image (fretboard.js) is drawn over it */
.fb-shade { pointer-events: none; }
.fb-edge { fill: none; stroke: rgba(0, 0, 0, 0.55); stroke-width: 1; pointer-events: none; }
.fb-inlay { fill: url(#fb-pearl); opacity: 0.55; } /* mother-of-pearl position markers */
.fb-wire { stroke: #a39c92; stroke-width: 3; }
.fb-wire-hl { stroke: #eee8dc; stroke-width: 1; opacity: 0.55; }
.fb-nut { stroke: #ece4d1; stroke-width: 8; stroke-linecap: round; }
.fb-string { stroke: #dcd5c8; }
.fb-string.is-wound { stroke: #c9b088; }
.fb-string-shadow { stroke: rgba(0, 0, 0, 0.5); }
.fb-strname, .fb-fretnum { fill: var(--text-muted); font: 600 var(--fs-small) var(--font-ui); text-anchor: middle; }
.fb-note { cursor: pointer; }
.fb-dot { fill: #17100b; stroke: var(--ivory); stroke-width: 2; }
.fb-halo { fill: none; stroke: var(--amber); stroke-width: 2; opacity: 0; }
.fb-note text { fill: var(--ivory); font: 600 var(--fs) var(--font-ui); text-anchor: middle; pointer-events: none; }
.fb-note.is-root .fb-dot { fill: var(--ivory); }
.fb-note.is-root text { fill: var(--ink); }
.fb-note:hover .fb-dot { stroke-width: 3; }
.fb-note.is-next .fb-dot { stroke-dasharray: 4 3; stroke-width: 2.5; }
.fb-note.is-current .fb-halo { opacity: 1; }
.fb-note.is-current .fb-dot { fill: var(--amber); stroke: var(--amber); }
.fb-note.is-current text { fill: var(--ink); }

/* neck view, right under the fretboard: how many frets it shows, and which string is on top */
.board-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: -8px; }
.fret-zoom {
  display: inline-flex;
  align-items: stretch;
  height: 30px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}
.fret-zoom button { width: 30px; padding: 0; border: 0; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; transition: background-color var(--ease), color var(--ease); }
.fret-zoom button:hover:not(:disabled) { background: var(--surface-raised); color: var(--text); }
.fret-zoom button:disabled { color: var(--text-quiet); opacity: 0.45; cursor: default; }
.fret-zoom span { display: grid; place-items: center; min-width: 64px; padding: 0 6px; border-inline: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }

/* string-order flip */
.flip-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}
.flip-btn:hover { background: var(--surface-raised); color: var(--text); }
.flip-btn[aria-pressed='true'] { border-color: var(--denim); background: var(--surface-raised); color: var(--text); }
@media (pointer: coarse) { /* full-size targets for fingers */
  .fret-zoom, .flip-btn { height: var(--control); }
  .fret-zoom button { width: var(--control); }
}
.seg button small { display: block; color: var(--text-quiet); font-size: 12px; font-weight: 500; }

/* tab strip: the exercise as TAB, scrolling to keep the current note in view */
.tab-wrap { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; }
.tab-names { display: grid; grid-template-rows: repeat(6, 19px); padding-top: 7px; }
.tab-names span { display: grid; place-items: center; color: var(--text-quiet); font-size: 12px; font-weight: 600; line-height: 1; }
.tab-strip {
  position: relative;
  height: 128px;
  overflow: hidden;
  border: 1px solid var(--on-stage-line);
  border-radius: var(--radius-control);
  background:
    repeating-linear-gradient(180deg, transparent 0 9px, rgba(232, 220, 196, 0.2) 9px 10px, transparent 10px 19px) 0 6px / 100% 114px no-repeat,
    var(--on-stage);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.tab-inner { display: flex; height: 100%; padding: 6px 0 0 50%; transition: transform 120ms linear; }
.tab-col { display: grid; grid-template-rows: repeat(6, 19px); flex: none; width: 30px; }
.tab-col.beat-start { box-shadow: inset 1px 0 0 var(--on-stage-line); }
.tab-col span { display: grid; place-items: center; color: transparent; font-size: 13px; font-weight: 600; line-height: 1; }
.tab-col span.on { color: var(--text); }
.tab-col span.on b { padding: 0 4px; border-radius: 4px; background: #15120f; font-weight: 600; }
.tab-col.is-current span.on b { background: var(--amber); color: var(--ink); }
.tab-col.is-done span.on { color: var(--text-quiet); }
.tab-col.is-rest { width: 18px; }

/* ---------- listen mode: marks under the TAB (the shared styles are in styles.css) ---------- */

/* Each TAB column gets a mark under it once the note is judged (a 7th row, shown only while listening). */
.tab-mark { display: none; }
body.is-listening .tab-col { grid-template-rows: repeat(6, 19px) 16px; }
body.is-listening .tab-strip { height: 144px; }
body.is-listening .tab-mark { display: inline-block; justify-self: center; align-self: center; }
.tab-col[data-result='wrong'] span.on b { box-shadow: inset 0 0 0 1px var(--danger); }
.tab-col[data-result='miss'] span.on { color: var(--text-quiet); }

/* exercise inspector */
.field-hint { color: var(--text-quiet); font-size: 13px; font-weight: 500; }
.key-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.key-grid button, .pos-grid button {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--field);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.key-grid button:hover, .pos-grid button:hover { background: var(--surface-raised); color: var(--text); }
.key-grid button[aria-checked='true'], .pos-grid button[aria-checked='true'] { border-color: var(--denim); background: var(--surface-raised); color: var(--text); }
.pos-grid { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 4px; }
.pos-grid button { display: grid; align-content: center; height: 48px; padding: 4px 0; line-height: 1.15; }
.pos-grid button small { color: var(--text-quiet); font-size: 12px; font-weight: 500; }
.pos-grid button[aria-checked='true'] small { color: var(--text-muted); }

@media (max-width: 1280px) {
  .scales-page .insp-body > .field:not(.wide) { grid-column: auto; }
}
@media (max-width: 860px) {
  .sp-info { grid-template-columns: 1fr 1fr; }
  .sp-neck { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .sp-info { grid-template-columns: 1fr; }
  .key-grid { grid-template-columns: repeat(4, 1fr); }
  .tab-strip { height: 124px; }
  body.is-listening .tab-strip { height: 140px; }
}
