/* Progress chart + leaderboard (progress.js), shared by Ear Training and
   Fretboard Quiz — the same file ships in both apps.

   Both apps are dark-only, so these are the dark steps. Correct/wrong are
   blue/orange, not green/red: checked with the palette validator against
   both apps' surfaces, where green/red fails for colour-blind readers. They
   always come with ✓/✗ and a word, never colour alone. An app tints the rest
   by setting the --fpg-* tokens on its own .fpg. */
.fpg {
  --fpg-text: #e6e8ee;
  --fpg-muted: #8b93a3;
  --fpg-line: rgba(255, 255, 255, .09);
  --fpg-grid: rgba(255, 255, 255, .07);
  --fpg-axis: rgba(255, 255, 255, .18);
  --fpg-hover: rgba(255, 255, 255, .05);
  --fpg-ok: #3987e5;
  --fpg-bad: #d95926;
  --fpg-btn: rgba(255, 255, 255, .04);
  --fpg-btn-on: rgba(255, 255, 255, .12);
  --fpg-tip: #0b0d12;
  /* The chart's own panel: darker than either app's card. */
  --fpg-plot-bg: #0a0c10;
  --fpg-plot-edge: rgba(255, 255, 255, .06);
  /* Area wash at the line, fading to almost nothing at the baseline. */
  --fpg-wash: .5;
  --fpg-wash-end: .06;
  color: var(--fpg-text);
  font-size: 12px;
  line-height: 1.35;
  border-top: 1px solid var(--fpg-line);
  padding-top: 4px;
  margin-top: 10px;
}
.fpg [hidden] { display: none !important; }

.fpg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}
.fpg-toggle {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 2px 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.fpg-chev { color: var(--fpg-muted); width: 10px; flex: none; }
.fpg-title { font-weight: 600; letter-spacing: .02em; }
.fpg-summary {
  color: var(--fpg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fpg-seg { display: flex; gap: 2px; flex: none; }
.fpg-seg button {
  padding: 3px 8px;
  background: var(--fpg-btn);
  border: 0;
  border-radius: 6px;
  color: var(--fpg-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.fpg-seg button:hover { color: var(--fpg-text); }
.fpg-seg button[aria-pressed="true"] { background: var(--fpg-btn-on); color: var(--fpg-text); }

.fpg-plot {
  position: relative;
  margin-top: 4px;
  background: var(--fpg-plot-bg);
  border: 1px solid var(--fpg-plot-edge);
  border-radius: 8px;
  overflow: hidden;
  touch-action: pan-y;          /* horizontal drags scroll the chart, not the page */
  user-select: none;
}
.fpg-svg { display: block; width: 100%; cursor: grab; outline: none; }
.fpg-svg:focus-visible { box-shadow: 0 0 0 2px var(--fpg-axis); border-radius: 4px; }
.fpg-svg:active { cursor: grabbing; }
.fpg-grid { stroke: var(--fpg-grid); stroke-width: 1; }
.fpg-axis { stroke: var(--fpg-axis); stroke-width: 1; }
.fpg-ytick, .fpg-xtick {
  fill: var(--fpg-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.fpg-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.fpg-line.fpg-ok { stroke: var(--fpg-ok); }
.fpg-line.fpg-bad { stroke: var(--fpg-bad); }
.fpg-stop-ok { stop-color: var(--fpg-ok); stop-opacity: var(--fpg-wash); }
.fpg-stop-bad { stop-color: var(--fpg-bad); stop-opacity: var(--fpg-wash); }
.fpg-stop-end { stop-opacity: var(--fpg-wash-end); }
.fpg-area { stroke: none; }
.fpg-cross { stroke: var(--fpg-axis); stroke-width: 1; }
/* Hover dots wear a ring of the panel colour, so they read over the lines. */
.fpg-dot { stroke: var(--fpg-plot-bg); stroke-width: 2; }
.fpg-dot.fpg-ok { fill: var(--fpg-ok); }
.fpg-dot.fpg-bad { fill: var(--fpg-bad); }
.fpg-plot.is-empty .fpg-svg { opacity: .5; }

.fpg-tip {
  position: absolute;
  top: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  background: var(--fpg-tip);
  border: 1px solid var(--fpg-line);
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.fpg-tip b { font-weight: 600; }
.fpg-tip span { color: var(--fpg-muted); }

.fpg-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--fpg-muted);
  font-size: 11px;
}
.fpg-step {
  width: 22px;
  height: 20px;
  padding: 0;
  background: var(--fpg-btn);
  border: 0;
  border-radius: 5px;
  color: var(--fpg-text);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.fpg-step:disabled { opacity: .3; cursor: default; }
.fpg-span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fpg-link {
  padding: 0 2px;
  background: none;
  border: 0;
  color: var(--fpg-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.fpg-legend { margin-left: auto; padding-right: 2px; display: flex; gap: 10px; flex: none; }
.fpg-legend span { display: inline-flex; align-items: center; gap: 4px; }
.fpg-legend i { width: 12px; height: 2px; border-radius: 1px; }
.fpg-legend em { font-style: normal; }
.fpg-legend i.ok { background: var(--fpg-ok); }
.fpg-legend i.bad { background: var(--fpg-bad); }

.fpg-empty, .fpg-note { color: var(--fpg-muted); font-size: 11px; margin: 2px 0 0; }
.fpg-note a { color: var(--fpg-text); }

.fpg-board-toggle { margin-top: 6px; }
.fpg-board table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.fpg-board th {
  color: var(--fpg-muted);
  font-weight: 500;
  font-size: 10px;
  text-align: left;
  padding: 2px 4px;
  border-bottom: 1px solid var(--fpg-line);
}
.fpg-board td { padding: 3px 4px; border-bottom: 1px solid var(--fpg-grid); }
.fpg-board .rank { width: 2.2em; color: var(--fpg-muted); }
.fpg-board .who { overflow-wrap: anywhere; }
.fpg-board .num { text-align: right; width: 5.5em; }
.fpg-board .dim { color: var(--fpg-muted); }
.fpg-board tr.me td { background: var(--fpg-hover); font-weight: 600; }
.fpg-board .fpg-mine td { border-top: 1px dashed var(--fpg-line); }

/* Narrow: an open chart's header needs the room for its buttons, so the
   summary gives way (folded, there are no buttons and it stays). */
@media (max-width: 420px) {
  .fpg-toggle[aria-expanded="true"] .fpg-summary { display: none; }
  .fpg-seg button { padding: 3px 6px; }
  /* ✓ and ✗ beside the swatches still say which is which. */
  .fpg-legend em { display: none; }
  .fpg-legend { gap: 8px; }
}
