/* ============================================================================
   Fretwise -- styles. Archivo for headings (loaded from Google Fonts), system
   stack for body -- so the app still reads correctly offline and from a local
   file, where the display face simply falls back.
   ========================================================================== */

:root {
  --bg: #12141a;
  --surface: #1a1d26;
  --surface-2: #22262f;
  --line: #2e3340;
  --line-soft: #262a34;
  --text: #eceef2;
  --text-dim: #a3aab8;
  --text-faint: #6f7787;

  --root: #ffb020;
  --third: #34d399;
  --fifth: #60a5fa;
  --seventh: #c084fc;
  --other: #7c8497;

  --accent: #ffb020;
  --accent-ink: #17181c;

  --board: #20242e;
  --wire: #4a5262;
  --string: #8d95a6;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 940px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI Semibold", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f0f2f6;
    --line: #dfe3ea;
    --line-soft: #eaedf2;
    --text: #171a21;
    --text-dim: #5b6472;
    --text-faint: #8a93a3;
    --root: #e08600;
    --third: #0f9d6e;
    --fifth: #2b6fd4;
    --seventh: #8b46c9;
    --other: #98a0b0;
    --accent: #1d2028;
    --accent-ink: #ffffff;
    --board: #e7ecf4;
    --wire: #b3bccb;
    --string: #78829a;
  }
}
html[data-theme="light"] {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f0f2f6;
  --line: #dfe3ea; --line-soft: #eaedf2;
  --text: #171a21; --text-dim: #5b6472; --text-faint: #8a93a3;
  --root: #e08600; --third: #0f9d6e; --fifth: #2b6fd4; --seventh: #8b46c9; --other: #98a0b0;
  --accent: #1d2028; --accent-ink: #ffffff;
  --board: #e7ecf4; --wire: #b3bccb; --string: #78829a;
}
html[data-theme="dark"] {
  --bg: #12141a; --surface: #1a1d26; --surface-2: #22262f;
  --line: #2e3340; --line-soft: #262a34;
  --text: #eceef2; --text-dim: #a3aab8; --text-faint: #6f7787;
  --root: #ffb020; --third: #34d399; --fifth: #60a5fa; --seventh: #c084fc; --other: #7c8497;
  --accent: #ffb020; --accent-ink: #17181c;
  --board: #20242e; --wire: #4a5262; --string: #8d95a6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.brand {
  font-family: var(--display);
  font-weight: 700; font-size: 16px; letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  color: var(--text); text-decoration: none;
}
.brand__mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(140deg, var(--root), var(--seventh));
  display: grid; place-items: center; font-size: 12px; color: #17181c; font-weight: 800;
}
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav__btn {
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 14px; font-weight: 550; padding: 7px 12px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.nav__btn:hover { color: var(--text); background: var(--surface-2); }
.nav__btn.is-active { background: var(--accent); color: var(--accent-ink); }
.iconbtn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-dim); width: 34px; height: 34px; border-radius: 999px;
  cursor: pointer; display: grid; place-items: center; font-size: 14px; flex-shrink: 0;
}
.iconbtn:hover { color: var(--text); border-color: var(--text-faint); }
.iconbtn.is-off { opacity: 0.45; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 24px 16px 96px; }

/* Bottom nav on phones -- reachable while holding a guitar. */
.botnav { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .botnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .botnav__btn {
    flex: 1; appearance: none; border: 0; background: transparent; color: var(--text-faint);
    font: inherit; font-size: 10.5px; font-weight: 600; padding: 5px 2px;
    display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
    border-radius: 10px; letter-spacing: 0.1px;
  }
  .botnav__btn svg { width: 20px; height: 20px; }
  .botnav__btn.is-active { color: var(--accent); }
  .wrap { padding-bottom: 88px; }
}

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.22; letter-spacing: -0.4px; margin: 0; font-family: var(--display); }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 650; margin: 34px 0 12px; }
h3 { font-size: 17px; font-weight: 650; margin: 26px 0 8px; }
p { margin: 0 0 14px; color: var(--text-dim); }
p b, li b, td b { color: var(--text); font-weight: 650; }
a { color: var(--accent); }
.lede { font-size: 17px; color: var(--text-dim); }
.eyebrow {
  font-family: var(--display);
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 6px;
}

/* ---------- Cards, controls ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
.controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px; margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint);
}
select, input[type="text"] {
  appearance: none; font: inherit; font-size: 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 30px 8px 11px; cursor: pointer; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select:focus-visible, button:focus-visible, .fb__dot:focus-visible,
.cof__seg:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none; font: inherit; font-size: 13px; font-weight: 550;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn {
  appearance: none; font: inherit; font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn--ghost {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- Fretboard ---------- */
.fb-wrap {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  padding: 4px 0 2px; margin: 0 -2px;
  scrollbar-width: thin;
}
.fb { display: block; }
.fb__board { fill: var(--board); }
.fb__inlay { fill: var(--wire); opacity: 0.55; }
.fb__fret { stroke: var(--wire); stroke-width: 1.4; }
.fb__nut { stroke: var(--string); stroke-width: 5; stroke-linecap: round; }
.fb__string { stroke: var(--string); opacity: 0.75; }
.fb__fretnum { fill: var(--text-faint); font-size: 10px; text-anchor: middle; font-family: var(--font); }
.fb__dotc { fill: var(--other); }
.fb__dott { fill: #14161c; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.fb__dot--root  .fb__dotc { fill: var(--root); }
.fb__dot--third .fb__dotc { fill: var(--third); }
.fb__dot--fifth .fb__dotc { fill: var(--fifth); }
.fb__dot--seventh .fb__dotc { fill: var(--seventh); }
.fb__dot.is-dim { opacity: 0.3; }
.fb__dot:hover .fb__dotc { stroke: var(--text); stroke-width: 2; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--text-faint); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Chord diagrams ---------- */
.cd-row { display: flex; flex-wrap: wrap; gap: 10px; }
.cd-wrap {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 8px 6px 10px; text-align: center;
}
.cd-name {
  font-family: var(--display); font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.cd-caption { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.cd__string, .cd__fret { stroke: var(--wire); stroke-width: 1.3; }
.cd__nut { stroke: var(--string); stroke-width: 4; }
.cd__dot { fill: var(--text); }
.cd__barre { fill: var(--text); }
.cd__finger { fill: var(--bg); font-size: 9px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.cd__open { fill: none; stroke: var(--text-dim); stroke-width: 1.5; }
.cd__mark { fill: var(--text-faint); font-size: 12px; text-anchor: middle; font-family: var(--font); }
.cd__pos { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }

/* ---------- Tab ---------- */
.tab {
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px;
  overflow-x: auto; margin: 0; color: var(--text-dim); white-space: pre;
}

/* ---------- Callouts ---------- */
.callout {
  border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 13px 16px; margin: 18px 0;
}
.callout--try  { border-left-color: var(--third); }
.callout--key  { border-left-color: var(--root); }
.callout--why  { border-left-color: var(--fifth); }
.callout--watch{ border-left-color: var(--seventh); }
.callout__t {
  font-family: var(--display);
  font-size: 11px; font-weight: 700; letter-spacing: 0.9px; text-transform: uppercase;
  margin-bottom: 5px; color: var(--text);
}
.callout__b { font-size: 14.5px; color: var(--text-dim); }
.callout__b b { color: var(--text); }

.formula {
  font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: 3px;
  text-align: center; padding: 16px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin: 16px 0;
}

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--text-faint); border-bottom-color: var(--line);
}
td { color: var(--text-dim); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Diatonic / progression strips ---------- */
.strip { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.deg {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
  text-align: center; min-width: 74px; flex: 1 1 auto;
}
.deg:hover { border-color: var(--accent); }
.deg__r { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.4px; }
.deg__n { font-size: 16px; font-weight: 650; margin: 1px 0; font-family: var(--display); }
.deg__f { font-size: 10px; color: var(--text-faint); }
.deg__notes { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); font-variant-numeric: tabular-nums; }

.prog { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.prog__c {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 15px; cursor: pointer; text-align: center;
}
.prog__c:hover { border-color: var(--accent); }
.prog__c.is-lit { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.prog__c.is-lit .prog__r { color: var(--accent-ink); opacity: 0.75; }
.prog__n { font-size: 16px; font-weight: 700; font-family: var(--display); }
.prog__r { font-size: 10.5px; color: var(--text-faint); font-weight: 650; }

.blues-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 14px 0;
}
.blues-grid div {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 7px; padding: 12px 6px; text-align: center;
  font-weight: 650; font-size: 14px;
}
.blues-grid div.is-lit { background: var(--accent); color: var(--accent-ink); }

/* ---------- Circle of fifths ---------- */
.cof { max-width: 380px; margin: 0 auto; display: block; }
.cof__outer { fill: var(--surface-2); stroke: var(--bg); stroke-width: 2; }
.cof__inner { fill: var(--surface); stroke: var(--bg); stroke-width: 2; }
.cof__seg:hover .cof__outer, .cof__seg:hover .cof__inner { fill: var(--line); }
.cof__seg.is-active .cof__outer { fill: var(--accent); }
.cof__seg.is-active .cof__inner { fill: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.cof__seg.is-active .cof__major { fill: var(--accent-ink); }
.cof__major { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.cof__minor { fill: var(--text-faint); font-size: 11px; text-anchor: middle; font-family: var(--font); }
.cof__hub { fill: var(--bg); }
.cof__hubmain { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.cof__hubsub { fill: var(--text-faint); font-size: 10.5px; text-anchor: middle; font-family: var(--font); }

/* ---------- Lessons ---------- */
.lesson-list { display: flex; flex-direction: column; gap: 26px; }
.lgroup__h {
  font-family: var(--display);
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 9px;
}
.lrow {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer;
  font: inherit; color: var(--text); margin-bottom: 7px;
}
.lrow:hover { border-color: var(--text-faint); }
.lrow__n {
  width: 27px; height: 27px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--line);
}
.lrow.is-done .lrow__n { background: var(--third); color: #0d1117; border-color: var(--third); }
.lrow__t {
  font-family: var(--display); font-weight: 600; font-size: 15px; }
.lrow__g { font-size: 12.5px; color: var(--text-faint); line-height: 1.45; }

.lesson-nav {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line-soft);
}
.progress-bar {
  height: 5px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; margin: 10px 0 22px;
}
.progress-bar > i { display: block; height: 100%; background: var(--third); border-radius: 999px; }

.figcap { font-size: 12.5px; color: var(--text-faint); margin: 7px 0 20px; line-height: 1.5; }
.blk { margin: 18px 0; }
.muted { color: var(--text-faint); }
.small { font-size: 13px; }
.hint {
  font-size: 11.5px; color: var(--text-faint); display: none;
  align-items: center; gap: 5px; margin-top: 4px;
}
@media (max-width: 760px) { .hint { display: flex; } h1 { font-size: 25px; } .wrap { padding-top: 18px; } }

.empty { text-align: center; padding: 48px 20px; color: var(--text-faint); }

/* ---------- Practice ---------- */
.drill-start {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px; margin: 18px 0 14px;
}
.drill-start .btn { font-size: 15px; padding: 11px 20px; }
.lrow__n--pct { font-size: 10.5px; letter-spacing: -0.2px; font-variant-numeric: tabular-nums; }

.drill-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
}
.drill-bar__t {
  font-family: var(--display); font-weight: 650; font-size: 14px;
  color: var(--text-dim); margin-left: auto;
}
.drill-bar__s {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.streak { color: var(--root); font-size: 13px; }

.q-prompt {
  font-family: var(--display); font-size: 22px; line-height: 1.4; font-weight: 600;
  color: var(--text); margin: 0 0 18px; text-wrap: balance;
}
.q-prompt b { font-weight: 700; }

.choices { display: grid; gap: 9px; margin: 18px 0; }
@media (min-width: 620px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice {
  appearance: none; font: inherit; font-size: 15.5px; text-align: left;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; min-height: 54px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice:hover:not(:disabled) { border-color: var(--text-faint); background: var(--surface-2); }
.choice__k {
  width: 21px; height: 21px; border-radius: 5px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--line);
}
.choice.is-right {
  border-color: var(--third); background: color-mix(in srgb, var(--third) 15%, var(--surface));
}
.choice.is-right .choice__k { background: var(--third); color: #0d1117; border-color: transparent; }
.choice.is-wrong {
  border-color: #f87171; background: color-mix(in srgb, #f87171 14%, var(--surface));
}
.choice.is-wrong .choice__k { background: #f87171; color: #1a0d0d; border-color: transparent; }
.choice.is-dim { opacity: 0.45; }

.verdict {
  border-left: 3px solid var(--third); background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px; margin: 18px 0;
}
.verdict.is-wrong { border-left-color: #f87171; }
.verdict__t {
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.9px; text-transform: uppercase; margin-bottom: 5px; color: var(--text);
}
.verdict__b { font-size: 14.5px; color: var(--text-dim); line-height: 1.6; }
.verdict__b b { color: var(--text); }

/* Six items in the bottom bar need a little more room than five. */
@media (max-width: 760px) {
  .botnav__btn { font-size: 9.5px; padding: 5px 1px; gap: 2px; letter-spacing: 0; }
  .botnav__btn svg { width: 19px; height: 19px; }
  .drill-bar__t { display: none; }
}
@media (max-width: 360px) { .botnav__btn { font-size: 9px; } }
