/* Worship Browser — studio console styling */

:root {
  --bg: #0d0e10;
  --bg-2: #111215;
  --panel: #16171b;
  --panel-2: #1c1e23;
  --panel-3: #24272d;
  --line: #24262c;
  --line-2: #30333a;
  --text: #ecedef;
  --text-2: #a8acb4;
  --text-3: #6d727b;
  --accent: #f0b24a;
  --accent-2: #f6c66f;
  --accent-ink: #1d1505;
  --accent-soft: rgba(240, 178, 74, 0.13);
  --solo: #f2c94c;
  --mute: #e5534b;
  --signal: #4ade80;
  --danger: #ef5d55;
  --wave: #3a3e46;
  --wave-played: #d8dade;

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 300px;
  --transport: 78px;
  --strip-w: 80px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(240, 178, 74, 0.35);
}

mark {
  background: none;
  color: var(--accent-2);
}

kbd {
  font: 600 11px/1 var(--mono);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  color: var(--text-2);
  background: var(--panel-2);
}

code {
  font: 12.5px var(--mono);
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-3);
}

.icon {
  display: inline-flex;
  flex: none;
  line-height: 0;
}

.icon.dim {
  color: var(--text-3);
}

.icon.flip svg {
  transform: rotate(180deg);
}

.spacer {
  flex: 1;
}

/* ------------------------------------------------------------------ layout */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  height: calc(100vh - var(--transport));
  height: calc(100dvh - var(--transport));
}

.main {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  scrollbar-gutter: stable;
}

.menu-toggle.icon-btn,
.scrim {
  display: none;
}

/* thin scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #444852;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 550;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}
.btn:hover {
  background: var(--panel-3);
  border-color: #3b3f47;
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 6px;
}
.btn.block {
  width: 100%;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--panel-2);
  color: var(--text);
}
.btn.danger,
.btn.ghost.danger {
  color: var(--danger);
}
.btn.ghost.danger:hover {
  background: rgba(239, 93, 85, 0.1);
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-2);
  border-color: transparent;
}
.btn-danger-solid {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn-danger-solid:hover {
  background: #f37068;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text-2);
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.icon-btn:hover {
  background: var(--panel-3);
  color: var(--text);
}
.icon-btn.ghost {
  background: transparent;
  border-color: transparent;
}
.icon-btn.ghost:hover {
  background: var(--panel-2);
}
.icon-btn.small {
  width: 28px;
  height: 28px;
}
.icon-btn.active {
  color: var(--accent);
}
.icon-btn.active svg {
  fill: currentColor;
}

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
}
.brand-name {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.logo {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
}
.logo i {
  width: 3.5px;
  border-radius: 2px;
  background: var(--accent);
}
.logo i:nth-child(1) {
  height: 55%;
}
.logo i:nth-child(2) {
  height: 100%;
}
.logo i:nth-child(3) {
  height: 35%;
  opacity: 0.75;
}
.logo i:nth-child(4) {
  height: 75%;
}
.logo.big {
  height: 44px;
  gap: 6px;
}
.logo.big i {
  width: 8px;
  border-radius: 4px;
}

.lib-search {
  padding: 0 12px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text-3);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 13.5px;
}
.search-input::placeholder {
  color: var(--text-3);
}
.search-input::-webkit-search-cancel-button {
  filter: invert(0.6);
}
.search:focus-within kbd {
  display: none;
}

.lib-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 4px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
}
.segmented button[aria-selected='true'] {
  background: var(--panel-3);
  color: var(--text);
}

.lib-count {
  padding: 6px 18px 6px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.song-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0 8px 12px;
}
.song-list li {
  position: relative;
}
.song-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 7px 8px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
  outline-offset: -2px;
}
.song-row:hover {
  background: var(--panel);
}
.song-row.active {
  background: var(--panel-2);
  box-shadow: inset 2px 0 0 var(--accent);
}
.row-cover {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-3);
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.row-title,
.row-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-title {
  font-weight: 560;
  font-size: 13.5px;
}
.row-artist {
  font-size: 12.5px;
  color: var(--text-2);
}
.row-key {
  font: 600 11px/1 var(--mono);
  color: var(--text-3);
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  min-width: 30px;
  text-align: center;
}
.song-list li:hover .row-key,
.song-list li:focus-within .row-key {
  visibility: hidden;
}
.row-star {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-3);
  opacity: 0;
}
.song-list li:hover .row-star,
.row-star:focus-visible {
  opacity: 1;
}
.row-star:hover {
  color: var(--text);
  background: var(--panel-3);
}
.row-star.on {
  opacity: 1;
  color: var(--accent);
  right: auto;
  left: 38px;
  top: 12px;
  width: 18px;
  height: 18px;
  transform: none;
  background: var(--bg-2);
  border-radius: 50%;
}
.row-star.on svg {
  fill: currentColor;
  width: 11px;
  height: 11px;
}
.song-row.active + .row-star.on {
  background: var(--panel-2);
}

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 30px;
  justify-content: center;
}
.eq i {
  width: 3px;
  border-radius: 1px;
  background: var(--accent);
  animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) {
  animation-delay: -0.3s;
}
.eq i:nth-child(3) {
  animation-delay: -0.6s;
}
@keyframes eq {
  0%,
  100% {
    height: 30%;
  }
  50% {
    height: 100%;
  }
}

.lib-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.lib-empty a {
  color: var(--accent);
}

.lib-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
}
.strip-name:disabled {
  cursor: default;
}
.strip-name:disabled:hover {
  background: none;
}

/* ------------------------------------------------------------------ player */

.player {
  padding-bottom: 40px;
}

.song-head {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) auto;
  align-items: end;
  gap: 26px;
  padding: 32px 36px 22px;
}
.cover {
  width: 136px;
  height: 136px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--text-3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.song-titles {
  min-width: 0;
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-titles h1 {
  margin: 6px 0 12px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0;
}
.facts div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.facts dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.facts dd {
  margin: 0;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}
.writers {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}
.head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 36px 14px;
}
.toolbar-note {
  font-size: 12.5px;
  color: var(--text-3);
}

.key-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  transition: background-color 0.12s, border-color 0.12s;
}
.key-btn:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: #3b3f47;
}
.key-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.key-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.key-value {
  font-weight: 650;
  font-size: 15px;
  min-width: 38px;
}
.key-tag {
  font: 600 11px/1 var(--mono);
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--text-2);
}
.key-tag.shifted {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ------------------------------------------------------------------- mixer */

.mixer {
  position: relative;
  display: flex;
  margin: 0 36px;
  height: 372px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.strips {
  flex: 1;
  display: flex;
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

.strip {
  flex: none;
  width: var(--strip-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: opacity 0.15s;
}
.strip.silenced .fader,
.strip.silenced .strip-name {
  opacity: 0.45;
}
.strip-cap {
  flex: none;
  width: 100%;
  height: 3px;
  background: var(--cat, var(--text-3));
}
.strip-name,
.strip-input {
  flex: none;
  width: calc(100% - 10px);
  height: 28px;
  margin: 7px 5px 6px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.strip-name {
  border: 0;
  background: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.strip-name:hover {
  background: var(--panel-3);
}
.strip-input {
  border: 1px solid var(--accent);
  background: var(--bg);
  outline: none;
}
.strip-btns {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  padding: 0 7px;
}
.tb {
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  color: var(--text-2);
  font: 700 11px/1 var(--font);
  letter-spacing: 0.03em;
}
.tb:hover {
  color: var(--text);
  border-color: #42464f;
}
.tb.solo.on {
  background: var(--solo);
  border-color: var(--solo);
  color: #231a00;
}
.tb.mute.on {
  background: var(--mute);
  border-color: var(--mute);
  color: #fff;
}

.strip-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  height: 32px;
  padding: 0 6px 0 9px;
}
.led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #33363d;
}
.led.on {
  background: var(--signal);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.75);
}
.val {
  font: 600 11.5px/1 var(--mono);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.val.hot {
  color: var(--accent);
}
.lock {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: #4a4e56;
}
.lock:hover:not(:disabled) {
  background: var(--panel-3);
  color: var(--text-2);
}
.lock.on {
  color: var(--text-2);
}
.lock:disabled {
  cursor: default;
}

/* fader */
.fader {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 14px 0 12px;
  touch-action: none;
  cursor: ns-resize;
  outline: none;
}
.fader:focus-visible .fader-cap {
  box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.fader-rail {
  position: relative;
  height: 100%;
}
.fader-slot {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: 8px;
  border-radius: 2px;
  background: #0a0b0d;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.fader-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cat, var(--text-3));
  opacity: 0.55;
}
.fader.accent .fader-fill {
  background: var(--accent);
}
.fader-scale {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fader-scale span {
  position: absolute;
  right: calc(50% + 2px);
  transform: translateY(50%);
  font: 500 9px/1 var(--mono);
  color: #555a63;
}
.fader-scale span::after {
  content: '';
  position: absolute;
  left: calc(100% + 3px);
  top: 50%;
  width: 4px;
  height: 1px;
  background: #3a3e45;
}
.fader-scale span.unity {
  color: var(--text-2);
}
.fader-cap {
  position: absolute;
  left: 50%;
  width: 28px;
  height: 18px;
  margin-left: -4px;
  transform: translateY(50%);
  border-radius: 4px;
  background: linear-gradient(180deg, #4a4e57 0%, #33363d 48%, #2b2e34 52%, #3a3d45 100%);
  border: 1px solid #575c66;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
}
.fader-cap i {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: #e6e7ea;
}
.fader.hot .fader-cap i {
  background: var(--accent);
}
.fader.dragging .fader-cap {
  cursor: grabbing;
}

/* master */
.master {
  flex: none;
  width: 124px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #191a1f, var(--panel));
}
.master-cap {
  background: var(--accent);
}
.master-name {
  height: 28px;
  margin: 7px 0 36px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.master-body {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  padding-right: 14px;
}
.master-body .fader {
  flex: 1;
}
.meters {
  display: flex;
  gap: 3px;
  padding: 14px 0 12px;
}
.meter-bar {
  position: relative;
  width: 6px;
  height: 100%;
  border-radius: 2px;
  background: #0a0b0d;
  overflow: hidden;
}
.meter-fill {
  position: absolute;
  inset: 0;
  clip-path: inset(100% 0 0 0);
  background: linear-gradient(0deg, #2f9e5f 0%, var(--signal) 70%, #e9d24a 88%, var(--mute) 100%);
}
.meter-peak {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: 0;
  background: #f0f1f3;
  opacity: 0.8;
  transform: translateY(50%);
}
.lim {
  font: 700 9.5px/1 var(--mono);
  letter-spacing: 0.05em;
  padding: 3px 4px;
  border-radius: 3px;
  color: #50545c;
  border: 1px solid var(--line-2);
}
.lim.on {
  color: #241900;
  background: var(--accent);
  border-color: var(--accent);
}

/* loading overlay */
.mixer-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 14, 16, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
  z-index: 5;
}
.mixer-overlay.show {
  opacity: 1;
  visibility: visible;
}
.busy-card {
  width: min(360px, 80%);
  text-align: center;
}
.busy-title {
  font-weight: 650;
  font-size: 16px;
}
.busy-detail {
  margin: 6px 0 16px;
  font-size: 13px;
  color: var(--text-2);
  min-height: 19px;
}
.busy-actions {
  margin-top: 16px;
}
.progress {
  position: relative;
  height: 4px;
  border-radius: 4px;
  background: var(--panel-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.progress.indeterminate .progress-bar {
  width: 35%;
  animation: indeterminate 1.1s ease-in-out infinite;
}
@keyframes indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

/* ------------------------------------------------------------------- chart */

.chart-card {
  margin: 22px 36px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.chart-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 10px 0 18px;
  border-bottom: 1px solid var(--line);
}
.chart-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}
.tabs {
  display: flex;
  gap: 2px;
  margin-left: 10px;
}
.tab {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
}
.tab:hover {
  color: var(--text);
}
.tab[aria-selected='true'] {
  background: var(--panel-3);
  color: var(--text);
}
.chart-toggle .icon {
  transition: transform 0.2s;
}
.chart-card.collapsed .chart-toggle .icon {
  transform: rotate(-90deg);
}
.chart-card.collapsed .chart-head {
  border-bottom: 0;
}
.chart-card.collapsed .chart-body {
  display: none;
}
.chart-body {
  background: #525659;
}
.chart-frame {
  display: block;
  width: 100%;
  height: min(1100px, 88vh);
  border: 0;
}
.chart-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--text-3);
}
.chart-empty div {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.chart-empty strong {
  color: var(--text-2);
  font-weight: 600;
}
.chart-empty span {
  font-size: 13px;
}

/* --------------------------------------------------------------- skeleton */

.skeleton {
  padding: 32px 36px;
}
.sk-head {
  display: flex;
  gap: 26px;
  align-items: flex-end;
  margin-bottom: 72px;
}
.sk-cover {
  width: 136px;
  height: 136px;
  border-radius: 10px;
}
.sk-lines {
  flex: 1;
  display: grid;
  gap: 12px;
}
.sk-line {
  height: 14px;
  border-radius: 6px;
}
.sk-line.w40 {
  width: 40%;
}
.sk-line.w70 {
  width: 70%;
  height: 30px;
}
.sk-line.w30 {
  width: 30%;
}
.sk-mixer {
  height: 372px;
  border-radius: var(--radius);
}
.shimmer {
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

/* ------------------------------------------------------------------- empty */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 70vh;
  padding: 40px;
  color: var(--text-2);
}
.empty h2 {
  margin: 18px 0 6px;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.empty p {
  max-width: 440px;
  margin: 0 0 22px;
}
.home-mark {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
}
.home-actions {
  display: flex;
  gap: 10px;
}

/* --------------------------------------------------------------- transport */

.transport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--transport);
  display: grid;
  grid-template-columns: var(--sidebar) auto minmax(0, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
  background: rgba(17, 18, 21, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}

.np {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  height: 100%;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  text-decoration: none;
}
.np-cover {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.np-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.np-text {
  min-width: 0;
}
.np-title,
.np-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-title {
  font-weight: 600;
  font-size: 13.5px;
}
.np-sub {
  font-size: 12px;
  color: var(--text-2);
}

.tcontrols {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 18px 0 22px;
}
.tbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-2);
  transition: background-color 0.12s, color 0.12s;
}
.tbtn:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--text);
}
.tbtn:disabled {
  opacity: 0.35;
  cursor: default;
}
.tbtn.skip b {
  position: absolute;
  font: 700 7.5px/1 var(--font);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -38%);
}
.tbtn.play {
  width: 46px;
  height: 46px;
  margin: 0 6px;
  background: var(--text);
  color: var(--bg);
}
.tbtn.play:hover:not(:disabled) {
  background: #fff;
  color: var(--bg);
  transform: scale(1.04);
}
.tbtn.play .icon {
  margin-left: 2px;
}
.tbtn.play.is-playing .icon {
  margin-left: 0;
}
.tbtn.on {
  color: var(--accent);
}
.tbtn.on::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 24px 0 0;
}
.clock {
  font: 600 12.5px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}
.clock.dim {
  color: var(--text-3);
  text-align: left;
}
.wave-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 52px;
}
.wave {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.wave-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  font: 600 11px/1 var(--mono);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}
.wave-tip.show {
  opacity: 1;
}

/* ------------------------------------------------------------ menus/modal */

.menu {
  position: fixed;
  z-index: 100;
  min-width: 180px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 5px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: #1e2025;
  box-shadow: var(--shadow);
  animation: pop 0.12s ease-out;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.menu-heading {
  padding: 8px 10px 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--line-2);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  font-size: 13px;
  outline: none;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--panel-3);
}
.menu-item:disabled {
  opacity: 0.4;
  cursor: default;
}
.menu-item .icon {
  color: var(--text-2);
}
.menu-check {
  width: 16px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}
.menu-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.menu-label small {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-hint {
  font: 600 11px/1 var(--mono);
  color: var(--text-3);
}
.menu-item.checked .menu-label {
  font-weight: 650;
}
.key-menu .menu-item {
  min-height: 32px;
}
.key-menu .menu-item.is-original .menu-hint {
  font-family: var(--font);
  color: var(--text-2);
}
.key-menu .menu-heading:last-child {
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s;
}
.modal-backdrop.in {
  opacity: 1;
}
.modal {
  width: min(440px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: #1a1c20;
  box-shadow: var(--shadow);
  transform: translateY(6px) scale(0.98);
  transition: transform 0.15s;
}
.modal-backdrop.in .modal {
  transform: none;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 4px 20px;
}
.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}
.modal-body {
  padding: 4px 20px 6px;
  color: var(--text-2);
}
.modal-body p {
  margin: 6px 0;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px 16px;
}
.shortcuts {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
}
.shortcuts div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.shortcuts div:last-child {
  border-bottom: 0;
}
.shortcuts dt {
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--text-3);
}
.shortcuts dd {
  margin: 0;
  color: var(--text);
}

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  right: 20px;
  bottom: calc(var(--transport) + 16px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
body:has(.editor-foot) .toasts {
  bottom: calc(var(--transport) + 74px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 10px 8px 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #202227;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
}
.toast.in {
  opacity: 1;
  transform: none;
}
.toast .icon {
  color: var(--text-2);
}
.toast-success .icon {
  color: var(--signal);
}
.toast-error {
  border-color: rgba(239, 93, 85, 0.45);
}
.toast-error .icon {
  color: var(--danger);
}
.toast-body {
  flex: 1;
}
.toast-close,
.toast-action {
  border: 0;
  background: none;
  color: var(--text-3);
  border-radius: 6px;
  padding: 4px;
  display: grid;
  place-items: center;
}
.toast-action {
  color: var(--accent);
  font-weight: 600;
  padding: 4px 8px;
}
.toast-close:hover {
  color: var(--text);
  background: var(--panel-3);
}

/* ------------------------------------------------------------------ editor */

.editor {
  max-width: 1180px;
  padding: 30px 36px 120px;
}
.editor-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  padding: 60px 0;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
}
.back-link:hover {
  color: var(--text);
}
.editor-head h1 {
  margin: 10px 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.lede {
  margin: 0 0 24px;
  max-width: 640px;
  color: var(--text-2);
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
.editor-main,
.editor-side {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 12px;
}
.card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.card-actions {
  display: flex;
  gap: 6px;
}
.auto-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 10px 8px 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 13px;
}
.auto-progress[hidden] {
  display: none;
}
.auto-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.name-cell .track-name {
  flex: 1;
  min-width: 0;
}
.conf {
  flex: none;
  border: 0;
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: help;
}
.conf-high {
  background: rgba(74, 222, 128, 0.12);
  color: var(--signal);
}
.conf-medium {
  background: var(--panel-3);
  color: var(--text-2);
}
.conf-low {
  background: var(--accent-soft);
  color: var(--accent);
}
.conf-suggest {
  cursor: pointer;
  background: rgba(95, 144, 240, 0.16);
  color: #8fb2f6;
}
.conf-suggest:hover {
  background: rgba(95, 144, 240, 0.28);
}
.auto-dialog p {
  margin: 4px 0 12px;
}
.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  cursor: pointer;
}
.check-row input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.check-row span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.check-row strong {
  color: var(--text);
  font-weight: 600;
}
.check-row small {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-3);
}
.muted {
  color: var(--text-3);
  font-size: 12.5px;
}
.login-form {
  display: grid;
  gap: 8px;
}
.login-form input {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  outline: none;
}
.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-error {
  color: var(--danger);
  font-size: 12.5px;
  min-height: 18px;
}
.lib-foot {
  display: grid;
  gap: 6px;
}
.lib-note {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
.lib-note button {
  border: 0;
  background: none;
  color: var(--text-2);
  text-decoration: underline;
  font-size: 12px;
  padding: 0;
}
.card-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}
.card-note {
  font-size: 12.5px;
  color: var(--text-3);
}
.card-empty {
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 34px 20px 28px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--line-2);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover {
  border-color: #474b54;
}
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dz-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--accent);
  margin-bottom: 14px;
}
.dz-title {
  font-weight: 650;
  font-size: 15px;
}
.dz-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-3);
}
.dz-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.track-list-head,
.track-row {
  display: grid;
  grid-template-columns: 10px minmax(140px, 1.2fr) minmax(0, 1.5fr) 76px 34px;
  align-items: center;
  gap: 12px;
}
.track-list-head {
  padding: 0 10px 8px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.track-list,
.chart-list {
  display: grid;
  gap: 4px;
}
.track-row,
.chart-row {
  padding: 6px 6px 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.chart-row {
  display: grid;
  grid-template-columns: 18px minmax(140px, 1fr) minmax(0, 1.2fr) 34px;
  align-items: center;
  gap: 12px;
}
.track-row.removed,
.chart-row.removed {
  opacity: 0.55;
}
.track-row.removed .track-name,
.chart-row.removed .track-name {
  text-decoration: line-through;
}
.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.track-name {
  height: 32px;
  width: 100%;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--bg-2);
  font-weight: 560;
  outline: none;
}
.track-name:hover:not(:disabled) {
  border-color: var(--line-2);
}
.track-name:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.track-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-3);
}
.track-file {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.track-stats {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
}
.tag {
  flex: none;
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-2);
}
.tag.new {
  background: rgba(74, 222, 128, 0.12);
  color: var(--signal);
}
.tag.warn {
  background: var(--accent-soft);
  color: var(--accent);
}
.tag.danger {
  background: rgba(239, 93, 85, 0.12);
  color: var(--danger);
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  border: 0;
  background: var(--panel-3);
  transition: background-color 0.15s;
  justify-self: start;
}
.toggle i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8a8f98;
  transition: transform 0.15s, background-color 0.15s;
}
.toggle.on {
  background: var(--accent);
}
.toggle.on i {
  transform: translateX(16px);
  background: #fff;
}
.toggle:disabled {
  opacity: 0.4;
}

.cover-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
}
.cover-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cover-info strong {
  font-size: 14px;
  font-weight: 650;
}
.cover-info span {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.cover-info .btn {
  align-self: flex-start;
}
.cover-tile {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 9px;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  color: var(--text-3);
}
.cover-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}
.cover-change {
  position: absolute;
  inset: auto 10px 10px auto;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
}
.cover-tile:hover .cover-change {
  opacity: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field.span2 {
  grid-column: span 2;
}
.field > span {
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
}
.field em {
  color: var(--accent);
  font-style: normal;
}
.field input,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  outline: none;
  resize: vertical;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder,
.field textarea::placeholder {
  color: #565a62;
}

.editor-foot {
  position: fixed;
  left: var(--sidebar);
  right: 0;
  bottom: var(--transport);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 36px;
  border-top: 1px solid var(--line);
  background: rgba(13, 14, 16, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.save-progress {
  display: none;
  align-items: center;
  gap: 12px;
  margin-right: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.save-progress .progress {
  width: 180px;
}
.editor-foot.saving .save-progress {
  display: flex;
}

/* ---------------------------------------------------------------- responsive */

/* ----------------------------------------------------------- chart viewer */

.chart-head {
  flex-wrap: nowrap;
  min-width: 0;
}
.chart-head .tabs {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.chart-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tool-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line-2);
}
.zoom-label {
  min-width: 42px;
  text-align: center;
  font: 500 12px var(--mono);
  color: var(--text-3);
}
.btn.active {
  border-color: var(--accent);
  color: var(--accent);
}
.chart-body {
  position: relative;
}

/* Click-to-scroll: charts don't take the wheel until clicked. */
.pdf-view,
.chords-view {
  position: relative;
  height: min(1100px, 82vh);
  overflow: hidden;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s;
}
.pdf-view.scroll-active,
.chords-view.scroll-active {
  overflow: auto;
  overscroll-behavior: contain;
  outline-color: rgba(240, 178, 74, 0.55);
}
.scroll-hint {
  position: sticky;
  top: calc(50% - 18px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  height: 36px;
  margin: 0 auto -36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(13, 14, 16, 0.86);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.scroll-locked:hover > .scroll-hint {
  opacity: 1;
}
@media (hover: none) {
  .scroll-locked > .scroll-hint {
    opacity: 0.9;
  }
}
.scroll-locked {
  cursor: pointer;
}

.pdf-view {
  background: #3d4045;
}
.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  min-width: max-content;
  margin: 0 auto;
}
.pdf-pages:not(.zoomed) {
  min-width: 0;
  padding-left: 14px;
  padding-right: 14px;
}
.pdf-page {
  position: relative;
  flex-shrink: 0;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.pdf-canvas,
.pdf-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.pdf-overlay {
  touch-action: auto;
}
.pdf-view.marking .pdf-overlay {
  touch-action: none;
  cursor: crosshair;
}
.pdf-view[data-tool='text'] .pdf-overlay {
  cursor: text;
}
.pdf-view[data-tool='erase'] .pdf-overlay {
  cursor: cell;
}
.pdf-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}
.pdf-text-input {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  margin: 0;
  padding: 0 2px;
  border: 1px dashed currentColor;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  font-family: Inter, Helvetica, Arial, sans-serif;
  font-weight: 600;
  line-height: 1.2;
  resize: none;
  overflow: hidden;
  outline: none;
}
.mark-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.mark-bar[hidden] {
  display: none;
}
.mark-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
}
.mark-tool:hover {
  background: var(--panel-3);
  color: var(--text);
}
.mark-tool.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.swatch {
  width: 22px;
  height: 22px;
  margin: 0 2px;
  border: 2px solid var(--panel-2);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line-2);
}
.swatch.on {
  box-shadow: 0 0 0 2px var(--text);
}
.mark-note {
  white-space: nowrap;
  margin: 0 8px;
  font-size: 12px;
  color: var(--text-3);
}

/* chord chart */
.chords-view {
  background: var(--bg-2);
}
.chords-sheet {
  --chord-size: 16px;
  padding: 26px 32px 40px;
  font-size: var(--chord-size);
}
.chords-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.chords-title h3 {
  margin: 0;
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.chords-title span {
  color: var(--text-3);
  font-size: 0.8em;
}
.chord-key {
  margin: 0 6px 0 8px;
  font: 600 12.5px var(--font);
  color: var(--accent);
  white-space: nowrap;
}
.chord-key small {
  color: var(--text-3);
  font-weight: 500;
}
.segmented.small button {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
}
.aa {
  font: 700 15px var(--font);
}
.aa.small {
  font-size: 11.5px;
}

.cc {
  line-height: 1.3;
}
.chords-sheet[data-cols='2'] .cc {
  column-count: 2;
  column-gap: 44px;
  column-rule: 1px solid var(--line);
}
.cc-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  column-span: all;
}
.cc-flow span {
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-2);
  font: 600 0.72em var(--font);
  text-align: center;
}
.cc-section {
  break-inside: avoid;
  margin: 0 0 1.1em;
  padding-left: 12px;
  border-left: 3px solid var(--sec, var(--line-2));
}
.cc-section[data-kind='verse'] {
  --sec: #5f90f0;
}
.cc-section[data-kind='chorus'] {
  --sec: var(--accent);
}
.cc-section[data-kind='pre'] {
  --sec: #a481e8;
}
.cc-section[data-kind='bridge'] {
  --sec: #e06a50;
}
.cc-section[data-kind='tag'] {
  --sec: #3fc3b6;
}
.cc-section[data-kind='inst'] {
  --sec: #8d939c;
}
.cc-name {
  margin: 0 0 0.35em;
  color: var(--sec, var(--text-2));
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cc-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 0.15em;
}
.cc-seg {
  display: inline-flex;
  flex-direction: column;
  white-space: pre;
}
.cc-chord {
  min-height: 1.25em;
  padding-right: 0.45em;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.88em;
}
.cc-seg:not(.has-chord) .cc-chord {
  display: none;
}
.cc-line:has(.has-chord) .cc-seg:not(.has-chord)::before {
  content: '';
  min-height: 1.1em;
}
.cc-lyric {
  color: var(--text);
}
.cc-chords-only {
  gap: 0.2em 1.1em;
  margin-bottom: 0.4em;
}
.cc-chords-only .cc-chord {
  padding: 0;
}
.cc-comment {
  margin: 0.15em 0 0.35em;
  color: var(--text-3);
  font-size: 0.82em;
  font-style: italic;
}
.cc-blank {
  height: 0.7em;
}
.chords-empty {
  max-width: 460px;
  margin: 70px auto;
  text-align: center;
  color: var(--text-2);
}
.chords-empty h3 {
  margin: 12px 0 6px;
  color: var(--text);
}
.chords-empty .home-actions {
  justify-content: center;
}

/* chord editor */
.chord-editor-backdrop {
  padding: 24px;
}
.chord-editor {
  display: flex;
  flex-direction: column;
  width: min(1400px, 100%);
  height: 100%;
  margin: 0 auto;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chord-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.chord-editor-head h2 {
  margin: 0;
  font-size: 15px;
}
.chord-editor-head h2 small {
  margin-left: 10px;
  color: var(--text-3);
  font-weight: 500;
}
.chord-editor-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.chord-editor-src {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.chord-src {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  border: 0;
  background: var(--bg-2);
  font: 13.5px/1.6 var(--mono);
  resize: none;
  outline: none;
  tab-size: 2;
}
.chord-help {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}
.chord-help div {
  display: flex;
  gap: 6px;
}
.chord-help dd {
  margin: 0;
}
.chord-help code {
  color: var(--accent-2);
  font-family: var(--mono);
}
.chord-editor-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chord-editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}
.chord-editor-preview .chords-sheet {
  flex: 1;
  overflow: auto;
  font-size: 15px;
}
select.small,
.set-key,
.user-row select {
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  font-size: 12.5px;
}
.choice-list {
  display: grid;
  gap: 8px;
}

/* ---------------------------------------------------------------- sidebar */

.lib-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin: 10px 12px 0;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.lib-mode button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.lib-mode button[aria-selected='true'] {
  background: var(--panel-3);
  color: var(--text);
}
.lib-tools[hidden] {
  display: none;
}
.small {
  font-size: 12px;
}
.dim {
  color: var(--text-3);
}
.set-cover b {
  color: var(--text-2);
  font: 700 14px var(--mono);
}
.linkish {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
}
.account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  text-align: left;
}
.account-btn:hover {
  background: var(--panel);
  border-color: var(--line);
}
.account-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.account-text strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-text small {
  font-size: 11.5px;
  color: var(--text-3);
}
.avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0b24a, #e06a50);
  color: #1d1505;
  font-size: 12px;
  font-weight: 750;
}

/* -------------------------------------------------------------- set view */

.set-view,
.settings {
  max-width: 980px;
  padding: 32px 36px 60px;
}
.set-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
}
.set-head-main {
  flex: 1;
  min-width: 0;
}
.set-title {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  padding: 2px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.02em;
  outline: none;
}
input.set-title:hover {
  border-color: var(--line-2);
}
input.set-title:focus {
  border-color: var(--accent);
  background: var(--bg-2);
}
.set-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.set-date {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--bg-2);
  color: var(--text);
  color-scheme: dark;
}
span.set-date {
  border: 0;
  padding: 0;
  height: auto;
  background: none;
  color: var(--text-2);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}
.badge.shared {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.set-notes {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  resize: vertical;
  outline: none;
}
.set-notes:focus {
  border-color: var(--accent);
}
.set-notes-text {
  margin: 0 0 16px;
  color: var(--text-2);
  white-space: pre-wrap;
}
.set-items {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.set-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.set-item:first-child {
  border-top: 0;
}
.set-item.dragging {
  opacity: 0.4;
}
.set-item.drop-target {
  box-shadow: inset 0 2px 0 var(--accent);
}
.drag {
  color: var(--text-3);
  cursor: grab;
}
.set-num {
  width: 20px;
  text-align: right;
  font: 600 13px var(--mono);
  color: var(--text-3);
}
.set-song {
  flex: 1.4;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}
.set-song:hover .row-title {
  color: var(--accent);
}
.set-song.missing .row-title {
  color: var(--danger);
}
.set-item-notes {
  flex: 1;
  min-width: 80px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  font-size: 12.5px;
  outline: none;
}
.set-item-notes:hover,
.set-item-notes:focus {
  border-color: var(--line-2);
  background: var(--bg-2);
}
.set-item-note {
  flex: 1;
  color: var(--text-2);
  font-size: 12.5px;
}
.set-item-actions {
  display: flex;
}
.set-empty {
  padding: 26px;
  text-align: center;
  color: var(--text-3);
}
.set-picker {
  position: relative;
  max-width: 460px;
}
.picker-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.picker-results:empty {
  display: none;
}
.picker-results .dim {
  padding: 8px 10px;
}
.picker-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.picker-row .row-cover {
  width: 34px;
  height: 34px;
}
.picker-row:hover,
.picker-row:focus {
  background: var(--panel-2);
  outline: none;
}

.set-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 36px -14px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(240, 178, 74, 0.28);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.set-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-2);
  font-weight: 650;
  text-decoration: none;
}
.set-bar-name:hover {
  text-decoration: underline;
}
.set-bar-pos {
  color: var(--text-2);
  font-size: 12.5px;
}
.set-bar .btn .dim {
  margin-right: 2px;
}

/* --------------------------------------------------------------- settings */

.settings-head h1 {
  margin: 4px 0 20px;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.settings-card {
  margin-bottom: 18px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.settings-card h2 {
  margin: 0 0 14px;
  font-size: 15px;
}
.settings-card .card-head {
  display: flex;
  align-items: center;
}
.settings-card .card-head h2 {
  margin: 0;
}
.settings-card p.dim {
  margin: 8px 0 14px;
  font-size: 13px;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.field-action {
  padding-top: 23px;
}
.form-row .field {
  flex: 1;
  max-width: 320px;
}
.field input:disabled {
  color: var(--text-3);
}
.form-actions {
  display: flex;
  gap: 8px;
}
.hint {
  color: var(--text-3);
  font-size: 11.5px;
}
.user-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.user-row:first-child {
  border-top: 0;
}
.user-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-text small {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
}
.check-list {
  display: grid;
  gap: 4px;
  max-height: 520px;
  overflow: auto;
}
.check-group {
  margin: 14px 0 4px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}
.check-list .check-row {
  align-items: center;
  cursor: default;
  padding: 8px 12px;
}
.check-list .check-row.done {
  opacity: 0.6;
}
.check-list .check-row .icon {
  color: var(--signal);
}
.check-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.check-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-input {
  font-family: var(--mono) !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.login-form .field input {
  height: 38px;
}


/* chord chart: song order bar */
.chord-pdf {
  position: relative;
}
.no-tracks {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 36px 4px;
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
}
.no-tracks > span:not(.icon) {
  flex: 1;
}
.no-tracks strong {
  color: var(--text);
}
.row-chartonly {
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.order-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.order-bar:empty {
  display: none;
}
.order-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.order-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.order-chip {
  position: relative;
  min-width: 38px;
  height: 26px;
  padding: 0 10px;
  border: 1.5px solid var(--c);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--c);
  font: 700 11.5px var(--font);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 0.05s;
}
.order-chip:hover {
  background: color-mix(in srgb, var(--c) 22%, transparent);
}
.order-chip.missing {
  opacity: 0.45;
  border-style: dashed;
}
.order-chip.dragging {
  z-index: 5;
  cursor: grabbing;
  box-shadow: var(--shadow);
  transition: none;
}
.order-chip.drop-before::before,
.order-chip.drop-after::after {
  content: '';
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.order-chip.drop-before::before {
  left: -6px;
}
.order-chip.drop-after::after {
  right: -6px;
}
.order-add {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1.5px dashed var(--line-2);
  border-radius: 50%;
  background: none;
  color: var(--text-3);
}
.order-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.key-select {
  min-width: 150px;
}
.chords-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  color: var(--text-2);
  font-size: 13px;
}
.auto-note {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 12.5px;
}
.chord-pdf .pdf-view {
  border-radius: 0;
}

/* editors: compare chord chart with the original PDF */
.chord-pdf.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.chord-pdf:not(.compare) .compare-side {
  display: none;
}
.compare-main,
.compare-side {
  position: relative;
  min-width: 0;
}
.compare-side {
  border-left: 1px solid var(--line);
}
.compare-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.compare-head > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-body {
  position: relative;
}
.chord-editor-orig {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chord-editor-orig .pdf-view {
  flex: 1;
  height: auto;
}
@media (max-width: 1100px) {
  .editor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-side {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar: 0px;
  }
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--transport);
    width: 300px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .app.sidebar-open .sidebar {
    transform: none;
  }
  .scrim {
    position: fixed;
    inset: 0 0 var(--transport) 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.5);
  }
  .app.sidebar-open .scrim {
    display: block;
  }
  .menu-toggle.icon-btn {
    display: grid;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 15;
  }
  .song-head {
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 64px 20px 18px;
    gap: 18px;
  }
  .cover {
    width: 96px;
    height: 96px;
  }
  .song-titles h1 {
    font-size: 26px;
  }
  .head-actions {
    grid-column: 1 / -1;
  }
  .toolbar {
    padding: 0 20px 12px;
  }
  .toolbar-note {
    display: none;
  }
  .master {
    width: 96px;
  }
  .mixer {
    height: 340px;
  }
  .mixer,
  .chart-card {
    margin-left: 16px;
    margin-right: 16px;
  }
  .transport {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .np {
    display: none;
  }
  .tcontrols {
    padding: 0 8px 0 12px;
  }
  .tbtn.skip {
    display: none;
  }
  .timeline {
    padding-right: 14px;
    gap: 10px;
  }
  .editor {
    padding: 64px 20px 140px;
  }
  .editor-side {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-foot {
    padding: 10px 16px;
  }
  .track-list-head {
    display: none;
  }
  .track-row {
    grid-template-columns: 10px minmax(0, 1fr) 40px 30px;
  }
  .track-row .track-meta {
    grid-column: 2 / 3;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

@media (max-width: 900px) {
  .set-view,
  .settings {
    padding: 22px 16px 60px;
  }
  .set-bar {
    margin: 12px 16px -6px;
    flex-wrap: wrap;
  }
  .set-item {
    flex-wrap: wrap;
  }
  .set-song {
    flex: 1 1 150px;
  }
  .set-item-notes,
  .set-item-note {
    order: 5;
    flex-basis: 100%;
  }
  .chord-editor-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .chord-editor-src {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .chord-help {
    display: none;
  }
  .chord-editor-backdrop {
    padding: 0;
  }
  .chords-sheet {
    padding: 18px 16px 30px;
  }
  .chords-sheet[data-cols='2'] .cc {
    column-count: 1;
  }
  .chart-head {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 10px;
  }
  .mark-bar {
    flex-wrap: wrap;
  }
  .mark-note {
    display: none;
  }
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .form-row .field {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .order-bar {
    flex-wrap: wrap;
  }
  .chart-tools {
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .chart-head > .chart-tools {
    order: 5;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .chart-head .chart-tools .chart-tools {
    flex-wrap: wrap;
  }
  .chart-head .tool-sep {
    display: none;
  }
  .key-select {
    min-width: 0;
  }
  .order-bar {
    padding: 8px 10px;
  }
}

@media (max-width: 1000px) {
  .chord-pdf.compare {
    grid-template-columns: 1fr;
  }
  .compare-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .no-tracks {
    margin: 0 16px 4px;
  }
}
.order-rep {
  margin-left: 3px;
  font-size: 9.5px;
  font-weight: 600;
  opacity: 0.75;
}
.code-block {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  user-select: all;
}

/* Two pages side by side (a grid, so zooming in keeps two per row and scrolls sideways) */
.pdf-pages.spread {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  align-items: start;
}

/* ---- Grouped toolbars; editor-only controls look different ---------------- */
.tool-group,
.action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-head .chart-tools {
  gap: 14px;
}
.chart-head .chart-tools .chart-tools {
  gap: 14px;
}
.zoom-group {
  gap: 2px;
}
.capo-select {
  max-width: 170px;
}
.editor-tools:empty {
  display: none;
}
.editor-tools {
  padding-left: 14px;
  border-left: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}
.btn.ed-only {
  --ed: #e8a33d;
  color: var(--ed);
  border-color: color-mix(in srgb, var(--ed) 45%, transparent);
  background: color-mix(in srgb, var(--ed) 9%, transparent);
}
.btn.ed-only:hover {
  background: color-mix(in srgb, var(--ed) 18%, transparent);
  border-color: color-mix(in srgb, var(--ed) 70%, transparent);
}
.btn.ed-only .icon {
  color: var(--ed);
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.editor-group {
  padding-left: 16px;
  border-left: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}
@media (max-width: 860px) {
  .head-actions {
    grid-column: 1 / -1;
    gap: 10px;
  }
  .editor-group {
    padding-left: 0;
    border-left: 0;
  }
  .chart-head .chart-tools,
  .chart-head .chart-tools .chart-tools {
    gap: 8px;
    flex-wrap: wrap;
  }
  .editor-tools {
    padding-left: 0;
    border-left: 0;
  }
}
/* Chart toolbar: wrap onto a second row instead of running off the edge */
.chart-head {
  flex-wrap: wrap;
  height: auto;
  min-height: 52px;
  row-gap: 6px;
  padding-top: 7px;
  padding-bottom: 7px;
}
.chart-head h2 {
  white-space: nowrap;
}
.chart-head > .chart-tools {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
  min-width: 0;
}
.chart-head > .chart-tools > .chart-tools {
  flex-wrap: wrap;
  row-gap: 6px;
}
.chart-head {
  position: relative;
  padding-right: 52px;
}
.chart-head > .chart-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
}
.chart-head .key-select {
  max-width: 150px;
}
.chart-head .capo-select {
  max-width: 132px;
}

/* Section markers row (from the guide track) */
.section-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 36px 12px;
  min-width: 0;
}
.section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3, #7c8594);
  flex-shrink: 0;
}
.section-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.section-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 8%, transparent);
  color: var(--text, #e8e9ec);
  font: 600 12px var(--font, system-ui);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.section-chip:hover {
  background: color-mix(in srgb, var(--c) 18%, transparent);
}
.section-chip.active {
  background: var(--c);
  border-color: var(--c);
  color: #111;
}
.section-code {
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 800;
  background: color-mix(in srgb, var(--c) 25%, transparent);
  color: var(--c);
}
.section-chip.active .section-code {
  background: rgba(0, 0, 0, 0.18);
  color: #111;
}
@media (max-width: 860px) {
  .section-bar {
    padding: 0 20px 10px;
  }
  .section-name {
    display: none;
  }
  .section-chip {
    padding: 0 4px;
  }
}
.section-chips {
  flex-wrap: wrap;
  overflow: visible;
}
/* "Listening to the guide…" — sits where the section chips will appear */
.section-pending {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 28px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  border: 1px dashed var(--line-2);
  color: var(--text-2, #a3a8b3);
  font-size: 12px;
  white-space: nowrap;
}
.pulse-dots {
  display: inline-flex;
  gap: 3px;
}
.pulse-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.pulse-dots i:nth-child(2) {
  animation-delay: 0.2s;
}
.pulse-dots i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes pulse-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-dots i {
    animation: none;
    opacity: 0.7;
  }
}

/* Pan knob on each mixer strip */
.knob {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 7px;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  outline: none;
}
.knob:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}
.knob-dial {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--panel-3, #2a2d33), var(--panel, #17181c));
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.knob-ind {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 2px;
  height: 8px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text-2, #a3a8b3);
  transform-origin: 50% 9px;
}
.knob.off-center .knob-ind {
  background: var(--cat, var(--accent));
}
.knob-val {
  width: 26px;
  font: 600 10.5px var(--mono, ui-monospace, monospace);
  color: var(--text-3, #7c8594);
  text-align: left;
}
.knob.off-center .knob-val {
  color: var(--text, #e8e9ec);
}
.knob.dragging .knob-dial {
  border-color: var(--cat, var(--accent));
}

/* Relisten (editors) sits at the end of the section bar. */
.section-redo {
  flex-shrink: 0;
  margin-left: auto;
}
.section-none {
  color: var(--text-3, #7c8594);
  font-size: 12px;
}

/* ------------------------------------------------------------ arrangement */
.arr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.section-arrange {
  flex-shrink: 0;
  margin-left: auto;
}
.section-arrange + .section-redo {
  margin-left: 0;
}
.section-bar.editing {
  flex-wrap: wrap;
  row-gap: 8px;
  padding-top: 10px;
  padding-bottom: 12px;
  margin: 0 24px 12px;
  padding-left: 12px;
  padding-right: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.section-chips.arranging {
  flex-wrap: wrap;
  overflow: visible;
  flex: 1 1 320px;
}
.arr-chip {
  cursor: grab;
}
.arr-chip.dragging {
  opacity: 0.4;
}
.arr-chip.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.arr-total {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-3, #7c8594);
}
.arr-note {
  flex-basis: 100%;
  font-size: 11.5px;
  color: var(--text-3, #7c8594);
}
.order-chip.locked {
  cursor: default;
}
.order-follow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-3, #7c8594);
}
.set-arr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  color: var(--text-3, #7c8594);
}
.set-arr b {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--c, var(--text-2));
  background: color-mix(in srgb, var(--c, #888) 16%, transparent);
}
.set-arr small {
  font-weight: 600;
  margin-left: 2px;
  opacity: 0.8;
}
.share-input {
  width: 100%;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* Team | Private switch for sets */
.vis-toggle {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--line-2, var(--line));
  background: var(--bg-2, transparent);
}
.vis-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3, #7c8594);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.vis-toggle button.on {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.vis-toggle button:disabled {
  cursor: default;
}
.field .vis-toggle {
  align-self: flex-start;
}

/* Phones: "Sections" and its buttons on one line, the chips full width below. */
@media (max-width: 640px) {
  .section-bar:not(.editing) {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .section-bar:not(.editing) > .section-chips {
    order: 3;
    flex: 1 1 100%;
  }
  .section-bar:not(.editing) > .section-arrange,
  .section-bar:not(.editing) > .section-redo,
  .section-bar:not(.editing) > .arr-badge {
    order: 2;
  }
  .section-bar:not(.editing) > .section-arrange {
    margin-left: auto;
  }
  .section-bar .btn.small {
    height: 28px;
  }
  .section-bar.editing {
    margin: 0 12px 12px;
  }
  .section-bar.editing .section-chips {
    flex-basis: 100%;
  }
  .section-bar.editing .arr-total {
    margin-left: 0;
  }
  .section-bar.editing .btn-primary {
    margin-left: auto;
  }
}

/* Playing from a set: a clear banner, distinct from opening a song on its own */
.set-bar {
  padding: 10px 12px 10px 12px;
  border-left: 3px solid var(--accent);
}
.set-bar-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  color: #111;
  background: var(--accent);
}
.set-bar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.set-bar-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2, var(--accent));
  opacity: 0.85;
}
.set-bar-text .set-bar-name {
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arr-badge.set {
  color: #111;
  background: var(--accent);
}
.np-set {
  color: var(--accent);
}
@media (max-width: 640px) {
  .set-bar {
    flex-wrap: wrap;
    margin-left: 12px;
    margin-right: 12px;
  }
  .set-bar .spacer {
    flex-basis: 100%;
    height: 0;
  }
  .set-bar-lib {
    margin-right: auto;
  }
}
.set-arr-clear {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3, #7c8594);
  cursor: pointer;
}
.set-arr-clear:hover {
  color: var(--text);
  background: var(--line);
}

/* Guitar helper */
.guitar-helper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.guitar-helper .field select {
  max-width: 240px;
}
.guitar-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guitar-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.guitar-option:hover {
  border-color: var(--line-2, var(--line));
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.guitar-option.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.guitar-option-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
}
.guitar-option-head span {
  color: var(--text-2, #a3a8b3);
}
.guitar-best {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  color: #111 !important;
  background: var(--accent);
}
.guitar-open {
  margin-left: auto;
  font-size: 12px;
}
.guitar-chords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.guitar-chord {
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.guitar-chord.hard {
  color: #ff8a80;
  background: color-mix(in srgb, #ff5a4f 14%, transparent);
}
.set-guitar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  color: var(--text-3, #7c8594);
}
.modal.modal-wide {
  width: min(600px, 100%);
}
.modal-body .guitar-option-head .guitar-open {
  margin-left: auto;
}
/* Read-only chips (order follows the tracks or the set) line up like the buttons */
.order-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.order-chip.locked {
  cursor: default;
}
.order-chip.locked:hover {
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.order-rep {
  font-size: 9.5px;
  opacity: 0.85;
}

/* ======================================================= phone polish ==== */
@media (max-width: 900px) {
  /* A real top bar behind the menu button, so it never covers content. */
  .app::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 14;
    background: color-mix(in srgb, var(--bg, #0d0e10) 86%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    pointer-events: none;
  }
  .main {
    padding-top: 60px;
  }
  .menu-toggle.icon-btn {
    top: 10px;
  }
  .song-head {
    padding-top: 18px;
  }
  .set-view,
  .settings {
    padding-top: 18px;
  }
}

@media (max-width: 640px) {
  /* Song header: smaller cover beside the title, facts below */
  .song-head {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px 14px;
    padding: 16px 16px 14px;
  }
  .song-head .cover {
    width: 64px;
    height: 64px;
    border-radius: 10px;
  }
  .song-titles h1 {
    font-size: 22px;
    line-height: 1.15;
  }
  .song-titles .eyebrow {
    font-size: 10.5px;
  }
  .facts {
    gap: 4px 14px;
  }
  .facts dt,
  .facts dd {
    font-size: 12px;
  }
  .writers {
    display: none;
  }
  .head-actions {
    gap: 8px;
  }
  .head-actions .action-group,
  .head-actions .editor-group {
    flex-wrap: wrap;
  }
  .editor-group {
    padding-left: 0;
    border-left: 0;
  }
  .toolbar {
    padding: 0 16px 10px;
  }
  .section-bar {
    padding: 0 16px 10px;
  }
  .mixer,
  .chart-card {
    margin-left: 10px;
    margin-right: 10px;
  }

  /* Playing from a set */
  .set-bar {
    margin: 10px 10px -6px;
    padding: 10px;
    gap: 8px 10px;
  }
  .set-bar-icon {
    width: 28px;
    height: 28px;
  }
  .set-bar-text .set-bar-name {
    font-size: 14px;
  }
  .set-bar .btn.small {
    height: 30px;
  }
  .set-bar > a.btn.small:last-child,
  .set-bar > .dim.small:last-child {
    margin-left: auto;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Chord chart tools wrap into tidy rows instead of scrolling sideways */
  .chart-head .tool-group {
    flex-wrap: wrap;
    width: 100%;
  }
  .chart-head .tool-group select {
    flex: 1 1 130px;
    min-width: 0;
    max-width: none;
  }
  .chart-head .chart-tools,
  .chart-head .chart-tools .chart-tools {
    gap: 8px;
    flex-wrap: wrap;
  }
  .editor-tools {
    padding-left: 0;
    border-left: 0;
  }
  .order-bar {
    gap: 8px;
  }
  .order-bar .spacer {
    display: none;
  }
  .order-follow {
    flex-basis: 100%;
  }

  /* Set page */
  .set-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .set-head-main {
    min-width: 0;
  }
  .set-title {
    width: 100%;
    font-size: 26px;
  }
  .set-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
  .set-head .head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
  }
  .set-head .head-actions:has(> :nth-child(4)) {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
  .set-head .head-actions .btn {
    justify-content: center;
  }
  .set-item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      'drag num song song'
      'key key key actions'
      'note note note note';
    column-gap: 10px;
    row-gap: 8px;
    padding: 12px;
  }
  .set-item .drag {
    grid-area: drag;
  }
  .set-item .set-num {
    grid-area: num;
  }
  .set-item .row-cover {
    display: none;
  }
  .set-item .set-song {
    grid-area: song;
    min-width: 0;
  }
  .set-item .set-key {
    grid-area: key;
    justify-self: start;
    width: auto;
    max-width: 100%;
  }
  .set-item .set-item-actions {
    grid-area: actions;
    justify-self: end;
  }
  .set-item .set-item-notes,
  .set-item .set-item-note,
  .set-item .spacer {
    grid-area: note;
    width: 100%;
  }
  .set-guitar {
    display: flex;
    margin: 3px 0 0;
  }

  /* Guitar helper */
  .guitar-option-head .guitar-open {
    flex-basis: 100%;
    margin-left: 0;
    font-size: 11.5px;
  }
}

/* Selects inside dialogs look like the rest of the app */
.modal select {
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line-2, var(--line));
  background: var(--bg-2, #15171b);
  color: var(--text);
  font: inherit;
}
@media (max-width: 700px) {
  /* Chart header: title + collapse on top, then the tools in tidy rows */
  .chart-head {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .chart-head > .chart-tools {
    order: 5;
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
  }
  .chart-head > .chart-tools > .chart-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .chart-head > .chart-tools > .chart-tools:empty {
    display: none;
  }
  .chart-head > .chart-tools > .editor-tools {
    justify-content: flex-start;
  }
  .chart-head .tool-group {
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
  }
  .chart-head .view-tools .tool-group {
    width: 100%;
  }
  .chart-head .view-tools .segmented {
    flex: 0 0 auto;
  }
  .chart-head .view-tools select {
    flex: 1 1 120px;
    min-width: 0;
  }
  .chart-head .zoom-group {
    display: none; /* pinch to zoom on phones */
  }
}

/* Tall dialogs (e.g. the guitar helper on a phone): the body scrolls, the
   title and buttons stay put. */
.modal {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
}
.modal-head,
.modal-foot {
  flex-shrink: 0;
}
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .modal-backdrop {
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .modal {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

/* Dark pages: the rendered page is inverted (colours keep their hue); your
   marks on top are not, so highlighter stays yellow. Downloads and prints
   are always the normal white PDF. */
.pdf-view.dark-pages {
  background: #0b0c0e;
}
.pdf-view.dark-pages .pdf-page {
  background: #0f1012;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.pdf-view.dark-pages .pdf-canvas {
  filter: invert(0.92) hue-rotate(180deg) saturate(1.5) brightness(1.18);
}
.dark-btn.active {
  color: var(--accent);
}

/* Share dialog */
.share-body { display: grid; gap: 12px; width: 100%; min-width: 0; text-align: left; }
.share-body select { width: 100%; max-width: 100%; box-sizing: border-box; }
.share-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.share-toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; flex: 1; min-width: 200px; }
.share-toggle input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.share-toggle span { display: grid; gap: 2px; }
.share-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #9aa0aa); margin: 6px 0 0; }
.share-pick { width: 100%; }
.share-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.share-people li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2, rgba(255,255,255,.04)); }
.share-people li > span { flex: 1 1 auto; text-align: left; display: block; margin: 0; }
.empty .row-gap { display: flex; gap: 8px; justify-content: center; }
