:root {
  color-scheme: dark;
  --ground: #101111;
  --surface: #1a1b1b;
  --raised: #242625;
  --rule: #353735;
  --text: #f6f5ef;
  --muted: #b3b6ae;
  --faint: #9b9e96;
  --accent: #c6f24e;
  --error: #ff9691;
  --radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--ground); padding-top: env(safe-area-inset-top); }
button, select { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button, select, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .48; }
button svg { pointer-events: none; }
button, h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.shell { width: min(1120px, 100% - 64px); margin-inline: auto; }
.topbar { border-bottom: 1px solid #262827; }
.topbar-content { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 66px; }
.wordmark, .navigation button, .icon-button, .text-button { border: 0; background: none; }
.wordmark { display: inline-flex; gap: 9px; align-items: center; justify-self: start; padding: 0; min-height: 44px; font-size: 23px; letter-spacing: -.045em; font-weight: 750; direction: ltr; }
.wordmark span span { color: var(--muted); font-weight: 500; }
.brand-mark { display: flex; gap: 3px; align-items: center; justify-content: center; width: 30px; height: 30px; transform: skew(-16deg); }
.brand-mark i { width: 4px; background: var(--accent); border-radius: 1px; height: 12px; }
.brand-mark i:nth-child(2) { height: 19px; }
.brand-mark i:nth-child(3) { height: 26px; }
.navigation { display: flex; align-items: center; gap: 28px; }
.navigation button { display: flex; align-items: center; gap: 7px; padding: 0 2px; color: var(--muted); min-height: 66px; position: relative; font-weight: 600; font-size: 14px; white-space: nowrap; }
.navigation button[aria-current] { color: var(--text); }
.navigation button[aria-current]::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--text); }
.navigation svg { width: 17px; height: 17px; }
.header-actions { display: flex; justify-self: end; gap: 7px; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0; border-radius: 12px; color: var(--muted); }
.icon-button:hover { background: var(--raised); color: var(--text); }

main { padding-block: 37px max(40px, env(safe-area-inset-bottom)); }
.view-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
h1 { font-size: clamp(27px, 4.7vw, 38px); letter-spacing: -.04em; line-height: 1.06; }
.view-heading p { color: var(--muted); margin-top: 8px; line-height: 1.4; font-size: 15px; }
h2 { font-size: 16px; font-weight: 700; }
.outline, .primary, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border-radius: 10px; white-space: nowrap; }
.outline { color: var(--text); background: var(--surface); border: 1px solid #454842; padding-inline: 12px; font-size: 13px; }
.outline:hover, .outline[aria-pressed="true"] { background: #30322e; }
.outline svg, .text-button svg { width: 17px; height: 17px; }
.primary { padding-inline: 18px; background: var(--text); color: var(--ground); font-weight: 700; border: 0; }
.primary:hover { background: #dedfd2; }
.practice-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, 305px); gap: 18px; align-items: start; }
.play-area, .practice-rail { min-width: 0; display: grid; gap: 14px; }
.panel { min-width: 0; background: var(--surface); border-radius: var(--radius); }
.round-strip { display: flex; align-items: center; gap: 14px; }
.round-ticks { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; flex: 1; }
.round-ticks i { border-radius: 3px; height: 5px; background: #343633; }
.round-ticks .current { background: #a9b29a; }
.round-ticks .correct { background: var(--accent); }
.round-ticks .assisted { background: #c5c5b9; }
.round-ticks .skipped { background: #845b56; }
.round-position { color: var(--muted); font-size: 12px; font-weight: 650; }

.prompt { min-height: 175px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, .8fr); align-items: center; padding: 16px; gap: 15px; }
.prompt-copy { padding-inline: 12px; }
.prompt-copy h2 { font-size: clamp(22px, 4.6vw, 29px); line-height: 1.1; letter-spacing: -.03em; }
.prompt-copy p { margin-block: 7px 13px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.note-plate { min-height: 143px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 10px; background: #242722; border-radius: 13px; }
.target-note { display: block; color: var(--accent); font-size: clamp(64px, 9vw, 94px); font-weight: 760; line-height: .93; letter-spacing: -.075em; }
.target-note sub { font-size: .32em; vertical-align: baseline; margin-inline-start: .13em; letter-spacing: 0; }
.target-note small { font-size: .54em; vertical-align: .28em; margin-inline-start: .06em; }
.target-note .unknown { color: #e4e5d9; }
.target-label { margin-top: 8px; color: #d6dbcd; font-size: 13px; font-weight: 600; text-align: center; }

.board-panel { padding: 17px 18px 10px; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-bottom: 6px; }
.range-control { display: flex; direction: ltr; gap: 3px; align-items: center; }
.range-control button { background: none; border: 0; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 650; min-height: 44px; padding-inline: 9px; }
.range-control button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.fretboard { --row-height: 43px; display: grid; grid-template-columns: minmax(26px, .53fr) repeat(var(--frets, 6), minmax(0, 1fr)); isolation: isolate; position: relative; border-radius: 10px; }
.fret-number { display: grid; place-items: center; height: 30px; color: var(--muted); font-size: 12px; font-weight: 650; }
.fret-number.is-marker { color: var(--text); }
.string-label { align-self: center; text-align: center; color: var(--muted); font-size: 13px; }
.string-label.is-focus { color: var(--accent); font-weight: 740; }
.fret { position: relative; z-index: 1; display: grid; place-items: center; height: var(--row-height); padding: 0; border: 0; border-right: 1px solid #52534d; background: #2c2d29; color: var(--text); }
.fret.start { border-left: 1px solid #434541; }
.fret.open { background: #232421; border-right: 3px solid #a3a69a; }
.fret.end { border-right-color: #454841; }
.fret.first-string.start { border-top-left-radius: 7px; }
.fret.first-string.end { border-top-right-radius: 7px; }
.fret.last-string.start { border-bottom-left-radius: 7px; }
.fret.last-string.end { border-bottom-right-radius: 7px; }
.fret::before { content: ""; position: absolute; inset: 50% 0 auto; height: var(--wire); background: #85867a; opacity: .78; }
.fret:disabled { opacity: 1; }
.fret.inactive { background: #242521; }
.fret.inactive::before { opacity: .35; }
@media (hover: hover) {
  button.fret:hover { background: #3d4036; }
}
.fret:focus-visible { z-index: 3; outline-offset: -3px; }
.fret.marker::after { content: ""; position: absolute; height: 5px; width: 5px; background: #86887f; border-radius: 50%; bottom: -2px; z-index: 1; pointer-events: none; }
.fret span { z-index: 2; display: grid; place-items: center; min-width: 26px; height: 26px; padding-inline: 4px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.fret.has-name span { background: #1b1d19; border: 1px solid #55584e; }
.fret.has-name.dim span { opacity: .48; }
.fret.marked span, .fret.hit span { color: #161a0e; background: var(--accent); border-color: var(--accent); opacity: 1; }
.fret.hinted span { color: var(--accent); background: #252b1b; border: 1px solid var(--accent); }
.fret.missed span { color: #311411; background: var(--error); }
.board-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 53px; margin-top: 5px; }
.board-footer p, .mic-tools > span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.board-footer p[data-tone="correct"] { color: var(--accent); }
.board-footer p[data-tone="wrong"], .error { color: var(--error); }
.board-actions { display: flex; flex: none; gap: 4px; }
.text-button { padding-inline: 8px; font-weight: 650; font-size: 13px; color: var(--muted); }
.text-button:hover { color: var(--text); background: var(--raised); }
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.choices button { min-height: 48px; border: 1px solid #4d5047; border-radius: 9px; background: var(--raised); font-size: 20px; font-weight: 700; }
.choices button[data-tone="correct"] { background: var(--accent); color: #171b0d; }
.choices button[data-tone="wrong"] { color: var(--error); border-color: var(--error); }
.choices button[data-tone="hint"] { color: var(--accent); border-color: var(--accent); }
.mic-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }

.game-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-block: 16px; text-align: center; }
.game-stats div + div { border-inline-start: 1px solid var(--rule); }
.game-stats span { display: flex; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.game-stats svg { width: 13px; height: 13px; }
.game-stats strong { display: block; font-size: 25px; font-weight: 700; margin-top: 3px; }
.modes { padding: 16px; }
.modes h2 { margin: 1px 3px 11px; }
.mode { display: grid; text-align: start; width: 100%; grid-template-columns: 22px minmax(0, 1fr) 12px; align-items: center; gap: 10px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 11px; min-height: 59px; padding: 8px 10px; }
.mode + .mode { margin-top: 3px; }
.mode[aria-pressed="true"], .mode:hover { background: var(--raised); color: var(--text); }
.mode[aria-pressed="true"] { border-color: #444740; }
.mode strong { display: block; color: var(--text); font-size: 14px; }
.mode small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.25; }
.mode i { width: 10px; height: 10px; border: 1px solid #757b6e; border-radius: 50%; }
.mode[aria-pressed="true"] i { border: 3px solid var(--raised); background: var(--text); outline: 1px solid var(--muted); }
.rail-tip { display: flex; gap: 10px; padding: 10px 7px; color: var(--muted); }
.rail-tip h2 { color: var(--text); font-size: 14px; }
.rail-tip p { margin-top: 5px; font-size: 13px; line-height: 1.5; }

.map-panel, .progress-panel, .totals-panel { padding: 18px; }
.map-detail { padding: 25px; text-align: center; }
.map-detail h2 { margin-top: 10px; }
.map-detail p, .progress-panel p { color: var(--muted); margin-block: 7px 15px; font-size: 14px; line-height: 1.45; }
.map-filter { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
select { max-width: 100%; min-height: 44px; color: var(--text); border: 1px solid #4d5047; border-radius: 9px; padding: 0 9px; background: var(--raised); }
.mastery { display: grid; gap: 13px; }
.mastery-row { display: grid; grid-template-columns: 37px 1fr auto; align-items: center; gap: 8px; }
.mastery-cells { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; }
.mastery-cells i { height: 14px; background: #383b34; border-radius: 3px; }
.mastery-cells .known { background: var(--accent); }
.mastery-row span, .totals dt { color: var(--muted); font-size: 13px; }
.totals { margin-top: 7px; }
.totals div { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 43px; }
.totals div + div { border-top: 1px solid var(--rule); }
.totals dd { font-weight: 700; }

dialog { color: var(--text); background: var(--surface); border: 1px solid #454842; border-radius: 18px; padding: 19px; width: min(440px, 100% - 30px); max-height: 90dvh; box-shadow: 0 18px 90px #0008; }
dialog::backdrop { background: #000a; }
.dialog-heading, .select-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-heading { margin-bottom: 13px; }
.dialog-heading h2 { font-size: 21px; }
fieldset { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.string-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.string-options label { display: flex; position: relative; align-items: center; justify-content: center; flex-direction: column; min-height: 50px; border-radius: 8px; border: 1px solid #454842; font-size: 14px; cursor: pointer; }
.string-options label:has(:checked) { color: #171b0d; background: #e0e3d6; border-color: #e0e3d6; }
.string-options label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.string-options input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.string-options small { font-size: 11px; }
.error { font-size: 13px; }
.error:not(:empty) { margin-top: 8px; }
.select-row { padding-block: 8px; border-top: 1px solid var(--rule); font-size: 14px; }
.setting-note { color: var(--muted); margin-block: 4px 12px; font-size: 13px; }
#settings .primary { width: 100%; }
.summary-score { display: grid; justify-items: center; padding: 16px; border-radius: 12px; background: var(--raised); }
.summary-score strong { font-size: 63px; line-height: 1.1; color: var(--accent); }
.summary-score span, #summary-detail { color: var(--muted); font-size: 14px; }
#summary-detail { margin: 12px 0; text-align: center; }
.summary-actions { display: flex; justify-content: center; gap: 10px; }

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .topbar-content { grid-template-columns: 1fr auto; min-height: 54px; }
  .navigation { position: fixed; z-index: 5; bottom: 0; inset-inline: 0; justify-content: center; gap: 0; border-top: 1px solid var(--rule); background: var(--ground); padding-bottom: env(safe-area-inset-bottom); }
  .navigation button { flex: 1; max-width: 180px; justify-content: center; flex-direction: column; min-height: 57px; gap: 3px; font-size: 12px; }
  .navigation button[aria-current]::after { inset: 0 calc(50% - 13px) auto; }
  .navigation svg { width: 20px; height: 20px; }
  .header-actions { gap: 1px; }
  main { padding-block: 17px calc(73px + env(safe-area-inset-bottom)); }
  .view-heading { align-items: center; gap: 8px; margin-bottom: 13px; }
  .view-heading p { margin-top: 4px; font-size: 13px; }
  #practice .view-heading p { display: none; }
  .scope { font-size: 11px; min-height: 44px; padding-inline: 7px; max-width: 46%; white-space: normal; text-align: start; }
  .scope svg { width: 14px; height: 14px; }
  .practice-layout { grid-template-columns: 1fr; gap: 11px; }
  .play-area, .practice-rail { display: contents; }
  .modes { order: -4; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 4px; border-radius: 12px; }
  .modes h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .mode { display: flex; justify-content: center; gap: 4px; padding: 3px; min-height: 44px; border-radius: 8px; }
  .mode + .mode { margin-top: 0; }
  .mode strong { font-size: 12px; }
  .mode svg { width: 15px; height: 15px; }
  .mode small, .mode i { display: none; }
  .game-stats { order: -3; padding-block: 8px; }
  .game-stats strong { font-size: 20px; margin-top: 2px; }
  .round-strip { order: -2; }
  .prompt { order: -1; padding: 9px; gap: 6px; min-height: 120px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .prompt-copy { padding-inline: 6px 2px; }
  .prompt-copy p { margin-block: 3px 4px; font-size: 12px; }
  .prompt-copy .outline { min-height: 44px; }
  .note-plate { min-height: 112px; }
  .target-label { margin-top: 6px; font-size: 12px; }
  .board-panel { padding: 7px 9px 3px; }
  .board-heading { margin-bottom: 0; }
  .board-heading h2 { font-size: 14px; }
  .range-control button { padding-inline: 7px; }
  .fretboard { --row-height: 44px; }
  .fret-number { height: 24px; }
  .board-footer { min-height: 45px; margin-top: 2px; }
  .board-footer p { font-size: 12px; }
  .board-actions { gap: 0; }
  .text-button { padding-inline: 6px; font-size: 12px; }
  .text-button svg { width: 14px; height: 14px; }
  .map-panel { padding: 10px 9px; }
  .rail-tip { padding-block: 5px; }
}

@media (max-width: 355px) {
  .shell { width: calc(100% - 24px); }
  .scope { max-width: 43%; }
  .view-heading p { font-size: 12px; }
  .game-stats span { font-size: 11px; }
}
