:root {
  color-scheme: dark;
  font: 16px 'Segoe UI', Arial, sans-serif;
  color: #dce5df; background: #111716;
  --surface: #19211e; --raised: #222d27; --border: #344238;
  --lime: #c4e99e; --muted: #a2b1a5; --chord: #b4e98c;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; align-items: flex-start; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: 6px; background: none; font-weight: 550; }
button:hover { background-color: #ffffff0d; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
input, textarea, select { border: 1px solid var(--border); background: #111a15; border-radius: 6px; padding: 9px 11px; min-width: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid #8cb875; outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: #84968a; }
.sidebar { position: sticky; top: 0; height: 100dvh; width: var(--library-width,236px); flex: 0 0 var(--library-width,236px); display: flex; flex-direction: column; gap: 10px; padding: 18px 12px 10px; background: #151f1a; min-height: 0; }
.resize-library { position: sticky; top: 0; height: 100dvh; flex: 0 0 6px; cursor: col-resize; background: #26352a; touch-action: none; }
.resize-library:hover, .resize-library:focus-visible { background: #658451; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #eaf1e7; text-decoration: none; padding: 0 0 4px 3px; }
.brand-icon { flex: none; }
.brand-wordmark { display: grid; gap: 2px; white-space: nowrap; }
.brand-name { font-size: 1.375rem; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.brand-byline { justify-self: end; color: var(--lime); font-size: .8125rem; font-weight: 600; line-height: 1; }
.library-brand { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#close-library, .library-backdrop { display: none; }
.primary { background: var(--lime); color: #172713; padding: 10px 16px; font-size: 14px; }
.primary:hover { background: #d3f2b4; }
.add { width: 100%; text-align: left; padding: 8px 13px; }
.search { display: flex; gap: 8px; align-items: center; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); }
.search span { font-size: 23px; }
.search input { width: 100%; padding: 8px 0; font-size: 14px; border: 0; background: none; outline: none; }
.search:focus-within { outline: 2px solid #8cb875; }
.library-heading { display: flex; justify-content: space-between; align-items: center; padding: 2px 5px; }
.library-heading h2 { font-size: 14px; font-weight: 550; margin: 0; }
.library-heading > span { font-size: 12px; color: var(--muted); }
.song-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.song-item { display: block; width: 100%; text-align: left; padding: 10px; margin-bottom: 3px; line-height: 1.35; }
.song-item.active { background: #2a3d2d; box-shadow: inset 3px 0 var(--lime); }
.song-item strong { display: block; font-size: 14px; font-weight: 550; }
.song-item small { display: block; font-size: 12px; color: #afbfaf; margin-top: 3px; }
.no-songs { color: var(--muted); padding: 0 7px; font-size: 14px; line-height: 1.5; }
.sidebar-bottom { border-top: 1px solid var(--border); padding: 7px 3px 0; }
.backup-actions { display: flex; justify-content: space-between; gap: 8px; }
.backup-actions button { font-size: 12px; color: #b6c8ad; padding: 4px 0; }
main { flex: 1; min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 20px; }
.topbar { height: 34px; flex: 0 0 34px; display: flex; align-items: center; gap: 12px; color: #a7b5a7; font-size: 10px; letter-spacing: 1.4px; border-bottom: 1px solid #2a362c; }
.private-label { margin-left: auto; font-size: 12px; letter-spacing: 0; }
#toggle-library { display: none; }
#player { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.song-header { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 10px 0; flex-shrink: 0; }
.song-header > div { min-width: 0; }
.song-header h1, .song-header p { overflow-wrap: anywhere; }
.song-header h1 { font: 550 clamp(20px, 2vw, 27px)/1.15 'Segoe UI', sans-serif; margin: 0 0 4px; color: #eff4eb; }
.song-header p { color: var(--muted); font-size: 13px; margin: 0; }
.song-header .eyebrow { display: none; }
.outline { border: 1px solid var(--border); padding: 6px 10px; font-size: 14px; white-space: nowrap; }
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 13px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; flex-shrink: 0; }
.control { display: flex; align-items: center; gap: 6px; }
.control label { font-size: 13px; color: #afbeae; }
.stepper { display: flex; align-items: center; height: 30px; background: #101a13; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.stepper button { height: 28px; min-width: 29px; padding: 0 6px; border-radius: 0; font-size: 15px; }
.stepper output { min-width: 64px; text-align: center; font-size: 13px; }
.stepper button + button { border-left: 1px solid var(--border); }
select { appearance: none; padding-right: 27px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23b9c6b5' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.controls select { height: 30px; font-size: 13px; padding-top: 3px; padding-bottom: 3px; padding-left: 8px; }
#fit-song, #expand-lyrics { height: 30px; font-size: 13px; }
#fit-song[aria-pressed='true'] { border-color: #82a66a; background: #304329; color: #d5efc1; }
.text-button { color: #c4dbb2; padding: 5px; font-size: 13px; margin-left: auto; }
.sheet-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; height: 27px; flex-shrink: 0; font-size: 12px; color: #acbda5; }
.sheet-meta span + span { color: #9caa98; }
.lyrics-area { flex: none; }
.sheet { min-height: calc(100dvh - 28px); display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; background: #19201c; border: 1px solid var(--border); border-radius: 7px; overflow-x: auto; font: 16px/1.1 Consolas, 'Courier New', monospace; tab-size: 8; }
.pane-divider { cursor: col-resize; background: linear-gradient(90deg,transparent 3px,#526548 3px,#526548 5px,transparent 5px); touch-action: none; }
.pane-divider:hover, .pane-divider:focus-visible { background: #658451; }
.resizing { user-select: none; }
.song-page { min-width: 0; padding: 10px 15px; overflow: visible; }
.pane-divider { align-self: stretch; }
.song-block { margin: 0 0 .45em; }
.song-row { white-space: pre; }
.song-row.inline { display: flex; align-items: flex-start; }
.inline-part { display: inline-flex; flex-direction: column; flex-shrink: 0; }
.chord { color: var(--chord); font-weight: 650; line-height: 1; min-height: 1em; padding-bottom: .03em; }
.inline-part .chord { padding-right: .15ch; }
.lyric { line-height: 1; min-height: 1em; color: #e0e6df; }
.song-row.section { color: #a1b399; font: 550 .82em/1.3 'Segoe UI', sans-serif; margin: 0 0 .4em; }
.song-row.lyric { padding-bottom: .1em; }
.song-footer { display: flex; justify-content: space-between; gap: 10px; color: #9eae99; font-size: 11px; min-height: 26px; align-items: center; flex-shrink: 0; }
.song-footer a { color: #b3caa1; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; color: #acc696; }
.empty { flex: 1; overflow: auto; padding: 55px 4vw 30px; }
.empty h1 { font: normal clamp(35px, 4vw, 54px)/1.12 Georgia, serif; color: #edf3e6; margin: 23px 0; }
.empty p { font-size: 16px; line-height: 1.7; color: var(--muted); }
.empty .primary { margin-top: 13px; }
.fret-art { height: 160px; margin: 35px 0 20px; position: relative; border-left: 4px solid #829b70; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), #374a31 calc(25% - 1px), #374a31 25%); overflow: hidden; }
.fret-art i { height: 1px; background: #405137; display: block; margin-top: 24px; }
.fret-art b { position: absolute; top: 45px; left: 8%; width: 55px; height: 55px; background: #2b4028; border: 1px solid #657e50; border-radius: 50%; display: grid; place-items: center; font: 24px Georgia; }
.fret-art b:nth-of-type(2) { left: 33%; top: 21px; }
.fret-art b:nth-of-type(3) { left: 58%; top: 69px; }
.fret-art b:nth-of-type(4) { left: 83%; }
.empty-features { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 13px; }
.empty-features span:before { content: '✓'; color: var(--lime); margin-right: 6px; }
dialog { width: calc(100% - 30px); max-width: 740px; max-height: 92dvh; overflow: auto; padding: 26px; border: 1px solid #4a5d40; border-radius: 12px; background: #1a251c; color: #e2ecdc; box-shadow: 0 25px 100px #0008; }
dialog::backdrop { background: #060c08b3; backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.dialog-header h2 { font-size: 26px; margin: 8px 0 0; }
.close { padding: 0 5px; font-size: 27px; color: #bacab0; }
form label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 550; }
form input { width: 100%; }
.import-row { display: flex; gap: 10px; }
.import-row button { white-space: nowrap; }
.hint { margin: 8px 0 0; font-size: 12px; line-height: 1.65; color: #b0c0a7; }
.divider { display: flex; align-items: center; gap: 10px; color: #a4b59b; font-size: 12px; margin: 21px 0; }
.divider:before, .divider:after { content: ''; flex: 1; height: 1px; background: var(--border); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
textarea { width: 100%; min-height: 230px; resize: vertical; font: 14px/1.5 Consolas, monospace; white-space: pre; tab-size: 8; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 22px; }
.dialog-footer .danger { margin-right: auto; }
.danger { color: #f1a899; padding: 10px 0; font-size: 14px; }
.danger.solid { background: #963e30; color: white; padding: 10px 16px; }
.dialog-footer span { color: #f1a899; font-size: 13px; }
#import-status { font-size: 13px; color: #c0dea9; line-height: 1.6; margin: 9px 0 0; }
#import-status.error { color: #f1a899; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: 90vw; background: #354c2a; border: 1px solid #6f8a56; color: #eff8e6; padding: 12px 20px; border-radius: 8px; box-shadow: 0 5px 30px #0005; font-size: 14px; z-index: 5; }
[hidden] { display: none !important; }
@media (max-width: 1100px) { main { padding: 0 12px; } .controls { gap: 7px; } .song-page { padding: 10px; } }
@media (max-width: 899px) {
  .sidebar { position: fixed; z-index: 6; top: 0; bottom: 0; height: 100dvh; left: 0; width: min(320px, calc(100vw - 24px)); transform: translateX(-100%); visibility: hidden; pointer-events: none; transition: transform .15s, visibility .15s; box-shadow: 10px 0 40px #0007; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .library-open .sidebar { transform: translateX(0); visibility: visible; pointer-events: auto; }
  body.library-open { overflow: hidden; }
  .library-open .library-backdrop { display: block; position: fixed; inset: 0; z-index: 5; background: #0009; border-radius: 0; }
  #close-library { display: block; width: 44px; height: 44px; padding: 0; font-size: 27px; flex-shrink: 0; }
  .resize-library { display: none; }
  #toggle-library { display: inline-flex; align-items: center; gap: 9px; min-height: 40px; font-size: 14px; padding: 6px 10px; background: #293c26; border-color: #6d8b55; }
  #mobile-count { min-width: 22px; padding: 2px 5px; border-radius: 5px; background: #456038; text-align: center; }
  .topbar { position: sticky; top: 0; z-index: 4; height: 48px; flex-basis: 48px; background: #111716; }
  .topbar > span { font-size: 9px; letter-spacing: .8px; }
  .sheet { min-height: calc(100dvh - 76px); scroll-margin-top: 48px; }
  .search input { font-size: 16px; padding: 11px 0; }
  .song-item { min-height: 44px; }
  .backup-actions button { min-height: 40px; }
  .private-label { display: none; }
  .sheet-meta { font-size: 11px; }
  .sheet-meta span + span { display: none; }
}
@media (max-width: 550px) {
  main { padding: 0 8px; }
  .song-header { padding: 8px 0; gap: 8px; }
  .song-header h1 { font-size: 20px; }
  .song-header p { font-size: 12px; }
  .song-header .outline { font-size: 12px; padding: 5px 7px; }
  .controls { padding: 6px; gap: 6px; }
  .control { gap: 4px; }
  .control label { font-size: 12px; }
  .controls select { padding-left: 6px; font-size: 12px; }
  .stepper output { min-width: 53px; font-size: 12px; }
  .stepper button { min-width: 26px; }
  .controls .stepper, .controls select, #fit-song, #expand-lyrics { height: 36px; }
  .stepper button { height: 34px; min-width: 32px; }
  form input, textarea { font-size: 16px; }
  #fit-song, .text-button { font-size: 12px; }
  .text-button { margin-left: 0; }
  .song-footer span { display: none; }
  dialog { padding: 19px; }
  .field-row { grid-template-columns: 1fr; gap: 13px; }
  .import-row { flex-direction: column; }
  .dialog-footer { flex-wrap: wrap; }
}
