/* ============================================================
   Theory drills. Builds on shared/tokens.css + shell.css (the
   toolkit's colours, header and buttons) and css/notation.css.
   Laid out like Aural Trainer's quiz so the two feel like one
   product. Light default, dark via prefers-color-scheme.
   ============================================================ */

.muted { color: var(--ink-2); }

/* ---------- home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.home-head h1 { margin: 0; }
.home-head p { margin: 4px 0 0; color: var(--ink-2); }
.launch { display: flex; gap: 10px; flex-wrap: wrap; }

.topic-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.topic-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px;
  padding: 15px 6px; border-bottom: 1px solid var(--line); margin: 0;
  text-decoration: none; color: inherit; transition: background 130ms ease-out;
}
.topic-row:hover { background: var(--surface); }
.topic-row .names b { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; display: block; }
.topic-row .names span { color: var(--ink-2); font-size: 0.92rem; }
.topic-row .stat { color: var(--ink-2); font-size: 0.88rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.topic-row .go { font-weight: 600; font-size: 0.92rem; color: var(--accent); }
.acc-meter { width: 90px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); display: inline-block; vertical-align: middle; }
.acc-meter i { display: block; height: 100%; background: var(--accent); }
.how { margin-top: 30px; color: var(--ink-2); font-size: 0.93rem; max-width: 70ch; }

/* ---------- a round ---------- */
.quiz-wrap { max-width: 720px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--ink-2); font-size: 0.92rem; gap: 10px; }
.quiz-top a { white-space: nowrap; }
.quiz-progress { flex: 1; height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; margin: 0 8px; overflow: hidden; min-width: 60px; }
.quiz-progress i { display: block; height: 100%; background: var(--accent); transition: width 300ms cubic-bezier(0.22, 1, 0.36, 1); }

.q-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 26px 30px; margin-top: 14px;
}
.q-type { color: var(--ink-2); font-size: 0.88rem; margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.q-type .lvl { font-size: 0.78rem; font-weight: 700; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.q-prompt { font-family: var(--serif); font-size: 1.3rem; line-height: 1.3; margin-bottom: 16px; text-wrap: balance; }
.staff-box { display: flex; justify-content: center; padding: 6px 0 18px; overflow-x: auto; }
.staff-box .mtn { max-width: 100%; }

.opts { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.opts.letters { grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); }
.opts.pictures { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.opt {
  text-align: left; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 12px 14px; color: var(--ink); line-height: 1.35;
  display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: center;
  transition: border-color 120ms ease-out, background 120ms ease-out;
}
.opts.letters .opt { grid-template-columns: 1fr; text-align: center; font-weight: 700; font-size: 1.1rem; padding: 12px 6px; }
.opts.letters .opt kbd { display: none; }
.opts.pictures .opt { grid-template-columns: 1fr; justify-items: center; padding: 10px 8px 8px; gap: 4px; }
.opts.pictures .opt .mtn { width: 100%; max-width: 92px; }
.opts.pictures .opt .cap { font-size: 0.85rem; color: var(--ink-2); min-height: 1.2em; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt kbd {
  font: 600 0.8rem var(--sans); color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 5px; text-align: center; padding: 1px 0;
}
.opt.correct { background: var(--ok-tint); border-color: var(--ok); }
.opt.wrong { background: var(--bad-tint); border-color: var(--bad); }
.opt:disabled { cursor: default; }
.opt.dim { opacity: 0.55; }

.q-feedback { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; }
.q-feedback .verdict { font-weight: 700; }
.q-feedback .verdict.good { color: var(--ok); }
.q-feedback .verdict.badv { color: var(--bad); }
.q-feedback .detail { color: var(--ink-2); font-size: 0.95rem; }
.q-feedback .btn { flex: none; }

/* ---------- on-screen keyboard ----------
   A piano stays a piano in dark mode: ivory and black keys either way,
   just a little dimmer at night. */
:root { --key-white: oklch(0.985 0.003 90); --key-black: oklch(0.2 0.01 280); --key-label: oklch(0.45 0.01 280); --key-edge: oklch(0.8 0.008 270); }
@media (prefers-color-scheme: dark) {
  :root { --key-white: oklch(0.86 0.006 90); --key-black: oklch(0.12 0.01 280); --key-label: oklch(0.4 0.01 280); --key-edge: oklch(0.4 0.01 280); }
}
.kb-wrap { max-width: 520px; margin: 0 auto; }
.kb { position: relative; height: 150px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.kb .key { position: absolute; top: 0; padding: 0; border: 1px solid var(--key-edge); cursor: pointer; }
.kb .key.white {
  height: 100%; background: var(--key-white); border-radius: 0 0 7px 7px; z-index: 1;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
}
.kb .key.black { height: 60%; background: var(--key-black); border-color: var(--key-black); border-radius: 0 0 5px 5px; z-index: 2; }
.kb .key .lbl { font-size: 0.7rem; color: var(--key-label); font-weight: 600; pointer-events: none; }
.kb .key.on.white { background: color-mix(in srgb, var(--accent) 45%, var(--key-white)); border-color: var(--accent); }
.kb .key.on.black { background: var(--accent); border-color: var(--accent); }
.kb .key.right.white { background: color-mix(in srgb, var(--ok) 40%, var(--key-white)); border-color: var(--ok); }
.kb .key.right.black { background: var(--ok); border-color: var(--ok); }
.kb .key.wrong.white { background: color-mix(in srgb, var(--bad) 40%, var(--key-white)); border-color: var(--bad); }
.kb .key.wrong.black { background: var(--bad); border-color: var(--bad); }
.kb .key.missed { outline: 3px dashed var(--ok); outline-offset: -5px; }
.kb .key:disabled { cursor: default; }
.kb-actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.kb-actions .chosen { color: var(--ink-2); font-size: 0.92rem; }

/* ---------- end of a round ---------- */
.result-summary { text-align: center; padding: 10px 0 4px; }
.score-line { font-family: var(--serif); font-size: 2rem; margin: 4px 0 2px; }
.result-summary .sub { color: var(--ink-2); margin-left: auto; margin-right: auto; }
.topic-split { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 0; padding: 0; list-style: none; }
.topic-split li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 0.88rem; }
.misses { margin-top: 24px; }
.misses h3 { margin-bottom: 8px; }
.misses ol { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.misses li { margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.misses li:last-child { border-bottom: 0; }
.misses b { display: block; }
.misses .why { color: var(--ink-2); font-size: 0.93rem; }
.misses .you { color: var(--bad); font-size: 0.85rem; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.task-saved { margin: 12px auto 0; max-width: 46ch; font-size: 0.95rem; }

/* ---------- my results ---------- */
.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.acc-row { display: grid; grid-template-columns: 150px 1fr 52px; gap: 12px; align-items: center; padding: 7px 0; font-size: 0.95rem; }
.acc-row .acc-meter { width: 100%; }
.acc-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.item-list { margin: 0; padding-left: 1.2em; }
.item-list .muted { font-size: 0.88rem; }
.attempt-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.attempt-table th { text-align: left; color: var(--ink-2); font-weight: 600; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.attempt-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.empty-note { color: var(--ink-2); }
.sync-note { color: var(--ink-2); font-size: 0.85rem; margin-top: 18px; }

/* ---------- homework task ---------- */
.task-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px; max-width: 540px; margin: 5vh auto 0;
}
.task-card .kicker { font-size: 0.82rem; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; }
.task-card h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
.task-spec { font-weight: 600; margin: 0 0 4px; }
.task-due { color: var(--ink-2); margin: 0; }
.task-done { background: var(--ok-tint); border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; font-size: 0.95rem; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.identity-card .skip { margin: 16px 0 0; font-size: 0.9rem; }
.identity-card .skip button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

@media (max-width: 820px) { .results-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .q-card { padding: 20px 16px; }
  .q-prompt { font-size: 1.15rem; }
  .topic-row { grid-template-columns: 1fr auto; gap: 10px; }
  .topic-row .go { display: none; }
  .acc-row { grid-template-columns: 110px 1fr 46px; }
  .opts { grid-template-columns: 1fr 1fr; }
  .opts.letters { grid-template-columns: repeat(4, 1fr); }
  .opts.pictures { grid-template-columns: 1fr 1fr; }
  .opt { padding: 11px 10px; grid-template-columns: 1fr; }
  .opt kbd { display: none; }
  .kb { height: 130px; }
  .q-feedback { flex-direction: column; align-items: stretch; }
  .q-feedback .btn { justify-content: center; }
}
