/* mandolintab.net */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson.woff") format("woff");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MTTab"; /* Barlow Semi Condensed SemiBold, digits for the tab */
  src: url("fonts/tab.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "MTTab";
  src: url("fonts/tab-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff") format("woff");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fafaf7;
  --white: #ffffff;
  --ink: #1f2427;
  --muted: #59626a;
  --rule: #d6dadc;
  --wash: #edf0f2;
  --rosewood: #6e2a24;
  --blue: #285886;
  --blue-wash: #e3ecf5;

  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  --measure: 44rem;
  --wide: 72rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  font-variant-numeric: lining-nums;
}

a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.1; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); font-variation-settings: "opsz" 144; }
h2 { font-size: 1.5rem; font-variation-settings: "opsz" 48; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--white); padding: .5rem .8rem; z-index: 10; }
.skip:focus { top: 1rem; }

/* ---------------------------------------------------------------- header */

.site-header { background: var(--paper); position: relative; }
/* the header ends in a pair of hairlines, like a course of mandolin strings */
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); pointer-events: none; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 3.75rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--rosewood); text-decoration: none; font-family: var(--serif); font-weight: 650; font-size: 1.35rem; letter-spacing: -.01em; font-variation-settings: "opsz" 36; }
.brand-mark { width: 1.75rem; height: 1.75rem; font-family: var(--sans); }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--blue); }

/* ---------------------------------------------------------------- footer */

.site-footer { margin-top: 5rem; border-top: 1px solid var(--rule); box-shadow: inset 0 4px 0 var(--paper), inset 0 5px 0 var(--rule); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 2.5rem; }
.site-footer p { margin: 0 0 .4rem; max-width: var(--measure); }

/* ---------------------------------------------------------------- shared bits */

.tag {
  display: inline-block;
  padding: .05rem .5rem;
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink);
  font-size: .82rem;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-strong { background: var(--rosewood); color: var(--white); }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 2.5rem; padding: .45rem 1rem;
  border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: var(--white);
  font: 600 .95rem/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: #000; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { background: var(--white); border-color: var(--ink); }

.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; }

.notice { padding: 1rem 1.2rem; background: var(--wash); border-radius: var(--radius); }

/* Tune lists (search results, "often played with") */
.tune-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.tune-list li { border-bottom: 1px solid var(--rule); }
.tune-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .3rem 1rem;
  padding: .8rem .25rem;
  color: var(--ink);
  text-decoration: none;
}
.tune-row:hover { background: var(--white); }
.tune-row:hover .tune-name { color: var(--blue); }
.tune-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 520; font-variation-settings: "opsz" 24; line-height: 1.25; }
.tune-via { display: block; font-family: var(--sans); font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: .1rem; }
.tune-meta { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.tune-count { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
@media (max-width: 34rem) {
  .tune-row { grid-template-columns: 1fr; }
  .tune-meta { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- home / finder */

.finder { max-width: 52rem; padding-top: clamp(2rem, 6vw, 4.5rem); }
.finder-title { font-size: clamp(2.6rem, 1.6rem + 4.5vw, 4.6rem); color: var(--ink); }
.finder-lede { max-width: 36rem; color: var(--muted); font-size: 1.1rem; margin: .9rem 0 1.8rem; }

.search input {
  width: 100%;
  padding: 1rem 1.1rem 1rem 3rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2427' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") no-repeat 1rem 50% / 1.3rem;
  color: var(--ink);
  font: 500 1.25rem/1.2 var(--sans);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #8a9298; }
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-wash); }

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; margin: 1rem 0 1.6rem; }
.type-filter { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 2.2rem; padding: .3rem .85rem;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--white); color: var(--ink);
  font: 500 .92rem/1 var(--sans); cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.key-filter { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .95rem; }
.key-filter select {
  min-height: 2.2rem; padding: .3rem 2rem .3rem .7rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231f2427' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right .7rem center / .7rem;
  color: var(--ink); font: 500 .95rem var(--sans);
  -webkit-appearance: none; appearance: none;
}

.result-info { color: var(--muted); font-size: .92rem; margin: 0 0 .5rem; min-height: 1.4em; }
.more { margin-top: 1.5rem; }

/* ---------------------------------------------------------------- tune page */

.crumbs { padding-top: 1.4rem; font-size: .95rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a::before { content: "‹ "; }
.crumbs a:hover { color: var(--blue); }

.tune-head { padding: .8rem 0 1.6rem; max-width: 56rem; }
.tune-facts { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; }
.aliases { margin: .9rem 0 0; color: var(--muted); max-width: var(--measure); }
.aliases span { color: var(--ink); }

.score-block { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: clamp(.75rem, 2.5vw, 1.75rem); }
.score-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1rem; margin-bottom: 1.2rem; }
.score-actions { display: flex; gap: .5rem; margin-left: auto; }

.settings {
  display: flex; gap: .35rem;
  overflow-x: auto; scrollbar-width: thin;
  max-width: 100%;
  padding: 2px;
}
.setting-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 2.4rem; padding: .3rem .8rem .3rem .35rem;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--white); color: var(--ink);
  font: 500 .9rem/1 var(--sans); cursor: pointer; white-space: nowrap;
}
.setting-btn:hover { border-color: var(--ink); }
.setting-n {
  display: inline-grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--wash); font-weight: 700; font-size: .85rem;
}
.setting-btn[aria-selected="true"] { border-color: var(--rosewood); background: var(--rosewood); color: var(--white); }
.setting-btn[aria-selected="true"] .setting-n { background: var(--white); color: var(--rosewood); }

.score { min-height: 16rem; color: var(--ink); }
.score svg { display: block; max-width: 100%; height: auto; }
/* Fret numbers in the same ink as the notes */
.score .abcjs-tab-number, .score .abcjs-tab-grace { fill: currentColor; }
/* gap in the string line around each fret number (drawn by tune.js) */
.score .tab-gap { fill: var(--white); }
.score .abcjs-chord { fill: var(--blue); }

.toggle {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 2.5rem; padding: .3rem .8rem .3rem .5rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--white); color: var(--ink);
  font: 600 .95rem/1 var(--sans); cursor: pointer;
}
.toggle:hover { border-color: var(--ink); }
.toggle-track { position: relative; width: 2.1rem; height: 1.2rem; border-radius: 999px; background: var(--rule); transition: background .15s; }
.toggle-track::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.toggle[aria-pressed="true"] .toggle-track { background: var(--rosewood); }
.toggle[aria-pressed="true"] .toggle-track::after { transform: translateX(.9rem); }

@media (max-width: 34rem) {
  .score-block { margin: 0 calc(-1 * clamp(1rem, 3vw, 2rem)); border-radius: 0; border-left: 0; border-right: 0; padding: .9rem .4rem; }
  .score-bar { padding: 0 .6rem; }
  .setting-credit, .abc-source { padding: 0 .6rem; }
  .score-actions { margin-left: 0; width: 100%; }
  .score-actions .btn-quiet { margin-left: auto; }
}

.player {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.1rem;
  padding: .7rem 0 1rem; margin-bottom: .6rem;
  border-bottom: 1px solid var(--rule);
}
.player[hidden] { display: none; }
.play-btn { min-width: 6.2rem; justify-content: center; background: var(--rosewood); border-color: var(--rosewood); }
.play-btn:hover { background: #57201b; }
.play-btn .icon { width: 1rem; height: 1rem; }
.play-btn .icon-stop, .play-btn[aria-pressed="true"] .icon-play { display: none; }
.play-btn[aria-pressed="true"] .icon-stop { display: inline; }
.play-btn:disabled { opacity: .5; cursor: default; }
.speed { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .95rem; }
.speed input { width: 9rem; accent-color: var(--rosewood); }
.speed output { min-width: 2.8rem; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--muted); }
.stop-btn .icon { width: .9rem; height: .9rem; }
.stop-btn[hidden] { display: none; }
.player-status { color: var(--muted); font-size: .9rem; }

/* Playback cursor */
.score .abcjs-note.playing, .score .abcjs-note.playing path { fill: var(--blue); }
.score .abcjs-tabNumber.playing .abcjs-tab-number { fill: var(--blue); font-weight: 700; }

@media print { .player { display: none !important; } }

.setting-credit { margin: 1rem 0 0; color: var(--muted); font-size: .9rem; }
.abc-source { margin-top: .6rem; font-size: .9rem; }
.abc-source summary { cursor: pointer; color: var(--muted); width: max-content; }
.abc-source summary:hover { color: var(--blue); }
.abc-source pre { margin: .6rem 0 0; padding: 1rem; background: var(--paper); border-radius: var(--radius); overflow-x: auto; font-size: .85rem; line-height: 1.5; }

.partners { margin-top: 3.5rem; max-width: 52rem; }
.section-note { color: var(--muted); margin: .4rem 0 1.2rem; }

/* ---------------------------------------------------------------- nav count, toast */

.nav-count {
  display: inline-grid; place-items: center;
  min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; margin-left: .35rem;
  border-radius: 999px; background: var(--rosewood); color: var(--white);
  font-size: .75rem; font-weight: 700; vertical-align: .1em;
}
.nav-count[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 50;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 2rem); padding: .75rem 1.1rem;
  background: var(--ink); color: var(--white); border-radius: var(--radius);
  font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.18);
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { color: #b9d4f0; }

/* ---------------------------------------------------------------- tune actions + set menu */

.tune-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.icon { width: 1rem; height: 1rem; flex: none; }
.save-btn .icon path { fill: none; }
.save-btn[aria-pressed="true"] { border-color: var(--rosewood); color: var(--rosewood); }
.save-btn[aria-pressed="true"] .icon path { fill: var(--rosewood); stroke: var(--rosewood); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 20; top: calc(100% + .4rem); left: 0;
  width: min(21rem, calc(100vw - 2rem));
  padding: .8rem; background: var(--white);
  border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(31,36,39,.14);
}
.menu-title { margin: 0 0 .5rem; font-weight: 700; }
.menu-empty { margin: 0 0 .6rem; color: var(--muted); font-size: .92rem; }
.menu-sets { list-style: none; margin: 0 0 .7rem; padding: 0; max-height: 15rem; overflow-y: auto; }
.menu-set {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .4rem; border: 0; border-radius: 4px; background: none;
  color: var(--ink); font: 500 .95rem var(--sans); text-align: left; cursor: pointer;
}
.menu-set:hover { background: var(--wash); }
.menu-set .check { width: 1.1rem; height: 1.1rem; border: 1.5px solid var(--muted); border-radius: 3px; flex: none; display: grid; place-items: center; }
.menu-set[aria-pressed="true"] .check { background: var(--rosewood); border-color: var(--rosewood); }
.menu-set[aria-pressed="true"] .check::after { content: ""; width: .5rem; height: .28rem; border: 2px solid var(--white); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.menu-set-name { flex: 1; }
.menu-set-count { color: var(--muted); font-size: .85rem; }
.menu-new { display: flex; gap: .4rem; }
.menu-new input, .set-rename input {
  flex: 1; min-width: 0; min-height: 2.5rem; padding: .4rem .7rem;
  border: 1px solid var(--rule); border-radius: var(--radius); font: 500 .95rem var(--sans); color: var(--ink);
}
.menu-new input:focus, .set-rename input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }

/* ---------------------------------------------------------------- my tunes */

.my { max-width: 52rem; padding-top: clamp(2rem, 6vw, 4rem); }
.my-lede { color: var(--muted); max-width: var(--measure); margin: .8rem 0 0; }
.my-section { margin-top: 2.8rem; }
.my-section h2 { margin-bottom: 1rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.empty { color: var(--muted); padding: 1.1rem 1.2rem; border: 1px dashed var(--rule); border-radius: 8px; margin: 0; }
.row-with-action { display: flex; align-items: center; gap: .5rem; }
.row-with-action .tune-row { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none;
  border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer;
}
.icon-btn svg { width: 1rem; height: 1rem; }
.icon-btn:hover:not(:disabled) { border-color: var(--rule); color: var(--ink); background: var(--white); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.set-card { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.set-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; }
.set-name { margin: 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.set-toggle { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.set-toggle::after { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-left: .55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-.2rem); transition: transform .15s; }
.set-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.set-count { color: var(--muted); font-size: .9rem; }
.set-rename { display: flex; flex-wrap: wrap; gap: .4rem; width: 100%; }
.set-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 0; }
.set-actions .btn { min-height: 2.2rem; padding: .35rem .8rem; font-size: .9rem; }
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 600; }
.set-items { margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: item; border-top: 1px solid var(--rule); }
.set-items li { counter-increment: item; display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: .2rem .6rem; padding: .45rem 0; border-bottom: 1px solid var(--rule); }
.set-items li::before { content: counter(item); color: var(--muted); font-weight: 700; font-size: .9rem; }
.set-items a { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.set-items a:hover { color: var(--blue); }
.set-item-meta { grid-column: 2; color: var(--muted); font-size: .85rem; margin-top: -.2rem; }
.set-item-actions { grid-column: 3; grid-row: 1 / span 2; display: flex; }
.set-card .empty { margin-top: 1rem; }

/* ---------------------------------------------------------------- set page */

.set-page { padding-top: .2rem; }
.set-page-head { padding: .8rem 0 1.4rem; }
.set-info { color: var(--muted); margin: .6rem 0 0; max-width: var(--measure); }
.set-page-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.set-tune { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: clamp(.75rem, 2.5vw, 1.5rem); margin-bottom: 1.2rem; }
.set-tune-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; margin-bottom: .6rem; }
.set-tune-head h2 { font-size: 1.5rem; }
.set-tune-n { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; margin-right: .2rem; border-radius: 50%; background: var(--rosewood); color: var(--white); font: 700 .9rem var(--sans); vertical-align: .2em; }
.set-tune-name { color: var(--ink); text-decoration: none; }
.set-tune-name:hover { color: var(--blue); }
.set-tune-meta { margin: 0; color: var(--muted); font-size: .92rem; }
.set-score { min-height: 6rem; }
.loading { color: var(--muted); }
.set-credit { color: var(--muted); font-size: .85rem; }

@media (max-width: 34rem) {
  .set-tune { margin-left: calc(-1 * clamp(1rem, 3vw, 2rem)); margin-right: calc(-1 * clamp(1rem, 3vw, 2rem)); border-radius: 0; border-left: 0; border-right: 0; padding: .9rem .4rem; }
  .set-tune-head { padding: 0 .6rem; }
}

/* ---------------------------------------------------------------- prose pages */

.prose { max-width: var(--measure); padding-top: clamp(2rem, 6vw, 4rem); }
.prose h2 { margin: 2.2rem 0 .6rem; }
.prose p { margin: 0 0 1rem; }

/* ---------------------------------------------------------------- print */

@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .crumbs, .score-bar, .abc-source, .partners, .aliases, .skip, .tune-actions, .set-page-actions, .toast { display: none !important; }
  .set-tune { border: 0; padding: 0; margin: 0 0 8mm; break-inside: avoid; }
  .set-tune-n { background: none; color: #000; width: auto; }
  .set-tune-name { color: #000; }
  .set-page-head { padding: 0 0 4mm; }
  .wrap { max-width: none; padding: 0; }
  .tune-head { padding: 0 0 4mm; }
  .tune-head h1 { font-size: 22pt; }
  .tag { background: none; padding: 0; margin-right: 3mm; color: #000; }
  .tag-strong { color: #000; font-weight: 700; }
  .score-block { border: 0; padding: 0; }
  .score .abcjs-tab-number { fill: #000; }
  .toggle {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 2.5rem; padding: .3rem .8rem .3rem .5rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--white); color: var(--ink);
  font: 600 .95rem/1 var(--sans); cursor: pointer;
}
.toggle:hover { border-color: var(--ink); }
.toggle-track { position: relative; width: 2.1rem; height: 1.2rem; border-radius: 999px; background: var(--rule); transition: background .15s; }
.toggle-track::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: .9rem; height: .9rem; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.toggle[aria-pressed="true"] .toggle-track { background: var(--rosewood); }
.toggle[aria-pressed="true"] .toggle-track::after { transform: translateX(.9rem); }

@media (max-width: 34rem) {
  .score-block { margin: 0 calc(-1 * clamp(1rem, 3vw, 2rem)); border-radius: 0; border-left: 0; border-right: 0; padding: .9rem .4rem; }
  .score-bar { padding: 0 .6rem; }
  .setting-credit, .abc-source { padding: 0 .6rem; }
  .score-actions { margin-left: 0; width: 100%; }
  .score-actions .btn-quiet { margin-left: auto; }
}

.setting-credit { font-size: 8.5pt; }
  .setting-credit::after { content: " Source: thesession.org · mandolintab.net"; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------------------------------------------------------------- small screens */
.site-nav a { white-space: nowrap; }
.tune-actions { position: relative; }
@media (max-width: 34rem) {
  .site-nav { gap: .9rem; font-size: .95rem; }
  .brand { font-size: 1.2rem; gap: .4rem; }
  .brand-mark { width: 1.5rem; height: 1.5rem; }
  .menu-wrap { position: static; }
  .menu { left: 0; right: 0; width: auto; }
}
@media (max-width: 23rem) {
  .brand span { display: none; }
}

/* ---------------------------------------------------------------- account */
.account { max-width: 40rem; padding-top: clamp(2rem, 6vw, 4rem); }
.account-lede { color: var(--muted); margin: .8rem 0 1.6rem; max-width: var(--measure); }
.account-form label { display: block; font-weight: 700; margin-bottom: .4rem; }
.account-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.account-row input {
  flex: 1 1 16rem; min-height: 2.9rem; padding: .5rem .9rem;
  border: 2px solid var(--ink); border-radius: var(--radius); background: var(--white);
  font: 500 1.05rem var(--sans); color: var(--ink);
}
.account-row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-wash); }
.account-row .btn { min-height: 2.9rem; }
.form-error { color: #a1271b; font-weight: 600; min-height: 1.4em; margin: .5rem 0 0; }
.account-small { color: var(--muted); font-size: .9rem; margin-top: 1.4rem; }
.account-facts { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.4rem; margin: 1.4rem 0; }
.account-facts dt { font-weight: 700; }
.account-facts dd { margin: 0; color: var(--ink); }
.account-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.notice-ok { background: #e6f2ea; }
.account-link { padding: .3rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius); }
.site-nav .account-link:hover { border-color: var(--ink); color: var(--ink); }
@media (max-width: 34rem) {
  .account-facts { grid-template-columns: 1fr; gap: .2rem; }
  .account-facts dd { margin-bottom: .6rem; }
  .site-nav .account-link { padding: .2rem .5rem; }
}

@media (max-width: 34rem) {
  .site-nav .nav-about { display: none; } /* About is linked in the footer */
  .site-nav .nav-tunes { display: none; } /* the logo leads to all tunes */
  .site-nav { gap: .75rem; }
}

.danger-zone { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.danger-zone h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.danger-zone p { color: var(--muted); max-width: var(--measure); }
.btn-danger { background: #a1271b; border-color: #a1271b; }
.btn-danger:hover { background: #82190f; }

.legal .lang-note { color: var(--muted); margin-top: -.4rem; }
.placeholder { margin: 1.2rem 0; padding: 1rem 1.2rem; background: #fff6dc; border: 1px solid #e8cf86; border-radius: var(--radius); }

/* ------------------------------------------------------------------ star rating (tune page) */
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .7rem; margin-top: .9rem; }
.stars { display: inline-flex; }
.star {
  appearance: none; background: none; border: 0; padding: .25rem .12rem; margin: 0; cursor: pointer;
  color: var(--rosewood); line-height: 0; border-radius: 3px;
}
.star svg { width: 1.25rem; height: 1.25rem; display: block; }
.star path { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
.star.on path { fill: currentColor; }
.rating:not(.is-mine) .star.on { color: #9a6a64; }
.star:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.rating-info { font-size: .9rem; color: var(--muted); }
.rating-note { flex-basis: 100%; margin: .15rem 0 0; font-size: .9rem; }
@media print { .rating { display: none !important; } }

/* ------------------------------------------------------------------ popular page */
.popular { padding-bottom: 3rem; }
.popular-lede { max-width: var(--measure); color: var(--muted); margin: .8rem 0 1.4rem; }
.popular-switch { margin-bottom: 1.2rem; }
.popular-list { counter-reset: rank; }
.popular-list li { counter-increment: rank; }
.popular-list .tune-name::before { content: counter(rank) ". "; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ home filters on phones: one row */
.chip-more { display: none; }
@media (max-width: 34rem) {
  .filters { margin: .8rem 0 1.2rem; gap: .6rem; }
  .type-filter { flex-wrap: nowrap; }
  .filters:not(.is-open) .chip-extra:not([aria-pressed="true"]),
  .filters:not(.is-open):not(.has-key) .key-filter { display: none; }
  .filters.is-open .type-filter { flex-wrap: wrap; }
  .chip-more { display: block; color: var(--blue); }
  .filters.is-open .chip-more { order: 99; }
}
@media (max-width: 34rem) {
  /* a chosen type from the tucked-away ones takes the third place */
  .filters:not(.is-open) .type-filter:has(.chip-extra[aria-pressed="true"]) .chip-third { display: none; }
}
@media (max-width: 23rem) {
  .filters:not(.is-open) .chip-third:not([aria-pressed="true"]) { display: none; }
  .filters:not(.is-open) .type-filter:has(.chip-extra[aria-pressed="true"]) .chip:nth-child(3):not([aria-pressed="true"]) { display: none; }
}

/* ------------------------------------------------------------------ sign-in and Plus dialog */
.mt-dialog {
  width: min(26rem, calc(100vw - 2rem)); padding: 1.5rem 1.5rem 1.3rem; border: 1px solid var(--rule);
  border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px rgba(31, 36, 39, .22);
}
.mt-dialog::backdrop { background: rgba(31, 36, 39, .35); }
.mt-dialog h2 { margin: 0 0 .6rem; font-size: 1.45rem; }
.mt-dialog p { margin: 0 0 .7rem; max-width: none; }
.mt-dialog-note { color: var(--muted); font-size: .92rem; }
.mt-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.plus-tag {
  margin-left: .5rem; padding: .1rem .4rem; border-radius: 4px; background: var(--rosewood); color: var(--white);
  font: 700 .68rem/1.2 var(--sans); letter-spacing: .02em; vertical-align: .1em;
}

/* ------------------------------------------------------------------ Google sign-in */
.btn-google { background: var(--white); color: var(--ink); border: 1px solid var(--ink); }
.btn-google:hover { background: var(--wash); color: var(--ink); }
.account-google { margin: 1.2rem 0 0; }
.account-google .btn-google { min-width: 16rem; justify-content: center; }
.account-or { display: flex; align-items: center; gap: .8rem; max-width: 26rem; margin: 1.1rem 0 .4rem; color: var(--muted); font-size: .9rem; }
.account-or::before, .account-or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.mt-dialog-later { margin-left: auto; }

/* ------------------------------------------------------------------ ads */
.tune-list-rest { border-top: 0; }
.ad-slot { position: relative; margin: 1.6rem 0; padding-top: 1.1rem; min-height: 6.5rem; }
.ad-slot::before {
  content: "Advertisement"; position: absolute; top: 0; left: 0;
  font: 500 .72rem/1 var(--sans); color: var(--muted); letter-spacing: .02em;
}
.ad-search { margin: 0; padding: 1.4rem 0 1rem; border-bottom: 1px solid var(--rule); }
.ad-search::before { top: .4rem; }
/* nothing to show: give the space back */
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
@media print { .ad-slot { display: none !important; } }

/* ------------------------------------------------------------------ practice tools (Plus) */
.practice {
  flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding-top: .7rem; margin-top: .2rem; border-top: 1px dashed var(--rule);
}
.practice-label { font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; }
.part-picker { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: var(--white); }
.part-picker[hidden] { display: none; }
.seg {
  appearance: none; border: 0; border-right: 1px solid var(--rule); background: none; color: var(--ink);
  min-height: 2.2rem; padding: .25rem .8rem; font: 600 .9rem/1 var(--sans); cursor: pointer;
}
.seg:last-child { border-right: 0; }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.seg:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.trainer-set { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; font-size: .92rem; }
.trainer-set[hidden] { display: none; }
.trainer-set label { display: inline-flex; align-items: center; gap: .35rem; }
.trainer-set input { width: 4.2rem; min-height: 2.1rem; padding: .2rem .45rem; border: 1px solid var(--rule); border-radius: 6px; font: inherit; background: var(--white); color: var(--ink); }
.trainer-info { color: var(--rosewood); font-weight: 600; flex-basis: 100%; min-height: 1.45em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ stage mode (Plus) */
html.stage-open, html.stage-open body { overflow: hidden; }
.stage {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
}
.stage[hidden] { display: none; }
.stage-bar { display: flex; align-items: center; gap: 1rem; padding: .5rem clamp(.8rem, 3vw, 2rem); border-bottom: 1px solid var(--rule); }
.stage-set { margin: 0; flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-count { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.stage-tools { display: flex; gap: .4rem; }
.stage-btn {
  appearance: none; min-height: 2.4rem; min-width: 2.4rem; padding: .3rem .8rem; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--white); color: var(--ink); font: 600 .9rem/1 var(--sans); cursor: pointer;
}
.stage-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.stage-btn svg { width: 1rem; height: 1rem; display: block; }
.stage-close { padding: .3rem; display: inline-grid; place-items: center; }
.stage-main { flex: 1; overflow-y: auto; padding: 1rem clamp(.8rem, 3vw, 2.5rem) 1.5rem; }
.stage-title { margin: 0; font-size: clamp(1.8rem, 1.2rem + 2.5vw, 3rem); line-height: 1.1; }
.stage-meta { margin: .35rem 0 1rem; color: var(--muted); font-size: 1.05rem; }
.stage-score { min-height: 0; }
.stage-foot { display: flex; gap: .6rem; padding: .5rem clamp(.8rem, 3vw, 2rem) calc(.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); }
.stage-nav {
  appearance: none; flex: 1; display: flex; align-items: center; gap: .5rem; min-height: 3.2rem; padding: .4rem .9rem;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--white); color: var(--ink);
  font: 600 1rem/1.2 var(--sans); cursor: pointer; text-align: left; min-width: 0;
}
.stage-nav-next { justify-content: flex-end; text-align: right; flex: 2; }
.stage-nav:disabled { opacity: .35; cursor: default; }
.stage-nav svg { width: 1.3rem; height: 1.3rem; flex: none; }
.stage-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-btn:focus-visible, .stage-nav:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* dark: invert the notation so it reads light on black */
.stage.stage-dark { background: #121416; color: #e9ecee; }
.stage.stage-dark .stage-bar, .stage.stage-dark .stage-foot { border-color: #2c3237; }
.stage.stage-dark .stage-btn, .stage.stage-dark .stage-nav { background: #1d2124; border-color: #343b41; color: #e9ecee; }
.stage.stage-dark .stage-btn[aria-pressed="true"] { background: #e9ecee; color: #121416; }
.stage.stage-dark .stage-meta, .stage.stage-dark .stage-count { color: #9aa4ab; }
.stage.stage-dark .stage-score svg { filter: invert(1) hue-rotate(180deg); }
@media print { .stage { display: none !important; } }
.stage.stage-dark .tab-gap { fill: #edebe9; }

/* ------------------------------------------------------------------ tunebook dialog */
.section-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.book-dialog { width: min(30rem, calc(100vw - 2rem)); }
.book-field { display: grid; gap: .3rem; font-weight: 600; margin-bottom: .9rem; }
.book-field input { min-height: 2.6rem; padding: .3rem .6rem; border: 1px solid var(--rule); border-radius: 6px; font: inherit; font-weight: 400; background: var(--white); color: var(--ink); }
.book-list { border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 .8rem; padding: .5rem .8rem .7rem; max-height: 14rem; overflow-y: auto; }
.book-list legend { font-weight: 600; padding: 0 .3rem; }
.book-list label, .book-check { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; }
.book-n { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* PDF options (set PDF, tunebook) */
.book-hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.book-layout label { align-items: baseline; flex-wrap: wrap; column-gap: .5rem; row-gap: 0; }
.book-layout .book-hint { flex-basis: 100%; padding-left: 1.6rem; }
.book-field select { min-height: 2.6rem; padding: .3rem .5rem; border: 1px solid var(--rule); border-radius: 6px; font: inherit; font-weight: 400; background: var(--white); color: var(--ink); }
.book-field .book-hint { margin-top: -.1rem; }
.stage-fit { max-width: 100%; }
.stage-cols { display: grid; column-gap: 96px; align-items: start; }
.stage-col { min-width: 0; }
.stage-multi .stage-col + .stage-col { border-left: 1px solid var(--rule); padding-left: 48px; margin-left: -48px; }
.stage-multi .stage-title { font-size: clamp(1.5rem, 1rem + 1.4vw, 2.3rem); }
.stage.stage-dark .stage-multi .stage-col + .stage-col { border-color: #2c3237; }

/* generated ornaments (Plus) */
.orn-set { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; }
.orn-pick { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .95rem; }
.orn-pick select { min-height: 2.2rem; padding: .2rem .5rem; border: 1px solid var(--rule); border-radius: 6px; font: 400 .92rem var(--sans); background: var(--white); color: var(--ink); }
.btn-small { min-height: 2.2rem; padding: .25rem .7rem; font-size: .88rem; }
.orn-info { color: var(--rosewood); font-weight: 600; font-size: .9rem; }
.score .mt-orn, .score .mt-orn path { fill: var(--rosewood); stroke: var(--rosewood); }
.score text.mt-orn, .score .mt-orn text { fill: var(--rosewood); }
