:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: #252820;
  background: #faf9f6;
  --ink: #252820;
  --muted: #696b61;
  --line: #e4e5dc;
  --orange: #aa421a;
  --green: #42604b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, select, input { font: inherit; }
a { color: inherit; text-underline-offset: 0.2em; }
select { min-height: 44px; width: 100%; border: 1px solid #cbd0c2; border-radius: 0.55rem; padding: 0.65rem 2rem 0.65rem 0.75rem; background: #fff; color: var(--ink); font-size: 0.9rem; }
:focus-visible { outline: 3px solid #b64d22; outline-offset: 4px; }
.container { width: min(calc(100% - 3rem), 1240px); margin-inline: auto; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 0.2rem; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 76px; height: auto; mix-blend-mode: multiply; }
nav { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; }
nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
nav a:hover { text-decoration: underline; }
.skip-link { position: absolute; top: -100px; left: 1rem; padding: 0.8rem; background: #fff; z-index: 5; }
.skip-link:focus { top: 0.5rem; }
.intro { padding-block: 0.8rem; }
.intro-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.eyebrow { margin: 0 0 0.65rem; font-size: 0.68rem; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; color: var(--green); }
h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 650; letter-spacing: -0.055em; line-height: 1.15; }
.subtitle { color: var(--muted); font-size: 0.85rem; line-height: 1.5; margin: 0.3rem 0 0; }
h2, h3 { margin: 0; }
.workspace { min-width: 0; border: 1px solid var(--line); border-radius: 1.25rem; background: #fff; box-shadow: 0 12px 40px #25282004; }
.selectors { display: grid; grid-template-columns: minmax(80px, 0.5fr) minmax(140px, 1fr) minmax(180px, 1.5fr) minmax(160px, 0.9fr); gap: 0.8rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); border-radius: 1.25rem 1.25rem 0 0; background: #f3f5ee; }
.field { min-width: 0; }
.field > label { display: block; margin-bottom: 0.3rem; font-size: 0.76rem; font-weight: 650; }
.pattern-summary { padding: 0.65rem 1rem 0.35rem; }
.pattern-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem; }
#patternTitle { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.035em; }
.tuning { font-size: 0.75rem; color: var(--muted); }
.formula { display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; margin: 0.35rem 0 0; font-size: 0.8rem; line-height: 1.6; }
.formula > div { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.formula dt { color: var(--muted); font-weight: 500; }
.formula dd { margin: 0; }
.diagram-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 1.2rem; padding: 0.25rem 1rem; }
.label-switch { display: flex; border: 1px solid var(--line); border-radius: 0.6rem; padding: 3px; margin: 0; background: #f6f6f1; }
.label-switch label { position: relative; cursor: pointer; }
.label-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.label-switch span { display: grid; place-items: center; min-height: 40px; padding-inline: 1rem; border-radius: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.label-switch input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 5px #25282016; font-weight: 700; }
.label-switch input:focus-visible + span { outline: 3px solid #b64d22; outline-offset: 2px; }
.overlay-controls { min-width: 0; }
.overlay-options { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.overlay-options label { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; font-size: 0.82rem; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
#frameworkCaption { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.4; }
.board-help { margin: 0; padding: 0.3rem 1rem 0.45rem; font-size: 0.72rem; line-height: 1.5; color: var(--muted); }
.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding: 6px 0; border-block: 1px solid var(--line); background: #fcfbf7; }
#fretboard { display: block; width: 100%; min-width: 950px; height: auto; }
.board-surface { fill: #f1eee4; }
.fret-wire { stroke: #b7b7a9; stroke-width: 2; }
.nut { stroke: #7a776b; stroke-width: 6; }
.guitar-string { stroke: #9b9788; }
.fret-number, .string-name { fill: #626353; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.string-name { font-weight: 650; }
.inlay { fill: #d4d0c1; }
.region-label { font-size: 14px; font-weight: 700; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fcfbf7; stroke-width: 5px; stroke-linejoin: round; }
.fret-note { cursor: pointer; outline: none; touch-action: manipulation; }
.note-hit { fill: transparent; }
.note-marker { fill: var(--green); stroke: #fff; stroke-width: 2; }
.fret-note.root .note-marker { fill: var(--orange); }
.note-label { fill: #fff; font-size: 14px; font-weight: 650; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.fret-note.additional .note-marker { fill: #fff; stroke: var(--green); stroke-width: 2; }
.fret-note.additional .note-label { fill: #334b39; }
.note-focus { fill: none; stroke: #252820; stroke-width: 3; opacity: 0; }
.fret-note:focus-visible .note-focus, .fret-note.sounding .note-focus { opacity: 1; }
.fret-note:hover .note-marker { stroke: #252820; stroke-width: 2.5; }
.diagram-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.6rem 1rem 0.3rem; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem 1.2rem; color: #555d4f; font-size: 0.75rem; }
.legend > span { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend i { display: inline-block; flex-shrink: 0; width: 12px; height: 12px; }
.root-symbol { border-radius: 3px; background: var(--orange); }
.note-symbol { border-radius: 50%; background: var(--green); }
.additional-symbol { border: 2px solid var(--green); border-radius: 50%; background: #fff; }
.hint { margin: 0; font-size: 0.75rem; color: var(--muted); line-height: 1.6; }
.caged-legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1.2rem; padding: 0.4rem 1.5rem; font-size: 0.74rem; color: #555d4f; }
.caged-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.caged-legend i { display: inline-block; width: 13px; height: 13px; border: 1px solid; border-radius: 3px; }
.audio-status { margin: 0; padding: 0.3rem 1rem 0.6rem; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.audio-status.error, .error { color: #9c2a22; }
.learning-section { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2rem; padding-block: 2.5rem; border-bottom: 1px solid var(--line); }
.learning-section h2, .instructions h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.045em; }
.learning-section h3 { font-size: 0.95rem; font-weight: 650; }
.learning-section p, .instructions p { color: var(--muted); font-size: 0.86rem; line-height: 1.8; }
.instructions { max-width: 900px; padding-block: 2rem; }
.instructions h2 { margin-bottom: 1.2rem; }
details { border-bottom: 1px solid var(--line); padding-block: 0.3rem; }
summary { padding-block: 0.8rem; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
footer { border-top: 1px solid var(--line); padding-block: 1.5rem 2rem; color: var(--muted); font-size: 0.75rem; line-height: 1.7; }
.footer-links { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
footer nav { font-size: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .container { width: calc(100% - 2rem); }
  .intro { padding-block: 0.75rem; }
  .selectors { grid-template-columns: minmax(80px, 0.7fr) minmax(0, 1.3fr); gap: 0.65rem; padding: 0.75rem; }
  .field:nth-child(3), .field:last-child { grid-column: 1 / -1; }
  .pattern-summary { padding: 0.75rem 1rem 0.4rem; }
  .formula { display: grid; gap: 0.3rem; font-size: 0.8rem; }
  .diagram-controls { padding: 0.25rem 1rem; }
  .board-help { padding-inline: 1rem; }
  .diagram-footer, .caged-legend { padding-inline: 1rem; }
  .audio-status { padding-inline: 1rem; }
  .learning-section { grid-template-columns: 1fr; gap: 1.2rem; padding-block: 2rem; }
  .learning-section p { margin-bottom: 0; }
  .masthead nav { gap: 0.75rem; font-size: 0.8rem; }
}

@media (forced-colors: active) {
  .note-marker, .fret-note.root .note-marker { fill: Canvas; stroke: CanvasText; }
  .note-label, .fret-note.additional .note-label { fill: CanvasText; }
  .note-focus { stroke: Highlight; }
  .guitar-string, .fret-wire, .nut { stroke: CanvasText; }
}
