body {
  font-family: sans-serif;
  margin: 0;
  background: #fafafa;
  color: #222;
}

.build-info {
  position: fixed;
  top: 0.5em;
  right: 0.75em;
  font-size: 0.8em;
  color: #888;
  background: rgba(250, 250, 250, 0.85);
  padding: 0.2em 0.5em;
  border-radius: 3px;
  z-index: 20;
  pointer-events: none;
}

.menubar {
  position: fixed;
  top: 0.5em;
  left: 0.75em;
  z-index: 30;
  display: flex;
  gap: 0.4em;
}

.menubar button {
  background: rgba(250, 250, 250, 0.9);
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.25em 0.55em;
  font-size: 0.9em;
  color: #555;
  cursor: pointer;
  line-height: 1;
}

.menubar button:hover,
.menubar button:focus-visible {
  background: #fff;
  color: #000;
  border-color: #88a;
  outline: none;
}

.bookmark-btn {
  background: none;
  border: none;
  padding: 0.15em 0.35em;
  color: #999;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1;
}

.bookmark-btn:hover {
  color: #444;
}

.bookmark-btn.is-bookmarked {
  color: #d4a000;
}

.build-info:empty {
  display: none;
}

#main {
  max-width: 900px;
  margin: 2em auto;
  padding: 0 1em;
}

h1 {
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5em;
  margin-bottom: 0.25em;
}

.search-bar {
  position: relative;
  margin: 1.5em 0 2em;
  display: flex;
  align-items: stretch;
  gap: 0.5em;
}

#q {
  flex: 1;
  padding: 0.6em 0.8em;
  font-size: 1.1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  min-width: 0;
}

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;             /* same width as the input above */
  z-index: 10;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-height: 50vh;
  overflow-y: auto;
}

.suggestions[hidden] {
  display: none;
}

.suggestions li {
  padding: 0.55em 0.8em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  border-bottom: 1px solid #f1f1f1;
}

.suggestions li:last-child {
  border-bottom: none;
}

.suggestions li.active {
  background: #eef6ff;
}

.suggestions .sugg-name {
  font-weight: 500;
}

.suggestions .sugg-meta {
  color: #888;
  font-size: 0.9em;
  white-space: nowrap;
}

#tune-view:empty {
  display: none;
}

/* Each setting is its own card. The space between cards shows the page
   background, giving a clear break. The tune header is plain text on the
   page background — not a card. */
.setting {
  background: white;
  padding: 1em 1.5em;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 2em;
}

.tune-header {
  margin-bottom: 1.5em;
}

.tune-header h2 {
  margin: 0 0 0.25em;
}

.tune-header .tune-meta {
  color: #666;
  font-size: 0.95em;
  margin: 0;
}

.tune-header .tune-aliases {
  color: #888;
  font-size: 0.9em;
  margin: 0.5em 0 0;
}

/* All setting details (title, copy-link, ABC Tools) on one row.
   ABC Tools link is pushed to the right via margin-left: auto. */
.setting-header {
  display: flex;
  align-items: center;
  gap: 0.25em;
  margin-bottom: 0.5em;
}

.setting-header h3 {
  margin: 0;
  font-size: 1em;
  color: #444;
  font-weight: normal;
}

.setting-header .abctools-link {
  margin-left: auto;
}

.copy-link {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 0.25em;
  margin-left: 0.35em;
  color: #aaa;
  vertical-align: middle;
  line-height: 1;
}

.copy-link:hover {
  color: #0066cc;
}

.copy-link.copied {
  color: #2a9d2a;
}

.copy-link.copy-failed {
  color: #c0392b;
}

.copy-note {
  margin-left: 0.25em;
  font-size: 0.85em;
  color: #2a9d2a;
  vertical-align: middle;
}

.copy-link.copy-failed + .copy-note {
  color: #c0392b;
}

.copy-note[hidden] {
  display: none;
}

.abctools-link {
  font-size: 0.85em;
  color: #0066cc;
  text-decoration: none;
}

.abctools-link:hover {
  text-decoration: underline;
}

/* Snippet (measure-range) controls — sit after the full ABC Tools link
   on the right side of the setting header. Hidden until a selection
   exists; revealed by toggling the `hidden` attribute. */
.snippet-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-left: 0.6em;
}

/* Specificity bump: `display: inline-flex` above outranks the UA's
   `[hidden] { display: none }` rule, so without this the controls
   stay visible even when the `hidden` attribute is set. */
.snippet-controls[hidden] {
  display: none;
}

.snippet-range {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
  color: #555;
  background: #f1f3f5;
  padding: 0.1em 0.45em;
  border-radius: 3px;
}

.snippet-clear {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 0.25em;
  color: #aaa;
  font-size: 1.05em;
  line-height: 1;
}

.snippet-clear:hover {
  color: #444;
}

/* Settings modal pane */
.settings-row {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin: 1em 0 0.5em;
}

.settings-label {
  min-width: 5em;
  font-weight: 500;
}

.settings-row input[type="range"] {
  flex: 1;
}

.settings-value {
  min-width: 3.5em;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #555;
}

.settings-hint {
  color: #666;
  font-size: 0.85em;
  margin: 0.25em 0 0;
}

/* Session-scoped paper width (matches the plugin default; explicit knob
   so it's easy to tweak alongside the per-render scale in session.js). */
#tune-view .abcjs-wrapper [id^="paper-"] {
  max-width: 1200px;
}

/* Reorder the abcjs wrapper so audio controls sit above the notation.
   The plugin keeps its DOM order (label, paper, audio, button); we
   re-stack visually with flex `order`. The Show Tabs checkbox is hidden
   here — tabs are always on in the session view. */
#tune-view .abcjs-wrapper {
  display: flex;
  flex-direction: column;
}
#tune-view .abcjs-wrapper > label                  { display: none; }
#tune-view .abcjs-wrapper > [id^="audio-"]         { order: 1; }
#tune-view .abcjs-wrapper > .activate-audio        { order: 2; }
#tune-view .abcjs-wrapper > [id^="paper-"]         { order: 3; }

/* ---- PWA offline-caching banner (added for the offline/camping build) ---- */
.offline-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: min(92vw, 40rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.6rem;
  background: #1f6feb;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.3;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.offline-banner.is-done  { background: #1a7f37; }
.offline-banner.is-error { background: #b3261e; }
.offline-banner-text { flex: 1 1 auto; }
.offline-banner-install {
  flex: 0 0 auto;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 0.4rem;
  background: #fff;
  color: #1f6feb;
  font-weight: 600;
  cursor: pointer;
}
.offline-banner-dismiss {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
