:root {
  /* Native iOS WebViews can draw beneath the clock and Dynamic Island. The
     native bridge supplies the second value because WebKit can report 0 for
     the CSS environment inset while scrolling. */
  --native-safe-area-top: 0px;
  --safe-area-top: max(env(safe-area-inset-top, 0px), var(--native-safe-area-top));
  color-scheme: light;
  --ink: #20382f;
  --muted: #748078;
  --paper: #f5f6f2;
  --panel: #fff;
  --line: #dfe5dd;
  --accent: #346c51;
  --accent-2: #527965;
  --shadow: 0 8px 28px #20382f08;
  font-family:
    "Avenir Next",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
/* UIKit applies the initial WebView inset, but the web content may scroll
   underneath it. Keep that system-owned strip visually clear at all times. */
body::before {
  content: "";
  position: fixed;
  z-index: 90;
  inset: 0 0 auto;
  height: var(--safe-area-top);
  background: var(--paper);
  pointer-events: none;
}
body.stage-dark::before {
  background: #000;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
button:hover {
  background: #f0f4ee;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.primary:hover {
  background: #285640;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #89b39a;
  outline-offset: 3px;
}
input,
select,
textarea {
  min-height: 46px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  width: 100%;
}
select {
  /* Keep the chevron comfortably inside the field on every platform. */
  appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2320382f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #9fbea9;
  outline-offset: 1px;
}
textarea {
  min-height: 110px;
  line-height: 1.6;
  resize: vertical;
}
textarea[name="body"] {
  min-height: 360px;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}
label {
  display: grid;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #58695e;
}
[hidden] {
  display: none !important;
}
h2,
h3,
p {
  margin-top: 0;
}
p {
  line-height: 1.6;
}
a {
  color: var(--accent);
}
.ui-icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}
.shell {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: calc(30px + var(--safe-area-top)) 16px 18px;
  display: flex;
  flex-direction: column;
  background: #eef1e9;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 42px;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.24rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  border-radius: 11px;
  width: 42px;
  height: 42px;
}
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand small {
  display: block;
  font-size: 0.43rem;
  letter-spacing: 0.1em;
  margin-top: 5px;
  font-weight: 600;
}
.main-nav {
  display: grid;
  gap: 7px;
}
.nav-item {
  border: 0;
  background: transparent;
  justify-content: start;
  padding: 13px 14px;
  color: #657369;
}
.nav-item > span { text-align: left; }
.nav-item.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.nav-item.active .ui-icon {
  color: var(--accent);
}
.nav-item small {
  margin-left: auto;
  background: #e9efe5;
  padding: 2px 7px;
  border-radius: 5px;
}
.sidebar-note {
  padding: 24px 14px;
  margin-top: 46px;
}
.tiny-label,
.eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--muted);
}
.sidebar-note p {
  font-family: Georgia, serif;
  font-size: 1.27rem;
  margin: 14px 0;
  line-height: 1.4;
}
.sidebar-note button {
  background: none;
  padding: 0;
  border: 0;
  font-size: 0.75rem;
  color: var(--accent);
}
.sidebar-news-copy { margin-top: 14px; }
.sidebar-news-copy strong { display: block; font-family: Georgia, serif; font-weight: 400; font-size: 1.14rem; line-height: 1.3; overflow-wrap: anywhere; }
.sidebar-note .sidebar-news-copy p { max-height: 10rem; overflow-y: auto; margin: 9px 0 14px; font-family: inherit; font-size: .76rem; line-height: 1.5; color: #52665a; white-space: pre-wrap; overflow-wrap: anywhere; }
.sidebar-news-dots { display: flex; gap: 0; align-items: center; overflow-x: auto; padding: 4px 2px; }
.sidebar-note .sidebar-news-dots button { flex: 0 0 28px; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.sidebar-note .sidebar-news-dots button::after { content: ""; display: block; width: 8px; height: 8px; margin: auto; border-radius: 50%; background: #b7c7b8; }
.sidebar-note .sidebar-news-dots button[aria-current="true"]::after { background: var(--accent); }
.sidebar-note .sidebar-news-dots button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 4px;
  justify-content: start;
  width: 100%;
  font-size: 0.8rem;
}
.profile-link .avatar { flex: 0 0 32px; }
.profile-link-copy {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-link small {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 400;
  margin-top: 3px;
}
.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  background: #d8e2d1;
}
.logout-link {
  border: 0;
  background: none;
  min-height: 36px;
  font-size: 0.7rem;
  margin-left: 38px;
  color: var(--muted);
}
.main {
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
/* Android 15's edge-to-edge WebView needs an explicit status-bar inset. */
.native-android .topbar { padding-top: calc(14px + 16px); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--muted);
}
.breadcrumb strong {
  color: var(--ink);
  font-weight: 600;
}
.workspace-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.text-button {
  background: none;
  border: 0;
  padding: 0;
  min-height: 40px;
  color: var(--muted);
  font-size: 0.75rem;
}
.instrument-chip {
  font-size: 0.68rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 12px;
  white-space: nowrap;
}
.workspace {
  min-width: 0;
}
.chart {
  padding: 36px clamp(20px, 3vw, 48px) 64px;
  max-width: 1440px;
  margin: auto;
}
.page-heading,
.reader-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}
.chart h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.1rem, 3.5vw, 3.25rem);
  line-height: 1.14;
  letter-spacing: -0.045em;
  margin: 9px 0 12px;
}
.page-heading p,
.reader-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.actions,
.segmented,
.stage-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.library-heading-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.library-heading-actions #findOnline { justify-content: flex-start; }
.library-modes { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.library-mode-label { display: flex; align-items: center; gap: 10px; }
.library-mode-label > .ui-icon { width: 20px; height: 20px; color: var(--accent); }
.library-mode-label span { display: grid; gap: 2px; }
.library-mode-label strong { font-size: .88rem; }
.library-mode-label small { color: var(--muted); font-size: .76rem; }
@media (max-width: 550px) { .library-modes { align-items: flex-start; flex-direction: column; } }
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 26px;
}
.library-filters {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 720px;
}
.library-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}
.library-search .ui-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  width: 18px;
}
.library-search input {
  padding-left: 43px;
  background: #fff;
}
.library-scope select { min-width: 132px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.search-clear-field { position: relative; display: block; flex: 1; min-width: 0; }
.search-clear-field > input { width: 100%; padding-right: 38px !important; }
.search-clear-field > input::-webkit-search-cancel-button,
.search-clear-field > input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear-button { position: absolute; z-index: 1; top: 50%; right: 6px; display: grid; width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.search-clear-button:hover, .search-clear-button:focus-visible { background: #00000012; color: var(--ink); }
.library-toolbar > span {
  font-size: 0.75rem;
  white-space: nowrap;
}
.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 20px;
}
.library-toolbar > .muted { display: none; }
.library-view-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -12px 0 14px; }
.library-view-controls > span { font-size: .75rem; }
.library-view-actions { display: flex; align-items: center; gap: 8px; }
.library-sort { position: relative; display: flex; align-items: center; color: var(--muted); }
.library-sort .ui-icon { position: absolute; left: 9px; z-index: 1; width: 16px; height: 16px; pointer-events: none; }
.library-sort select { min-height: 38px; width: 112px; padding: 7px 28px 7px 31px; font-size: .75rem; }
.song-grid.song-list { grid-template-columns: 1fr; gap: 8px; }
.song-list .song-card { display: flex; align-items: stretch; min-height: 76px; }
.song-list .song-art { flex: 0 0 80px; height: auto; min-height: 76px; }
.song-list .song-art .ui-icon { width: 32px; height: 32px; }
.song-list .song-card-content { flex: 1; min-width: 0; padding: 10px 14px; }
.song-list .song-card h3 { margin: 2px 0; }
.song-list .song-card p { margin: 0; }
.song-list .song-card-footer { border: 0; padding-top: 4px; }
.song-list .ensemble-song-card, .song-compact .ensemble-song-card { border: 0; border-left: 6px solid #bd6079; }
.song-grid.song-compact { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px; }
.song-compact .song-card { display: flex; align-items: stretch; min-height: 52px; border-radius: 10px; }
.song-compact .song-card:hover { transform: none; }
.song-compact .song-art { flex: 0 0 52px; height: auto; min-height: 52px; }
.song-compact .song-art::before { inset: 8px 0; background-size: auto 11px; }
.song-compact .song-art .ui-icon { width: 24px; height: 24px; }
.song-compact .song-art > span { right: 3px; bottom: 3px; padding: 0 3px; border-radius: 4px; font-size: .55rem; }
.song-compact .song-card-content { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 7px 10px; }
.song-compact .song-card .tiny-label, .song-compact .song-card-footer { display: none; }
.song-compact .song-card h3 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.song-compact .song-card p { min-width: 0; max-width: 42%; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; }
.song-card {
  display: block;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.song-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px #20382f0d;
  background: white;
}
.ensemble-song-card { background: #fff0f3; border-color: #cf7f93; box-shadow: inset 4px 0 #bd6079; }
.ensemble-song-card:hover { background: #fce2e8; }
.ensemble-song-card .tiny-label { color: #87384e; }
.song-art {
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #e7ecdf;
  color: #789571;
}
.song-art .ui-icon {
  width: 52px;
  height: 52px;
  stroke-width: 1;
  transform: rotate(-7deg);
}
.song-art::before {
  content: "";
  position: absolute;
  inset: 22px 0;
  background: repeating-linear-gradient(
    transparent 0 16px,
    #9aaa8b1c 16px 17px
  );
}
.song-art > span {
  position: absolute;
  bottom: 12px;
  right: 14px;
  border: 1px solid #fff8;
  background: #ffffff90;
  border-radius: 8px;
  color: #4a6444;
  padding: 5px 10px;
  font-size: 0.75rem;
}
.art-1 {
  background: #eee6db;
  color: #b59a77;
}
.art-2 {
  background: #e3e9ed;
  color: #8d9faa;
}
.art-3 {
  background: #eae4ed;
  color: #a195ad;
}
.song-card-content {
  padding: 20px;
}
.song-card h3 {
  font-size: 1.05rem;
  margin: 9px 0 6px;
  letter-spacing: -0.025em;
}
.song-card p {
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 400;
  margin-bottom: 22px;
}
.song-card-footer {
  border-top: 1px solid #edf0ea;
  padding-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 0.64rem;
  color: var(--muted);
  font-weight: 400;
}
.song-card-footer span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-badge { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 3px 7px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1; }
.workflow-badge .ui-icon { width: 14px; height: 14px; }
.workflow-green { background: #dff4e5; color: #17673a; }
.workflow-blue { background: #e2efff; color: #195da8; }
.workflow-amber { background: #fff0ca; color: #8c5d00; }
.workflow-purple { background: #eee5ff; color: #6542a3; }
.workflow-rose { background: #fde5e9; color: #a13c56; }
.workflow-gray { background: #ecefed; color: #526158; }
.workflow-select { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; }
.workflow-select select { width: auto; min-width: 130px; }
.is-loading .ui-icon { animation: gigalong-spin .8s linear infinite; }
@keyframes gigalong-spin { to { transform: rotate(360deg); } }
.empty-state {
  padding: 56px 20px;
  text-align: center;
  grid-column: 1/-1;
  color: var(--muted);
}
.empty-state .ui-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
}
.muted {
  color: var(--muted);
}
.surface,
.item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-grid {
  display: grid;
  gap: 18px;
  max-width: 960px;
}
.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.small-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}
.disclosure {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  margin-bottom: 24px;
}
.disclosure summary {
  padding: 17px 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.disclosure summary .muted {
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 12px;
}
.disclosure-body {
  padding: 6px 20px 22px;
}
.reader-heading {
  margin-bottom: 18px;
}
.chart-facts {
  display: flex;
  gap: 10px 22px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 24px;
}
.chart-facts strong {
  color: var(--ink);
}
.reader-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}
.text-size {
  margin-top: 14px;
}
.practice-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  grid-column: 1/-1;
}
.practice-controls input {
  width: 150px;
}
.chart-body {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 28px;
  font-size: var(--chart-size, 20px);
  line-height: 1.75;
}
.chart-sharing {
  margin-top: 24px;
}
.chart-sharing .disclosure-body {
  display: grid;
  gap: 16px;
  max-width: 600px;
}
.danger-text {
  color: #a3463e;
}
.section {
  color: var(--accent-2);
  font-size: 0.8em;
  font-weight: 700;
  margin-top: 18px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.notice {
  background: #fff4e8;
  border: 1px solid #e9d6b9;
  border-radius: 10px;
  color: #755b32;
  padding: 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.pill {
  background: #edf2e9;
  border-radius: 20px;
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.72rem;
  margin: 8px 4px 0 0;
}
.ensemble-forms {
  margin-bottom: 28px;
}
.ensemble-forms h3 {
  font-size: 1.1rem;
  margin: 0;
}
.online-form,
.online-import {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 24px 0;
}
.online-form label,
.online-import label {
  flex: 1;
}
.online-results {
  display: grid;
  gap: 18px;
}
.online-artist-group { display: grid; gap: 8px; }
.online-artist-group h3, .performance-artist-group h3 { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.online-result {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 20px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.online-result-info {
  display: grid;
  gap: 6px;
}
.online-result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.online-result-button { padding: 8px 12px; font-size: .8rem; }
.online-result-button .ui-icon { width: 20px; height: 20px; flex: none; }
.online-rating { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; font-size: 0.94rem; }
.online-rating-star { color: #b77513; font-size: 1.2rem; line-height: 1; }
.online-rating-scale { color: var(--muted); font-weight: 400; font-size: .78rem; }
.online-rating-votes { color: var(--muted); font-size: .78rem; margin-left: 4px; }
.online-result small,
.online-result > span:last-child {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.76rem;
}
.online-preview .chart-body {
  margin-top: 20px;
}
.online-preview .stage-tools {
  margin-top: 16px;
}
.online-detail { --online-size: 16px; }
.online-detail-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.online-detail-header h2 { font-size: 1.25rem; margin: 6px 0 2px; }
.online-detail-header p { font-size: .82rem; color: var(--muted); margin: 0; }
.online-detail-header .tiny-label { display: block; margin-top: 8px; }
.online-detail-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.online-detail .online-import { margin: 0; gap: 8px; }
.online-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 16px; }
.online-detail .online-chart { font-size: var(--online-size); line-height: 1.45; }
.online-controls { display: grid; min-width: 0; gap: 10px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; position: sticky; top: 170px; }
.online-controls p { margin: 0; }
.online-controls .transpose-control { flex-wrap: wrap; }
.online-formats { width: 100%; }
.online-controls .online-formats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.online-controls .online-formats button { min-width: 0; min-height: 44px; padding: 8px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; font-size: .76rem; }
.online-controls .online-formats button:nth-child(odd) { border-left: 0; }
.online-controls .online-formats button:nth-child(n + 3) { border-top: 1px solid var(--line); }
.online-stage-dark .online-controls .online-formats button { border-color: #fff; }
body.online-preview-active { background: #fff; }
.online-stage { min-height: 100dvh; padding: 8px; background: #fff; color: #111; }
.online-stage .online-detail-header, .online-stage .online-controls { box-shadow: none; border-color: #aaa; }
.online-stage .online-chart { border: 0; box-shadow: none; padding: 4px; background: transparent; color: inherit; }
.online-stage-dark { background: #000; color: #fff; }
.online-stage-dark .online-detail-header, .online-stage-dark .online-controls { background: #000; color: #fff; border-color: #fff; }
.online-stage-dark .online-detail-header p, .online-stage-dark .field-hint, .online-stage-dark label, .online-stage-dark .segment-chord, .online-stage-dark .chordpro-token, .online-stage-dark .section, .online-stage-dark a { color: #fff; }
.online-stage-dark button, .online-stage-dark select { background: #000; color: #fff; border-color: #fff; }
.online-stage-dark .format-control button[aria-pressed="true"], .online-stage-dark button.primary { background: #fff; color: #000; }
@media (max-width: 740px) {
  .online-detail-header { align-items: start; flex-wrap: wrap; }
  .online-detail-layout { grid-template-columns: 1fr; }
  .online-controls { position: static; order: -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-controls > strong, .online-controls > .field-hint, .online-controls > a, .online-controls > .online-formats { grid-column: 1 / -1; }
  .online-detail .online-import { flex-wrap: nowrap; }
}
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(ellipse at top left, #dce7d6, transparent 60%), var(--paper);
}
.auth-card {
  width: 100%;
  max-width: 470px;
  display: grid;
  gap: 20px;
  padding: 40px;
  border-radius: 22px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 20px 70px #20382f0c;
}
.auth-card h1 {
  font-family: Georgia, serif;
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  margin: 0;
}
.auth-card p {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}
.auth-card:has(#authPassword) > label[for="authPassword"] { margin-bottom: -14px; }
.password-input { position: relative; }
.password-input input { width: 100%; padding-right: 52px; }
.password-input .password-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 0; background: transparent; color: var(--muted); }
.password-toggle svg { width: 22px; height: 22px; }
.confirm-password { display: grid; gap: 6px; }
.confirm-password[hidden] { display: none; }
#passwordMatchStatus { color: var(--muted); }
#authConfirmPassword[aria-invalid="true"] { border-color: #b42318; }
.confirm-password:has(#authConfirmPassword[aria-invalid="true"]) #passwordMatchStatus { color: #b42318; }
.password-strength { display: grid; gap: 6px; color: var(--muted); font-size: .85rem; }
.password-strength meter { width: 100%; height: 10px; }
.password-strength small { color: var(--muted); }
.install-landing {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: radial-gradient(ellipse at top left, #dce7d6, transparent 60%), var(--paper);
}
.launch-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 32px;
  color: var(--ink);
  background: radial-gradient(ellipse at top left, #dce7d6, transparent 60%), var(--paper);
}
.launch-screen img { border-radius: 15px; box-shadow: 0 8px 24px #20382f24; }
.launch-screen strong { font: 400 1.8rem/1 Georgia, serif; }
.launch-screen p { margin: 0; color: var(--muted); }
.launch-spinner { width: 26px; height: 26px; border: 3px solid #244e3d33; border-top-color: var(--accent); border-radius: 50%; animation: gigalong-spin .8s linear infinite; }
.install-card {
  width: 100%;
  max-width: 470px;
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 20px 70px #20382f0c;
  text-align: center;
}
.install-card h1 { margin: 0; font: 400 2.4rem/1.05 Georgia, serif; letter-spacing: -0.04em; }
.install-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.install-card .language-picker { width: 100%; max-width: none; }
.install-card [data-install-app] { justify-self: center; }
.install-languages { display: flex; gap: 8px; }
.install-languages button { min-height: 44px; min-width: 44px; padding: 6px; font-size: 1.5rem; background: transparent; }
.install-languages button[aria-pressed="true"] { border-color: var(--accent); }
.install-instructions { font-size: .85rem; }
.segmented {
  background: #f1f4ef;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.segmented button {
  flex: 1;
  border: 0;
  background: none;
}
.segmented button.active {
  background: white;
  box-shadow: var(--shadow);
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .sidebar {
    padding: calc(24px + var(--safe-area-top)) 10px 16px;
  }
  .brand {
    font-size: 1.1rem;
    gap: 8px;
    margin-left: 4px;
  }
  .brand small {
    font-size: 0.38rem;
  }
  .sidebar-note {
    padding: 20px 10px;
  }
  .topbar {
    padding: 12px 24px;
  }
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .song-card-content {
    padding: 16px;
  }
}
@media (max-width: 740px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: calc(16px + var(--safe-area-top)) 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    margin: 0 0 15px;
  }
  .main-nav {
    display: flex;
    gap: 4px;
  }
  .nav-item {
    flex: 1;
    justify-content: center;
    padding: 12px 4px;
    font-size: 0.72rem;
    gap: 6px;
    border-radius: 9px 9px 0 0;
  }
  .nav-item .ui-icon {
    width: 18px;
  }
  .nav-item small {
    display: none;
  }
  .sidebar-footer {
    position: absolute;
    right: 16px;
    top: calc(12px + var(--safe-area-top));
    margin: 0;
    padding: 0;
    border: 0;
  }
  .profile-link {
    width: 40px;
    padding: 0;
  }
  .profile-link > span:last-child,
  .logout-link,
  .sidebar-note {
    display: none;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    min-height: 58px;
    padding: 12px 20px;
  }
  .chart {
    padding: 26px 20px 48px;
  }
  .page-heading {
    margin-bottom: 24px;
  }
  .page-heading .actions {
    width: 100%;
  }
  .library-heading-actions { align-items: flex-start; }
  .reader-controls {
    grid-template-columns: 1fr;
  }
  .cols {
    grid-template-columns: 1fr;
  }
  .disclosure summary .muted {
    display: block;
    margin: 6px 0 0;
  }
  .song-grid {
    gap: 12px;
  }
  .song-art {
    height: 105px;
  }
  .song-card h3 {
    font-size: 0.95rem;
  }
  .song-card .tiny-label {
    font-size: 0.52rem;
  }
  .instrument-chip {
    font-size: 0.6rem;
  }
  .online-form,
  .online-import {
    flex-wrap: wrap;
  }
  .online-form label {
    min-width: 100%;
  }
}
@media (max-width: 400px) {
  .song-grid {
    grid-template-columns: 1fr;
  }
  .auth-card, .install-card {
    padding: 28px;
  }
  .nav-item {
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.format-control {
  display: inline-flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.format-control button {
  border: 0;
  border-radius: 0;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  padding: 8px 3px;
  font-size: clamp(0.58rem, 2vw, 0.76rem);
}
.format-control button + button {
  border-left: 1px solid var(--line);
}
.format-control button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
.chart-line {
  white-space: pre-wrap;
}
.chord-word { display: inline-flex; max-width: 100%; vertical-align: bottom; }
.chord-segment {
  display: inline-grid;
  grid-template-rows: 1.1em auto;
  vertical-align: bottom;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
}
.segment-chord {
  color: var(--accent);
  font-weight: 400;
  line-height: 1.1;
  white-space: pre;
}
.segment-lyric {
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Catalog uses a rose cue; performance uses the app's green accent. */
body:not(.performance) .chart-body .chord-syllable {
  color: #b51f61;
  font-weight: 700;
}
.plain-line,
.chordpro-line {
  min-height: 1.4em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chordpro-token {
  color: var(--accent);
  font-weight: 400;
}

.chord-only {
  padding-right: 0.6em;
}
.chart-cue {
  display: flex;
  align-items: baseline;
  gap: .45em;
  margin: .45em 0;
  padding: .38em .6em;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--ink);
  font-size: .85em;
  line-height: 1.35;
}
.chart-cue strong { color: var(--accent); font-size: .85em; }
.performance .chart-cue {
  display: grid;
  gap: .1em;
  margin: .6em 0;
  padding: .35em .55em;
  border-left-width: 3px;
  background: #102317;
  color: #e6f3e9;
  font-size: .9em;
  font-weight: 500;
  line-height: 1.25;
}
.performance .chart-cue strong {
  color: #9bd6ad;
  font-size: .66em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.stage-dark .performance .chart-cue,
.stage-dark .chart-cue {
  background: #102317;
  border-left-color: #76b88a;
  color: #e6f3e9;
}
.stage-dark .chart-cue strong { color: #9bd6ad; }
.rhythm-line {
  display: inline-flex;
  align-items: stretch;
  min-height: 1.4em;
  white-space: nowrap;
}
.rhythm-beat {
  display: inline-flex;
  align-items: flex-start;
  min-width: 2.4em;
}
.rhythm-beat .segment-chord {
  min-width: 0;
}
.rhythm-bar {
  color: var(--muted);
  line-height: 1.1;
  padding: 0 .3em;
}

.key-control {
  display: grid;
  gap: 10px;
  max-width: 440px;
}
.key-control-info {
  color: var(--muted);
  font-size: 0.8rem;
}
.transpose-control {
  display: flex;
  gap: 8px;
  align-items: center;
}
.transpose-control > span {
  font-size: 0.82rem;
  font-weight: 700;
}
.transpose-control button {
  min-width: 42px;
}
.stage-menu .transpose-control .stage-key-reset {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 9px;
}
.stage-menu .transpose-control .stage-key-reset .ui-icon { width: 20px; height: 20px; }

/* The stage is an unframed reading surface; secondary actions live in the menu. */
body.performance {
  background: #fff;
}
html.stage-fits,
html.stage-fits body.performance {
  overflow-y: hidden;
  overscroll-behavior-y: none;
}
.performance .stage {
  --stage-drawer-width: min(340px, 45vw);
  /* Capacitor's iOS WebView extends beneath the system status area.  Reserve
     that inset for both the fixed controls and the chart rather than hiding
     the status bar or leaving the controls behind the clock/notch. */
  --stage-safe-top: var(--safe-area-top);
  background: #fff;
  color: #111;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  touch-action: pan-y;
}
.performance .stage-content {
  padding: 0;
  touch-action: pan-y;
}
.performance .stage.drawer-open .stage-content {
  margin-left: calc(var(--stage-drawer-width) + 8px);
}
.performance .stage-content h1 {
  font-size: clamp(1.7rem, 5vw, 3.3rem);
  line-height: 1.05;
  margin: 0;
  padding: calc(56px + var(--stage-safe-top)) 8px 0;
}
.performance .stage-song-meta {
  font-size: 0.85rem;
  padding: 4px 8px;
}
.performance .stage-content .chart-body {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 8px;
  max-width: none;
}
.performance .stage-content .segment-lyric.chord-syllable {
  color: var(--accent);
  font-weight: 700;
}
.performance .stage-content .section {
  margin-top: 0.25em;
  line-height: 1.2;
}
.performance .stage-compact .chart-body {
  line-height: 1.1;
  column-gap: 12px;
}
.stage-compact .chord-segment {
  grid-template-rows: 1em auto;
}
.stage-compact .segment-chord,
.stage-compact .segment-lyric {
  line-height: 1;
}
.stage-compact .plain-line,
.stage-compact .chordpro-line {
  min-height: 1em;
}
.stage-compact .section {
  margin-top: 0.35em;
}
.stage-compact .chord-only {
  padding-right: 0.2em;
}
.stage-menu #stageCompact[aria-pressed="true"] {
  background: #111;
  color: #fff;
}
.stage-dark .stage-menu #stageCompact[aria-pressed="true"] {
  background: #fff;
  color: #000;
}
.stage-menu {
  position: fixed;
  z-index: 11;
  top: calc(52px + var(--stage-safe-top));
  right: 4px;
  height: auto;
  max-height: calc(100dvh - 60px - var(--stage-safe-top));
  width: min(340px, calc(100vw - 16px));
  border: 1px solid #111;
  border-radius: 8px;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.2);
  background: #fff;
  color: #111;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.stage-menu-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
}
.stage-menu-heading button {
  font-size: 1.2rem;
}
.stage-menu-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #aaa;
}
.stage-menu-section > span {
  font-weight: 800;
}
.stage-menu-section label {
  color: inherit;
  text-transform: none;
}
.stage-menu-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stage-appearance-row { display: flex; align-items: end; gap: 14px; }
.stage-appearance-row > label { flex: 1; min-width: 0; }
.stage-font-controls { display: grid; gap: 7px; font-size: .8rem; font-weight: 600; }
.stage-font-controls > div { display: flex; }
.stage-font-controls button, .stage-dark .stage-menu .stage-font-controls button { border: 0; padding: 8px; background: transparent; }
.stage-menu .format-control {
  width: 100%;
}
.projection-controls { display: grid; gap: 8px; }
.projection-controls small { line-height: 1.4; }
.projection-settings { margin-top: 20px; max-width: 340px; }
.spotify-settings { margin-top: 20px; }
.spotify-panel { display: grid; gap: 10px; min-width: 0; }
.spotify-panel p { margin: 0; }
.spotify-panel details > * + * { margin-top: 10px; }
.spotify-callback-url { display: block; white-space: normal; overflow-wrap: anywhere; font-size: .78rem; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.spotify-devices, .spotify-search { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.spotify-devices label, .spotify-search input { flex: 1; min-width: 120px; }
.spotify-results { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.spotify-results button { display: flex; text-align: left; justify-content: space-between; }
.spotify-results small { display: block; font-weight: 400; margin-top: 4px; }
.spotify-chart { margin-bottom: 16px; }
.stage-dark .spotify-panel a { color: #fff; }
.stage-exit {
  margin-top: auto;
}
body.stage-dark,
.stage-dark .stage,
.stage-dark .stage-content,
.stage-dark .stage-content .chart-body {
  background: #000;
  color: #fff;
}
.stage-dark .stage-content .segment-lyric.chord-syllable {
  color: #86c99c;
}
.stage-dark .stage-content .section,
.stage-dark .stage-content .segment-chord,
.stage-dark .stage-content .chordpro-token {
  color: #fff;
}
.stage-dark .stage-menu {
  background: #000;
  color: #fff;
  border: 1px solid #fff;
}
.stage-dark .stage-menu button,
.stage-dark .stage-menu select,
.stage-dark .stage-menu input {
  background: #000;
  color: #fff;
  border-color: #fff;
}
.stage-dark select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
}
.stage-dark .stage-menu .format-control {
  border-color: #fff;
}
.stage-dark .stage-menu .format-control button[aria-pressed="true"] {
  background: #fff;
  color: #000;
}
.stage-dark .stage-menu-section {
  border-color: #fff;
}
.stage-dark .key-control-info {
  color: #fff;
}

.stage-dark .stage-menu input[type="range"] {
  accent-color: #fff;
}

/* Keep lines together while the browser balances the chart into fitting columns. */
.chart-body {
  column-width: auto;
  column-count: 1;
  column-gap: clamp(24px, 4vw, 64px);
  column-fill: balance;
}
.chart-body > .chart-line,
.chart-body > .chordpro-line,
.chart-body > .section {
  break-inside: avoid;
}
.chart-body > .section {
  break-after: avoid;
}

/* Keep the chart readable while the non-modal performance controls are open. */

.stage-toolbar {
  position: fixed;
  top: calc(4px + var(--stage-safe-top));
  right: 4px;
  z-index: 12;
  display: flex;
  gap: 4px;
}
.stage-drawer-toggle {
  position: fixed;
  top: calc(4px + var(--stage-safe-top));
  left: 4px;
  z-index: 12;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #111;
  border-radius: 5px;
  background: #fff;
  color: #111;
  font-size: 1.4rem;
}
.stage-drawer {
  position: fixed;
  top: calc(52px + var(--stage-safe-top));
  left: 4px;
  z-index: 11;
  width: var(--stage-drawer-width);
  max-height: calc(100dvh - 60px - var(--stage-safe-top));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
  color: #111;
  box-shadow: 0 4px 22px #0003;
}
.stage-drawer-list {
  display: grid;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}
.stage-drawer-footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.stage-drawer-footer button { width: 46px; height: 46px; padding: 10px; }
.stage-drawer-footer .ui-icon { width: 24px; height: 24px; }
.stage-drawer-list button {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 2px;
  text-align: left;
}
.stage-drawer-list small {
  font-weight: 400;
}
.stage-drawer-list button[aria-current="true"] {
  background: #111;
  color: #fff;
}
.stage-dark .stage-drawer-toggle,
.stage-dark .stage-drawer,
.stage-dark .stage-drawer button {
  background: #000;
  color: #fff;
  border-color: #fff;
}
.stage-dark .stage-drawer-list button[aria-current="true"] {
  background: #fff;
  color: #000;
}
.stage-toolbar button,
.stage-navigation button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #111;
  border-radius: 5px;
  background: #fff;
  color: #111;
  font-weight: 800;
  font-size: 1rem;
}
.stage-progress {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: #fff;
  color: #111;
  font-weight: 700;
}
.stage-dark .stage-progress { background: #000; color: #fff; }
.stage-navigation {
  position: fixed;
  z-index: 12;
  top: calc(4px + var(--stage-safe-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stage-navigation button { font-size: 1.8rem; line-height: 1; }
.desktop-stage-control { display: contents; }
.mobile-stage-control { display: none; }
.stage-toolbar #stageMenuToggle {
  font-size: 1.4rem;
}
.stage-toolbar #stageScroll {
  display: grid;
  place-items: center;
}
.stage-toolbar #stageScroll .ui-icon {
  width: 22px;
  height: 22px;
}
.stage-toolbar #stageScroll[aria-pressed="true"] {
  background: #111;
  color: #fff;
}
.speed-control { display: inline-flex; align-items: center; justify-content: center; gap: 1px; }
.speed-control .ui-icon { width: 18px; height: 18px; }
.speed-control span { font-size: .85rem; line-height: 1; }
.stage-toolbar-feedback { position: absolute; top: calc(100% + 6px); right: 0; padding: 7px 10px; border-radius: 8px; color: #fff; background: rgb(20 52 36 / .88); box-shadow: 0 3px 12px #0004; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.stage-dark .stage-toolbar-feedback { color: #000; background: rgb(255 255 255 / .9); }
.stage-dark .stage-toolbar button,
.stage-dark .stage-navigation button {
  border-color: #fff;
  background: #000;
  color: #fff;
}
.stage-dark .stage-toolbar #stageScroll[aria-pressed="true"] {
  background: #fff;
  color: #000;
}

@media (min-width: 900px) {
  .performance .stage.menu-open .stage-content {
    width: calc(100% - 352px);
  }
}
@media (max-width: 899px) {
  .stage-menu {
    top: calc(52px + var(--stage-safe-top));
    bottom: auto;
    max-height: calc(100dvh - 60px - var(--stage-safe-top));
  }
}

/* Use normal-weight chords and high-contrast white notation on the dark stage. */

.stage-dark .stage-content,
.stage-dark .stage-content .chart-body,
.stage-dark .stage-content .section,
.stage-dark .stage-content .segment-chord,
.stage-dark .stage-content .segment-lyric,
.stage-dark .stage-content .chordpro-token {
  color: #fff;
}

.setlist-list {
  margin-top: 24px;
}
.setlist-page-controls { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.setlists-editing { position: fixed; z-index: 80; inset: 0; overflow: auto; padding: clamp(18px, 5vw, 56px); background: var(--panel); color: var(--ink); }
.setlists-editing > .page-heading, .setlists-editing > .setlist-page-controls { display: none; }
.setlists-editing .setlist-list { max-width: 920px; margin: 0 auto; }
.setlists-editing .setlist-card { min-height: calc(100dvh - 2 * clamp(18px, 5vw, 56px)); }
.setlist-view-toggle { display: inline-flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.setlist-view-toggle button { display: grid; place-items: center; width: 40px; min-width: 40px; height: 38px; min-height: 38px; padding: 8px; border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.setlist-view-toggle button + button { border-left: 1px solid var(--line); }
.setlist-view-toggle button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.setlist-view-toggle .ui-icon { width: 19px; height: 19px; }
.setlist-create-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(88dvh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 60px #0006; }
.setlist-create-dialog::backdrop { background: #0008; }
.setlist-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.setlist-dialog-heading h3 { margin: 0; }
.setlist-dialog-heading button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; }
.setlist-card {
  padding: 16px;
}
.setlist-cards { display: grid; grid-template-columns: repeat(auto-fill, min(100%, 280px)); align-items: stretch; }
.shell .setlist-cards .setlist-card { display: flex; flex-direction: column; height: 360px; }
.setlist-cards .setlist-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px 6px; }
.setlist-cards .setlist-heading > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.setlist-cards .setlist-heading .actions { grid-column: 1 / -1; grid-row: 2; display: flex; width: 100%; margin: 0; flex-wrap: nowrap; gap: 6px; }
.setlist-cards .setlist-heading .actions [data-edit-setlist] { order: 0; }
.setlist-cards .setlist-heading .actions [data-play-setlist] { order: 1; flex: 1 1 0; min-width: 0; overflow: hidden; padding-inline: 4px; font-size: .85rem; }
.setlist-cards .setlist-heading .actions [data-delete-setlist] { order: 2; }
.setlist-cards .offline-badge { display: block; color: var(--muted); font-size: .7rem; }
.setlist-cards .setlist-heading .setlist-offline-actions { grid-column: 2; grid-row: 1; }
.setlist-cards .setlist-items { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-bottom: 10px; }
.setlist-cards .setlist-card::after { content: attr(data-song-count); margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; font-weight: 700; }
.setlist-perform-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setlist-compact .setlist-heading { cursor: pointer; }
.setlist-compact .setlist-heading::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 1.2rem; }
.setlist-compact .setlist-collapsed > :not(.setlist-heading) { display: none; }
.setlist-compact .setlist-collapsed .setlist-heading::after { transform: rotate(-90deg); }
.setlist-name-editor { display: grid; gap: 6px; max-width: 440px; font-size: .85rem; font-weight: 700; }
.setlist-name-editor > span { display: flex; gap: 6px; }
.setlist-name-editor input { flex: 1; min-width: 0; }
.setlist-name-editor button { width: 38px; min-width: 38px; min-height: 38px; padding: 6px; }
.setlist-name-editor #applySetlistName { color: var(--accent); }
.setlist-name-edit { display: inline-grid; place-items: center; width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin-left: 6px; padding: 6px; vertical-align: middle; }
.setlist-name-edit .ui-icon { width: 16px; height: 16px; }
.setlist-icon-action { display: inline-grid; place-items: center; width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 8px; }
.setlist-icon-action .ui-icon { width: 18px; height: 18px; }
.setlist-icon-action.danger { color: #bd3c35; border-color: #d98580; }
.setlist-heading {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.setlist-heading .actions { margin-left: auto; }
.setlist-items {
  padding-left: 1.8rem;
}
.setlist-items li {
  padding: 5px 0;
}
.setlist-items li > span:first-child {
  display: inline-block;
  min-width: 14ch;
}
.setlist-reorder {
  display: inline-flex;
  gap: 6px;
  margin-left: 12px;
}
.setlist-reorder button {
  min-width: 42px;
  font-size: 1.1rem;
}
.performance .segment-chord,
.performance .chordpro-token {
  font-weight: 600;
}

.setlist-items li[data-drag-row] {
  position: relative;
  padding: 7px 0;
}
.setlist-items .setlist-title {
  display: inline-block;
  min-width: 14ch;
}
.setlist-cues {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 500;
}
.setlist-drag {
  touch-action: none;
  cursor: grab;
  min-width: 38px;
  font-size: 1.2rem;
  letter-spacing: -3px;
  margin-right: 10px;
}
.setlist-drag.dragging {
  cursor: grabbing;
}
.setlist-items .drop-before::before,
.setlist-items .drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-2);
}
.setlist-items .drop-before::before {
  top: 0;
}
.setlist-items .drop-after::after {
  bottom: 0;
}
.setlist-add {
  display: flex;
  gap: 8px;
  align-items: end;
  margin: 16px 0;
}
.setlist-add label {
  flex: 1;
}
.setlist-add #addSetlistSong { display: none; }
.offline-badge, .offline-readiness { display: none; }
.setlist-offline-actions { position: relative; display: inline-flex; gap: 6px; }
.setlist-offline-actions button { display: grid; place-items: center; width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 6px; }
.setlist-cards .setlist-offline-actions button { width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 3px; font-size: .8rem; }
.setlist-heading .setlist-offline-actions { margin-left: 0; align-self: flex-start; }
.setlist-offline-popover { position: absolute; z-index: 5; top: calc(100% + 8px); right: 0; width: min(300px, 70vw); padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 24px #0003; font-size: .8rem; font-weight: 500; line-height: 1.4; }
.setlist-edit-hint { margin: 0; font-size: .85rem; line-height: 1.4; }
.setlist-note {
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .setlist-page-controls { align-items: stretch; flex-direction: column; }
  .setlist-view-toggle { align-self: flex-start; }
  .setlist-add {
    flex-wrap: wrap;
  }
  .setlist-add label {
    min-width: 100%;
  }
}

@media (max-width: 590px) {
  .stage-navigation {
    left: 50px;
    transform: none;
  }
}
@media (max-width: 420px) {
  .stage-toolbar { gap: 2px; }
  .stage-toolbar button, .stage-navigation button { width: 34px; }
}
.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
.chart-guide-link {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
}
.chart-editor-shortcuts {
  position: sticky;
  bottom: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 6px 20px #0b24181a;
}
.chart-chord-shortcuts, .chart-modifier-shortcuts { display: flex; flex-wrap: wrap; gap: 6px; }
.chart-editor-shortcuts button { min-height: 34px; padding: 5px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chart-chord-shortcuts button { min-width: 30px; padding-inline: 5px; border: 0; background: transparent; color: var(--accent); font-weight: 500; }
.chart-chord-shortcuts button:hover, .chart-chord-shortcuts button:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart-modifier-shortcuts { padding-left: 8px; border-left: 1px solid var(--line); }
.chart-modifier-shortcuts button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: white; }
.chart-preview-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  margin-left: auto;
  padding: 5px !important;
}
.chart-preview-toggle .ui-icon { width: 18px; height: 18px; }
.chart-editor-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: stretch; }
.chart-editor-workspace.preview-open { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.chart-editor-field { display: grid; min-width: 0; grid-template-rows: auto auto minmax(0, 1fr); }
.chart-editor-field textarea { min-height: 360px; height: min(56vh, 640px); resize: vertical; }
.chart-guide-dialog { width: min(620px, calc(100vw - 32px)); }
.chart-guide-content { display: grid; gap: 12px; margin-top: 16px; }
.chart-guide-content p { margin: 0; line-height: 1.5; }
.chart-guide-content code { overflow-wrap: anywhere; color: var(--accent); }
.chart-cue-dialog form { display: grid; gap: 14px; }
.chart-cue-dialog label { display: grid; gap: 6px; }
.editor-chart-preview {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.editor-chart-preview > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.editor-chart-preview header small { color: var(--muted); font-size: .78rem; }
.preview-instrument-label { display: flex; align-items: center; gap: 8px; }
.preview-instrument-label select { width: auto; min-height: 34px; padding: 5px 32px 5px 8px; background-position: right 8px center; }
.editor-chart-preview .chart-body {
  min-height: 0;
  height: min(56vh, 640px);
  column-count: auto;
  column-width: auto;
  column-fill: auto;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
@media (max-width: 800px) {
  .chart-editor-workspace.preview-open { grid-template-columns: minmax(0, 1fr); }
  .editor-chart-preview .chart-body { height: min(46vh, 540px); }
}
@media (max-width: 520px) {
  .chart-editor-shortcuts { bottom: 4px; }
  .chart-modifier-shortcuts { width: 100%; padding: 8px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}
.editor-save {
  position: sticky;
  bottom: 8px;
  display: flex;
  gap: 10px;
  background: #ffffffed;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.song-picker {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
}
.song-picker legend {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 8px;
  margin-left: 10px;
  color: #58695e;
}
.song-picker label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf0ea;
  cursor: pointer;
  min-height: 58px;
}
.song-picker label:last-child {
  border-bottom: 0;
}
.song-picker input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.song-picker small {
  display: block;
  margin-top: 4px;
  font-weight: 400;
  color: var(--muted);
}
.picker-key {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}
.import-settings {
  margin-top: 24px;
}
.import-settings p {
  color: var(--muted);
  font-size: 0.85rem;
}
.settings-panel {
  position: relative;
  overflow: hidden;
  border-color: #cfe0d1;
  background: linear-gradient(135deg, #f7fbf6 0%, #ffffff 58%, #eef7f0 100%);
}
.settings-panel::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -74px;
  top: -92px;
  border-radius: 50%;
  background: #77a9851c;
  pointer-events: none;
}
.settings-panel > * { position: relative; }
.settings-panel > :is(h3, .spotify-panel) { padding-right: 42px; }
.settings-panel-icon {
  position: absolute;
  z-index: 1;
  top: clamp(18px, 2.4vw, 24px);
  right: clamp(18px, 2.4vw, 24px);
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #397048;
  pointer-events: none;
}
.settings-panel-icon .ui-icon { width: 22px; height: 22px; }
.app-version-settings {
  min-height: 148px;
}
.app-version-heading,
.app-version-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-version-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #557661;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.app-version-settings h3 { font-size: clamp(1.15rem, 2vw, 1.35rem); }
.app-version-number { display: block; margin-top: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.app-version-orb {
  animation: none;
}
.app-version-settings > p { position: relative; max-width: 48ch; margin: 14px 0 18px; line-height: 1.5; }
.app-version-actions { justify-content: flex-start; flex-wrap: wrap; }
.app-version-actions button { min-width: 190px; }
#updateCheckStatus { min-height: 1.25em; color: #3f625a; font-weight: 650; }
body.app-dark:not(.performance) .settings-panel { border-color: #41694c; background: linear-gradient(135deg, #213c2b, #213128 62%, #294332); }
body.app-dark:not(.performance) .app-version-eyebrow { color: #a6d7b4; }
body.app-dark:not(.performance) .settings-panel-icon { color: #b6e6c1; }
body.app-dark:not(.performance) #updateCheckStatus { color: #b6e6c1; }
@media (max-width: 520px) {
  .app-version-heading { align-items: flex-start; }
  .app-version-actions { align-items: flex-start; flex-direction: column; }
  .app-version-actions button { width: 100%; }
}
.documentation-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.documentation-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; box-sizing: border-box; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; }
.documentation-actions a:hover { border-color: var(--accent); color: var(--accent); }
.documentation-settings .documentation-version { margin-top: 4px; text-align: left; }
.profile-signout {
  margin-top: 24px;
}
.profile-details { display: grid; max-width: 960px; margin: 0 0 16px; }
.profile-details.settings-panel .profile-name-settings { padding-right: 64px; }
.profile-details-block { display: grid; gap: 14px; padding: 22px 24px; }
.profile-details #settingsForm { max-width: none; margin: 0; }
.profile-name-summary { display: flex; align-items: center; gap: 4px; }
.profile-name-summary strong { font-size: 1.05rem; }
.profile-name-editor { display: grid; gap: 6px; max-width: 440px; font-size: .85rem; font-weight: 700; }
.profile-name-editor > span { display: flex; gap: 6px; }
.profile-name-editor input { flex: 1; min-width: 0; }
.profile-name-editor button { width: 38px; min-width: 38px; min-height: 38px; padding: 6px; }
.profile-name-editor #applyProfileName { color: var(--accent); }
.profile-language { align-content: start; }
.profile-language > small, .profile-data > small { color: var(--muted); font-size: .76rem; }
.profile-data p { margin: 0; color: var(--muted); font-size: .85rem; }
.profile-data button { justify-self: start; }
.profile-panel { padding: 22px 24px; }
.trash-panel { max-width: 720px; }
.profile-panel-heading h3 { margin: 0; }
.profile-panel-heading p { margin: 6px 0 0; }
.profile-panel.settings-panel .profile-panel-heading { padding-right: 42px; }
.trash-list, .security-stack { display: grid; gap: 10px; margin-top: 18px; }
.trash-list { max-height: 310px; overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
.clear-trash-button { margin-top: 16px; }
.trash-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.trash-entry-copy { min-width: 0; display: grid; gap: 3px; }
.trash-entry-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-entry-copy span { color: var(--muted); font-size: .78rem; }
.trash-entry-actions { display: flex; flex-wrap: nowrap; gap: 8px; }
.trash-entry-actions button { min-height: 38px; white-space: nowrap; }
.empty-panel-message { display: block; padding: 14px 0 2px; color: var(--muted); }
.security-block { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.security-block > div > strong { font-size: .9rem; }
.security-block p { margin: 4px 0 0; }
.security-block > button { justify-self: start; }
.security-revoke { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 10px; }
.security-revoke label { display: grid; gap: 6px; font-size: .8rem; font-weight: 700; }
.security-revoke small { grid-column: 1 / -1; }
.two-factor-block { gap: 16px; }
.two-factor-heading strong { font-size: .98rem; }
.two-factor-heading p { max-width: 54ch; }
.two-factor-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px);
  grid-template-areas:
    "toggle password"
    "actions status";
  align-items: end;
  gap: 12px 16px;
}
.two-factor-toggle {
  grid-area: toggle;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #dce6dd;
  border-radius: 10px;
  background: #f7faf7;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.two-factor-toggle input {
  appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #bcc8c0;
  cursor: pointer;
}
.two-factor-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0003;
  transition: transform .18s;
}
.two-factor-toggle input:checked { background: var(--accent); }
.two-factor-toggle input:checked::after { transform: translateX(18px); }
.two-factor-toggle input:focus-visible { outline: 3px solid #89b39a; outline-offset: 3px; }
.two-factor-password { grid-area: password; display: grid; gap: 6px; color: #58695e; font-size: .8rem; font-weight: 700; }
.two-factor-actions { grid-area: actions; display: flex; align-items: center; gap: 10px; }
.two-factor-status { grid-area: status; align-self: center; color: var(--muted); font-size: .78rem; }
input,
select,
textarea {
  font-weight: 400;
}
.file-import {
  min-width: 200px;
  flex: 1;
}
.file-import input {
  font-size: 0.78rem;
}
.data-transfer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.data-transfer-action { display: grid; align-content: start; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.data-transfer-action strong { font-size: .88rem; }
.data-transfer-action p { min-height: 2.6em; margin: 0; }
.data-transfer-action button, .data-transfer-action .file-import { box-sizing: border-box; width: 100%; min-width: 0; min-height: 42px; margin-top: auto; }
.data-transfer-action .file-import { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-size: .8rem; font-weight: 700; }
.data-transfer-action .file-import input { min-width: 0; flex: 1; font-weight: 400; }

@media (max-width: 740px) {
  .chart-body {
    padding: 18px;
  }
  .reader-heading .actions {
    width: 100%;
  }
  .online-result {
    flex-wrap: wrap;
  }
  .setlist-heading .actions {
    width: 100%;
  }
  .setlist-reorder {
    margin-left: 0;
  }
  .profile-panel { padding: 18px; }
  .trash-entry { grid-template-columns: 1fr; gap: 10px; }
  .trash-entry-actions { width: 100%; }
  .trash-entry-actions button { flex: 1; min-width: 0; padding-inline: 8px; }
  .security-revoke { grid-template-columns: 1fr; }
  .security-revoke button { justify-self: start; }
  .two-factor-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "toggle"
      "password"
      "actions"
      "status";
  }
  .two-factor-actions button { width: 100%; }
}
.connection-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-status-actions { position: relative; display: inline-flex; gap: 4px; }
.topbar-status-button {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 7px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
}
.topbar-status-button:hover { background: transparent; }
.topbar-status-button .ui-icon { width: 18px; height: 18px; }
.topbar-status-button.offline, .topbar-status-button.not-ready {
  color: #9a640d;
}
.topbar-status-popover {
  position: fixed;
  z-index: 10;
  box-sizing: border-box;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow-wrap: anywhere;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 24px #0003;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: pre-line;
}
.sync-button {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 0.7rem;
}
.offline-toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 50;
  max-width: min(420px, 90vw);
  box-shadow: 0 8px 30px #0003;
}
@media (max-width: 740px) {
  .connection-area {
    gap: 6px;
  }
  .instrument-chip {
    display: none;
  }
}
.language-settings {
  margin-bottom: 18px;
  max-width: 960px;
}
.language-picker {
  max-width: 340px;
}
.appearance-picker {
  max-width: 340px;
  margin-top: 18px;
}
.scroll-finish-setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.scroll-finish-stepper { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.scroll-finish-stepper button { display: grid; place-items: center; width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; font-size: 1.1rem; }
.scroll-finish-stepper input { width: 3.2ch; min-width: 3.2ch; height: 34px; min-height: 34px; padding: 0 3px; border: 0; background: transparent; text-align: right; font-variant-numeric: tabular-nums; }
.scroll-finish-stepper > span { display: inline-grid; place-items: center; width: 1ch; height: 34px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .data-transfer-actions { grid-template-columns: 1fr; } }
.auth-card .language-picker {
  max-width: none;
}
.offline-badge {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 6px;
}
@media (max-width: 740px) {
  .connection-status {
    white-space: normal;
    max-width: 170px;
  }
}

.spotify-modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: #000a; display: grid; place-items: center; padding: 16px; }
.spotify-modal { background: var(--surface, white); color: var(--text, #111); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(100%, 620px); max-height: 85vh; overflow: auto; display: grid; gap: 12px; }
.spotify-modal-head { display: flex; align-items: center; justify-content: space-between; }

/* Spotify recording and playback controls */
.spotify-recording { padding: 18px; border: 1px solid #d9e5de; border-radius: 18px; background: linear-gradient(135deg, #f4fbf6, #fff); color: #163429; }
.spotify-recording-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.spotify-recording-heading > div { display: grid; min-width: 0; gap: 2px; }
.spotify-recording-heading small { color: #21844c; font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.spotify-recording-heading strong, .spotify-recording-heading span { overflow: hidden; text-overflow: ellipsis; }
.spotify-recording-heading span { font-size: .86rem; opacity: .75; }
.spotify-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #1d9b54; color: white; flex: none; }
.spotify-recording > [data-spotify-action="open-search"] { justify-self: start; }
.spotify-stage-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .84rem; }
.spotify-stage-setting input { width: auto; }
.spotify-stage-setting small { flex-basis: 100%; padding-left: 26px; opacity: .7; }
.spotify-playbar { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border-radius: 14px; background: #163429; color: white; }
.spotify-playbar button, .stage-dark .spotify-playbar button { display: grid; place-items: center; flex: none; width: 38px; height: 38px; min-height: 0; padding: 9px; border: 0; border-radius: 50%; background: transparent; color: white; }
.spotify-playbar .spotify-play-button, .stage-dark .spotify-playbar .spotify-play-button { background: #1ed760; color: #10261a; }
.spotify-progress { display: grid; flex: 1; gap: 3px; min-width: 70px; }
.spotify-progress input { width: 100%; margin: 0; accent-color: #1ed760; }
.spotify-progress span { font-size: .69rem; font-variant-numeric: tabular-nums; opacity: .8; }
.spotify-bar-brand { font-weight: 750; font-size: .75rem; }
.spotify-playbar-floating { position: fixed; z-index: 20; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 24px)); box-shadow: 0 8px 30px #0005; }
.stage-dark .spotify-recording { background: #111; border-color: #777; color: #fff; }
.stage-dark .spotify-playbar-floating { background: #000; border: 1px solid #fff; }
.stage-dark .spotify-playbar .spotify-play-button { background: #fff; color: #000; }
.stage-dark .spotify-progress input { accent-color: #fff; }

/* Performance song drawer */
.stage-drawer { top: 52px; bottom: 8px; max-height: none; gap: 0; padding: 0; border-color: #d9dedb; border-radius: 14px; box-shadow: 0 12px 34px #0003; }
.drawer-header { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; padding: 18px 16px 12px; }
.drawer-pin { flex: none; width: 40px; height: 40px; min-height: 40px; padding: 9px; border-radius: 10px; }
.drawer-pin .ui-icon { width: 20px; height: 20px; }
.drawer-pin[aria-pressed="true"] { background: #346c51; color: #fff; border-color: #346c51; }
.stage-dark .stage-drawer .drawer-pin[aria-pressed="true"] { background: #fff; color: #000; border-color: #fff; }
.drawer-heading { display: grid; gap: 3px; min-width: 0; }
.drawer-heading strong { font-size: 1.12rem; line-height: 1.2; overflow-wrap: anywhere; }
.drawer-heading small { font-size: .74rem; color: #68736d; }
.drawer-kicker { color: #65756b; font-size: .64rem; font-weight: 800; letter-spacing: .12em; }
.drawer-icon { flex: none; width: 34px; height: 34px; min-height: 34px; padding: 0; border: 0; border-radius: 10px; background: #f1f4f2; }
.drawer-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 10px; background: #f1f4f2; border-radius: 10px; color: #68736d; }
.drawer-search .ui-icon { width: 17px; height: 17px; }
.drawer-search input { min-width: 0; height: 40px; padding: 0; border: 0; outline: 0; background: transparent; color: #111; font-size: .86rem; }
.drawer-search-row { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; }
.drawer-search-row .drawer-search { flex: 1; min-width: 0; margin: 0; }
.drawer-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 12px 10px; }
.drawer-library-filter, .drawer-sort { display: flex; align-items: center; gap: 6px; min-width: 0; height: 40px; color: #68736d; }
.drawer-library-filter { flex: 1; }
.drawer-library-filter .ui-icon, .drawer-sort .ui-icon { width: 19px; height: 19px; flex: none; }
.drawer-library-filter select, .drawer-sort select { height: 40px; min-height: 40px; padding: 0 32px 0 6px; border: 0; border-radius: 10px; background: #f1f4f2; color: #18231c; font-size: .76rem; font-weight: 700; }
.drawer-library-filter select { width: 100%; min-width: 0; }
.drawer-sort select { width: 82px; }
.stage-drawer-list { display: block; flex: 1; padding: 0 8px; overscroll-behavior: contain; }
.stage-drawer-list .drawer-song { display: flex; flex-direction: row; align-items: center; width: 100%; min-height: 52px; padding: 6px 10px; gap: 10px; border: 0; border-radius: 10px; background: transparent; color: #18231c; }
.stage-drawer-list .drawer-song[hidden], .drawer-empty[hidden] { display: none; }
.drawer-number { width: 24px; flex: none; color: #89938d; font-size: .73rem; font-variant-numeric: tabular-nums; }
.drawer-song-text { display: grid; min-width: 0; gap: 3px; flex: 1; }
.drawer-song-text strong, .drawer-song-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-song-text strong { font-size: .9rem; }
.drawer-song-text small { color: #738078; font-size: .75rem; }
.stage-drawer-list .drawer-song[aria-current="true"] { background: #e7f1e9; color: #163c25; }
.stage-drawer-list .drawer-song[aria-current="true"] .drawer-number, .drawer-playing { color: #248c51; }
.drawer-playing { font-size: .55rem; }
.drawer-empty { padding: 14px 10px; color: #68736d; font-size: .85rem; }
.stage-drawer-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 12px; border-top: 1px solid #e6eae7; }
.stage-drawer-add-actions, .drawer-footer-navigation { display: flex; gap: 8px; }
.stage-drawer-footer > span { margin: 0; justify-self: center; }
.drawer-footer-navigation { justify-self: end; }
.stage-drawer-footer button { width: 40px; height: 40px; min-height: 40px; border: 0; border-radius: 10px; background: #f1f4f2; }
.stage-drawer-footer .ui-icon { width: 20px; height: 20px; }
.stage-drawer-footer span { color: #748078; font-size: .76rem; font-variant-numeric: tabular-nums; }
.stage-dark .stage-drawer { border-color: #555; }
.stage-dark .drawer-search, .stage-dark .drawer-library-filter select, .stage-dark .drawer-sort select, .stage-dark .drawer-icon, .stage-dark .stage-drawer-footer button { background: #1a1a1a; }
.stage-dark .drawer-search input, .stage-dark .drawer-library-filter, .stage-dark .drawer-library-filter select, .stage-dark .drawer-sort, .stage-dark .drawer-sort select, .stage-dark .drawer-heading small, .stage-dark .drawer-kicker, .stage-dark .drawer-song-text small, .stage-dark .drawer-number, .stage-dark .stage-drawer-footer span { color: #bbb; }
.stage-dark .stage-drawer-list .drawer-song { color: #fff; }
.stage-dark .stage-drawer-list .drawer-song[aria-current="true"] { background: #fff; color: #000; }
.stage-dark .stage-drawer-list .drawer-song[aria-current="true"] .drawer-number, .stage-dark .drawer-playing { color: #333; }
.stage-dark .stage-drawer-list .drawer-song[aria-current="true"] small { color: #444; }
.stage-dark .stage-drawer-footer { border-color: #444; }

/* Spotify card and search */
.spotify-recording { gap: 14px; }
.spotify-card-actions { display: grid; gap: 2px; }
.spotify-recording .spotify-manage { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 2px; color: #234434; background: transparent; border: 0; border-bottom: 1px solid #e2ebe4; border-radius: 0; text-align: left; font-size: .88rem; font-weight: 650; }
.spotify-manage .ui-icon { width: 19px; height: 19px; color: #61786a; }
.spotify-manage span:nth-child(2) { flex: 1; }
.spotify-manage span:last-child { font-size: 1.4rem; color: #84978a; }
.spotify-stage-setting { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 12px; padding: 12px 2px 2px; cursor: pointer; }
.spotify-setting-copy { display: grid; gap: 4px; }
.spotify-stage-setting small { padding: 0; font-size: .73rem; color: #6a7c70; }
.spotify-stage-setting input, .notes-reminder-setting input { appearance: none; flex: none; width: 42px; height: 24px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 20px; background: #bcc8c0; position: relative; cursor: pointer; }
.spotify-stage-setting input::after, .notes-reminder-setting input::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: transform .18s; box-shadow: 0 1px 3px #0003; }
.spotify-stage-setting input:checked, .notes-reminder-setting input:checked { background: #328658; }
.spotify-stage-setting input:checked::after, .notes-reminder-setting input:checked::after { transform: translateX(18px); }
.spotify-stage-setting input:focus-visible, .notes-reminder-setting input:focus-visible, .spotify-progress input:focus-visible { outline: 2px solid #1e9660; outline-offset: 3px; }
.spotify-status:empty { display: none; }
.spotify-playbar { background: #26312b; }
.spotify-playbar .spotify-play-button { background: #f3f6f4; color: #24332a; }
.spotify-playbar.has-progress .spotify-play-button { background: #1ed760; color: #10261a; }
.spotify-progress input { appearance: none; height: 5px; min-height: 5px; border: 0; border-radius: 5px; padding: 0; background: linear-gradient(to right, #1ed760 var(--played, 0%), #a4afa8 var(--played, 0%)); cursor: pointer; }
.spotify-progress input::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; background: white; border-radius: 50%; }
.spotify-progress input::-moz-range-thumb { width: 12px; height: 12px; background: white; border: 0; border-radius: 50%; }
.spotify-progress input:disabled { opacity: 1; cursor: default; }
.spotify-modal-backdrop { background: #14221dcc; backdrop-filter: blur(4px); }
.spotify-modal { width: min(100%, 600px); max-height: min(85dvh, 720px); padding: clamp(20px, 4vw, 30px); gap: 16px; background: #fff; color: #20382f; border: 0; border-radius: 22px; box-shadow: 0 24px 70px #0004; }
.spotify-modal-head { align-items: flex-start; gap: 12px; }
.spotify-modal-head h2 { margin: 4px 0; font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -.03em; }
.spotify-modal-head p, .spotify-modal-hint { margin: 0; color: #718078; font-size: .85rem; }
.spotify-modal-eyebrow { color: #25804d; font-size: .68rem; letter-spacing: .13em; font-weight: 800; }
.spotify-modal .spotify-modal-close { width: 38px; height: 38px; min-height: 38px; padding: 0; border: 0; border-radius: 50%; color: #4b6154; background: #eff4f0; font-size: 1.5rem; line-height: 1; }
.spotify-modal-search, .spotify-link-input { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 5px 5px 12px; background: #f1f5f2; border: 1px solid #e2eae4; border-radius: 12px; }
.spotify-modal-search > span { display: flex; color: #718078; }
.spotify-modal-search .ui-icon { width: 19px; height: 19px; }
.spotify-modal-search input, .spotify-link-input input { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; background: transparent; color: #20382f; outline: 0; }
.spotify-modal-search:focus-within, .spotify-link-input:focus-within { border-color: #48936a; box-shadow: 0 0 0 3px #48936a22; }
.spotify-modal .spotify-primary, .spotify-modal .spotify-link-button { flex: none; padding: 10px 16px; min-height: 40px; border: 0; border-radius: 9px; color: white; background: #286b47; font-size: .84rem; font-weight: 700; }
.spotify-results-heading { color: #718078; font-weight: 700; font-size: .73rem; text-transform: uppercase; letter-spacing: .06em; }
.spotify-modal .spotify-results { max-height: 260px; gap: 4px; }
.spotify-modal .spotify-results button { display: flex; align-items: center; justify-content: initial; gap: 11px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: #f7f9f7; color: #20382f; text-align: left; }
.spotify-modal .spotify-results button:hover { background: #eaf4ed; }
.spotify-result-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; color: #397a54; background: #e0eee4; }
.spotify-result-icon .ui-icon { width: 20px; height: 20px; }
.spotify-result-icon img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.spotify-result-text { display: grid; flex: 1; min-width: 0; gap: 3px; }
.spotify-result-text strong, .spotify-result-text small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.spotify-modal .spotify-result-text small { margin: 0; color: #75847a; font-size: .76rem; }
.spotify-result-add { color: #2e8151; font-size: 1.45rem; }
.spotify-link-section { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid #edf1ee; color: #63756a; font-size: .8rem; font-weight: 650; }
.spotify-modal .spotify-unlink { justify-self: start; padding: 4px 0; min-height: 0; border: 0; background: none; color: #9a514c; font-size: .8rem; }
.stage-dark .spotify-recording .spotify-manage { color: white; border-color: #555; }
.stage-dark .spotify-setting-copy small { color: #bbb; }
.stage-dark .spotify-progress input { background: linear-gradient(to right, #fff var(--played, 0%), #777 var(--played, 0%)); }

/* Compact, movable performance player */
.spotify-playbar-floating { width: min(310px, calc(100vw - 20px)); gap: 5px; padding: 5px 7px; border-radius: 12px; }
.spotify-playbar-floating button, .stage-dark .spotify-playbar-floating button { width: 31px; height: 31px; padding: 6px; }
.spotify-playbar-floating .spotify-progress { min-width: 48px; gap: 2px; }
.spotify-playbar-floating .spotify-progress span { font-size: .64rem; }
.spotify-drag-handle { display: grid; place-items: center; flex: none; width: 24px; height: 36px; color: #c8d1cb; font-size: 1.3rem; cursor: grab; touch-action: none; user-select: none; }
.spotify-drag-handle:active { cursor: grabbing; }
.spotify-docked { display: inline-flex; }
.spotify-docked .ui-icon { width: 20px; height: 20px; }

/* Chart player and recording selector */
.spotify-player-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.spotify-player-row .spotify-playbar { flex: 1 1 240px; width: min(100%, 380px); max-width: 380px; min-height: 62px; }
.spotify-player-row .spotify-progress { position: relative; display: flex; align-items: center; min-height: 24px; }
.spotify-player-row .spotify-progress span { position: absolute; left: 0; top: calc(50% + 7px); white-space: nowrap; }
.spotify-recording .spotify-change-recording { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 9px 12px; border: 1px solid #d6e4d9; border-radius: 11px; color: #315841; background: #fff; font-size: .8rem; font-weight: 650; }
.spotify-change-recording .ui-icon { width: 17px; height: 17px; flex: none; }
.spotify-settings .spotify-stage-setting { padding: 14px 2px; border-top: 1px solid var(--line); }
.stage-dark .spotify-recording .spotify-change-recording { background: #000; color: #fff; border-color: #777; }
@media (max-width: 480px) { .spotify-player-row .spotify-playbar { flex-basis: 190px; } .spotify-change-recording span { display: none; } }
.spotify-player-row .spotify-bar-time { flex: none; font-size: .7rem; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: .85; }
.spotify-recording .spotify-change-recording { width: 42px; height: 42px; min-height: 42px; padding: 10px; }
.spotify-recording .spotify-change-recording .ui-icon { width: 20px; height: 20px; }

/* Performance playback controls */
.spotify-playbar-floating .spotify-progress { display: flex; align-items: center; }
.spotify-playbar-floating .spotify-bar-time { flex: none; white-space: nowrap; font-size: .62rem; font-variant-numeric: tabular-nums; opacity: .85; }
.spotify-playbar-floating [data-spotify-action="dock"] .ui-icon { width: 20px; height: 20px; }
.performance .spotify-recording-heading > div { flex: 1; }
.spotify-docked button { touch-action: manipulation; -webkit-touch-callout: none; user-select: none; }
@media (max-width: 740px) { .stage-toolbar { gap: 2px; } .stage-toolbar button { width: 32px; } }
.spotify-playbar-floating .spotify-play-button, .stage-dark .spotify-playbar-floating .spotify-play-button { display: grid; place-items: center; padding: 0; line-height: 1; }
.spotify-playbar-floating .spotify-play-button .ui-icon { display: block; width: 19px; height: 19px; }
.stage-practice-row { display: flex; align-items: end; gap: 8px; }
.stage-menu .stage-practice-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; min-height: 42px; padding: 9px; }
.stage-practice-icon .ui-icon { width: 22px; height: 22px; }
.stage-menu .stage-practice-icon[aria-pressed="true"] { background: #183e2b; color: white; }
.stage-dark .stage-menu .stage-practice-icon[aria-pressed="true"] { background: #fff; color: #000; }
.stage-tempo { display: grid; gap: 4px; font-size: .75rem; }
.stage-tempo input { width: 85px; min-height: 42px; }
.stage-duration { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .78rem; }
.stage-menu .stage-duration-edit { min-height: 0; padding: 3px 5px; border: 0; text-decoration: underline; background: transparent; }
.stage-duration-form { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; }
.stage-duration-form[hidden] { display: none; }
.stage-duration-form label { display: grid; flex: 1; gap: 4px; min-width: 110px; font-size: .75rem; }
.stage-duration-form input { min-width: 0; }
#stagePlaybackError:empty { display: none; }
.stage-menu .stage-narrow-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.stage-menu .stage-narrow-toggle input { appearance: none; position: relative; flex: none; width: 42px; height: 24px; min-height: 24px; padding: 0; border: 1px solid #777; border-radius: 14px; background: #ddd; }
.stage-menu .stage-narrow-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0005; transition: transform .15s; }
.stage-menu .stage-narrow-toggle input:checked { background: #111; border-color: #111; }
.stage-menu .stage-narrow-toggle input:checked::after { transform: translateX(18px); }
.stage-dark .stage-menu .stage-narrow-toggle input { background: #222; border-color: #aaa; }
.stage-dark .stage-menu .stage-narrow-toggle input:checked { background: #fff; }
.stage-dark .stage-menu .stage-narrow-toggle input:checked::after { background: #111; }
.stage-menu .stage-narrow-toggle input:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Performance title and key dialog */
.performance .stage-content h1 { font-size: clamp(1.5rem, 4.2vw, 2.8rem); }
.performance .stage-song-meta { font-size: 1rem; }
.stage-key-button { display: inline; min-height: 0; padding: 2px 3px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
.stage-key-button .stage-key-concert-reference { font-weight: 400; }
.stage-key-button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.stage-key-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: #0008; }
.stage-key-dialog { width: min(100%, 440px); padding: 20px; border: 1px solid #ccc; border-radius: 14px; color: #111; background: #fff; box-shadow: 0 12px 36px #0005; }
.stage-key-dialog header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.stage-key-dialog header button { min-width: 40px; min-height: 40px; padding: 4px; }
.stage-key-dialog .key-control { display: grid; gap: 12px; }
.stage-key-dialog .key-control label { display: grid; gap: 5px; }
.stage-key-dialog .transpose-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stage-dark .stage-key-dialog { color: #fff; background: #000; border-color: #fff; }
.stage-dark .stage-key-dialog button, .stage-dark .stage-key-dialog select { color: #fff; background: #000; border-color: #fff; }
.stage-key-dialog .stage-key-controls { gap: 14px; }
.stage-key-facts { display: grid; gap: 4px; font-size: .82rem; }
.stage-key-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(145px, 1.1fr); gap: 14px; align-items: start; }
.stage-key-dialog .stage-key-grid > label, .stage-key-transpose { display: grid; gap: 6px; font-size: .85rem; }
.stage-key-transpose .stage-key-steps { display: flex; align-items: center; gap: 8px; }
.stage-key-steps button { min-width: 38px; min-height: 38px; padding: 4px; }
.stage-key-steps strong { min-width: 28px; text-align: center; }
.stage-key-dialog .stage-key-reset { justify-self: end; min-height: 0; padding: 3px 6px; font-size: .8rem; }
.chart-font-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 10px 0; color: var(--muted); font-size: .8rem; }
.chart-font-control button { min-width: 38px; min-height: 38px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font-weight: 700; }
.chart-font-control .ui-icon { width: 21px; height: 21px; vertical-align: middle; }
.chart-font-control output { min-width: 2ch; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Chart reading workspace */
.reader-page .reader-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 16px; }
.reader-page .reader-title { min-width: 0; }
.reader-page .reader-title h2 { margin: 7px 0 3px; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; letter-spacing: -.035em; overflow-wrap: anywhere; }
.reader-page .reader-title p { margin: 0; font-size: 1rem; color: var(--muted); }
.reader-main-actions { flex: none; align-items: center; }
.reader-main-actions .primary { display: inline-flex; align-items: center; gap: 7px; }
.reader-main-actions .ui-icon { width: 17px; height: 17px; }
.reader-page .chart-facts { align-items: center; gap: 7px; margin-bottom: 18px; }
.reader-page .chart-facts span { padding: 6px 10px; background: #eef3ee; border-radius: 8px; color: #6c7b70; }
.reader-page .chart-facts strong { margin-left: 3px; color: #274435; }
.reader-tools { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.reader-display { display: flex; align-items: center; gap: 14px; }
.reader-tool-label { flex: none; color: #728178; font-size: .74rem; font-weight: 700; }
.reader-display .format-control { max-width: 520px; }
.reader-options { margin-top: 10px; }
.reader-options summary { display: flex; align-items: center; gap: 8px; width: fit-content; list-style: none; cursor: pointer; font-size: .8rem; font-weight: 700; color: #426650; }
.reader-options summary::-webkit-details-marker { display: none; }
.reader-options summary .ui-icon { width: 17px; height: 17px; }
.reader-chevron { font-size: 1rem; transition: transform .15s; }
.reader-options[open] .reader-chevron { transform: rotate(180deg); }
.reader-options .reader-controls { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr); gap: 20px; padding-top: 16px; margin-top: 12px; border-top: 1px solid #edf1ed; }
.reader-options .practice-controls { grid-column: auto; align-content: start; }
.reader-options .practice-controls label { display: grid; gap: 6px; flex: 1 1 150px; font-size: .8rem; }
.reader-options .practice-controls input { width: 100%; }
.reader-page .spotify-chart { margin-bottom: 16px; }
.reader-page .spotify-recording { gap: 10px; }
.chart-paper { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 30px #20382f08; overflow: hidden; }
.chart-paper-toolbar { display: flex; justify-content: flex-end; padding: 10px 16px 0; }
.chart-paper .chart-font-control { margin: 0; }
.chart-paper .chart-body { border: 0; border-radius: 0; background: transparent; padding: 12px clamp(16px, 3vw, 32px) 32px; }
@media (max-width: 700px) {
  .reader-page .reader-heading { align-items: flex-start; flex-direction: column; }
  .reader-display { align-items: stretch; flex-direction: column; gap: 8px; }
  .reader-options .reader-controls { grid-template-columns: 1fr; }
}
@media print { .chart-paper-toolbar, .reader-tools { display: none; } .chart-paper { border: 0; box-shadow: none; } }

/* Song notes */
.chart-notes { margin-top: 20px; }
.song-notes-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 0 20px 20px; }
.song-notes-editor form, .song-notes-editor label { display: grid; gap: 8px; }
.song-notes-editor textarea { resize: vertical; min-height: 84px; }
.song-notes-editor small { color: var(--muted); font-size: .76rem; }
.song-notes-editor button { justify-self: start; }
.song-notes-editor p { margin: 0; font-size: .8rem; }
.song-notes-editor p:empty { display: none; }
.notes-reminder-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.notes-reminder-setting input { order: 1; }
.stage-notes p, .stage-notes-reminder p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 10px; font-size: .86rem; }
.stage-notes strong, .stage-notes-reminder strong { font-size: .8rem; }
.stage-notes-reminder { position: fixed; z-index: 90; top: 58px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 28px)); max-height: min(45dvh, 320px); overflow: auto; padding: 14px 16px; border: 1px solid #ddd; border-radius: 12px; background: #fff; color: #111; box-shadow: 0 10px 32px #0005; }
.stage-notes-reminder-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stage-notes-reminder-head button { width: 30px; height: 30px; min-height: 30px; padding: 0; }
.stage-dark .stage-notes-reminder { background: #000; color: #fff; border-color: #fff; }
.stage-dark .stage-notes-reminder button { background: #000; color: #fff; border-color: #fff; }
@media (max-width: 700px) { .song-notes-editor { grid-template-columns: 1fr; } }

/* Compact key controls */
.stage-key-dialog { width: min(100%, 340px); padding: 16px; }
.stage-key-dialog header { margin-bottom: 10px; }
.stage-key-dialog .stage-key-controls, .reader-options .stage-key-controls { display: grid; gap: 10px; max-width: 340px; }
.stage-key-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.stage-key-transpose .stage-key-steps { gap: 4px; }
.stage-key-steps button { min-width: 36px; min-height: 38px; }
.stage-key-footer { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
.stage-key-footer .stage-key-reset { min-height: 34px; padding: 5px 10px; border-radius: 8px; font-size: .78rem; }
.stage-key-grid select { min-width: 0; width: 100%; min-height: 40px; padding: 8px 48px 8px 10px; border: 1px solid #d7e3d9; border-radius: 9px; color: #20382f; background-color: #f7faf7; }
.stage-dark .stage-key-dialog .stage-key-grid select { color: #fff; background-color: #000; border-color: #fff; }
.reader-options .stage-key-facts { color: #718078; }
.reader-options .stage-key-facts strong { color: var(--ink); }
.reader-options .stage-key-grid { align-items: end; }
.reader-options .practice-controls { gap: 9px; padding: 12px; border-radius: 12px; background: #f5f8f5; }
.reader-options .practice-controls button { min-height: 40px; }

/* Chart practice controls */
.reader-tools { padding-top: 20px; }
.reader-options { margin-top: 16px; }
.reader-options summary { width: 100%; min-height: 44px; padding: 8px 10px; border-radius: 9px; background: #f3f7f3; }
.reader-options summary > span:nth-child(2) { flex: 1; }
.reader-options summary .reader-chevron { display: grid; place-items: center; width: 28px; height: 28px; }
.reader-options summary .reader-chevron .ui-icon { width: 22px; height: 22px; }
.reader-options .practice-controls .reader-practice-icon { display: grid; place-items: center; width: 42px; height: 42px; min-height: 42px; padding: 9px; }
.reader-practice-icon .ui-icon { width: 22px; height: 22px; }
.reader-options .practice-controls .reader-practice-icon[aria-pressed="true"] { color: white; background: var(--accent); border-color: var(--accent); }
.reader-tempo { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.reader-options .practice-controls input[type="range"] { accent-color: var(--accent); }

/* Chart controls sit beside the first lines rather than above the song. */
.chart-paper .chart-body { display: flow-root; padding-top: 16px; }
.chart-paper-toolbar { float: right; display: flex; align-items: center; gap: 8px; padding: 0; margin: 0 0 6px 12px; font-size: .8rem; line-height: 1.2; }
.chart-paper-toolbar #autoScroll { display: grid; place-items: center; width: 38px; height: 38px; min-height: 38px; padding: 8px; border-radius: 9px; }
.chart-paper-toolbar #autoScroll[aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.chart-paper-toolbar #autoScroll .ui-icon { width: 20px; height: 20px; }
.reader-options .practice-controls .reader-tempo { display: grid; flex: 0 1 105px; gap: 4px; }
.reader-options .practice-controls .reader-tempo input { width: 88px; min-height: 40px; }
#chartTempoError:empty { display: none; }
.reader-duration-button { display: grid; flex: 0 1 118px; gap: 3px; min-height: 40px; padding: 6px 9px; text-align: left; font-size: .74rem; color: var(--muted); }
.reader-duration-button strong { color: var(--ink); font-size: .9rem; font-variant-numeric: tabular-nums; }
.reader-options .practice-controls.chart-practice-layout { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(86px, auto) minmax(100px, auto); align-items: end; gap: 8px; }
.reader-options .practice-controls.chart-practice-layout > label { grid-column: 1; }
.chart-scroll-duration-card { grid-column: 2; }
.reader-options .practice-controls.chart-practice-layout > #editChartDuration { grid-column: 3; }
.chart-practice-secondary { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.chart-metronome-heading { flex-basis: 100%; color: var(--muted); font-size: .78rem; }
.chart-practice-secondary .reader-practice-icon { flex: none; }
.reader-options .practice-controls .chart-practice-secondary .reader-tempo { display: flex; flex: none; flex-wrap: nowrap; align-items: center; gap: 9px; }
.reader-options .practice-controls .chart-practice-secondary .reader-tempo input { width: 88px; }
.chart-tempo-suffix { color: var(--ink); font-size: .85rem; font-weight: 700; }
.chart-practice-secondary #chartTempoError { align-self: center; }
@media (max-width: 440px) {
  .reader-options .practice-controls.chart-practice-layout { grid-template-columns: minmax(0, 1fr) minmax(100px, auto); }
  .chart-scroll-duration-card { grid-column: 1; }
  .reader-options .practice-controls.chart-practice-layout > #editChartDuration { grid-column: 2; }
}
.chart-duration-dialog { width: min(400px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 60px #0006; }
.chart-duration-dialog::backdrop { background: #0008; }
.chart-duration-dialog form { display: grid; gap: 16px; }
.chart-duration-dialog label { display: grid; gap: 6px; }
.chart-duration-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-duration-dialog-heading h3 { margin: 0; }
.chart-duration-dialog-heading button { min-height: 34px; }
.chart-duration-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
#chartDurationError:empty { display: none; }
:is(.chart-notes, .chart-sharing) summary { list-style: none; }
:is(.chart-notes, .chart-sharing) summary::-webkit-details-marker { display: none; }
:is(.chart-notes, .chart-sharing) summary > span:first-child { flex: 1; }
:is(.chart-notes, .chart-sharing) summary .reader-chevron { display: grid; place-items: center; width: 28px; height: 28px; }
:is(.chart-notes, .chart-sharing) summary .reader-chevron .ui-icon { width: 22px; height: 22px; }
:is(.chart-notes, .chart-sharing)[open] .reader-chevron { transform: rotate(180deg); }
@media print { .chart-paper-toolbar { display: none; } }

/* Album artwork */
.song-art { overflow: hidden; position: relative; }
.song-art img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.song-art > span { position: relative; z-index: 1; }
.cover-editor { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 14px; align-items: center; }
.cover-editor-preview { display: grid; place-items: center; overflow: hidden; width: 90px; height: 90px; border-radius: 12px; background: #edf4ed; color: #63806e; }
.cover-editor-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-editor p { margin: 4px 0 8px; color: var(--muted); font-size: .85rem; }
.cover-editor small { display: block; margin-top: 8px; color: var(--muted); font-size: .73rem; }
#coverResults { grid-column: 1 / -1; font-size: .83rem; }
.cover-results { display: grid; gap: 6px; max-height: 240px; overflow: auto; }
.cover-results button { justify-content: flex-start; text-align: left; }
.online-cover-status { margin: 8px 0 12px; color: var(--muted); font-size: .78rem; }
.online-stage-dark .online-cover-status { color: #ddd; }

/* The chart is a viewport-sized, independently scrollable reading pane. */
.reader-page .chart-paper { height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; }
@media print { .reader-page .chart-paper { height: auto; overflow: visible; } }
.reader-page .chart-paper-toolbar { position: sticky; top: 8px; z-index: 2; border-radius: 10px; background: #fff; }
.cover-results button { display: flex; align-items: center; gap: 12px; min-height: 70px; }
.cover-results button img { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 7px; background: #edf4ed; }
.cover-results button img[hidden], .online-cover-preview img[hidden] { display: none; }
.cover-results button span { display: grid; gap: 4px; min-width: 0; }
.cover-results button small { color: var(--muted); font-size: .75rem; }
.online-cover-preview { display: flex; align-items: center; gap: 10px; }
.online-cover-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.song-art > span { position: absolute; }

/* Standard search preview follows the reading layout and stays visibly distinct. */
.online-chart-preview { padding: clamp(12px, 2vw, 20px); border: 1px solid #e7d5a6; border-radius: 16px; background: #fbf6e8; }
.online-chart-preview .online-detail-header { position: static; background: #fffdf7; border-color: #eadfbe; }
.online-chart-preview .online-detail-header .tiny-label { color: #80651f; }
.online-preview-tools { margin-bottom: 16px; padding: 18px 16px 14px; border: 1px solid #e8ddbe; border-radius: 14px; background: #fffdf7; }
.online-preview-tools .reader-display .format-control { max-width: 520px; }
.online-key-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 14px 2px 2px; }
.online-key-controls .field-hint { flex-basis: 100%; margin: 0; }
.online-key-controls > label { display: grid; gap: 5px; min-width: 110px; }
.online-key-controls .transpose-control { flex-wrap: wrap; }
.online-preview-paper { min-height: min(100dvh, 720px); padding: 16px clamp(16px, 3vw, 32px) 32px; border: 1px solid #e8ddbe; border-radius: 14px; background: white; }
.online-preview-paper .online-chart { border: 0; padding: 0; background: transparent; }
.online-preview-font { display: flex; justify-content: flex-end; align-items: center; gap: 7px; margin: 0 0 12px; font-size: .8rem; color: var(--muted); }
.online-preview-font button { min-width: 38px; min-height: 38px; padding: 5px; }
.online-preview-font output { min-width: 2ch; text-align: center; }
.online-source { display: inline-block; margin-top: 12px; font-size: .8rem; }
@media (max-width: 700px) { .online-preview-tools .reader-display { flex-direction: column; align-items: stretch; gap: 8px; } }

/* Recording artwork choices */
.online-cover-well { margin: 0 0 16px; padding: 15px; border: 1px solid #e8ddbe; border-radius: 14px; background: #fffdf7; }
.online-cover-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.online-cover-heading strong { font-size: .9rem; }
.online-cover-heading p { margin: 3px 0 0; color: #718078; font-size: .77rem; }
.online-cover-heading small { color: #718078; font-size: .73rem; }
.online-cover-options { display: flex; gap: 10px; overflow-x: auto; padding: 3px 3px 6px; }
.online-cover-choice, .online-stage .online-cover-choice { display: grid; flex: 0 0 108px; align-content: start; gap: 6px; padding: 5px; min-width: 0; border: 2px solid transparent; border-radius: 11px; background: transparent; color: #233b2d; text-align: left; }
.online-cover-choice[aria-pressed="true"], .online-stage .online-cover-choice[aria-pressed="true"] { border-color: #258653; background: #eaf5ed; }
.online-cover-choice:focus-visible { outline: 2px solid #176439; outline-offset: 2px; }
.online-cover-image { display: grid; place-items: center; width: 94px; aspect-ratio: 1; overflow: hidden; border-radius: 7px; background: #e7ecdf; color: #789571; }
.online-cover-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.online-cover-none .online-cover-image .ui-icon { width: 40px; height: 40px; stroke-width: 1; transform: rotate(-7deg); }
.online-cover-retry .online-cover-image .ui-icon { width: 40px; height: 40px; stroke-width: 1.2; }
.online-cover-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.2em; font-size: .7rem; line-height: 1.1; overflow-wrap: anywhere; }
.online-stage-dark .online-cover-well { background: #000; border-color: #fff; color: #fff; }
.online-stage-dark .online-cover-choice { color: #fff; }
.online-stage-dark .online-cover-choice[aria-pressed="true"] { border-color: #1ed760; background: #162b1c; }

/* Collapsible navigation */
.sidebar-toggle { width: 100%; min-height: 40px; justify-content: flex-start; gap: 10px; margin-top: auto; padding: 9px 12px; border: 0; background: transparent; color: #657369; font-size: .74rem; }
.sidebar-toggle .ui-icon { width: 19px; height: 19px; }
.sidebar-toggle + .sidebar-footer { margin-top: 8px; }
.logout-link .ui-icon { display: none; }
.shell.sidebar-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.sidebar-collapsed .sidebar { padding: 24px 9px 14px; }
.sidebar-collapsed .brand { justify-content: center; margin: 0 0 32px; }
.sidebar-collapsed .brand > span:last-child, .sidebar-collapsed .nav-item > span, .sidebar-collapsed .nav-item small, .sidebar-collapsed .sidebar-note, .sidebar-collapsed .sidebar-toggle span, .sidebar-collapsed .profile-link > span:last-child, .sidebar-collapsed .logout-link span { display: none; }
.sidebar-collapsed .brand-mark { flex: none; }
.sidebar-collapsed .main-nav { display: grid; gap: 7px; }
.sidebar-collapsed .nav-item { width: 48px; height: 46px; min-height: 46px; justify-content: center; padding: 10px; border-radius: 10px; }
.sidebar-collapsed .sidebar-toggle { width: 48px; justify-content: center; padding: 9px; }
.sidebar-collapsed .sidebar-toggle .ui-icon { transform: rotate(180deg); }
.sidebar-collapsed .sidebar-footer { position: static; display: grid; justify-items: center; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-collapsed .profile-link { width: 44px; min-height: 40px; justify-content: center; padding: 4px; }
.sidebar-collapsed .logout-link { display: grid; place-items: center; width: 44px; min-height: 40px; margin: 0; padding: 8px; }
.sidebar-collapsed .logout-link .ui-icon { display: block; width: 19px; height: 19px; }
@media (max-width: 740px) {
  .shell:not(.sidebar-collapsed) .sidebar-toggle { position: absolute; top: 12px; right: 64px; width: 40px; min-height: 40px; padding: 8px; justify-content: center; }
  .shell:not(.sidebar-collapsed) .sidebar-toggle span { display: none; }
  .shell.sidebar-collapsed .sidebar { position: sticky; top: 0; height: 100dvh; border-right: 1px solid var(--line); border-bottom: 0; }
  .shell.sidebar-collapsed .nav-item { flex: none; }
  .shell.sidebar-collapsed .sidebar-footer { position: static; }
}

/* First-visit guide */
.quick-guide { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: clamp(24px, 5vw, 40px); border: 1px solid #dce7dc; border-radius: 24px; background: #fff; color: var(--ink); box-shadow: 0 24px 80px #17271c40; }
.quick-guide::backdrop { background: #17251db3; }
.quick-guide-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.quick-guide-top button { min-height: 40px; padding: 8px; border: 0; background: transparent; color: #56705e; font-size: .8rem; letter-spacing: 0; }
.quick-guide-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 28px 0 22px; border-radius: 20px; background: #e7f1e8; color: #316c4a; }
.quick-guide-icon .ui-icon { width: 32px; height: 32px; }
.quick-guide-count { margin: 0 0 8px; color: #6a8671; font-size: .75rem; font-weight: 700; }
.quick-guide h2 { margin: 0 0 10px; font-size: clamp(1.65rem, 4vw, 2.2rem); letter-spacing: -.035em; line-height: 1.15; }
.quick-guide-description { min-height: 3em; margin: 0; color: #62746a; font-size: .95rem; line-height: 1.6; }
.quick-guide-dots { display: flex; gap: 6px; margin: 24px 0; }
.quick-guide-dots span { width: 7px; height: 7px; border-radius: 10px; background: #d9e5d9; }
.quick-guide-dots span.active { width: 22px; background: #397953; }
.quick-guide-actions { display: flex; justify-content: space-between; gap: 12px; }

/* Shared workspace design */
.shell { --workspace-radius: 15px; --workspace-shadow: 0 8px 28px #20382f0b; }
.shell .workspace { background: var(--paper); }
.shell .chart > .page-heading, .shell .chart > .reader-heading { align-items: end; gap: 16px; margin-bottom: 22px; }
.shell .page-heading h2, .shell .reader-heading h2, .shell .online-search > h2 { margin: 8px 0 7px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.9rem, 3.7vw, 2.85rem); line-height: 1.1; letter-spacing: -.04em; }
.shell .page-heading p, .shell .reader-heading p, .shell .online-search > p { max-width: 64ch; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.shell .eyebrow { color: #72877a; letter-spacing: .11em; }
.shell .surface, .shell .item, .shell .disclosure, .shell .online-result, .shell .reader-tools, .shell .chart-paper { border-color: #dfe8df; border-radius: var(--workspace-radius); box-shadow: var(--workspace-shadow); }
.shell .surface, .shell .item { padding: clamp(18px, 2.4vw, 24px); }
.shell .surface h3, .shell .item h3 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.shell .disclosure summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 16px 18px; border-radius: var(--workspace-radius); }
.shell .disclosure summary .muted { margin-left: 4px; }
.shell .disclosure[open] summary { border-bottom: 1px solid #edf2ed; border-radius: 15px 15px 0 0; }
.shell .disclosure-body { padding: 16px 18px 20px; }
.shell .form-grid { gap: 16px; }
.shell input:not([type="range"]):not([type="checkbox"]), .shell select, .shell textarea { border-color: #dce6dd; border-radius: 10px; background-color: #fcfdfb; }
.shell .page-heading .actions, .shell .reader-main-actions { gap: 8px; }
.shell .song-card { border-radius: 15px; box-shadow: var(--workspace-shadow); }
.shell .song-card:focus-visible, .shell .online-result:focus-within { outline: 2px solid #89b39a; outline-offset: 2px; }
.shell .setlist-card { display: grid; gap: 12px; }
.shell .setlist-heading > div > strong { font-size: 1.08rem; letter-spacing: -.02em; }
.shell .setlist-items { margin: 0; color: #52665a; }
body.app-dark:not(.performance) .shell .setlist-items,
body.app-dark:not(.performance) .shell .setlist-items .setlist-title { color: var(--ink); }
.shell .ensemble-forms .surface { align-content: start; }
.shell .ensemble-forms .surface button { justify-self: start; }
.shell .online-search > .eyebrow { display: block; margin-bottom: 8px; }
.shell .online-form { padding: 14px; border: 1px solid #dfe8df; border-radius: 15px; background: #fff; box-shadow: var(--workspace-shadow); }
.shell .online-result { padding: 16px 18px; }
.shell .online-chart-preview { background: #fbf6e8; }
.shell .language-settings, .shell #settingsForm, .shell .profile-details, .shell .spotify-settings, .shell .import-settings { max-width: 960px; margin: 0 0 16px; }
.shell .profile-details { padding: 0; overflow: hidden; }
.shell .profile-details #settingsForm { max-width: none; margin: 0; }
.shell .language-settings { display: grid; gap: 14px; }
.shell .language-settings h3, .shell #settingsForm h3 { margin: 0 0 2px; }
.shell .language-settings .appearance-picker { margin-top: 0; }
.shell .language-settings > small { color: var(--muted); font-size: .76rem; }
.shell #settingsForm button { justify-self: start; }
.shell .import-settings p { margin: 8px 0 14px; }
.shell .profile-signout { margin-top: 4px; }
.auth-card { box-shadow: 0 20px 70px #20382f12; border-color: #dfe8df; }
@media (max-width: 700px) {
  .shell .chart > .page-heading, .shell .chart > .reader-heading { align-items: flex-start; }
  .shell .online-form { flex-wrap: wrap; }
  .shell .online-form label { min-width: 100%; }
}

/* Setlists show which collection is being managed. */
.setlist-scope { display: grid; gap: 6px; max-width: 320px; margin: 0 0 20px; }
.ensemble-setlist-context .sidebar { background: #e1ebf3; border-color: #b5cddd; }
.ensemble-setlist-context .nav-item[data-tab="setlists"] { color: #174b6a; }

.storage-notice:not([hidden]) { position: fixed; z-index: 10000; bottom: 16px; left: 16px; right: 16px; max-width: 720px; margin: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; background: #fff; color: #20382f; border: 1px solid #b9ccc0; border-radius: 12px; box-shadow: 0 8px 32px #0003; }
.storage-notice p { flex: 1 1 320px; margin: 0; }
.privacy-document { max-width: 800px; margin: 0 auto; padding: 32px 20px 80px; line-height: 1.6; }
.privacy-document h2 { margin-top: 2em; }

.auth-methods, .social-providers { display: grid; gap: .5rem; }
.auth-methods h2 { margin: 0 0 4px; padding-top: 16px; border-top: 1px solid var(--line); font: inherit; font-size: .82rem; font-weight: 700; color: var(--muted); }
.auth-methods small:empty { display: none; }
.auth-methods small { color: var(--muted, #66716b); line-height: 1.4; }
.auth-methods button:disabled { opacity: .55; cursor: not-allowed; }

.frontend-version { display: block; color: #53645a; font-size: 0.7rem; line-height: 1.4; text-align: center; }
.frontend-version:empty { display: none; }
.sidebar > .frontend-version { flex: 0 0 auto; margin-top: 10px; }
@media (min-width: 741px) { .sidebar { overflow-y: auto; } .sidebar-note { flex-shrink: 1; min-height: 0; overflow-y: auto; } }
@media (max-width: 740px) { .sidebar > .frontend-version { margin: 4px 0; } }

.auth-method-button { width: 100%; min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; align-items: center; gap: 10px; text-align: center; }
.auth-method-icon { width: 20px; height: 20px; display: block; }

/* Chord diagrams */
.chord-trigger { appearance: none; border: 0; background: transparent; padding: 0; min-height: 0; border-radius: 0; font: inherit; line-height: 1.1; color: var(--accent); display: inline; text-align: left; cursor: pointer; }
.chord-trigger:hover, .chord-trigger:focus-visible { background: transparent; text-decoration: underline; }
.chord-dialog { width: min(640px, calc(100% - 32px)); max-height: 90vh; border: 1px solid #d7c2c7; border-radius: 16px; padding: 22px; color: #30272a; background: #fffaf9; box-shadow: 0 15px 60px #0005; }
.chord-dialog.chord-dialog-piano { width: min(480px, calc(100% - 32px)); }
.chord-dialog::backdrop { background: #0009; }
.chord-dialog-header { display: flex; justify-content: space-between; align-items: center; font-size: 1.5rem; }
.chord-dialog-header button { min-height: 40px; }
.chord-dialog p { margin: 8px 0 16px; }
.chord-voicings { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.chord-voicings svg { width: min(160px, 100%); }
.chord-piano { display: flex; justify-content: center; }
.chord-piano svg { width: min(100%, 360px); }
.chord-dialog .chord-piano-notes { text-align: center; }
.chord-piano .piano-white { fill: #fff; stroke: #333; }
.chord-piano .piano-white.piano-selected { fill: #c77b89; }
.chord-piano .piano-black { fill: #222; }
.chord-piano .piano-black.piano-selected { fill: #a63d56; }
.chord-piano .piano-label { fill: #221b1d; }
.chord-dialog.chord-dialog-dark { color-scheme: dark; color: #f3f6f3; background: #1d2921; border-color: #586b5d; }
.chord-dialog.chord-dialog-dark .chord-dialog-header button { background: #304239; color: #f3f6f3; border-color: #586b5d; }
.chord-dialog.chord-dialog-dark .piano-white { fill: #e8eee8; stroke: #425248; }
.chord-dialog.chord-dialog-dark .piano-white.piano-selected { fill: #a6d7b4; }
.chord-dialog.chord-dialog-dark .piano-black { fill: #202923; }
.chord-dialog.chord-dialog-dark .piano-black.piano-selected { fill: #4c9a68; }
.chord-dialog.chord-dialog-dark .piano-label { fill: #1b2820; }
.ensemble-setlist-context .sidebar { background: #f2e4e7; border-color: #d6b6bf; }
.ensemble-setlist-context .nav-item[data-tab="setlists"] { color: #762e43; }

/* Spotify search should remain readable inside the dark performance menu. */
.stage-dark .spotify-modal-backdrop { background: #000c; }
.stage-dark .spotify-modal { background: #1b211e; color: #f4f7f5; border: 1px solid #47544c; box-shadow: 0 24px 70px #000a; }
.stage-dark .spotify-modal-head p, .stage-dark .spotify-modal-hint, .stage-dark .spotify-results-heading, .stage-dark .spotify-modal .spotify-result-text small { color: #b5c2ba; }
.stage-dark .spotify-modal-eyebrow, .stage-dark .spotify-result-add { color: #70dc98; }
.stage-dark .stage-menu .spotify-modal .spotify-modal-close { background: #303b34; color: #f4f7f5; border: 0; }
.stage-dark .spotify-modal-search, .stage-dark .spotify-link-input { background: #2a342e; border-color: #58685e; }
.stage-dark .spotify-modal-search > span { color: #b5c2ba; }
.stage-dark .stage-menu .spotify-modal-search input, .stage-dark .stage-menu .spotify-link-input input { background: transparent; color: #f4f7f5; border: 0; }
.stage-dark .spotify-modal input::placeholder { color: #b5c2ba; opacity: 1; }
.stage-dark .stage-menu .spotify-modal .spotify-primary, .stage-dark .stage-menu .spotify-modal .spotify-link-button { background: #70dc98; color: #132419; border: 0; }
.stage-dark .stage-menu .spotify-modal .spotify-results button { background: #29332d; color: #f4f7f5; border: 0; }
.stage-dark .stage-menu .spotify-modal .spotify-results button:hover { background: #3b4d41; }
.stage-dark .spotify-result-icon { background: #395442; color: #9be3b5; }
.stage-dark .spotify-link-section { color: #c5d0c9; border-color: #47544c; }
.stage-dark .stage-menu .spotify-modal .spotify-unlink { background: transparent; color: #f3a69d; border: 0; }

/* Two rows keep all display labels readable in the narrow performance menu. */
.stage-menu .format-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage-menu .format-control button { white-space: normal; overflow-wrap: anywhere; line-height: 1.2; min-height: 44px; }
.stage-menu .format-control button:nth-child(odd) { border-left: 0; }
.stage-menu .format-control button:nth-child(n + 3) { border-top: 1px solid var(--line); }
.stage-dark .stage-menu .format-control button { border-color: #fff; }

/* Center the single-column chart as a block, with its lines left-aligned. */
.performance .stage-content.single-column h1,
.performance .stage-content.single-column .stage-song-meta { text-align: center; }
.performance .stage-content.single-column .chart-body { width: fit-content; max-width: 100%; margin-inline: auto; text-align: left; }

/* Spotify recording search in the performance toolbar and overlay. */
.stage-toolbar .spotify-stage-link .ui-icon { width: 22px; height: 22px; }
.stage-dark .spotify-modal .spotify-modal-close { background: #303b34; color: #f4f7f5; border: 0; }
.stage-dark .spotify-modal-search input, .stage-dark .spotify-link-input input { background: transparent; color: #f4f7f5; border: 0; }
.stage-dark .spotify-modal .spotify-primary, .stage-dark .spotify-modal .spotify-link-button { background: #70dc98; color: #132419; border: 0; }
.stage-dark .spotify-modal .spotify-results button { background: #29332d; color: #f4f7f5; border: 0; }
.stage-dark .spotify-modal .spotify-results button:hover { background: #3b4d41; }
.stage-dark .spotify-modal .spotify-unlink { background: transparent; color: #f3a69d; border: 0; }

/* The app theme is independent of the performance theme. */
body.app-dark:not(.performance) {
  color-scheme: dark;
  --ink: #e5eee7; --muted: #aabbb0; --paper: #101914; --panel: #1c2921;
  --line: #384b3e; --accent: #86c99c; --accent-2: #a3d8b2; --shadow: 0 8px 28px #0004;
  background: var(--paper); color: var(--ink);
}
body.app-dark:not(.performance) :is(button, input, select, textarea) { background-color: #25362b; color: var(--ink); border-color: var(--line); }
body.app-dark:not(.performance) button.setlist-icon-action.danger { color: #ff6b63; }
body.app-dark:not(.performance) button:hover:not(:disabled) { background-color: #354d3c; }
body.app-dark:not(.performance) .sidebar-note .sidebar-news-dots button,
body.app-dark:not(.performance) .sidebar-note .sidebar-news-dots button:hover:not(:disabled) { background: transparent; border: 0; box-shadow: none; }
body.app-dark:not(.performance) button.primary { background: #397b54; border-color: #397b54; color: #fff; }
body.app-dark:not(.performance) :is(label, .nav-item, .sidebar-toggle, .sidebar-news-copy p, .frontend-version, .field-hint, .breadcrumb) { color: #b7c8bc; }
body.app-dark:not(.performance) :is(.sidebar, .segmented) { background: #18241c; }
/* Keep the shared-setlist workspace visibly distinct from the personal one in dark mode. */
body.app-dark:not(.performance) .ensemble-setlist-context .sidebar { background: #2e2025; border-color: #754a57; }
body.app-dark:not(.performance) .ensemble-setlist-context .nav-item[data-tab="setlists"] { color: #ffb4c6; }
body.app-dark:not(.performance) :is(.nav-item.active, .segmented button.active, .song-card, .surface, .item, .disclosure, .online-result, .auth-card, .quick-guide) { background: #213128; color: var(--ink); border-color: var(--line); }
body.app-dark:not(.performance) .ensemble-song-card { background: #4a252f; border-color: #c96d83; box-shadow: inset 4px 0 #ef8da6; }
body.app-dark:not(.performance) .ensemble-song-card:hover { background: #5a2c38; }
body.app-dark:not(.performance) .ensemble-song-card .tiny-label { color: #ffc0cf; }
body.app-dark:not(.performance) :is(.song-list, .song-compact) .ensemble-song-card { border: 2px solid #ef8da6; border-left-width: 6px; }
/* The ensemble outline must win over the shared dark card surface in every Library layout. */
:is(body.app-dark:not(.performance), body.stage-dark) .shell .song-card.ensemble-song-card {
  background: #4a252f !important;
  border: 0 !important;
  border-left: 6px solid #ffb2c5 !important;
  box-shadow: none !important;
}
:is(body.app-dark:not(.performance), body.stage-dark) .shell :is(.song-list, .song-compact) .song-card.ensemble-song-card {
  border-left-width: 6px !important;
}
body.app-dark:not(.performance) :is(.main, .workspace, .chart, .topbar) { background-color: var(--paper); color: var(--ink); }
body.app-dark:not(.performance) :is(.library-search, .chart-paper, .reader-controls, .online-detail-header, .online-controls, .spotify-modal, .song-picker, .online-cover-well) { background: var(--panel); color: var(--ink); border-color: var(--line); }
body.app-dark:not(.performance) :is(.song-card h3, .chart h2, .breadcrumb strong, .quick-guide h2, .spotify-recording-heading strong, .online-cover-choice) { color: var(--ink); }
body.app-dark:not(.performance) :is(.song-card p, .song-card-footer, .page-heading p, .reader-heading p, .quick-guide-description, .import-settings p, .spotify-setting-copy small, .online-cover-heading p, .online-cover-heading small) { color: var(--muted); }
body.app-dark:not(.performance) :is(.pill, .instrument-chip, .nav-item small, .avatar) { background: #314637; color: #d6ead9; }
body.app-dark:not(.performance) :is(.section, .segment-chord, .chordpro-token, a) { color: #9cddaf; }
body.app-dark:not(.performance) .notice { background: #493b26; color: #ffe0a7; border-color: #765e39; }
body.app-dark:not(.performance) :is(.auth, .install-landing, .launch-screen) { background: radial-gradient(ellipse at top left, #273c2e, transparent 60%), var(--paper); }
body.app-dark:not(.performance) :is(.auth-card, .install-card) { border-color: var(--line); }
body.app-dark:not(.performance) .spotify-recording { background: #1d2d24; color: var(--ink); border-color: #405647; }
body.app-dark:not(.performance) .spotify-playbar { background: #16251c; border: 1px solid #405647; }
body.app-dark:not(.performance) .spotify-playbar button:hover:not(:disabled) { background-color: #30483a; }
body.app-dark:not(.performance) .spotify-playbar .spotify-play-button,
body.app-dark:not(.performance) .spotify-playbar .spotify-play-button:hover:not(:disabled) { background: #91d7a6; color: #102219; }
body.app-dark:not(.performance) .two-factor-toggle { border-color: var(--line); background: #25362b; color: var(--ink); }
body.app-dark:not(.performance) .online-cover-choice[aria-pressed="true"] { background: #294d35; border-color: #80c998; }
/* Full-screen online previews retain their separate performance appearance. */
body.app-dark:not(.performance) .online-stage:not(.online-stage-dark), body.app-dark:not(.performance) .online-stage:not(.online-stage-dark) .online-chart { background: #fff; color: #111; }
body.app-dark:not(.performance) .online-stage:not(.online-stage-dark) :is(.online-detail-header, .online-controls, button, select) { background: #fff; color: #111; border-color: #aaa; }
body.app-dark:not(.performance) .online-stage:not(.online-stage-dark) select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
}
body.app-dark:not(.performance) .online-stage:not(.online-stage-dark) :is(.segment-chord, .chordpro-token, .section, label, a) { color: #111; }
body.app-dark:not(.performance) .shell input:not([type="range"]):not([type="checkbox"]),
body.app-dark:not(.performance) .shell select,
body.app-dark:not(.performance) .shell textarea { background-color: #25362b; color: #e5eee7; border-color: #43584a; }
body.app-dark:not(.performance) .shell select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23e5eee7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
}
body.app-dark:not(.performance) .library-search { background: #25362b; border-color: var(--line); }
body.app-dark:not(.performance) .library-search input { background: transparent; color: var(--ink); }
body.app-dark:not(.performance) :is(.editor-save, .reader-page .chart-paper-toolbar, .storage-notice:not([hidden]), .spotify-modal-search, .spotify-link-input) { background: #25362b; color: var(--ink); border-color: var(--line); }
body.app-dark:not(.performance) :is(.spotify-modal-search input, .spotify-link-input input) { background: transparent; color: var(--ink); }
body.app-dark:not(.performance) :is(.notes-reminder-setting, .spotify-stage-setting) input:checked { background: #438f60; }
body.app-dark:not(.performance) :is(input, textarea)::placeholder { color: #aabbb0; opacity: 1; }
body.app-dark:not(.performance) :is(.reader-tools, .online-preview-tools, .online-preview-paper) { background: var(--panel); color: var(--ink); border-color: var(--line); }
body.app-dark:not(.performance) :is(.reader-options summary, .reader-page .chart-facts span) { background: #304237; color: #c3d4c7; }
/* The practice-controls background is set after the base reader styles, so it
   needs its own dark-mode surface rather than falling back to its light tint. */
body.app-dark:not(.performance) .reader-options .practice-controls { background: #25362b; }
body.app-dark:not(.performance) .reader-options .reader-controls { border-color: var(--line); }
body.app-dark:not(.performance) .reader-page .chart-facts strong { color: #e5eee7; }
body.app-dark:not(.performance) .format-control button[aria-pressed="true"] { background: #83c49a; color: #102219; border-color: #83c49a; }

.theme-toggle { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 7px; }
.theme-toggle svg { display: block; width: 20px; height: 20px; }

.live-chart-notice { position: fixed; z-index: 2000; right: 16px; bottom: 16px; max-width: min(440px, calc(100vw - 32px)); display: flex; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 8px 28px #0004; }

.drawer-song-row { display: flex; align-items: center; }
.drawer-song-row[hidden] { display: none; }
.stage-drawer-list .drawer-song-row .drawer-song { flex: 1; width: auto; min-width: 0; touch-action: pan-y; }
.drawer-options-dialog { display: grid; gap: 10px; }
.drawer-options-dialog > button { width: 100%; text-align: left; }
.performance-song-search { width: min(620px, calc(100% - 32px)); max-height: min(80dvh, 680px); display: grid; gap: 14px; overflow: auto; }
.performance-song-search.preview-open { width: min(900px, calc(100% - 32px)); height: min(88dvh, 900px); max-height: none; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.performance-song-search header > div { display: grid; gap: 3px; }
.performance-song-search header small { color: #68736d; font-size: .82rem; font-weight: 400; }
.performance-song-search-form { display: flex; align-items: end; gap: 8px; }
.performance-song-search-form label { display: grid; flex: 1; gap: 5px; font-size: .85rem; }
.performance-song-search-form input { min-width: 0; }
.performance-song-search-results { display: grid; gap: 6px; }
.performance-library-picker { width: min(520px, calc(100% - 32px)); max-height: min(80dvh, 680px); display: grid; gap: 14px; overflow: auto; }
.performance-library-picker header > div, .performance-library-picker > label, .performance-library-songs { display: grid; gap: 5px; }
.performance-library-picker select { padding-right: 42px; }
.performance-library-picker header small, .performance-library-songs small { color: #68736d; font-size: .82rem; font-weight: 400; }
.performance-library-songs { gap: 6px; }
.performance-library-songs > button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px; text-align: left; }
.performance-library-songs > button > span { display: grid; min-width: 0; gap: 2px; }
.performance-library-songs strong, .performance-library-songs small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.performance-artist-group { display: grid; gap: 2px; }
.performance-artist-group h3 { padding: 8px 0 4px; }
.performance-song-search-results article { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid #d9dedb; }
.performance-song-search-results article > div:first-child { display: grid; min-width: 0; gap: 2px; }
.performance-song-search-results strong, .performance-song-search-results small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.performance-song-search-results small { color: #68736d; font-size: .78rem; }
.performance-search-rating { color: #a16b15; font-size: .72rem; font-weight: 700; }
.performance-search-actions { display: flex; flex: none; gap: 5px; }
.performance-search-actions button, .performance-search-add { display: grid; place-items: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 7px; border-radius: 9px; }
.performance-search-actions .ui-icon, .performance-search-add .ui-icon { width: 19px; height: 19px; }
.performance-song-search-preview { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; }
.performance-song-search-chart-wrap { position: relative; min-width: 0; min-height: 0; }
.performance-song-search-chart { position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; column-count: auto; column-width: auto; padding: 14px; border: 1px solid #d9dedb; border-radius: 12px; background: #fff; color: #18231c; font-size: clamp(1rem, 2.3vw, 1.35rem); }
#performanceSongSearchBackdrop { overscroll-behavior: contain; }
.performance-preview-key-menu { position: absolute; z-index: 1; top: 10px; right: 10px; }
.performance-preview-key-menu { display: grid; gap: 4px; }
.performance-preview-key-menu select { min-height: 34px; padding: 4px 28px 4px 8px; border: 1px solid #cbd7ce; border-radius: 8px; background-color: #fff; background-position: right 7px center; color: #20382f; font-weight: 700; }
.performance-preview-key-menu summary { display: flex; align-items: center; gap: 5px; min-width: 56px; min-height: 32px; padding: 5px 8px; border: 1px solid #cbd7ce; border-radius: 8px; background: #fff; color: #20382f; cursor: pointer; font-size: .8rem; font-weight: 800; list-style: none; }
.performance-preview-key-menu summary::-webkit-details-marker { display: none; }
.performance-preview-key-menu > div { display: grid; gap: 4px; padding: 4px; border: 1px solid #53665b; border-radius: 8px; background: #152019; }
.performance-preview-key-menu button { min-width: 32px; min-height: 30px; padding: 4px; border: 0; border-radius: 6px; background: #000; color: #fff; text-align: center; font-size: .85rem; font-weight: 700; }
.performance-preview-key-menu button:hover, .performance-preview-key-menu button:focus-visible { background: #edf4ed; }
.performance-preview-key-menu strong { padding: 3px 8px; color: #53705e; font-size: .75rem; text-align: center; }
.performance-song-search-chart .chord-trigger { background: transparent; border: 0; color: #286b47; }
.stage-dark .performance-search-rating { color: #e8c475; }
.stage-dark .performance-song-search-chart { border-color: #4a5b50; background: #152019; color: #f4f7f5; }
.stage-dark .performance-preview-key-menu summary, .stage-dark .performance-preview-key-menu > div { border-color: #4a5b50; background: #152019; color: #f4f7f5; }
.stage-dark .stage-key-dialog .performance-preview-key-menu select { border-color: #4a5b50; background-color: #152019; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; background-size: 16px; color: #fff; }
.stage-dark .performance-preview-key-menu button:hover, .stage-dark .performance-preview-key-menu button:focus-visible { background: #2a4030; }
.stage-dark .performance-song-search-chart .section { color: #a9cbb4; }
.stage-dark .performance-song-search-chart .chord-trigger { background: transparent; border: 0; color: #9fe2b5; }
.stage-dark .performance-song-search header small, .stage-dark .performance-song-search-results small { color: #bbb; }
.stage-dark .performance-library-picker header small, .stage-dark .performance-library-songs small { color: #bbb; }
.stage-dark .performance-song-search-results article { border-color: #444; }
@media (max-width: 520px) {
  .performance-song-search-form { align-items: stretch; flex-direction: column; }
  /* Only the form's submit control should span the dialog. The searchable
     input gets a nested clear button at runtime, which must remain compact. */
  .performance-song-search-form > button { width: 100%; }
}
.local-recording { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.local-recording strong, .local-recording small { flex-basis: 100%; }
.local-recording-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-recording-choose { cursor: pointer; padding: 8px 12px; border: 1px solid currentColor; border-radius: 8px; }
.local-recording-toggle { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 10px; border-radius: 50%; }
.local-recording-toggle .ui-icon { width: 20px; height: 20px; }
.local-recording input[type=range] { min-width: 80px; flex: 1; }
.local-recording-floating { position: fixed; z-index: 20; bottom: 18px; left: 50%; transform: translateX(-50%); width: min(420px, 90vw); padding: 10px; border-radius: 12px; background: #25362b; color: white; box-shadow: 0 4px 20px #0007; }
.local-recording-floating p:empty { display: none; }
.local-recording-floating:has(~ .spotify-playbar-floating) { bottom: 72px; }

/* Keep the search context visible while reading either kind of preview. */
.online-search-context { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid #bd8b42; border-radius: 12px; background: #fff3d5; color: #47310d; box-shadow: 0 4px 14px #4e340d18; }
.online-search-context #onlineBack { flex: none; min-height: 40px; padding: 8px 12px; border: 1px solid #99702e; border-radius: 9px; background: #fffaf0; color: #4a330f; font-weight: 700; }
.online-search-context-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.online-search-context-copy strong { font-size: .72rem; letter-spacing: .09em; }
.online-search-context-copy span { font-size: .78rem; }
.online-search-mode { flex: none; padding: 5px 9px; border-radius: 99px; background: #f5dfa9; color: #54380b; font-size: .72rem; font-weight: 700; }
.online-stage .online-detail-header { position: static; }
.online-stage-dark .online-search-context, body.app-dark:not(.performance) .online-chart-preview .online-search-context { background: #4b3518; border-color: #c9984d; color: #fff5db; }
.online-stage-dark .online-search-context #onlineBack, body.app-dark:not(.performance) .online-chart-preview .online-search-context #onlineBack { background: #694b22; border-color: #e4bd78; color: #fff; }
.online-stage-dark .online-search-mode, body.app-dark:not(.performance) .online-chart-preview .online-search-mode { background: #725126; color: #fff5db; }
@media (max-width: 600px) {
  .online-search-context { gap: 8px; padding: 7px 8px; }
  .online-search-context #onlineBack { padding: 7px 8px; font-size: .74rem; }
  .online-search-context-copy strong { font-size: .65rem; }
  .online-search-context-copy span { font-size: .7rem; }
  .online-search-mode { display: none; }
}

/* Phone workspace: keep navigation close to the thumb and songs easy to scan. */
@media (max-width: 600px) {
  .shell, .shell.sidebar-collapsed { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .shell .sidebar, .shell.sidebar-collapsed .sidebar {
    position: static; height: auto; padding: 10px 16px; border: 0;
    border-bottom: 1px solid var(--line);
  }
  .shell .brand, .shell.sidebar-collapsed .brand { justify-content: flex-start; margin: 0; font-size: 1.05rem; }
  .shell .brand-mark { width: 34px; height: 34px; }
  .shell .brand > span:last-child, .shell.sidebar-collapsed .brand > span:last-child { display: block; }
  .shell .brand small { display: none; }
  .shell .sidebar-toggle, .shell.sidebar-collapsed .sidebar-toggle,
  .shell .sidebar > .frontend-version { display: none; }
  .shell .sidebar-footer, .shell.sidebar-collapsed .sidebar-footer {
    position: absolute; right: 16px; top: 8px; display: block; padding: 0; margin: 0; border: 0;
  }
  .shell .profile-link, .shell.sidebar-collapsed .profile-link { width: 40px; min-height: 40px; padding: 4px; }
  .shell .profile-link > span:last-child { display: none; }
  .shell .main-nav, .shell.sidebar-collapsed .main-nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    display: flex; gap: 2px; padding: 5px 5px env(safe-area-inset-bottom);
    background: var(--paper); border-top: 1px solid var(--line);
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  }
  .shell .nav-item, .shell.sidebar-collapsed .nav-item {
    flex: 1 0 64px; width: auto; height: auto; min-width: 64px; min-height: 54px;
    display: flex; flex-direction: column; justify-content: center; gap: 3px;
    padding: 5px 2px; border-radius: 9px; font-size: .62rem; line-height: 1.1;
  }
  .shell .nav-item > span, .shell.sidebar-collapsed .nav-item > span { display: block; text-align: center; }
  .shell .nav-item .ui-icon { width: 20px; height: 20px; }
  .shell .nav-item small { display: none; }
  .shell .topbar { min-height: 42px; padding: 5px 16px; }
  .shell .connection-area { gap: 6px; }
  .shell .topbar-status-actions { gap: 4px; }
  .shell .sync-button { min-height: 34px; padding: 5px 9px; font-size: .7rem; }
  .shell .theme-toggle { width: 34px; height: 34px; min-height: 34px; padding: 7px; }
  .shell .chart { padding: 20px 16px 36px; }
  .shell .chart > .page-heading, .shell .chart > .reader-heading { gap: 12px; margin-bottom: 16px; }
  .shell .page-heading h2, .shell .reader-heading h2 { font-size: 1.85rem; }
  .shell .page-heading p { font-size: .82rem; }
  .shell .library-heading-actions { width: 100%; }
  .shell .library-heading-actions .actions { display: flex; flex-wrap: nowrap; }
  .shell .library-heading-actions button { flex: 1; min-width: 0; padding: 9px 6px; font-size: .75rem; }
  .shell .library-modes { flex-direction: row; align-items: center; padding: 8px 0; margin-bottom: 10px; }
  .shell .library-mode-label small { display: none; }
  .shell .library-mode-label strong { font-size: .75rem; }
  .shell .library-modes > button { padding: 8px; font-size: .72rem; }
  .shell .library-toolbar { gap: 8px; margin: 8px 0 14px; }
  .shell .library-filters { gap: 6px; }
  .shell .library-scope select { min-width: 0; max-width: 130px; padding-left: 8px; padding-right: 40px; font-size: .76rem; }
  .shell .library-toolbar > span { font-size: .68rem; }
  .shell .library-view-actions { gap: 6px; }
  .shell .library-sort select { width: 96px; padding-left: 29px; padding-right: 24px; font-size: .7rem; }
  .shell .song-grid { grid-template-columns: 1fr; gap: 8px; }
  .shell .song-card { display: flex; align-items: stretch; min-height: 76px; border-radius: 12px; }
  .shell .song-card:hover { transform: none; }
  .shell .song-art { flex: 0 0 72px; height: auto; min-height: 76px; }
  .shell .song-art .ui-icon { width: 32px; height: 32px; }
  .shell .song-art > span { position: absolute; bottom: 4px; right: 4px; padding: 1px 5px; font-size: .65rem; }
  .shell .song-card-content { flex: 1; min-width: 0; padding: 11px 12px; }
  .shell .song-card .tiny-label { display: none; }
  .shell .song-card h3 { margin: 0 0 3px; font-size: .92rem; }
  .shell .song-card p { margin: 0; font-size: .76rem; }
  .shell .song-card-footer { border: 0; padding: 3px 0 0; font-size: .65rem; }
  .shell .song-card-footer span:last-child { display: none; }
  .shell .song-grid:not(.song-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell .song-grid:not(.song-list) .song-card { display: block; }
  .shell .song-grid:not(.song-list) .song-art { height: 100px; }
  .shell .song-grid:not(.song-list) .song-card-content { padding: 11px; }

  /* Compact is a genuine text list on phones, not a smaller card grid. */
  .shell .song-grid.song-compact { grid-template-columns: 1fr; gap: 5px; }
  .shell .song-grid.song-compact .song-card { display: block; min-height: 0; }
  .shell .song-compact .song-art { display: none; }
  .shell .song-compact .song-card-content { display: flex; align-items: center; gap: 12px; padding: 9px 12px; }
  .shell .song-compact .song-card h3 { flex: 1; min-width: 0; margin: 0; font-size: .88rem; }
  .shell .song-compact .song-card p { min-width: 0; max-width: 45%; margin: 0; font-size: .74rem; }
}

/* On phones the list overlays the chart; on tablets it leaves more room for music. */
@media (min-width: 601px) and (max-width: 1050px) {
  .performance .stage { --stage-drawer-width: min(280px, 35vw); }
}
@media (max-width: 600px) {
  .performance .stage { --stage-drawer-width: min(320px, calc(100vw - 32px)); }
  .performance .stage.drawer-open .stage-content { margin-left: 0; }
  .performance .stage-drawer { z-index: 20; }
  .performance .stage-drawer-toggle { z-index: 21; }
}

.recording-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.recording-file-button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-size: .9rem; font-weight: 600; cursor: pointer; }
.recording-file-button:focus-within { outline: 3px solid #89b39a; outline-offset: 3px; }
.recording-file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.recording-spotify-track { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: .88rem; }
.recording-spotify-track span { color: var(--muted); }
.spotify-settings:has(.spotify-unavailable) { display: none; }
.spotify-embed { overflow: hidden; border-radius: 12px; }
.spotify-embed iframe { display: block; border: 0; }
.stage-dark .recording-file-button { background: #000; color: #fff; border-color: #777; }

.stage-dark .stage-menu .notes-reminder-setting input { background: #777; }
.stage-dark .stage-menu .notes-reminder-setting input:checked { background: #328658; }

/* The catalog and performance modes share one consistent switch. */
.topbar-with-mode { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.topbar-with-mode .connection-area { justify-self: end; }
.mode-switch { display: flex; gap: 3px; padding: 3px; background: var(--line); border-radius: 10px; }
.mode-switch button { min-height: 38px; padding: 7px 12px; border-color: transparent; background: transparent; font-size: .78rem; white-space: nowrap; }
.mode-switch .mode-switch-current { background: var(--panel); border-color: var(--line); }
.mode-switch .ui-icon { width: 17px; height: 17px; }
body.app-dark:not(.performance) .mode-switch button { background: transparent; }
body.app-dark:not(.performance) .mode-switch .mode-switch-current { background: var(--panel); }
@media (max-width: 800px) {
  .topbar-with-mode { grid-template-columns: minmax(0, 1fr) auto; }
  /* Connection controls take priority over navigation context on narrow screens. */
  .topbar-with-mode .breadcrumb {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }
  .topbar-with-mode .breadcrumb .text-button,
  .topbar-with-mode .breadcrumb strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-with-mode .breadcrumb .text-button { min-width: 0; }
  .topbar-with-mode .breadcrumb strong { min-width: 0; flex: 0 1 auto; }
  .topbar-with-mode .mode-switch { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .topbar-with-mode .connection-area { grid-column: 2; grid-row: 1; }
}

@media (max-width: 600px) {
  /* A back link is useful; the current-page crumb is expendable on a phone. */
  .topbar-with-mode .breadcrumb > span,
  .topbar-with-mode .breadcrumb > strong { display: none; }
  .topbar-with-mode .breadcrumb .text-button { max-width: 100%; }
}

@media (max-width: 350px) {
  /* Preserve the online/offline controls even on the narrowest devices. */
  .topbar-with-mode .breadcrumb { display: none; }
}

/* Give stage controls a full touch target. Put the toolbar on its own row on phones. */
.performance .stage-toolbar button, .performance .stage-navigation button, .performance .stage-drawer-toggle { width: 44px; height: 44px; min-height: 44px; }
@media (max-width: 740px) {
  .performance .stage-toolbar { top: 52px; right: 4px; gap: 2px; max-width: calc(100vw - 8px); overflow-x: auto; }
  .performance .stage-toolbar button { flex: 0 0 44px; }
  .performance .stage-content h1 { padding-top: 104px; }
}
.offline-readiness { margin: 10px 0; font-size: .9rem; }
.offline-readiness summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.offline-readiness ul { padding-left: 1.4em; }

.stage-next-reminder { position: fixed; z-index: 89; top: 58px; left: 50%; transform: translateX(-50%); display: grid; gap: 2px; justify-items: start; width: max-content; max-width: min(340px, calc(100vw - 32px)); min-height: 0; padding: 8px 14px; border: 1px solid #b9cabe; border-radius: 10px; background: #f6faf5; color: #20382f; box-shadow: 0 4px 16px #0002; text-align: left; }
.stage-next-reminder-label { font-size: .7rem; font-weight: 600; opacity: .75; }
.stage-next-reminder strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.stage-dark .stage-next-reminder { background: #18271f; color: #f3f7f2; border-color: #73917c; }

.conflict-dialog { width: min(960px, calc(100vw - 24px)); max-height: 90dvh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); }
.conflict-dialog::backdrop { background: #0009; }
.conflict-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.conflict-columns pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
@media (max-width: 600px) { .conflict-columns { grid-template-columns: 1fr; } }

/* Keep chart format choices legible when the available reading width is narrow. */
@media (max-width: 600px) {
  .reader-display .format-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-display .format-control button { min-height: 44px; padding: 8px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
  .reader-display .format-control button:nth-child(odd) { border-left: 0; }
  .reader-display .format-control button:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* Make chords easier to pick out while reading on stage. */
.performance .stage-content .segment-chord { font-weight: 700; }

.spotify-playback-error { position: fixed; z-index: 91; left: 50%; bottom: 88px; transform: translateX(-50%); width: max-content; max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border: 1px solid #d69a91; border-radius: 10px; background: #fff4f2; color: #7a261e; box-shadow: 0 4px 16px #0003; font-size: .85rem; }
.spotify-playback-error:empty { display: none; }

.version-notice { width: min(420px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 80px #0b24183d; }
.version-notice::backdrop { background: #10291db3; }
.version-notice-brand { display: flex; align-items: center; gap: 12px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.version-notice-brand img { display: block; width: 42px; height: 42px; border-radius: 10px; }
.version-notice h2 { margin: 22px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: 1.9rem; font-weight: 400; line-height: 1.15; letter-spacing: -.03em; }
.version-notice p { margin: 0 0 24px; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.version-notice-actions { display: flex; gap: 10px; }
.version-notice-actions button { flex: 1; }
body.app-dark:not(.performance) .version-notice { background: var(--panel); color: var(--ink); }
body.app-dark:not(.performance) .version-notice-brand { color: #a6d7b4; }

/* Give phone charts the full reading width even in single-column mode. */
@media (max-width: 600px) {
  .performance .stage-content.single-column .chart-body { width: 100%; }
}

.ensemble-controls { display: flex; justify-content: flex-end; margin: 20px 0; }
.ensemble-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: start; }
.ensemble-card { min-width: 0; }
.ensemble-card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.ensemble-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0; color: var(--muted); font-size: .9rem; }
.ensemble-invite { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.invite-qr-dialog .disclosure-body { display: grid; justify-items: center; text-align: center; }
.invite-qr-code { width: min(100%, 320px); padding: 12px; background: #fff; border-radius: 10px; }
.invite-qr-code svg { display: block; width: 100%; height: auto; }
.invite-qr-code + .field-hint { margin-top: 14px; }
.qr-scanner-dialog video { display: block; width: 100%; max-height: 60dvh; border-radius: 10px; background: #111; }
.ensemble-management { margin-top: 12px; }
.ensemble-management summary { cursor: pointer; color: var(--muted); }
.ensemble-member-list { display: grid; gap: 2px; margin-top: 10px; }
.ensemble-member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ensemble-member-row:last-child { border-bottom: 0; }
.ensemble-member-name { display: grid; gap: 2px; min-width: 0; color: var(--ink); }
.ensemble-member-name small { color: var(--muted); font-size: .78rem; }
.ensemble-member-actions { display: flex; align-items: center; flex: none; gap: 8px; }
.ensemble-member-actions select { width: 102px; min-height: 36px; padding: 0 28px 0 9px; font-size: .78rem; }
.ensemble-member-remove { display: grid; place-items: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; color: var(--danger, #b42318); }
.ensemble-member-remove .ui-icon { width: 17px; height: 17px; }
.ensemble-secondary-actions { margin-top: 12px; }
.ensemble-compact .ensemble-card { padding: 10px 16px; }
.ensemble-compact .ensemble-stats { margin: 6px 0; }
.ensemble-cards .ensemble-card-heading { align-items: flex-start; }
.ensemble-cards .ensemble-card-heading strong { flex: 1 1 100%; }
@media (max-width: 420px) {
  .ensemble-member-row { align-items: flex-start; }
  .ensemble-member-actions { padding-top: 2px; }
  .ensemble-member-actions select { width: 88px; }
}

/*
 * Compact layouts are based on the space and input capabilities available to
 * the app, rather than on a browser/OS device guess.  A phone in landscape,
 * split-screen tablet, and a resizable desktop window all get the layout they
 * can actually accommodate.
 */
@media (max-width: 600px) {
  /* Phones keep only the stage-critical controls visible: drawer, previous /
     next, auto-scroll, a linked-recording toggle, and the main menu. */
  .performance .desktop-stage-control,
  .performance .desktop-stage-player {
    display: none;
  }
  .performance .mobile-stage-control {
    display: contents;
  }
  .performance .stage-topbar {
    position: fixed;
    z-index: 12;
    top: calc(4px + var(--stage-safe-top));
    right: 4px;
    left: 4px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
  }
  .performance .stage-topbar > .stage-drawer-toggle,
  .performance .stage-topbar > .stage-navigation,
  .performance .stage-topbar > .stage-toolbar {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    max-width: none;
    overflow: visible;
    transform: none;
  }
  .performance .stage-topbar > .stage-navigation,
  .performance .stage-topbar > .stage-toolbar,
  .performance .stage-content,
  .performance .stage-content .chart-body {
    min-width: 0;
    max-width: 100%;
  }
  .performance .stage-topbar > .stage-navigation {
    justify-self: center;
  }
  .performance .stage-topbar > .stage-toolbar {
    justify-self: end;
  }
  .performance .stage-content h1 {
    padding-top: calc(60px + var(--stage-safe-top));
    overflow-wrap: anywhere;
  }
  .performance .stage-song-meta {
    overflow-wrap: anywhere;
  }
  /* A deliberately unbroken rhythm bar may be wider than a phone. Keep that
     exceptional overflow on the line itself, never on the stage/page. */
  .performance .rhythm-line {
    max-width: 100%;
    overflow-x: auto;
  }

  /* Reader metadata comes from user-entered arrangements and localized labels.
     Do not let a long fact or status picker widen the page beyond the phone. */
  .shell .reader-page,
  .shell .reader-tools,
  .shell .reader-display,
  .shell .reader-display .format-control {
    min-width: 0;
    max-width: 100%;
  }
  .shell .reader-page .chart-facts {
    gap: 6px;
  }
  .shell .reader-page .chart-facts > span,
  .shell .reader-page .workflow-select {
    min-width: 0;
    max-width: 100%;
  }
  .shell .reader-page .workflow-select {
    flex-wrap: wrap;
  }
  .shell .reader-page .workflow-select select {
    min-width: min(130px, 100%);
    max-width: 100%;
  }

  /* Keep the chart toolbar to five icon controls on phones: auto-scroll,
     speed down/up, and text smaller/larger. Tooltips retain the values. */
  .shell .reader-page .chart-paper-toolbar .chart-font-control output {
    display: none;
  }

  /* Avoid iOS zooming the page when a text field or select receives focus. */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* The filter row previously squeezed the search field, scope, and count
     into one line at 320–390px. Keep the search usable and move metadata
     below it when necessary. */
  .shell .library-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .shell .library-filters {
    flex: 1 1 100%;
    min-width: 0;
  }
  .shell .library-scope {
    flex: 0 1 122px;
    min-width: 0;
  }
  .shell .library-scope select {
    width: 100%;
    max-width: none;
  }
  .shell .library-toolbar > span {
    flex: 1 1 100%;
  }

  /* Keep fixed UI clear of the home indicator and the bottom navigation. */
  .storage-notice:not([hidden]) {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .offline-toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
  }

  /* Dialogs and cards stay inside display cutouts on installed PWAs. */
  .auth,
  .install-landing {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
  }
}

.app-notification .app-notification-message { margin: 22px 0 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-toast { position: fixed; z-index: 1000; top: max(16px, env(safe-area-inset-top)); left: 50%; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; color: #fff; font-size: .875rem; font-weight: 700; text-align: center; transform: translateX(-50%); box-shadow: 0 4px 16px #0b241833; }
.app-toast-success { background: rgb(32 112 62 / .6); }
.app-toast-error { background: rgb(173 42 42 / .6); }
.setlists-editing .setlist-heading { align-items: flex-start; }
.setlists-editing .setlist-heading .setlist-offline-actions { margin-left: auto; }
.setlist-add .setlist-library { flex: 0 1 220px; }
@media (max-width: 640px) { .setlist-add .setlist-library { flex-basis: 100%; } }

@media (max-width: 600px) {
  .reader-page:has(.chart-paper) { display: flex; flex-direction: column; }
  .reader-page > .chart-paper { order: 1; height: 55vh; height: 55dvh; }
  .reader-page > .reader-tools { order: 2; margin-top: 16px; }
  .reader-page > .spotify-chart { order: 3; }
  .reader-page > .chart-notes, .reader-page > .chart-sharing { order: 4; }
}
.cover-disclosure > .cover-editor { padding: 0 18px 18px; }

.chart-copy-row { display:flex; gap:.75rem; align-items:end; }
.chart-copy-row label { flex:1; min-width:0; }
.chart-copy-row button { flex-shrink:0; }
.chart-import-dialog { width:min(30rem,90vw); }
.chart-import-dialog form { display:grid; gap:1rem; }
#sharingStatus input { width:100%; }

.sharing-sections { display: grid; gap: 1.25rem; }
.sharing-section { display: grid; gap: .8rem; }
.sharing-section + .sharing-section { border-top: 1px solid var(--border, #d9e2dc); padding-top: 1.25rem; }
.sharing-section h3 { margin: 0; font-size: 1rem; }
.sharing-action-row { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.sharing-action-row button { min-width: 10rem; }
.sharing-state { color: var(--muted, #657368); font-size: .9rem; }
#shareLinkDetails:not(:empty), #publicationDetails:not(:empty) { display: grid; gap: .6rem; padding: .8rem; border-radius: .65rem; background: color-mix(in srgb, currentColor 5%, transparent); }
#shareLinkDetails label { min-width: 0; }
#shareLinkDetails input { width: 100%; }
#publicationDetails p { margin: 0; }
@media (max-width: 520px) { .chart-copy-row { flex-wrap: wrap; } .chart-copy-row label { flex: 1 1 8rem; } }
.sharing-section-heading { display: flex; align-items: center; gap: .25rem; }
.sharing-section-heading .sharing-info-button { width: 30px; min-width: 30px; height: 30px; min-height: 30px; }
.sharing-link-row { display: flex; align-items: stretch; gap: .5rem; min-width: 0; }
.sharing-link-row input { flex: 1; min-width: 0; }
.sharing-copy-button { display: grid; place-items: center; width: 42px; min-width: 42px; padding: 8px; }
.sharing-copy-button .ui-icon { width: 20px; height: 20px; }
.import-preview-dialog { width: min(46rem, 92vw); max-height: 90dvh; overflow-y: auto; }
.import-preview-title { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1rem; }
.import-preview-paper { max-height: 55dvh; overflow: auto; padding: 1rem; }
.import-preview-paper .chart-body { font-size: 16px; }
.sharing-view-button { box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--panel); text-decoration: none; }
.sharing-view-button:hover { background: var(--soft, #eef5ef); }
.sharing-view-button .ui-icon { width: 20px; height: 20px; }

/* Open Stage shares the library's surfaces and color tokens. */
.open-stage { max-width: 1040px; margin: 0 auto; }
.open-stage-hero { display:flex; align-items:end; justify-content:space-between; gap:24px; padding:28px 0 30px; }
.open-stage-hero h2 { font-size:clamp(2rem,4vw,3rem); margin:8px 0; letter-spacing:-.035em; }
.open-stage-hero p,.open-stage-section p { color:var(--muted); }
.open-stage-list { display:grid; gap:12px; }
.open-stage-card { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:12px; padding:8px 12px; border:1px solid var(--line); border-radius:16px; background:var(--panel); }
.open-stage .open-stage-card-open,
body.app-dark:not(.performance) .open-stage .open-stage-card-open { justify-content:start; min-width:0; gap:12px; border:0; color:var(--ink); background:transparent; text-align:left; }
.open-stage .open-stage-card-open:hover,
body.app-dark:not(.performance) .open-stage .open-stage-card-open:hover { background:color-mix(in srgb,var(--accent) 12%,var(--panel)); }
.open-stage-card-open>span:nth-child(2) { flex:1; min-width:0; overflow-wrap:anywhere; }
.open-stage-card strong,.open-stage-card small,.open-stage-performance strong,.open-stage-performance small { display:block; }
.open-stage-card small,.open-stage-performance small { color:var(--muted); margin-top:5px; }
.open-stage-card-icon,.open-stage-empty>span { display:grid; place-items:center; width:48px; height:48px; border-radius:14px; color:var(--accent); background:color-mix(in srgb,var(--accent) 12%,var(--panel)); font-size:24px; }
.open-stage-empty { text-align:center; padding:58px 20px; border-radius:18px; } .open-stage-empty>span { margin:auto; }
.open-stage-section { padding:24px; border-radius:18px; margin-bottom:18px; } .open-stage-section>label { display:block; margin-bottom:16px; } .open-stage-section input:not([type=checkbox]) { width:100%; }
.open-stage-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.open-stage-control-room { container-type:inline-size; }
.open-stage-control-grid { display:grid; gap:16px; align-items:start; margin-bottom:18px; }
.open-stage-control-grid > section { min-width:0; margin:0; padding:clamp(14px, 2.5vw, 24px); }
.open-stage-control-grid h3 { margin:0 0 16px; }
@container (min-width:720px) {
  .open-stage-control-grid { grid-template-columns:minmax(0, 2fr) minmax(0, 3fr); }
}
.open-stage-add-performance form, .open-stage-add-performance [data-stage-role-inputs] { display:grid; gap:12px; }
.open-stage-add-performance label, .stage-assignment-editor form label { display:grid; gap:5px; overflow-wrap:anywhere; }
.open-stage-add-performance form button { justify-self:start; }
.open-stage-add-performance [role="alert"]:empty, .stage-assignment-editor [role="alert"]:empty { display:none; }
.open-stage-performance { position:relative; display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:start; gap:8px 12px; padding:14px 0; border-top:1px solid var(--line); }
.open-stage-performance-info { display:flex; align-items:flex-start; gap:6px; min-width:0; overflow-wrap:anywhere; }
.open-stage-performance-info > div { min-width:0; }
.stage-reorder-handle { display:grid; place-items:center; flex:0 0 28px; height:36px; border-radius:6px; color:var(--muted); cursor:grab; touch-action:none; user-select:none; }
.stage-reorder-handle:hover { background:var(--paper); color:var(--ink); }
.stage-reorder-handle .ui-icon { width:17px; height:17px; }
.open-stage-performance[data-stage-dragging] { opacity:.55; }
.open-stage-performance[data-stage-drop]::after { content:""; position:absolute; left:0; right:0; height:2px; background:var(--accent); border-radius:2px; pointer-events:none; }
.open-stage-performance[data-stage-drop="before"]::after { top:-1px; }
.open-stage-performance[data-stage-drop="after"]::after { bottom:-1px; }
.open-stage-management { margin-bottom:16px; }
.open-stage-management .ui-icon { width:17px; height:17px; }
.stage-duplicate-dialog h2 { margin-top:0; }
.stage-duplicate-dialog form { display:grid; gap:16px; }
.stage-duplicate-dialog form input:not([type=checkbox]) { width:100%; }
.stage-duplicate-dialog .stage-duplicate-choice { display:flex; align-items:center; gap:8px; }
.stage-duplicate-choice input { width:20px; min-height:20px; }
.open-stage-queue-legend { display:flex; flex-wrap:wrap; gap:6px 14px; padding:8px 10px; margin:0 0 12px; border:1px solid var(--line); border-radius:10px; color:var(--muted); font-size:.82rem; list-style:none; }
.open-stage-queue-legend li { display:inline-flex; align-items:center; gap:5px; }
.open-stage-queue-legend .ui-icon { width:15px; height:15px; flex:none; color:var(--ink); }
.open-stage-queue-status { display:inline-block; margin-top:5px; padding:2px 8px; border-radius:999px; background:var(--paper); color:var(--muted); font-size:.8rem; }
.open-stage-queue-status[data-status="current"] { background:color-mix(in srgb,var(--accent) 15%,var(--panel)); color:var(--accent); font-weight:700; }
.open-stage-queue-actions { display:flex; justify-content:end; flex-wrap:wrap; gap:5px; max-width:140px; }
@container (min-width:900px) {
  .open-stage-queue-actions { max-width:220px; }
}
.open-stage-queue-actions:empty { display:none; }
.open-stage-queue-actions button { width:40px; min-height:40px; padding:0; }
.open-stage-queue-actions button[aria-busy="true"] { cursor:wait; opacity:.6; }
.open-stage-queue-actions .ui-icon { width:18px; height:18px; }
.stage-assignment-editor { grid-column:1 / -1; }
.stage-assignment-editor summary { width:fit-content; color:var(--accent); font-size:.875rem; cursor:pointer; }
.stage-assignment-editor form { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr)); align-items:end; gap:8px; margin-top:10px; }
.stage-assignment-editor button { justify-self:start; }
.stage-assignment-message { grid-column:1 / -1; margin:0; }
.stage-assignment-message:empty { display:none; }
.open-stage-role { display:grid; grid-template-columns:2fr 1fr 1fr auto; gap:12px; align-items:end; margin:12px 0; } .open-stage-chips { display:flex; flex-wrap:wrap; gap:8px; } .open-stage-chips span { padding:8px 12px; border-radius:99px; background:var(--paper); }
@media(max-width:600px) { .open-stage-hero { align-items:start; flex-direction:column; } .open-stage-role { grid-template-columns:1fr 1fr auto; } .open-stage-role label:first-child { grid-column:1 / -1; } }
.open-stage .open-stage-breadcrumb {
  min-height:44px;
  margin-top:16px;
  padding:8px 14px;
  border-color:#759585;
  background:#eaf4ee;
  color:#214b38;
}
.open-stage .open-stage-breadcrumb:hover { background:#d9ebdf; }
.open-stage-breadcrumb .ui-icon { width:19px; height:19px; }
body.app-dark:not(.performance) .open-stage .open-stage-breadcrumb { border-color:#89b59a; background:#263e30; color:#eaf9ee; }
body.app-dark:not(.performance) .open-stage .open-stage-breadcrumb:hover { background:#355643; }
.open-stage-detail-hero { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:clamp(8px,2vw,24px); }
.open-stage-detail-hero > [data-stage-edit] { justify-self:end; }
.open-stage-detail-hero h2 { font-size:clamp(1.35rem,4vw,3rem); }
.open-stage-section .open-stage-switch { display:flex; align-items:center; gap:10px; margin:20px 0; }
.open-stage-switch input[type="checkbox"] { width:20px; height:20px; margin:0; flex:none; }
.stage-standalone-header { display:flex; align-items:center; gap:12px; padding:18px clamp(20px,5vw,64px); border-bottom:1px solid var(--line); background:var(--panel); }
.stage-standalone-header strong { font-size:1.1rem; } .stage-standalone-header strong span { color:var(--accent); }
.stage-standalone-user { margin-left:auto; color:var(--muted); }
.stage-standalone-main { max-width:1150px; margin:auto; padding:0 clamp(20px,5vw,56px) 64px; }
.stage-display-launch, .perform-stage-display { display:none; }
.stage-display-queue { display:grid; gap:var(--display-gap); min-width:0; overflow-wrap:anywhere; }
.stage-display-queue h3 { margin:0 0 .5em; font-size:.9em; color:var(--display-accent); }
.stage-display-queue ul { display:grid; gap:.45em; margin:0; padding:0; list-style:none; }
.stage-display-queue li { display:grid; gap:.1em; }
.stage-display-queue li + li { border-top:1px solid var(--display-line); padding-top:.45em; }
.stage-display-queue small, .stage-display-queue p { color:var(--display-muted); }
.stage-display-queue p { margin:0; }
.stage-display-performers { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.stage-display-song { display:grid; gap:2px; min-width:0; }
.standalone-stage-display {
  --display-accent:#98e1b4;
  --display-muted:#c0d0c6;
  --display-line:#385649;
  --display-panel:#172a21;
  --display-gap:clamp(12px, 2.5vw, 34px);
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  max-width:none;
  max-height:none;
  margin:0;
  padding:calc(var(--display-gap) + var(--safe-area-top)) max(var(--display-gap), env(safe-area-inset-right)) max(var(--display-gap), env(safe-area-inset-bottom)) max(var(--display-gap), env(safe-area-inset-left));
  border:0;
  background:#101e18;
  color:#f1faf4;
  overflow:auto;
}
.standalone-stage-display::backdrop { background:#101e18; }
.standalone-stage-display > header { display:flex; gap:16px; justify-content:space-between; align-items:start; margin-bottom:var(--display-gap); }
.standalone-stage-display :is(h1,h2) { margin:0; font-size:clamp(1.4rem, 3vw, 3rem); overflow-wrap:anywhere; }
.standalone-stage-display-body { display:flex; gap:var(--display-gap); align-items:start; }
.standalone-stage-display .stage-display-queue { flex:1; grid-template-columns:repeat(2, minmax(0, 1fr)); font-size:clamp(.95rem, 2.15vw, 2rem); }
.standalone-stage-display .stage-display-queue section { padding:.75em; border:1px solid var(--display-line); border-radius:.55em; background:var(--display-panel); }
.standalone-stage-display .stage-display-current,
.standalone-stage-display .stage-display-upcoming:last-child { grid-column:1 / -1; }
.standalone-stage-display .stage-display-current strong { font-size:1.7em; line-height:1.12; }
.stage-display-qr { display:grid; justify-items:center; gap:12px; width:clamp(110px, 19vw, 300px); text-align:center; }
.stage-display-qr[hidden] { display:none; }
.stage-display-qr img { display:block; width:100%; border-radius:10px; }
.stage-display-qr strong { display:block; font-size:clamp(1rem, 2.5vw, 2.5rem); letter-spacing:.12em; }
.stage-display-qr :is(img,strong)[hidden] { display:none; }
.stage-display-document::before { background:transparent; }
.stage-display-page > header { align-items:center; }
.stage-display-appearance { position:relative; flex:none; }
.stage-display-appearance > summary {
  display:grid; place-items:center; width:44px; height:44px; border-radius:9px;
  list-style:none; color:var(--display-muted); cursor:pointer;
}
.stage-display-appearance > summary::-webkit-details-marker { display:none; }
.stage-display-appearance > summary .ui-icon { width:16px; height:16px; }
.stage-display-appearance > summary:hover,
.stage-display-appearance[open] > summary { background:var(--display-panel); color:inherit; }
.stage-display-appearance-options {
  position:absolute; z-index:1; inset-block-start:calc(100% + 4px); inset-inline-end:0;
  display:grid; grid-template-columns:1fr auto; align-items:center; gap:8px; width:max-content; padding:8px;
  border:1px solid var(--display-line); border-radius:12px; background:var(--display-panel);
}
.stage-display-appearance :is(select,button) { min-height:44px; color:inherit; background:var(--display-panel); border:1px solid var(--display-line); }
.stage-display-language { grid-column:1 / -1; }
.stage-display-select { position:relative; }
.stage-display-select::after {
  content:""; position:absolute; inset-inline-end:14px; top:50%; width:7px; height:7px;
  border:solid currentColor; border-width:0 1px 1px 0;
  transform:translateY(-70%) rotate(45deg); pointer-events:none;
}
.stage-display-appearance select { width:100%; padding:8px 32px 8px 12px; }
.stage-display-appearance button { width:44px; padding:0; font-size:1.1rem; }
.stage-display-appearance :is(select,button):hover { border-color:var(--display-accent); }
html[data-stage-display-mode="dark"] { color-scheme:dark; }
html[data-stage-display-mode="light"] .stage-display-page {
  --display-accent:#346c51;
  --display-muted:#50665a;
  --display-line:#ccd9d0;
  --display-panel:#fff;
  background:#f5f6f2;
  color:#20382f;
}
html[data-stage-display-style="perform"][data-stage-display-mode="dark"] .stage-display-page {
  --display-accent:#fff;
  --display-muted:#ccc;
  --display-line:#fff;
  --display-panel:#000;
  background:#000;
  color:#fff;
}
html[data-stage-display-style="perform"][data-stage-display-mode="light"] .stage-display-page {
  --display-accent:#111;
  --display-muted:#444;
  --display-line:#111;
  --display-panel:#fff;
  background:#fff;
  color:#000;
}
.perform-stage-display {
  --display-accent:#245a40;
  --display-muted:#505d56;
  --display-line:#d1ddd4;
  --display-gap:12px;
  position:fixed;
  z-index:10;
  bottom:max(12px, env(safe-area-inset-bottom));
  right:max(12px, env(safe-area-inset-right));
  max-width:calc(100vw - 36px);
  border:1px solid var(--display-line);
  border-radius:14px;
  background:#f8fbf9;
  color:#15261d;
  box-shadow:0 8px 26px #0c241e30;
  font-size:.875rem;
}
.stage-dark .perform-stage-display {
  --display-accent:#98e1b4;
  --display-muted:#c0d0c6;
  --display-line:#385649;
  background:#172a21;
  color:#f1faf4;
}
.perform-stage-display { width:min(345px, 54vw); }
.perform-stage-display > header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 8px 4px 12px; cursor:grab; touch-action:none; user-select:none; }
.perform-stage-display > header strong { min-width:0; overflow-wrap:anywhere; }
.perform-stage-display [data-stage-drag] { cursor:grab; touch-action:none; }
.perform-stage-display :is(header,[data-stage-drag]):active { cursor:grabbing; }
.perform-stage-panel-tools { display:flex; gap:4px; }
.perform-stage-display [data-stage-resize] { cursor:ns-resize; touch-action:none; }
.perform-stage-display-body { height:var(--perform-stage-height, auto); max-height:min(var(--perform-stage-height, min(56dvh, 480px)), max(72px, calc(100dvh - 76px))); overflow:auto; overscroll-behavior:contain; touch-action:pan-y; padding:10px 12px 14px; border-top:1px solid var(--display-line); }
.perform-stage-display-body > p:empty, .perform-stage-menu small:empty { display:none; }
.perform-stage-display .stage-display-queue li { grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:6px; }
.perform-stage-display :is(.stage-queue-action,[data-stage-drag],[data-stage-resize],[data-stage-collapse],[data-stage-control-room]) { width:36px; min-height:36px; padding:0; color:inherit; border-color:var(--display-line); background:transparent; }
.perform-stage-display :is(.perform-stage-display-body,[data-stage-resize])[hidden] { display:none; }
.perform-stage-display [data-stage-collapse][aria-expanded="false"] .ui-icon { transform:rotate(180deg); }
.perform-stage-display button:hover:not(:disabled) { background:color-mix(in srgb,var(--display-accent) 14%,transparent); }
.perform-stage-display .ui-icon { width:17px; height:17px; }
.perform-stage-display .stage-queue-actions { display:flex; gap:4px; }
.perform-stage-display .stage-queue-chart { display:grid; justify-items:start; gap:2px; padding:4px 5px; min-width:0; text-align:left; color:inherit; border-color:transparent; background:transparent; }
.perform-stage-display .stage-queue-chart strong { color:var(--display-accent); text-decoration:underline; text-underline-offset:.15em; }
.perform-stage-display .stage-display-qr { width:100%; margin-bottom:12px; }
.perform-stage-display .stage-display-qr[hidden], .perform-stage-display[hidden], .perform-stage-menu { display:none; }
.perform-stage-display .stage-display-qr img { width:clamp(80px, 13vw, 116px); }
.perform-stage-display .stage-display-qr strong { font-size:1.1rem; }
.performance .stage-content.stage-without-chart { padding:0 clamp(16px, 5vw, 64px); }
.stage-without-chart p { text-align:center; }
@media (orientation:landscape) {
  .stage-display-launch { display:inline-flex; }
  .perform-stage-display:not([hidden]) { display:block; }
  .stage-menu .perform-stage-menu { display:grid; }
  .open-stage-detail-hero { grid-template-columns:minmax(0,1fr) minmax(0,max-content) minmax(0,1fr); }
  .open-stage-detail-hero .stage-display-launch { justify-self:center; }
}
@media (orientation:portrait) {
  dialog.standalone-stage-display, .standalone-stage-display::backdrop { display:none; }
}
@media (orientation:portrait), (max-width:600px) {
  .stage-display-page { text-align:center; }
  .stage-display-page > header {
    display:grid; grid-template-columns:44px minmax(0, 1fr) 44px; gap:8px;
  }
  .stage-display-page > header h1 { grid-column:2; }
  .stage-display-page .standalone-stage-display-body { flex-direction:column; align-items:center; }
  .stage-display-page .stage-display-queue { flex:none; width:min(100%, 36rem); grid-template-columns:minmax(0, 1fr); }
  .stage-display-page .stage-display-qr { width:clamp(130px, 42vw, 210px); }
}
.join-landing { min-height:100vh; display:grid; place-items:center; padding:24px; }
.join-card { width:min(100%,440px); padding:clamp(24px,6vw,42px); background:var(--panel); border:1px solid var(--line); border-radius:22px; box-shadow:var(--shadow); text-align:center; }
.join-card h1 { margin:12px 0; font-size:2.2rem; }
.join-card p { color:var(--muted); }
.join-card form { display:grid; gap:12px; text-align:left; margin:26px 0 12px; }
.join-card input,.join-card form button,.join-card #scanQr { width:100%; }
#stageContactPreferences { display:grid; gap:12px; min-width:0; margin:0; padding:12px; border:1px solid var(--line); border-radius:10px; }
#stageContactPreferences p { margin:0; font-size:.85rem; }
#stageContactPreferences label { display:flex; align-items:center; gap:8px; }
#stageContactPreferences input { appearance:auto; width:18px; height:18px; min-height:0; flex:none; margin:0; }
#stageContactPreferences a { font-size:.85rem; }
.join-card video { width:100%; border-radius:12px; margin-top:16px; }
.join-languages { display:flex; justify-content:center; gap:8px; margin-top:24px; }
.join-languages button { min-width:48px; font-size:1.3rem; }
.join-languages button[aria-pressed="true"] { border-color:var(--accent); }
html[data-join-theme="dark"] { color-scheme:dark; --ink:#edf3ef; --muted:#b5c3b8; --paper:#111a16; --panel:#1c2922; --line:#405046; --accent:#88c89f; --shadow:0 12px 38px #0004; }
.join-theme { position:fixed; top:20px; right:20px; width:44px; height:44px; font-size:1.2rem; z-index:2; }
.open-stage-mobile-nav { display:none; }
.open-stage-separate { margin: 12px 0; }
.stage-live { display:inline-block; border-radius:999px; padding:3px 9px; background:var(--paper); color:var(--muted); font-size:.8rem; font-weight:700; }
.stage-live.is-live { background:color-mix(in srgb,var(--accent) 15%,var(--panel)); color:var(--accent); }
.stage-code { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.stage-code strong { font-size:1.1rem; overflow-wrap:anywhere; }
.stage-display-link:not([hidden]) { display:grid; gap:12px; }
.stage-display-link a { overflow-wrap:anywhere; }
.stage-qr img { display:block; width:min(240px,100%); height:auto; margin:18px 0; background:white; }
@media(max-width:740px) { .open-stage-separate { display:none; } .open-stage-mobile-nav { display:flex; } }
.open-stage-separate .nav-item { width:100%; }
.sidebar-collapsed .open-stage-separate .nav-item { width:48px; }
.open-stage-lock { display:inline-flex; margin-left:auto; opacity:.7; }
.open-stage-lock .ui-icon { width:15px; height:15px; }
.nav-item[data-tab="openstage"][aria-disabled="true"] { opacity:.65; }
.sidebar-collapsed .open-stage-lock { position:absolute; margin:0; transform:translate(15px,14px); }
@media(max-width:600px) { .shell .open-stage-lock, .shell.sidebar-collapsed .open-stage-lock { position:absolute; margin:0; transform:translate(17px,-14px); } .shell .open-stage-lock .ui-icon { width:12px; height:12px; } }
.open-stage-section > label.notes-reminder-setting, .open-stage-section section > label.notes-reminder-setting { display:flex; align-items:center; justify-content:space-between; margin:18px 0; }
.open-stage .stage-delete { margin-left:auto; color:#a32732; border-color:#d8a6aa; }
/* The participant page uses its own theme preference, independent of the
   organizer's GigAlong appearance setting. */
html[data-join-theme="dark"] body { background:var(--paper); color:var(--ink); }
html[data-join-theme="dark"] .join-card :is(input,select,textarea),
html[data-join-theme="dark"] :is(.join-card button,.join-theme) { background:#25362b; color:#edf3ef; border-color:#506356; }
html[data-join-theme="dark"] .join-card button.primary { background:#397b54; border-color:#397b54; color:#fff; }
html[data-join-theme="dark"] .join-card button:hover,
html[data-join-theme="dark"] .join-theme:hover { background:#354d3c; }
html[data-join-theme="dark"] .join-card button.primary:hover { background:#2f6846; }
html[data-join-theme="dark"] .join-card :is(label,h1) { color:#edf3ef; }
html[data-join-theme="dark"] .join-card .eyebrow { color:#a3d8b2; }
body.app-dark:not(.performance) .open-stage .stage-delete { color:#ffb8bd; border-color:#a65f67; }
.join-landing:has(.participant-stage:not([hidden])) { display:block; }
.participant-stage { max-width:900px; margin:0 auto; padding:32px 0; }
.participant-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding-right:52px; }
.participant-header h1 { margin:8px 0; font-size:clamp(2rem,6vw,3rem); }
.participant-header p,.participant-item small { color:var(--muted); }
.participant-section { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:22px; margin:16px 0; }
.participant-section h2 { font-size:1.35rem; margin:0 0 16px; }
.participant-item { border-top:1px solid var(--line); padding:14px 0; }
.participant-item strong,.participant-item small { display:block; }
.participant-item p { color:var(--muted); margin:6px 0; }
.participant-section form { display:grid; gap:12px; }
.participant-section label:not(.participant-role) { display:grid; gap:6px; }
.participant-section fieldset { border:1px solid var(--line); border-radius:10px; display:flex; flex-wrap:wrap; gap:12px; }
.participant-role { display:inline-flex; align-items:center; gap:6px; }
.participant-role input { width:20px; min-height:20px; }
html[data-join-theme="dark"] .participant-stage :is(input,button,select) { background:#25362b; color:#edf3ef; border-color:#506356; }
html[data-join-theme="dark"] .participant-stage button.primary { background:#397b54; border-color:#397b54; color:#fff; }
.join-card [hidden], .participant-stage[hidden] { display:none !important; }
#participantName { display:grid; gap:12px; text-align:left; margin:26px 0 12px; }

.stage-loading { display:flex; justify-content:center; align-items:center; gap:10px; margin:18px 0; color:var(--muted); }
.stage-spinner { width:20px; height:20px; border:2px solid var(--line); border-top-color:#56ac74; border-radius:50%; animation:stage-spin .7s linear infinite; }
.stage-welcome { animation:stage-enter .4s cubic-bezier(.2,.8,.2,1) both; }
.stage-welcome-icon { display:grid; place-items:center; width:64px; height:64px; margin:20px auto; border-radius:50%; background:#397b54; color:white; font-size:2rem; }
.stage-welcome .eyebrow { margin-bottom:0; }
@keyframes stage-spin { to { transform:rotate(360deg); } }
@keyframes stage-enter { from { opacity:0; transform:translateY(14px) scale(.98); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion:reduce) { .stage-welcome { animation:none; } .stage-spinner { animation-duration:1.5s; } }

 .song-search { position:relative; min-width:0; }
#songSuggestions { position:absolute; z-index:5; top:calc(100% + 5px); left:0; right:0; display:grid; gap:2px; max-height:240px; overflow-y:auto; padding:6px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 28px #0004; }
#songSuggestions:empty { display:none; }
.participant-stage #songSuggestions .song-suggestion { width:100%; text-align:left; display:grid; gap:2px; padding:9px 10px; border:0; border-radius:8px; background:transparent; color:var(--ink); }
.participant-stage #songSuggestions .song-suggestion:is(:hover,:focus-visible) { background:color-mix(in srgb,var(--accent) 17%,var(--panel)); }
.song-suggestion small { color:var(--muted); }

/* Participant dashboard: one shared set of data, adapted to the available space. */
.join-landing:has(.participant-stage:not([hidden])) { padding:clamp(16px,2.5vw,32px); }
.participant-stage { max-width:1800px; padding:16px 0 40px; }
.participant-header { margin-bottom:22px; align-items:flex-start; }
.participant-header h1 { font-size:clamp(1.8rem,3vw,2.7rem); line-height:1.08; }
.participant-header p { margin:0; }
.stage-title-line { display:flex; align-items:center; gap:6px; }
.stage-title-line :is(h1,h2) { min-width:0; overflow-wrap:anywhere; }
.participant-header #leaveStage { white-space:nowrap; }
:is(.open-stage,.participant-stage) button.stage-refresh-button[type="button"] {
  display:inline-grid;
  place-items:center;
  width:40px;
  height:40px;
  min-height:0;
  padding:0;
  background:transparent;
  border:1px solid transparent;
  color:var(--muted);
  flex:none;
}
:is(.open-stage,.participant-stage) button.stage-refresh-button[type="button"]:hover {
  border-color:var(--line);
  color:var(--ink);
}
.stage-refresh-button .ui-icon { width:18px; height:18px; }
.participant-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:start; }
.participant-column { min-width:0; }
.participant-section { margin:0 0 14px; padding:clamp(15px,1.6vw,22px); border-radius:18px; box-shadow:0 4px 18px #0000000a; overflow-wrap:anywhere; }
.participant-section h2 { font-size:1.05rem; line-height:1.2; }
.participant-current { border-top:3px solid var(--accent); }
.participant-item:first-of-type { border-top:0; padding-top:0; }
.participant-item strong { font-size:1rem; line-height:1.3; }
.participant-item small,.participant-item p,.participant-empty { font-size:.86rem; line-height:1.45; }
.participant-empty { color:var(--muted); margin:0; }
.participant-add input:not([type=checkbox]) { width:100%; min-width:0; }
.participant-add form > small { color:var(--muted); line-height:1.4; }
.participant-section fieldset,.participant-dialog fieldset { margin:0; padding:12px; border:1px solid var(--line); border-radius:12px; display:flex; flex-wrap:wrap; gap:10px; }
.participant-section legend,.participant-dialog legend { color:var(--muted); padding:0 5px; font-size:.85rem; font-weight:600; }
.participant-join { margin-top:8px; display:inline-flex; align-items:center; gap:12px; color:var(--accent); font-weight:700; }
.participant-tabs,.participant-next-summary { display:none; }
.participant-dialog { width:min(440px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:auto; border:1px solid var(--line); border-radius:20px; padding:24px; color:var(--ink); background:var(--panel); box-shadow:0 24px 80px #0007; }
.participant-dialog::backdrop { background:#09120dcc; backdrop-filter:blur(3px); }
.participant-dialog h2 { margin:12px 0 8px; }
.participant-dialog p { color:var(--muted); }
.participant-dialog form { display:grid; gap:16px; }
.participant-dialog-head { display:flex; justify-content:space-between; align-items:center; }
.participant-dialog-head button { font-size:1.4rem; min-width:42px; }
.participant-dialog form [role=alert]:empty { display:none; }
html[data-join-theme="dark"] .participant-dialog button { background:#25362b; color:#edf3ef; border-color:#506356; }
html[data-join-theme="dark"] .participant-dialog button.primary { background:#397b54; border-color:#397b54; color:#fff; }
@media (max-width:767px) {
 .join-landing:has(.participant-stage:not([hidden])) { padding:16px; }
 .participant-stage { padding:8px 0 28px; }
 .participant-header { margin-bottom:16px; padding-right:48px; }
 .participant-header h1 { font-size:1.7rem; }
 .participant-header #leaveStage { padding:8px; font-size:.78rem; }
 .participant-tabs { display:flex; gap:6px; overflow-x:auto; padding:2px 0 12px; scrollbar-width:none; }
 .participant-tabs::-webkit-scrollbar { display:none; }
 .participant-tabs button { white-space:nowrap; border-radius:999px; padding:9px 13px; font-size:.82rem; }
 .participant-tabs button[aria-pressed="true"],html[data-join-theme="dark"] .participant-tabs button[aria-pressed="true"] { background:#397b54; border-color:#397b54; color:#fff; }
 .participant-grid { display:block; }
 .participant-column { display:none; }
 .participant-grid[data-active-tab="overview"] :is(.participant-column-live,.participant-column-add),
 .participant-grid[data-active-tab="queue"] .participant-column-live,
 .participant-grid[data-active-tab="looking"] .participant-column-looking,
 .participant-grid[data-active-tab="history"] .participant-column-history { display:block; }
 .participant-grid[data-active-tab="overview"] .participant-next-summary { display:block; }
 .participant-grid[data-active-tab="overview"] .participant-next-all { display:none; }
 .participant-section { margin-bottom:12px; }
}

html[data-join-theme="dark"] .participant-stage label,
html[data-join-theme="dark"] .participant-dialog label { color:#d4e2d7; }

.participant-column-lyrics { display:none; }
.participant-song-title,html[data-join-theme="dark"] .participant-stage .participant-song-title { display:inline; min-height:0; padding:0; border:0; border-radius:0; background:transparent; color:var(--ink); font:inherit; text-align:left; text-decoration:underline; text-decoration-color:var(--accent); text-underline-offset:3px; }
.participant-lyrics-dialog { width:100vw; max-width:none; height:100dvh; max-height:none; margin:0; border:0; border-radius:0; padding:clamp(20px,4vw,48px); }
.participant-lyrics-content { font-size:clamp(1.05rem,2vw,1.4rem); line-height:1.75; }
.participant-lyrics-content .section { margin:1.1em 0 .25em; color:var(--accent); font-weight:700; }
@media(max-width:767px) {
 .participant-tabs { gap:0; border-bottom:1px solid var(--line); padding:0; margin-bottom:16px; }
 .participant-tabs button,html[data-join-theme="dark"] .participant-tabs button { border:0; border-bottom:3px solid transparent; border-radius:0; padding:12px 14px 10px; background:transparent; color:var(--muted); font-weight:600; }
 .participant-tabs button[aria-selected="true"],html[data-join-theme="dark"] .participant-tabs button[aria-selected="true"] { background:transparent; color:var(--ink); border-bottom-color:var(--accent); }
 .participant-grid[data-active-tab="lyrics"] .participant-column-lyrics { display:block; }
 .participant-lyrics h3 { margin:0 0 16px; }
}

.join-theme-picker { position:fixed; top:14px; right:16px; z-index:3; display:flex; align-items:center; gap:7px; color:var(--muted); font-size:.75rem; }
.join-theme-picker select { max-width:145px; padding:8px 25px 8px 10px; border:1px solid var(--line); border-radius:9px; background:var(--panel); color:var(--ink); }
.participant-header { padding-right:185px; }
@media(max-width:767px) { .join-theme-picker span { display:none; } .join-theme-picker select { max-width:120px; font-size:.75rem; } .participant-header { padding-right:130px; } }
html[data-join-theme="perform"] { color-scheme:dark; --ink:#fff; --muted:#ccc; --paper:#000; --panel:#000; --line:#fff; --accent:#fff; --shadow:none; }
html[data-join-theme="perform"] body { background:#000; color:#fff; }
html[data-join-theme="perform"] :is(.join-card,.participant-section,.participant-dialog) { background:#000; color:#fff; border-color:#fff; box-shadow:none; }
html[data-join-theme="perform"] :is(.join-card,.participant-stage,.participant-dialog) :is(input,select,button) { background:#000; color:#fff; border-color:#fff; }
html[data-join-theme="perform"] :is(.join-card,.participant-stage,.participant-dialog) button.primary { background:#fff; color:#000; border-color:#fff; }
html[data-join-theme="perform"] :is(.join-card,.participant-stage,.participant-dialog) label { color:#fff; }
html[data-join-theme="perform"] .participant-tabs button[aria-selected="true"] { color:#fff; border-bottom-color:#fff; }
@media(max-width:767px) { .participant-header { flex-direction:column; align-items:flex-start; gap:8px; } }

.join-mode-toggle { display:grid; place-items:center; width:40px; height:40px; padding:0; border:1px solid var(--line); border-radius:9px; background:var(--panel); color:var(--ink); font-size:1.1rem; }
.participant-header { padding-right:225px; }
@media(max-width:767px) { .join-theme-picker { right:12px; gap:5px; } .join-theme-picker select { max-width:100px; } .participant-header { padding-right:155px; } }
html[data-join-theme="perform-light"] { color-scheme:light; --ink:#000; --muted:#444; --paper:#fff; --panel:#fff; --line:#111; --accent:#111; --shadow:none; }
html[data-join-theme="perform-light"] body { background:#fff; color:#000; }
html[data-join-theme="perform-light"] :is(.join-card,.participant-section,.participant-dialog) { background:#fff; color:#000; border-color:#111; box-shadow:none; }
html[data-join-theme="perform-light"] :is(.join-card,.participant-stage,.participant-dialog) :is(input,select,button) { background:#fff; color:#000; border-color:#111; }
html[data-join-theme="perform-light"] :is(.join-card,.participant-stage,.participant-dialog) button.primary { background:#000; color:#fff; border-color:#000; }
html[data-join-theme="perform-light"] :is(.join-card,.participant-stage,.participant-dialog) label { color:#000; }
html[data-join-theme="perform-light"] .participant-tabs button[aria-selected="true"] { color:#000; border-bottom-color:#000; }

.join-mode-toggle { flex:none; min-width:40px; }

/* Mutually exclusive role choices follow the Stage's selected theme. */
.participant-role { position:relative; display:inline-flex; align-items:center; cursor:pointer; }
.participant-role input[type="radio"] { position:absolute; opacity:0; width:1px; height:1px; min-height:0; margin:0; }
.participant-role span { display:block; padding:9px 14px; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--panel); font-weight:600; line-height:1.2; }
.participant-role input:checked + span { background:#397b54; border-color:#397b54; color:#fff; }
.participant-role input:focus-visible + span { outline:3px solid var(--accent); outline-offset:2px; }
html[data-join-theme="perform"] .participant-role input:checked + span { background:#fff; border-color:#fff; color:#000; }
html[data-join-theme="perform-light"] .participant-role input:checked + span { background:#000; border-color:#000; color:#fff; }

/* Center the lyric block while retaining natural left-aligned lines. */
.participant-lyrics-dialog h2, .participant-lyrics h3 { text-align:center; }
.participant-lyrics-content { width:fit-content; max-width:100%; margin-inline:auto; text-align:left; font-size:var(--participant-lyrics-size, 22px); touch-action:pan-x pan-y; }
.participant-lyrics-dialog, .participant-lyrics { touch-action:pan-x pan-y; }
@media (max-width:767px) { .participant-stage { width:100%; max-width:100%; } }
