:root {
  color-scheme: light;
  --page: var(--studio-page);
  --paper: var(--studio-paper);
  --ink: var(--studio-ink);
  --muted: var(--studio-muted);
  --line: var(--studio-line);
  --green: var(--studio-accent);
  --green-dark: var(--studio-dark);
  --gold: var(--studio-gold);
  --mono: var(--studio-mono);
  font-family: var(--studio-sans);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--page); }
button, input, select { font: inherit; }
button, label[for], select, a { -webkit-tap-highlight-color: transparent; }
button, select, label[for] { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
input.sr-only:focus-visible, body:has(#file-input:focus-visible) .import-button,
body:has(#pair-input:focus-visible) label[for="pair-input"] {
  outline: 2px solid #328469;
  outline-offset: 3px;
}
button { color: inherit; }
a { color: inherit; }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px var(--studio-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
#library-toggle { display: none; }
.workspace:focus { outline: none; }
.player-nav { display: flex; gap: 3px; align-items: center; background: #e9eee5; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.player-nav a { text-decoration: none; text-align: center; min-width: 62px; padding: 6px 11px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.player-nav a:hover { color: var(--ink); }
.player-nav a[aria-current="page"] { color: var(--green-dark); background: var(--paper); border-color: var(--line); box-shadow: 0 1px 2px #1a292615; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  min-height: 39px;
  color: white;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 8px;
  font-weight: 650;
  font-size: .875rem;
  text-decoration: none;
  transition: background .16s var(--studio-ease), transform .13s var(--studio-ease);
}
.button:hover { background: #164c3d; }
.button:active, button:active { transform: translateY(1px); }
.button span { font-size: 1.3rem; line-height: 1; }
.button.small { min-height: 34px; padding: 6px 11px; }
.button.secondary { background: var(--paper); border-color: var(--line); color: var(--green-dark); }
.button.secondary:hover { background: #ecf1e8; }
.layout { max-width: 1650px; margin: 0 auto; display: grid; grid-template-columns: minmax(238px, 281px) minmax(0, 1fr); min-height: calc(100svh - 121px); }
.library { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: #efefe6; }
.library-heading { padding: 29px 19px 13px; }
.library-title-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.library-title-line h2 { font-size: 1.1rem; letter-spacing: -.035em; }
#library-count { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.search { position: relative; display: block; }
.search span { width: 11px; height: 11px; position: absolute; top: 13px; left: 12px; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search span::after { content: ''; width: 6px; height: 1.5px; position: absolute; left: 7px; top: 8px; background: var(--muted); transform: rotate(45deg); transform-origin: left; }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px 9px 32px; color: var(--ink); background: var(--paper); font-size: .875rem; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.library-list { list-style: none; margin: 0; padding: 0 11px 10px; display: grid; gap: 3px; max-height: calc(100svh - 295px); overflow-y: auto; scrollbar-width: thin; }
.library-list button {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  text-align: left;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  padding: 10px 9px;
  border-radius: 7px;
  background: transparent;
}
.library-list button:hover { background: #e4ebdf; }
.library-list button[aria-current="true"] { border-color: #cbdccc; background: #dfece1; }
.library-icon {
  align-self: start;
  background: #e1e9df;
  color: #2e624e;
  border-radius: 5px;
  padding: 4px 0;
  text-align: center;
  line-height: 1;
}
[aria-current="true"] .library-icon { background: #cce2d3; }
.library-item-title { display: block; font-size: .875rem; line-height: 1.29; font-weight: 650; overflow-wrap: anywhere; }
.library-item-topic { display: block; color: var(--muted); margin-top: 4px; font-size: .78rem; line-height: 1.25; }
.empty-library { padding: 13px 10px; color: var(--muted); font-size: .875rem; }
.drop-note { border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); padding: 13px 19px; margin-top: auto; line-height: 1.45; }
.workspace { padding: 30px clamp(18px, 3.1vw, 48px) 38px; min-width: 0; }
.study-header { display: flex; align-items: end; justify-content: space-between; gap: 12px 22px; margin-bottom: 15px; }
.eyebrow { color: var(--green); font-family: var(--mono); font-size: .76rem; line-height: 1.35; font-weight: 700; letter-spacing: .084em; text-transform: uppercase; }
.study-header h1 { font: 400 clamp(2.2rem, 4vw, 3.4rem)/1.03 'Iowan Old Style', 'Palatino Linotype', Georgia, serif; letter-spacing: -.045em; margin-top: 5px; overflow-wrap: anywhere; }
.source-switch { flex: 0 0 auto; }
.source-switch button { min-width: 50px; }
.notice { margin: 0 0 14px; padding: 11px 14px; border-radius: 7px; background: #fbf1d8; color: #5e4017; font-size: .875rem; line-height: 1.45; overflow-wrap: anywhere; }
.notice[data-style="success"] { background: #e3efe2; color: #214c3e; }
.pdf-panel { border: 1px solid var(--line); border-radius: 9px; margin-bottom: 14px; background: var(--paper); overflow: hidden; }
.pdf-bar, .pair-panel { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 9px 13px; font-size: .875rem; color: var(--muted); }
.pair-panel { border-top: 1px solid var(--line); line-height: 1.45; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 7px; }
#pdf-frame iframe { width: 100%; border: 0; height: min(65vh, 700px); display: block; }
.sheet-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 11px; }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 15px; border-bottom: 1px solid var(--line); }
.sheet-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; }
.sheet-title h2 { font-size: 1rem; letter-spacing: -.022em; }
.sheet-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 11px; }
.loop-button { padding: 4px 9px; border: 1px solid #c7d8cc; border-radius: 5px; background: #eef4ed; color: var(--green-dark); font-size: .8rem; font-weight: 650; white-space: nowrap; }
.loop-button:hover:not(:disabled) { background: #e0ebdf; }
.loop-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 6px 15px; color: var(--green-dark); background: #edf4ed; border-bottom: 1px solid var(--line); font-size: .82rem; line-height: 1.4; }
#sheet-caption, #sheet-hint, #sheet-tab-caption { font-size: .78rem; color: var(--muted); }
#sheet-tab-caption { color: var(--green); font-weight: 650; }
#sheet-caption:empty { display: none; }
.sheet-follow { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .8rem; color: var(--muted); }
.sheet-follow input { margin: 0; accent-color: var(--green); }
.sheet-viewport { height: clamp(182px, 29vh, 315px); position: relative; overflow: auto; scrollbar-width: thin; scrollbar-gutter: stable; }
.sheet-viewport.has-tab { height: clamp(272px, 34vh, 345px); }
.sheet-viewport:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.sheet-status { padding: 24px 15px; color: var(--muted); font-size: .9rem; }
.sheet-page { position: relative; min-width: 510px; }
#sheet-drawing { position: relative; }
#sheet-drawing svg { display: block; }
#sheet-drawing h3 { margin: 0; border-bottom: 1px solid var(--line); padding: 12px 15px 6px; font-size: .825rem; color: var(--muted); }
.sheet-cursor { position: absolute; top: 0; left: 0; width: 24px; border-radius: 5px; background: #ffd27282; pointer-events: none; }
.sheet-chords { position: absolute; inset: 0; pointer-events: none; }
.sheet-chord { position: absolute; padding: 0; border: 0; border-radius: 5px; background: transparent; pointer-events: auto; }
.sheet-chord:hover { background: #ffc25142; }
.sheet-chord:focus-visible { outline-offset: -2px; background: #ffc25142; }
.sheet-tab { position: absolute; inset: 0; pointer-events: none; }
.tab-system { position: absolute; --top-string: 7px; --string-spacing: 12px; }
.tab-string { position: absolute; top: calc(var(--top-string) + var(--string) * var(--string-spacing)); inset-inline: 0; height: 1px; background: #8d9b90; }
.tab-string span { position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); color: #354d3f; font: 650 .7rem/1 var(--mono); }
.tab-barline { position: absolute; top: var(--top-string); bottom: var(--top-string); width: 1px; background: #728378; }
.tab-chord { position: absolute; pointer-events: auto; inset-block: 0; border: 0; padding: 0; background: transparent; border-radius: 4px; }
.tab-chord:active { transform: none; }
.tab-chord:hover, .tab-chord:focus-visible { background: #ffc2513d; }
.tab-chord:focus-visible { outline-offset: -2px; }
.tab-chord.is-current { background: #ffd27254; }
.tab-fret { position: absolute; top: calc(var(--top-string) + var(--string) * var(--string-spacing)); left: var(--fret-x); transform: translate(-50%, -50%); min-width: .86rem; padding: 0 2px; border-radius: 3px; background: var(--paper); color: var(--ink); font: 680 .74rem/1 var(--mono); text-align: center; }
.tab-fret.is-down { background: var(--gold); color: #392d12; }
:is(.sheet-chord, .tab-chord)[data-loop-marker="inside"] { box-shadow: inset 0 -2px #4f795a64; }
:is(.sheet-chord, .tab-chord):is([data-loop-marker="start"], [data-loop-marker="both"]) { box-shadow: inset 2px 0 #2f6a4b; }
:is(.sheet-chord, .tab-chord)[data-loop-marker="end"] { box-shadow: inset -2px 0 #2f6a4b; }
:is(.sheet-chord, .tab-chord)[data-loop-marker="both"] { box-shadow: inset 2px 0 #2f6a4b, inset -2px 0 #2f6a4b; }
.score-note-active, .score-note-active path, .score-note-active text { fill: #8a4e00 !important; }
.chord-panel {
  display: grid;
  grid-template-columns: minmax(200px, .93fr) minmax(0, 1.1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  min-height: 100px;
  margin-bottom: 11px;
}
.chord-reading, .voicing { min-width: 0; padding: 10px 18px; }
.chord-name { font: 400 clamp(1.9rem, 4vw, 3.2rem)/1.02 'Iowan Old Style', 'Palatino Linotype', Georgia, serif; color: var(--ink); letter-spacing: -.05em; margin: 0 0 3px; overflow-wrap: anywhere; }
.chord-name.long { font-size: clamp(1.5rem, 3vw, 2.35rem); letter-spacing: -.045em; margin-top: 4px; }
.chord-context { font-size: .875rem; color: var(--muted); min-height: 1.15em; }
.voicing { border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; align-items: start; gap: 12px; }
.voicing h2 span { color: #8b958e; }
.note-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.note-list li { display: grid; place-items: center; min-width: 42px; padding: 8px 10px; border: 1px solid #dae5d8; background: #eef4eb; color: #244a3c; border-radius: 6px; font: 650 1rem/1.2 var(--mono); }
.note-list:empty { display: none; }
.note-empty { color: var(--muted); font-size: .875rem; }
.workspace:has(.has-tab) .study-header h1 { font-size: clamp(2rem, 3.7vw, 2.95rem); }
.workspace:has(.has-tab) .chord-panel { min-height: 88px; }
.workspace:has(.has-tab) .chord-reading, .workspace:has(.has-tab) .voicing { padding-block: 7px; }
.workspace:has(.has-tab) .chord-name { font-size: clamp(1.75rem, 3.5vw, 2.55rem); }
.workspace:has(.has-tab) .chord-name.long { font-size: clamp(1.45rem, 2.8vw, 2.18rem); }
.sequence-heading h2 { font-size: 1rem; font-weight: 680; letter-spacing: -.022em; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(12px, 2vw, 26px); padding-top: 10px; }
.transport-buttons, .transport-settings { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.icon-button, .play-button {
  display: grid;
  place-items: center;
  min-width: 31px;
  height: 35px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #e6eee8;
  font-size: .76rem;
}
.icon-button:hover:not(:disabled) { background: #33554a; }
.restart { font-size: 1.25rem; }
.play-button { width: 44px; height: 39px; background: var(--gold); color: #272e22; }
.play-button:hover:not(:disabled) { background: #ffdf93; }
.play-button span { display: block; width: 0; height: 0; margin-left: 3px; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid currentColor; }
.play-button.playing span { width: 11px; height: 13px; margin-left: 0; border: 0 solid currentColor; border-inline-width: 3px; }
.scrubber { flex: 1 1 126px; min-width: 48px; }
input[type="range"] { width: 100%; accent-color: var(--gold); display: block; margin: 0; cursor: pointer; }
.clock { display: flex; justify-content: space-between; margin-top: 2px; color: #d0ddd4; font: .73rem var(--mono); font-variant-numeric: tabular-nums; }
.transport-settings { gap: 13px; }
.walkthrough-link { display: inline-block; margin-bottom: 12px; color: var(--green); }
.custom-speed { display: inline-flex; align-items: center; gap: 3px; color: #e2eee5; }
.custom-speed input { width: 4.4em; padding: 5px; border-radius: 6px; border: 1px solid #597267; font: 650 .81rem var(--mono); }
.speed-label select { appearance: none; background: #25473c; color: #f3f6ef; border: 1px solid #597267; border-radius: 6px; font: 650 .81rem var(--mono); padding: 7px 21px 7px 8px; }
.speed-label { position: relative; display: flex; align-items: center; gap: 6px; color: #e2eee5; font-size: .78rem; }
.speed-label::after { content: ''; position: absolute; pointer-events: none; right: 8px; top: 10px; width: 6px; height: 6px; border-right: 1.5px solid #d9e8db; border-bottom: 1.5px solid #d9e8db; transform: rotate(45deg); }
.volume-label { display: flex; align-items: center; gap: 6px; }
.volume-label input { width: clamp(39px, 5.2vw, 74px); }
.volume-icon { width: 15px; height: 15px; background: #dde9df; clip-path: polygon(5% 33%, 31% 33%, 65% 4%, 65% 96%, 31% 68%, 5% 68%); }
.sequence { margin-top: 20px; }
.sequence-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 9px; }
#sequence-position { color: var(--muted); font: .76rem var(--mono); }
.sequence-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.sequence-list button { width: 100%; min-height: 49px; text-align: left; padding: 6px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); overflow-wrap: anywhere; font-weight: 650; font-size: .875rem; }
.sequence-list button:hover, .sequence-list button[aria-current="step"] { color: var(--green-dark); background: #e2eee2; border-color: #adcab6; }
.sequence-list time { display: block; margin-top: 3px; color: var(--muted); font: .7rem var(--mono); }
.drop-overlay { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; background: #12352bc4; pointer-events: none; }
.drop-overlay div { padding: 36px; color: white; border: 2px dashed #aac7b7; font-size: 1.25rem; font-weight: 650; border-radius: 10px; text-align: center; }
@media (max-width: 1060px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .study-header { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  #library-toggle { display: inline-flex; }
  #library-toggle[aria-expanded="true"] { background: var(--studio-wash); }
  .workspace { padding-block: 20px; }
  .library { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .library.expanded { display: flex; }
  .drop-note { display: none; }
  .library-heading { padding: 16px 19px 9px; }
  .library-title-line { margin-bottom: 8px; }
  .library-list { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); max-height: 270px; }
  .study-header { margin-bottom: 14px; }
  .sheet-viewport { height: clamp(174px, 25vh, 270px); }
  .chord-panel { min-height: 91px; grid-template-columns: minmax(105px, .85fr) minmax(0, 1.15fr); }
  .chord-reading, .voicing { padding: 9px 12px; }
  .voicing { gap: 8px; }
  .note-list li { padding: 5px 6px; min-width: 32px; font-size: .87rem; }
  .transport { gap: 8px; }
  .transport-buttons { gap: 1px; }
  .transport-settings { gap: 6px; }
  .sequence-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 410px) {
  .transport { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .transport-settings { grid-column: 1 / -1; flex-wrap: wrap; }
  .study-header h1 { font-size: 2.07rem; }
}
@media (max-width: 520px) {
  .app-header { gap: 6px; }
  .app-header > .studio-button { min-height: 36px; padding-inline: 8px; font-size: .8rem; }
  .player-nav a { min-width: 0; padding-inline: 8px; font-size: .8rem; }
  .sheet-heading { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  .app-header .import-button { white-space: nowrap; }
  .app-header .import-button span { display: none; }
  .transport-settings { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.practice-analysis, .time-loop { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 14px; padding: 12px 15px; }
.practice-analysis { align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.practice-analysis label, .time-loop label { display: grid; gap: 3px; color: var(--muted); font-size: .8rem; }
.practice-analysis select, .time-loop input { max-width: 100%; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 5px; }
.practice-analysis label { max-width: 100%; }
#practice-tones { color: var(--green-dark); font-family: var(--mono); font-size: .85rem; }
.time-loop input { width: 8em; font-variant-numeric: tabular-nums; }
#time-error { color: #a33b26; }
.keyboard:not(.is-3d) .piano-key[data-kind="scale"]:not(.is-preview) { color: #133b2b; background: #a9d7be; }
.keyboard:not(.is-3d) .piano-key.black[data-kind="scale"]:not(.is-preview) { background: #659d85; }
.fret-position[data-kind="scale"] .fret-note, .fretboard-three-labels [data-kind="scale"] { background: #a9d7be; color: #133b2b; }
.piano-three-labels [data-kind="scale"] { color: #b9e8cc; }
