/* Audio Skills Progress Tracker — dashboard, no audio.
   Reads localStorage["fd-ear-training"] (shared trainer schema) and
   localStorage["fd-ear-goals"]. Tool-specific overrides only. */

/* ---- honest caveat note (matches the .X-warn-note convention) ---- */
.apt-warn-note {
  max-width: 820px; margin: var(--space-md) auto 0;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border); border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius-sm); background: rgba(0, 255, 65, 0.04);
  color: var(--color-text-dim); font-size: 0.9rem; line-height: 1.55; text-align: left;
}
.apt-warn-note strong { color: var(--color-text); }

/* ---- toolbar ---- */
.apt-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--space-sm);
  align-items: center; justify-content: flex-end;
  margin-bottom: var(--space-lg);
}
.apt-toolbar__spacer { margin-right: auto; }

/* ---- status line ---- */
.apt-status {
  min-height: 1.2em; margin-bottom: var(--space-md);
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--color-secondary);
}

/* ---- headline stat cards ---- */
.apt-headline {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md); margin-bottom: var(--space-lg);
}
@media (max-width: 760px) { .apt-headline { grid-template-columns: repeat(2, 1fr); } }
.apt-stat {
  padding: var(--space-md); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); text-align: center;
}
.apt-stat__val {
  display: block; font-family: var(--font-display); font-size: 1.9rem;
  color: var(--color-primary); line-height: 1.1;
}
.apt-stat__label {
  display: block; margin-top: 6px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--color-text-dim);
}
.apt-stat__sub { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--color-text-muted); }

/* ---- section block headings inside the panel ---- */
.apt-block { margin-top: var(--space-xl); }
.apt-block:first-of-type { margin-top: 0; }
.apt-block__title {
  font-size: 1.05rem; margin-bottom: var(--space-sm);
  color: var(--color-text-bright); font-family: var(--font-display);
}
.apt-block__hint { font-size: 0.82rem; color: var(--color-text-muted); line-height: 1.5; margin-top: var(--space-xs); }

/* ---- history chart ---- */
.apt-canvas {
  display: block; width: 100%; height: 280px;
  border-radius: var(--radius-sm); background: #060a08;
  border: 1px solid var(--color-border);
}
.apt-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-md);
  margin-top: var(--space-sm); font-size: 0.78rem; color: var(--color-text-dim);
}
.apt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.apt-dot { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.apt-dot--acc { background: #00ff41; }
.apt-dot--goal { background: #00e5ff; }

/* ---- per-tool table ---- */
.apt-tablewrap { border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; overflow-x: auto; }
.apt-table { display: flex; flex-direction: column; font-size: 0.84rem; min-width: 560px; }
.apt-trow { display: grid; grid-template-columns: 2fr 70px 100px 100px 1.2fr; }
.apt-trow:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.apt-trow--head { background: rgba(0, 255, 65, 0.08); color: var(--color-primary); font-weight: 600; }
.apt-tcell { padding: 8px 10px; border-bottom: 1px solid var(--color-border); font-family: var(--font-mono); text-align: center; color: var(--color-text); }
.apt-tcell--tool { text-align: left; color: var(--color-primary); }
.apt-tcell--date { color: var(--color-text-muted); }

/* ---- goals ---- */
.apt-goals { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); align-items: start; }
@media (max-width: 760px) { .apt-goals { grid-template-columns: 1fr; } }
.apt-goal { padding: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.apt-goal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.apt-goal__label { font-size: 0.8rem; color: var(--color-text-dim); }
.apt-goal__field { display: flex; align-items: center; gap: 6px; }
.apt-num {
  width: 84px; padding: 8px 10px; background: var(--color-bg); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.92rem;
}
.apt-num:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.18); }
.apt-goal__unit { font-family: var(--font-mono); font-size: 0.85rem; color: var(--color-text-muted); }
.apt-bar {
  margin-top: var(--space-md); height: 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--color-border); overflow: hidden;
}
.apt-bar__fill { height: 100%; width: 0; background: var(--color-primary); transition: width 0.3s ease; }
.apt-bar__fill--met { background: var(--color-success); }
.apt-goal__progress { margin-top: 6px; font-family: var(--font-mono); font-size: 0.82rem; color: var(--color-text); }
.apt-goal__progress--met { color: var(--color-success); }

/* ---- streak ---- */
.apt-streak { display: flex; align-items: baseline; gap: var(--space-md); flex-wrap: wrap; }
.apt-streak__num { font-family: var(--font-display); font-size: 2.4rem; color: var(--color-secondary); line-height: 1; }
.apt-streak__txt { font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.5; }

/* ---- empty state ---- */
.apt-empty {
  text-align: center; padding: var(--space-xl) var(--space-md);
  border: 1px dashed var(--color-border); border-radius: var(--radius-md);
  background: rgba(0, 255, 65, 0.02);
}
.apt-empty__icon { font-size: 2.6rem; margin-bottom: var(--space-sm); }
.apt-empty__title { font-family: var(--font-display); font-size: 1.2rem; color: var(--color-primary); margin-bottom: var(--space-xs); }
.apt-empty__text { max-width: 560px; margin: 0 auto var(--space-md); color: var(--color-text-muted); line-height: 1.6; }
.apt-empty__links { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; }
.apt-chip {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--color-border);
  border-radius: 999px; background: var(--color-surface); color: var(--color-primary);
  text-decoration: none; font-family: var(--font-mono); font-size: 0.85rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.apt-chip:hover { border-color: var(--color-primary); transform: translateY(-2px); }

/* ---- explanatory text + FAQ (production convention; box comes from .faq-item) ---- */
.content-section { color: var(--color-text-muted); line-height: var(--lh-loose, 1.7); }
.content-section p { margin-bottom: var(--space-md); }
.content-section strong { color: var(--color-text-bright); }

.faq-question {
  font-family: var(--font-mono); color: var(--color-text-bright);
  padding: var(--space-md) var(--space-lg); cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '+'; color: var(--color-primary); font-family: var(--font-mono); margin-left: var(--space-md); }
.faq-item[open] .faq-question::after { content: '\2013'; }
.faq-answer { padding: 0 var(--space-lg) var(--space-md); font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.65; }

/* ---- related tools (per-tool, matches the category convention) ---- */
.related-tools-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md); text-align: left;
}
.related-tool-card {
  display: block; padding: var(--space-md);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.related-tool-card:hover { border-color: var(--color-primary); transform: translateY(-3px); box-shadow: var(--glow-sm); }
.related-tool-card__title { font-family: var(--font-display); font-size: 0.95rem; color: var(--color-primary); margin-bottom: 4px; }
.related-tool-card__desc { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.45; }

@media (max-width: 720px) {
  .related-tools-grid { grid-template-columns: 1fr; }
}
