/* ==========================================================================
   BandDeck — dark blue theme (powered by QueueStackPro)
   ========================================================================== */

:root {
    --bg: #070d1a;
    --bg-glow: #0d1b36;
    --surface: #0d1628;
    --surface-2: #111d34;
    --surface-3: #172642;
    --border: #1d2e4d;
    --border-strong: #2a4170;

    --text: #e6edf8;
    --text-2: #b4c3dc;
    --muted: #7e90b0;

    --accent: #3b82f6;
    --accent-hi: #60a5fa;
    --accent-lo: #1d4ed8;
    --accent-soft: rgb(59 130 246 / 0.14);
    --cyan: #22d3ee;

    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;

    /* Stem palette: blues and cool hues that stay distinct from each other. */
    --stem-vocals: #60a5fa;
    --stem-drums: #a78bfa;
    --stem-bass: #22d3ee;
    --stem-other: #818cf8;
    --stem-guitar: #38bdf8;
    --stem-piano: #93c5fd;
    --stem-mix: #3b82f6;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 32px -12px rgb(0 0 0 / 0.6);
    --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace;

    color-scheme: dark;
}

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

/* Baseline smoothness for anything interactive that doesn't already declare its own transition below —
   later, more specific rules for a given element/property simply override this. */
a, button, .btn, .card, .chip, select, .select, input, textarea,
.table tbody tr, .switch-track, .switch-track::after, summary {
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
        box-shadow 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

/* Panels that swap via the hidden attribute (Songs/Setlists) get a quick fade-in instead of popping in;
   same "animation restarts on display:none → visible" trick used for the accordion cards below. */
#songs:not([hidden]), #setlists:not([hidden]) { animation: panel-in 0.15s ease; }
@keyframes panel-in { from { opacity: 0; } to { opacity: 1; } }

/* Component display rules must never defeat the hidden attribute. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    /* Sticky footer: main grows to fill the viewport, so the footer sits at the bottom of the page
       even when there isn't enough content to push it there naturally. */
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 85% -10%, rgb(37 99 235 / 0.18), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgb(34 211 238 / 0.07), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
/* #main uses .page's `margin: 0 auto` to center on wide screens, but auto cross-axis margins
   disable flex stretch alignment (per spec), so without an explicit width it sizes to its
   content instead of the viewport - this is what let long nowrap text (e.g. a song title)
   blow out the whole page's width on mobile. width:100% + min-width:0 keeps it filling the
   viewport (clamped by .page's max-width, with the auto margins still centering it once that
   max-width kicks in on wide screens) while still allowing it to shrink below its content size. */
#main { flex: 1 0 auto; width: 100%; min-width: 0; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 700; }
h2 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
p { margin: 0; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.center { text-align: center; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -40px; z-index: 100;
    background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Icons ---------- */
.icon {
    width: 18px; height: 18px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px max(20px, env(safe-area-inset-left));
    /* Window Controls Overlay draws the OS minimize/maximize/close buttons over the top-right corner of
       the page itself (this bar IS the title bar - see the drag-region note below). env(titlebar-area-width)
       is how wide the bar can be before it runs under those buttons; reserve the rest as padding so nothing
       interactive ends up beneath them. Resolves to 0 outside WCO (fallback matches the bar's own width). */
    padding-right: max(max(20px, env(safe-area-inset-right)), calc(100% - env(titlebar-area-width, 100%)));
    background: rgb(7 13 26 / 0.75);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
    /* The manifest opts into Window Controls Overlay, so the OS draws no title bar for the installed
       app — this bar IS the title bar. Mark it draggable and carve out the interactive bits (the
       brand link and nav buttons/links) as non-draggable so the window can still be moved. */
    -webkit-app-region: drag;
    app-region: drag;
}
.brand, .topnav { -webkit-app-region: no-drag; app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 4px 12px rgb(37 99 235 / 0.45)); }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { color: var(--accent-hi); font-weight: 500; }
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav-link { color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-size: 0.9rem; }
.topnav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }

.page { max-width: 1380px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- Cards ---------- */
.card {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card.narrow { max-width: 520px; margin: 48px auto; display: grid; gap: 16px; justify-items: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* Collapsible "advanced" cards — off by default, expand on click (Backing tracks, Chord chart). */
details.card.accordion { padding: 0 0 18px; }
details.card.accordion > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    list-style: none; cursor: pointer; padding: 18px; font-weight: 700; color: var(--text);
}
details.card.accordion > summary::-webkit-details-marker { display: none; }
details.card.accordion > summary::after {
    content: ''; flex: none; width: 8px; height: 8px; margin-left: auto;
    border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2);
    transform: rotate(-45deg); transition: transform 0.15s;
}
details.card.accordion[open] > summary::after { transform: rotate(45deg); }
details.card.accordion > summary .muted { font-weight: 400; margin-left: 4px; }
details.card.accordion > *:not(summary) { margin-left: 18px; margin-right: 18px; }
details.card.accordion > summary + * { margin-top: 0; }
/* Native <details> shows/hides content instantly; this re-plays a quick fade+slide every time it opens
   (animations restart when an element goes from display:none to visible, so no JS is needed). */
details.card.accordion[open] > *:not(summary) { animation: accordion-in 0.18s ease; }
@keyframes accordion-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.card-tools { display: flex; align-items: center; gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    font: inherit; font-weight: 600; font-size: 0.9rem;
    color: var(--text); background: var(--surface-3);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1c2e50; border-color: #36528a; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(180deg, #3b82f6, #2563eb); border-color: #3b82f6; color: #fff;
    box-shadow: 0 6px 18px -6px rgb(37 99 235 / 0.7);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #4f8ff7, #2f6ff0); border-color: #60a5fa; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: #fca5a5; }
.btn-danger-ghost:hover:not(:disabled) { background: rgb(248 113 113 / 0.1); border-color: rgb(248 113 113 / 0.3); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 0.85rem; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 0.78rem; }
.btn-icon { width: 38px; padding: 0; font-size: 1.15rem; }
.btn-play {
    width: 52px; height: 52px; padding: 0; border-radius: 50%;
    background: linear-gradient(180deg, #4f8ff7, #1d4ed8); border: 0; color: #fff;
    box-shadow: 0 10px 26px -8px rgb(37 99 235 / 0.85), 0 0 0 4px rgb(59 130 246 / 0.12);
}
.btn-play .icon { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.btn-play .icon-pause { display: none; }
.btn-play[aria-pressed="true"] .icon-play { display: none; }
.btn-play[aria-pressed="true"] .icon-pause { display: block; }
.btn[aria-pressed="true"]:not(.btn-play) { background: var(--accent-soft); color: var(--accent-hi); border-color: rgb(59 130 246 / 0.4); }
.button-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
/* A secondary + primary pair (Reset / Export…) reads better spread across the row than bunched together at
   one edge with a big empty gap on the other side. */
.button-row.split { justify-content: space-between; }
/* A single primary action in a narrow sidebar card (e.g. "Build backing track") reads as more intentional
   filling the row than nearly-but-not-quite touching the edge at its natural width. */
.button-row.full > .btn { flex: 1; }

/* ---------- Badges / alerts ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
    background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge, .chip, .status { white-space: nowrap; flex-shrink: 0; }
.badge-key { background: var(--accent-soft); color: var(--accent-hi); border-color: rgb(59 130 246 / 0.35); }
.status { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.status-ready { color: var(--ok); border-color: rgb(52 211 153 / 0.3); background: rgb(52 211 153 / 0.08); }
.status-busy { color: var(--accent-hi); border-color: rgb(59 130 246 / 0.35); background: var(--accent-soft); }
.status-failed { color: var(--danger); border-color: rgb(248 113 113 / 0.3); background: rgb(248 113 113 / 0.08); }
.status-busy::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }

.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 16px; font-size: 0.9rem; border: 1px solid; }
.alert-warn { background: rgb(251 191 36 / 0.08); border-color: rgb(251 191 36 / 0.3); color: #fde68a; }
.alert-error { background: rgb(248 113 113 / 0.08); border-color: rgb(248 113 113 / 0.3); color: #fecaca; }

/* ---------- Progress / spinner / skeleton ---------- */
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-bar {
    height: 100%; width: 0; border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--cyan));
    transition: width 0.4s ease;
}
.spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2.5px solid rgb(96 165 250 / 0.2); border-top-color: var(--accent-hi);
    animation: spin 0.8s linear infinite; flex: none;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.skeleton-row {
    height: 58px; border-radius: var(--radius-sm); margin-bottom: 8px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Library ---------- */
.hero {
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center;
    margin: 12px 0 28px;
}
.eyebrow { color: var(--accent-hi); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 800; letter-spacing: -0.03em;
    background: linear-gradient(180deg, #fff, #a9c3ef); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--text-2); font-size: 1.05rem; margin-top: 12px; max-width: 52ch; }

.dropzone { position: relative; }
.dropzone-inner {
    display: grid; justify-items: center; gap: 8px; text-align: center;
    padding: 36px 24px; cursor: pointer;
    border: 1.5px dashed var(--border-strong); border-radius: 18px;
    background: radial-gradient(400px 180px at 50% 0%, rgb(59 130 246 / 0.12), transparent), var(--surface);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dropzone-inner:hover, .dropzone.is-dragging .dropzone-inner { border-color: var(--accent-hi); background-color: var(--surface-2); }
.dropzone.is-dragging .dropzone-inner { transform: scale(1.01); }
.dropzone-icon {
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px;
    background: var(--accent-soft); color: var(--accent-hi); margin-bottom: 4px;
}
.dropzone-title { font-weight: 600; font-size: 1.05rem; }
.dropzone-title u { text-decoration-color: var(--accent); text-underline-offset: 3px; color: var(--accent-hi); }
.dropzone-hint { color: var(--muted); font-size: 0.82rem; }
.dropzone.is-uploading .dropzone-inner { pointer-events: none; opacity: 0.5; }
.upload-progress { margin-top: 12px; display: grid; gap: 8px; }
.upload-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.song-list { display: grid; gap: 6px; }
.song-row {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center;
    padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text);
    border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.song-row:hover { background: var(--surface-3); border-color: var(--border); text-decoration: none; }
.song-art {
    width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, #1e3a8a, #0ea5e9); color: #fff; font-weight: 700; font-size: 0.95rem;
}
.song-main { min-width: 0; display: grid; }
.song-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-sub { color: var(--muted); font-size: 0.8rem; }
.song-progress { width: 120px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 36px 12px; color: var(--muted); }

/* ---------- Studio ---------- */
.studio-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.studio-title { flex: 1; min-width: 0; }
.studio-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.meta { color: var(--muted); font-size: 0.85rem; }
.meta + .meta::before { content: "·"; margin-right: 10px; color: var(--border-strong); }
.studio-actions { display: flex; gap: 6px; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.studio-side { position: sticky; top: 76px; }

.processing { margin-bottom: 16px; display: grid; gap: 14px; }
.processing-head { display: flex; align-items: center; gap: 14px; }
.processing-head > div:nth-child(2) { flex: 1; }
.processing-pct { font-size: 1.1rem; color: var(--accent-hi); }
.steps { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li {
    font-size: 0.78rem; padding: 4px 10px 4px 26px; border-radius: 999px; position: relative;
    background: var(--surface-3); color: var(--muted); border: 1px solid var(--border);
}
.steps li::before {
    content: ""; position: absolute; left: 10px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
    border-radius: 50%; border: 1.5px solid currentColor;
}
.steps li.is-active { color: var(--accent-hi); border-color: rgb(59 130 246 / 0.4); }
.steps li.is-active::before { background: currentColor; animation: pulse 1.2s infinite; }
.steps li.is-done { color: var(--ok); }
.steps li.is-done::before { background: currentColor; }

/* Now playing */
.now-chords { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.now-chords > div {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 0;
}
.label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.chord-big {
    font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05;
    color: #fff; text-shadow: 0 0 30px rgb(59 130 246 / 0.55);
    transition: transform 0.12s ease;
}
.chord-big.bump { transform: scale(1.06); }
.chord-mid { font-size: 1.9rem; font-weight: 700; color: var(--text-2); line-height: 1.1; }
.key-big { font-size: 1.35rem; font-weight: 700; color: var(--accent-hi); line-height: 1.3; }
.numeral { font-family: var(--mono); color: var(--cyan); font-size: 0.9rem; }
.next-meter { height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.next-meter-bar { height: 100%; width: 0; background: var(--accent-hi); }

.timeline { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.waveform { display: block; width: 100%; height: 170px; cursor: pointer; touch-action: none; }
.timeline-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
    color: var(--muted); font-size: 0.9rem; background: rgb(13 22 40 / 0.85);
}
.timeline-loading[hidden] { display: none; }

.transport { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.transport-left, .transport-right { display: flex; align-items: center; gap: 10px; }
.time { font-size: 0.95rem; margin-left: 8px; }
.master { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.master input { width: 120px; }

/* Chord chart */
.chord-used { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chord-pill {
    font-weight: 700; font-size: 0.85rem; padding: 4px 10px; border-radius: 8px;
    background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
}
.chord-chart {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px;
    max-height: 420px; overflow-y: auto; padding: 2px; scroll-behavior: smooth;
}
.chord-chip {
    display: grid; gap: 2px; text-align: left; padding: 10px 10px 8px; min-height: 64px;
    font: inherit; color: var(--text); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.chord-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.chord-chip .sym { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.chord-chip .sub { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); font-family: var(--mono); }
.chord-chip.nc .sym { color: var(--muted); font-weight: 500; }
.chord-chip.low-confidence .sym::after { content: "?"; color: var(--muted); font-weight: 500; margin-left: 2px; font-size: 0.8em; }
.chord-chip.is-current {
    background: linear-gradient(180deg, rgb(59 130 246 / 0.28), rgb(59 130 246 / 0.12));
    border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.18);
}
.chord-chart.view-numerals .sym-chord { display: none; }
.chord-chart:not(.view-numerals) .sym-numeral { display: none; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.seg {
    font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--muted);
    background: transparent; border: 0; border-radius: 7px; padding: 5px 12px; cursor: pointer; min-width: 40px;
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgb(255 255 255 / 0.05) inset, 0 1px 4px rgb(0 0 0 / 0.4); }

/* Form fields */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.field-label { font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
.select {
    font: inherit; font-size: 0.88rem; color: var(--text); height: 36px; min-width: 150px; padding: 0 32px 0 12px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e90b0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); appearance: none; cursor: pointer;
}
.select:disabled { opacity: 0.5; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.stepper .btn-icon { width: 34px; height: 32px; }
.stepper-value { min-width: 46px; text-align: center; font-weight: 700; font-size: 1rem; color: var(--accent-hi); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 0.85rem; color: var(--text-2); cursor: pointer; }
.check input, input[type="range"] { accent-color: var(--accent); }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: var(--surface-3); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgb(0 0 0 / 0.5);
}
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

/* Mixer - a compact, icon-led row per stem (glyph, one slider, an overflow menu for mute/solo/download),
   closer to how a mobile stem-mixing app lays this out than the old always-expanded card-per-track grid. */
.mixer { display: grid; gap: 2px; }
.channel {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 10px 4px;
}
.channel + .channel { border-top: 1px solid var(--border); }
.channel-icon {
    display: grid; place-items: center; width: 30px; height: 30px; flex: none; color: var(--stem, var(--text-2));
}
.channel-icon-svg { width: 22px; height: 22px; }
.channel-vol { position: relative; display: flex; align-items: center; min-width: 0; }
.channel-vol .channel-slider { width: 100%; position: relative; z-index: 1; background: transparent; }
/* The level meter sits behind the slider track as a soft glow rather than a separate readout row - the
   slider itself is the only control a glance needs; loudness is a background cue, not a second thing to read. */
.channel-vol .meter {
    position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px;
    background: var(--surface-3); overflow: hidden; pointer-events: none;
}
.meter-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--stem, var(--accent)), #fff); opacity: 0.55; transition: width 0.06s linear; }
.channel.is-silent { opacity: 0.4; }
.channel-menu { position: relative; }
.channel-menu summary {
    list-style: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
    color: var(--muted); cursor: pointer;
}
.channel-menu summary::-webkit-details-marker { display: none; }
.channel-menu summary:hover, .channel-menu[open] summary { color: var(--text); background: var(--surface-3); }
.channel-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 30;
    padding: 12px; display: grid; gap: 10px;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.7);
}
.channel-menu-name { font-weight: 600; font-size: 0.88rem; display: flex; align-items: center; gap: 8px; }
.channel-menu-name .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stem); box-shadow: 0 0 10px var(--stem); }
.channel-vol-row { display: flex; align-items: center; gap: 8px; }
.channel-vol-row input { flex: 1; min-width: 0; }
.channel-vol-row output { width: 34px; text-align: right; font-size: 0.72rem; color: var(--muted); }
.channel-buttons { display: flex; gap: 6px; }
.ms {
    flex: 1; height: 30px; font: inherit; font-size: 0.76rem; font-weight: 700; cursor: pointer;
    background: var(--surface-3); border: 1px solid var(--border); border-radius: 6px; color: var(--muted);
}
.ms:hover { color: var(--text); }
.ms.mute[aria-pressed="true"] { background: rgb(248 113 113 / 0.18); color: #fca5a5; border-color: rgb(248 113 113 / 0.4); }
.ms.solo[aria-pressed="true"] { background: rgb(251 191 36 / 0.18); color: #fde68a; border-color: rgb(251 191 36 / 0.4); }
.dl { color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; height: 30px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); font-size: 0.76rem; }
.dl:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.dl .icon { width: 15px; height: 15px; }
.dl .icon { width: 15px; height: 15px; }

.stem-vocals { --stem: var(--stem-vocals); }
.stem-drums { --stem: var(--stem-drums); }
.stem-bass { --stem: var(--stem-bass); }
.stem-other, .stem-no_vocals { --stem: var(--stem-other); }
.stem-guitar { --stem: var(--stem-guitar); }
.stem-piano { --stem: var(--stem-piano); }
.stem-mix { --stem: var(--stem-mix); }

/* Exports */
.exports { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.exports:empty { display: none; }
.export {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 0.82rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.export-main { flex: 1; min-width: 0; }
.export-title { font-weight: 600; }
.export-sub { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-size: 0.88rem;
    background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 12px;
    box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.7); animation: toast-in 0.2s ease-out;
}
.toast-error { border-color: rgb(248 113 113 / 0.5); }
.toast-ok { border-color: rgb(52 211 153 / 0.45); }
.toast .btn { margin-left: auto; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.offline-pill {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
    padding: 8px 14px; border-radius: 999px; font-size: 0.8rem;
    background: rgb(251 191 36 / 0.14); color: #fde68a; border: 1px solid rgb(251 191 36 / 0.35);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .studio-grid { grid-template-columns: minmax(0, 1fr); }
    .studio-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
    .studio-side .card + .card { margin-top: 0; }
}
@media (max-width: 820px) {
    .hero { grid-template-columns: 1fr; }
    .song-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
    .song-row .hide-sm { display: none; }
}
@media (max-width: 600px) {
    /* env(safe-area-inset-*) keeps content clear of notches/rounded corners in the installed PWA; the
       16px floor is what phones without a safe-area report. */
    .page {
        padding: 16px calc(16px + env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
    }
    .card { padding: 14px; }
    .now-chords { grid-template-columns: 1fr 1fr; }
    .card-head { flex-wrap: wrap; }
    #chart-summary { display: none; }
    .now-chords .key-now { grid-column: 1 / -1; }
    .studio-actions span, .brand-powered { display: none; }
    .stage-title-block, .stage-title-block h1 { max-width: calc(100vw - 32px); }
    /* Keep the avatar (the sign-out trigger) from being pushed past the edge of narrow screens by the
       brand text and nav links crowding the same row. */
    .user-name { display: none; }
    .topnav { gap: 4px; }
    .waveform { height: 140px; }
    .master input { width: 90px; }
    .transport { gap: 8px; }
    .transport-left { gap: 4px; }
    .btn-icon { width: 36px; height: 36px; padding: 0; }
    /* Any table (song library, etc.) sheds its least essential columns instead of forcing a horizontal
       scrollbar on a narrow phone. */
    .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   BandDeck additions
   ========================================================================== */

.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-size: 1.05rem; }
.brand-powered { font-size: 0.66rem; color: var(--muted); letter-spacing: 0.02em; }
.brand-powered strong { color: var(--accent-hi); font-weight: 600; }
.brand-mark { width: 32px; height: 32px; }

.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.avatar-initials, .avatar-lg { display: inline-grid; place-items: center; font-weight: 700; font-size: 0.8rem; color: #fff; background: linear-gradient(135deg, #1e40af, #0ea5e9); }
.avatar-lg { width: 40px; height: 40px; border-radius: 50%; font-size: 0.95rem; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.user-name { font-size: 0.88rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; max-width: calc(100vw - 24px);
    z-index: 30; padding: 12px; display: grid; gap: 10px;
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.7);
}
.user-menu-head { display: grid; gap: 2px; }
.btn-block { width: 100%; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 1rem; }

.site-footer {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 36px 20px 44px; font-size: 0.8rem; color: var(--text-2); text-align: center;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, transparent, rgb(37 99 235 / 0.05));
}
.footer-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; row-gap: 4px; }
.footer-brand { color: var(--text-2); }
.footer-name { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.footer-credits { font-size: 0.76rem; color: var(--muted); }
.footer-version { font-size: 0.7rem; color: var(--muted); opacity: 0.7; }
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; flex: none; }

/* Forms */
.input, .textarea {
    font: inherit; font-size: 0.92rem; color: var(--text); width: 100%;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 0 12px; height: 38px; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.2); }
.input::placeholder, .textarea::placeholder { color: #5b6d8e; }
.input[type="date"], .input[type="time"] { color-scheme: dark; }
.field-stack { display: grid; gap: 6px; min-width: 0; }
.form-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-row > * { min-width: 0; }
.form-stack { display: grid; gap: 12px; }
.upload-progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8rem; color: var(--muted); }
.input-search { margin-bottom: 14px; }
.youtube-import { margin: 12px 0 16px; align-items: end; }
.grow { flex: 1 1 200px; }
.stack { display: grid; gap: 14px; }
.select-sm { height: 32px; min-width: 0; font-size: 0.82rem; }
.input-search { max-width: 280px; height: 34px; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0 12px; }
.button-row.start { justify-content: flex-start; }
.btn-google { background: #fff; color: #1f2937; border-color: #fff; }
.btn-google:hover:not(:disabled) { background: #eef2ff; border-color: #eef2ff; }
.google-icon { width: 20px; height: 20px; }

/* Landing */
.landing { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; padding: 36px 0 20px; }
.landing-title {
    font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02;
    background: linear-gradient(180deg, #fff 30%, #93c5fd); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.landing-visual { position: relative; height: 340px; }
.mock-card { position: absolute; inset: 20px 30px; border-radius: 22px; border: 1px solid var(--border-strong); }
.mock-back { background: #13254a; transform: rotate(7deg) translate(18px, -6px); opacity: 0.6; }
.mock-mid { background: #173064; transform: rotate(-4deg) translate(-10px, 6px); opacity: 0.8; }
.mock-front { background: linear-gradient(180deg, var(--surface-2), var(--surface)); padding: 22px; display: grid; gap: 8px; align-content: start; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(96 165 250 / 0.15); }
.mock-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.mock-row.is-current { border-color: var(--accent-hi); background: rgb(59 130 246 / 0.16); }
.mock-num { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.mock-key { color: var(--accent-hi); font-weight: 700; }
.mock-chords { display: flex; gap: 8px; margin-top: 8px; }
.mock-chords span { flex: 1; text-align: center; padding: 12px 0; border-radius: 10px; background: var(--surface-3); font-weight: 800; font-size: 1.2rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0 10px; }
.feature { padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); display: grid; gap: 8px; }
.feature h2 { font-size: 1.25rem; }
.feature p { color: var(--text-2); font-size: 0.92rem; }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hi); }

/* Auth */
.auth-card { max-width: 440px; margin: 48px auto; display: grid; gap: 14px; justify-items: center; text-align: center; padding: 32px 28px; }
.auth-card .brand-mark { width: 52px; height: 52px; }
.auth-form { display: grid; gap: 12px; width: 100%; text-align: left; }
.dev-login { width: 100%; text-align: left; border-top: 1px solid var(--border); padding-top: 12px; }
.dev-login summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }

/* Page scaffolding */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 20px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); }
.band-title { display: flex; align-items: center; gap: 14px; }
.band-avatar { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; color: #fff; background: linear-gradient(135deg, #1d4ed8, #22d3ee); box-shadow: 0 10px 24px -10px rgb(37 99 235 / 0.8); }

.band-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.band-card { display: grid; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); color: var(--text); transition: border-color 0.15s, transform 0.15s; }
.band-card:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-2px); }
.band-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.band-card-head .band-avatar { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.band-card h2 { font-size: 1.1rem; }
.band-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 4px; min-width: 0; }
.band-card-title h2 { min-width: 0; }
.band-stats { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); }
.next-gig { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 0.86rem; min-width: 0; }
.next-gig-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-hi); }
.next-gig-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-gig-when { color: var(--muted); font-size: 0.8rem; }
.skeleton-card { height: 170px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.create-band { max-width: 760px; }
.create-band h2 { margin-bottom: 14px; }
.create-band .muted { margin-top: 10px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--muted); background: none; border: 0; cursor: pointer;
    padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-hi); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.panel-grid > aside h2, .panel-grid > .card > h2 { margin-bottom: 12px; }

/* Date badge + setlist cards */
.setlist-list { display: grid; gap: 10px; }
.setlist-card {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px;
    border-radius: var(--radius); background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); color: var(--text);
}
.setlist-card:hover { text-decoration: none; border-color: var(--border-strong); }
.setlist-card.is-past { opacity: 0.65; }
.setlist-card-title { display: grid; gap: 4px; min-width: 0; }
.date-badge { display: grid; justify-items: center; padding: 8px 0; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); line-height: 1.1; }
.date-badge .m { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-hi); font-weight: 700; }
.date-badge .d { font-size: 1.4rem; font-weight: 800; }
.date-badge .w { font-size: 0.68rem; color: var(--muted); }
.date-badge.tbd .d { font-size: 0.9rem; color: var(--muted); padding: 6px 0; }
.setlist-card h3 { font-size: 1.02rem; }
.setlist-sub { color: var(--muted); font-size: 0.82rem; display: flex; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-3); }
.table .song-cell { display: grid; min-width: 0; max-width: 340px; }
.table .song-cell a { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .song-cell span { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-compact { margin-bottom: 16px; }
.dropzone-compact .dropzone-inner { padding: 20px; grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 16px; }
.dropzone-compact .dropzone-icon { grid-row: span 2; margin: 0; width: 48px; height: 48px; }

/* Members */
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.member { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.member-info { display: grid; gap: 4px; min-width: 0; }
.member-name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.member-sub { font-size: 0.8rem; color: var(--muted); }
.member-actions { display: flex; gap: 6px; align-items: center; }
.badge-leader { background: rgb(251 191 36 / 0.12); color: #fde68a; border-color: rgb(251 191 36 / 0.3); }
.badge-view { background: var(--accent-soft); color: var(--accent-hi); border-color: rgb(59 130 246 / 0.3); }
.instrument-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.instrument-picker label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-3); cursor: pointer; }
.instrument-picker input { accent-color: var(--accent); }
.invite-result { display: grid; gap: 8px; margin-top: 14px; }

/* Setlist editor */
.setlist-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-bottom: 16px; }
.setlist-fields { display: grid; gap: 12px; }
.input-title { font-size: 1.5rem; font-weight: 800; height: 48px; background: transparent; border-color: transparent; padding: 0 8px; margin-left: -8px; letter-spacing: -0.02em; }
.input-title:hover { border-color: var(--border); }
.setlist-actions { display: grid; gap: 12px; justify-items: end; }
.setlist-stats { display: flex; gap: 22px; }
.setlist-stats > div { display: grid; justify-items: end; }
.stat { font-size: 1.5rem; font-weight: 800; }
.setlist-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.setlist-side { position: sticky; top: 76px; display: grid; gap: 16px; }
.setlist-side .card + .card { margin-top: 0; }
.set-section { padding: 14px; }
.set-section + .set-section { margin-top: 12px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.input-section { font-weight: 700; font-size: 1.02rem; max-width: 220px; background: transparent; border-color: transparent; padding: 0 8px; }
.input-section:hover { border-color: var(--border); }
.section-time { margin-left: auto; white-space: nowrap; }
.set-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-height: 8px; }
.set-empty { padding: 14px; text-align: center; border: 1.5px dashed var(--border); border-radius: 10px; }
.set-items:not(:empty) + .set-empty { display: none; }
.set-item {
    display: grid; grid-template-columns: 22px 28px minmax(0, 1fr) auto auto auto auto; gap: 10px; align-items: center;
    padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
}
.set-item.dragging { opacity: 0.4; }
.set-item.drop-before { box-shadow: 0 -3px 0 var(--accent-hi); }
.set-items.drop-into { outline: 2px dashed var(--accent-hi); outline-offset: 4px; border-radius: 10px; }
.drag-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; touch-action: none; background: none; border: 0; padding: 0; }
.drag-handle .icon { width: 16px; height: 16px; }
.set-num { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; text-align: right; }
.set-song { display: grid; min-width: 0; }
.set-song a { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-song .sub { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-note { font-size: 0.78rem; height: 28px; width: 150px; }
.key-select { height: 30px; min-width: 88px; font-size: 0.82rem; font-weight: 700; color: var(--accent-hi); }
.set-meta { font-size: 0.78rem; color: var(--muted); text-align: right; min-width: 64px; font-family: var(--mono); }
.item-tools { display: flex; gap: 4px; }
.item-tools .btn { width: 28px; height: 28px; font-size: 0.85rem; }
.add-section { margin: 12px 0 16px; width: 100%; border: 1.5px dashed var(--border-strong); height: 44px; }
.library-picker { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; max-height: 380px; overflow-y: auto; }
.library-picker li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.library-picker li:hover { background: var(--surface-3); }
.library-picker-title { display: grid; gap: 2px; min-width: 0; }
.library-picker .t { font-weight: 600; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-picker .a { font-size: 0.74rem; color: var(--muted); }
.library-picker .in-set { color: var(--ok); font-size: 0.72rem; }
.lineup { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.lineup li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.lineup .avatar, .lineup .avatar-initials { width: 32px; height: 32px; }
.lineup .who { display: grid; font-size: 0.86rem; }
.lineup .who span { font-size: 0.74rem; color: var(--muted); }
.guest-form { margin-top: 8px; }
.add-member { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.save-state.is-saving { color: var(--accent-hi); }
.save-state.is-error { color: var(--danger); }

/* ChordPro sheet rendering */
.sheet { --sheet-size: 1rem; font-size: var(--sheet-size); line-height: 1.35; }
.sheet .line { display: flex; flex-wrap: wrap; align-items: flex-end; min-height: 1.4em; margin: 0 0 0.15em; }
.sheet .chunk { display: inline-flex; flex-direction: column; white-space: pre; max-width: 100%; }
.sheet .lyric { white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet .chord { color: var(--accent-hi); font-weight: 700; font-size: 0.9em; min-height: 1.3em; padding-right: 0.45em; font-family: var(--font); }
.sheet .chord .num { color: var(--cyan); font-family: var(--mono); font-size: 0.85em; }
.sheet .lyric { color: var(--text); }
.sheet.no-chords-on-line .chord { display: none; }
.sheet .line.chords-only .lyric { display: none; }
.sheet .line.chords-only .chord { padding-right: 1.4em; }
.sheet .section-label {
    display: inline-block; margin: 0.9em 0 0.35em; padding: 2px 10px; border-radius: 6px; font-size: 0.72em; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-hi); background: var(--accent-soft); border: 1px solid rgb(59 130 246 / 0.3);
}
.sheet .comment { margin: 0.4em 0; font-style: italic; color: #fde68a; font-size: 0.85em; }
.sheet .comment::before { content: "▸ "; color: var(--warn); }
.sheet .space { height: 0.7em; }
.sheet .in-chorus { border-left: 3px solid var(--accent); padding-left: 0.7em; }
.sheet .draft-note { font-size: 0.8em; color: var(--muted); margin-bottom: 0.8em; }
.sheet-empty { color: var(--muted); padding: 20px; text-align: center; border: 1.5px dashed var(--border); border-radius: 10px; }

/* Views */
.sheet.view-Lyrics { --sheet-size: 1.25rem; }
.sheet.view-Lyrics .chord { font-size: 0.6em; opacity: 0.8; }
.sheet.view-Lyrics .lyric { font-weight: 500; }
.sheet.view-Lyrics .line.chords-only { display: none; }
.sheet.view-Bass .chord { font-size: 1.05em; }
.sheet.view-Bass .chord .root { color: #fff; font-weight: 800; }
.sheet.view-Bass .chord .rest { color: var(--muted); font-weight: 600; font-size: 0.8em; }
.sheet.view-Bass .lyric { color: var(--text-2); font-size: 0.85em; }
.sheet.view-Rhythm .lyric { color: var(--muted); font-size: 0.8em; }
.sheet.view-Rhythm .chord { font-size: 0.8em; }
.sheet.view-Rhythm .section-label { font-size: 1em; }

.sheet-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sheet-edit-col { display: grid; gap: 8px; align-content: start; }
.sheet-edit-col .field-label { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.sheet-edit-col code { color: var(--accent-hi); }
.sheet-text { min-height: 460px; font-size: 0.86rem; line-height: 1.55; tab-size: 4; }
.sheet-preview-col { display: grid; gap: 8px; align-content: start; }
.sheet-preview { max-height: 520px; overflow-y: auto; padding: 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.my-notes { margin-top: 14px; }

/* ==========================================================================
   Stage mode
   ========================================================================== */
.stage-body .topbar, .stage-body .site-footer { display: none; }
.stage-body .page { max-width: none; padding: 0; }
.stage-body { background: #050a14; }
.stage { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.stage-bar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left));
    background: rgb(5 10 20 / 0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.stage-where { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 6px 10px; border-radius: 8px; min-width: 0; }
.stage-where:hover { background: var(--surface-2); }
.stage-pos { color: var(--accent-hi); font-weight: 700; white-space: nowrap; }
.stage-setname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.stepper-sm .btn-icon { width: 36px; height: 30px; font-size: 0.8rem; }
.stage-clock { color: var(--muted); font-size: 0.95rem; min-width: 48px; text-align: right; }
.stage-loading { display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--muted); padding: 80px 20px; }
.stage-song { padding: 20px max(20px, 4vw) 120px; max-width: 1200px; width: 100%; margin: 0 auto; position: relative; }
.stage-song-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-title-block { min-width: 0; flex: 1 1 260px; }
.stage-title-block h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.03em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-facts { display: flex; gap: 10px; flex-wrap: wrap; }
.fact { display: grid; gap: 2px; justify-items: start; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); min-width: 96px; }
.fact-value { font-size: 1.7rem; font-weight: 800; color: var(--accent-hi); line-height: 1.1; }
.fact-sub { font-size: 0.75rem; color: var(--muted); }
.bpm-button { background: none; border: 0; padding: 0; font: inherit; font-size: 1.7rem; font-weight: 800; color: var(--accent-hi); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.bpm-button::after { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.bpm-button[aria-pressed="true"]::after { background: currentColor; }
.icon-fill { fill: currentColor; stroke: none; }
.stage-notes { display: grid; gap: 6px; margin-bottom: 16px; }
.stage-note { padding: 8px 12px; border-radius: 10px; font-size: 0.92rem; border: 1px solid; }
.stage-note b { margin-right: 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stage-note.band { background: rgb(59 130 246 / 0.08); border-color: rgb(59 130 246 / 0.3); }
.stage-note.gig { background: rgb(251 191 36 / 0.08); border-color: rgb(251 191 36 / 0.3); color: #fde68a; }
.stage-note.mine { background: rgb(52 211 153 / 0.08); border-color: rgb(52 211 153 / 0.3); color: #a7f3d0; }
.stage .sheet { --sheet-size: calc(1.2rem * var(--stage-scale, 1)); }
.stage .sheet.view-Lyrics { --sheet-size: calc(1.6rem * var(--stage-scale, 1)); }
.stage .sheet.view-Rhythm { --sheet-size: calc(1.1rem * var(--stage-scale, 1)); }
.rhythm-panel { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin-bottom: 20px; }
.big-bpm { display: grid; justify-items: center; padding: 18px 26px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border-strong); }
.big-bpm .n { font-size: 4.5rem; font-weight: 900; line-height: 1; color: #fff; }
.beat-dots { display: flex; gap: 8px; margin-top: 10px; }
.beat-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); transition: background 0.05s; }
.beat-dots span.on { background: var(--accent-hi); box-shadow: 0 0 14px var(--accent-hi); }
.beat-dots span.on.accent { background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.structure { display: flex; flex-wrap: wrap; gap: 8px; }
.structure .blk { padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 4px; min-width: 120px; }
.structure .blk b { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-hi); }
.structure .blk span { font-size: 0.9rem; font-weight: 600; }
.beat-flash { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 6px var(--accent-hi); opacity: 0; transition: opacity 0.12s; z-index: 5; }
.beat-flash.on { opacity: 0.8; transition: none; }
.stage-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
    padding: 10px max(16px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)); background: rgb(5 10 20 / 0.92); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
}
.stage-nav .btn { height: 58px; justify-content: flex-start; gap: 12px; min-width: 0; }
.stage-next { justify-content: flex-end !important; background: linear-gradient(180deg, #1e3a8a, #172554); border-color: #2a4170; }
.stage-nav-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-hi); }
.stage-nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.stage-list { width: min(520px, calc(100vw - 32px)); max-height: 80vh; padding: 0; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
.stage-list::backdrop { background: rgb(0 0 0 / 0.6); }
.stage-list-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface-2); }
.stage-list ol { list-style: none; margin: 0; padding: 8px; display: grid; gap: 4px; }
.stage-list .sec { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-hi); padding: 10px 10px 4px; font-weight: 700; }
.stage-list button { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: 10px; border-radius: 10px; cursor: pointer; }
.stage-list button:hover { background: var(--surface-3); }
.stage-list button.is-current { background: var(--accent-soft); outline: 1px solid rgb(59 130 246 / 0.4); }
.stage-list .k { color: var(--accent-hi); font-weight: 700; }
.stage-list .sl-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
    .setlist-grid, .panel-grid { grid-template-columns: minmax(0, 1fr); }
    .setlist-side { position: static; }
    .sheet-editor { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .landing { grid-template-columns: 1fr; }
    .landing-visual { height: 280px; }
    .features { grid-template-columns: 1fr; }
    .setlist-head { grid-template-columns: 1fr; }
    .setlist-actions { justify-items: stretch; }
    .set-item { grid-template-columns: 22px minmax(0, 1fr) auto auto auto; }
    .set-item .set-num, .set-item .set-note { display: none; }
    .stage-bar { flex-wrap: wrap; row-gap: 8px; }
    .stage-tools { width: 100%; margin-left: 0; justify-content: space-between; flex-wrap: wrap; row-gap: 6px; }
    .stage { overflow-x: hidden; }
    .stage-where { max-width: calc(100vw - 80px); }
    .stage-clock { display: none; }
    .rhythm-panel { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .user-name, #install-app span, .brand-powered { display: none; }
    .set-item .set-meta { display: none; }
    .set-item { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
    .stage-tools #save-offline span { display: none; }
    .stage-tools .seg { padding: 5px 8px; min-width: 0; }
    .stage-song { padding: 16px 16px 110px; }
    .fact { min-width: 0; padding: 8px 10px; }
    .fact-value, .bpm-button { font-size: 1.4rem; }
    .big-bpm { justify-self: start; }
    .big-bpm .n { font-size: 3.2rem; }
}

/* ==========================================================================
   Buy me a coffee
   ========================================================================== */
.coffee-btn {
    position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 40; display: flex; align-items: center; gap: 8px;
    font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 999px;
    padding: 11px 18px 11px 14px; box-shadow: var(--shadow); cursor: pointer;
    transition: border-color 0.15s, color 0.15s, transform 0.05s;
}
.coffee-btn:hover { border-color: var(--accent-hi); color: var(--accent-hi); }
.coffee-btn:active { transform: translateY(1px); }
.coffee-btn .icon { width: 17px; height: 17px; color: var(--warn); }
.stage-body .coffee-btn { display: none; }
@media (max-width: 600px) {
    .coffee-btn span { display: none; }
    .coffee-btn { padding: 12px; }
}

.coffee-overlay {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: rgb(3 7 15 / 0.72); backdrop-filter: blur(4px);
}
.coffee-modal {
    position: relative; width: 100%; max-width: 720px; max-height: calc(100vh - 48px); overflow-y: auto;
    background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.coffee-modal-close {
    position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center;
    background: var(--surface-3); border: 1px solid var(--border); border-radius: 50%; color: var(--text-2); cursor: pointer;
}
.coffee-modal-close:hover { color: var(--text); border-color: var(--border-strong); }
.coffee-modal-close .icon { width: 16px; height: 16px; }
.coffee-modal-heading { max-width: 480px; margin: 0 0 22px; }
.coffee-modal-heading h2 { font-size: 1.35rem; margin: 6px 0 8px; }
.coffee-modal-heading p { margin-top: 4px; }

.coffee-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .coffee-grid { grid-template-columns: 1fr; } }
.coffee-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    padding: 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
    cursor: pointer; transition: filter 0.2s, opacity 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.coffee-card:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
/* Tapping one QR blurs the other two, so a phone camera pointed at the screen can't pick up the
   wrong code by accident. Tapping the same card again (or closing the modal) clears it. */
.coffee-card.blurred { filter: blur(6px); opacity: 0.45; }
.coffee-card.focused { border-color: var(--accent-hi); box-shadow: 0 0 0 2px var(--accent-hi); }
.coffee-card-badge {
    display: inline-flex; align-items: center; font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.04em; padding: 4px 10px; border-radius: 999px;
}
.coffee-card-badge.maya { background: #113822; color: #7fd9ac; }
.coffee-card-badge.bpi { background: #3a1c18; color: #ff8a7a; }
.coffee-card-badge.gcash { background: #14264a; color: #9fc2ff; }
.coffee-card-qr {
    width: 100%; max-width: 170px; aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--border);
    background: #fff; padding: 8px; object-fit: contain;
}
.coffee-card-name { font-weight: 700; font-size: 0.95rem; }
.coffee-card-detail { font-family: var(--mono); line-height: 1.5; }
.coffee-card-download { margin-top: 2px; }
.coffee-modal-footer { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); line-height: 1.5; }

/* ==========================================================================
   Chord view (Moises-style): strip + diagrams + bar grid
   ========================================================================== */
.cp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 14px; }
.cp-key { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.cp-key strong { font-size: 1.15rem; color: var(--accent-hi); white-space: nowrap; }
.cp-options { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background 0.15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform 0.15s, background 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent-hi); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

.chord-strip-wrap { position: relative; margin: 0 -4px 8px; }
.chord-strip-wrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 8px; width: 40px; pointer-events: none; background: linear-gradient(90deg, transparent, var(--surface-2)); border-radius: 0 14px 14px 0; }
.chord-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.cs-empty { padding: 18px 8px; }
.cs-card {
    flex: none; width: 78px; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 8px 6px 7px;
    font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s, transform 0.2s;
}
.cs-card:hover { border-color: var(--border-strong); }
.cs-name { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; }
.cs-sub { font-size: 0.66rem; color: var(--muted); margin-top: -3px; }
.cs-progress { width: 100%; height: 3px; border-radius: 4px; background: transparent; overflow: hidden; }
.cs-progress-bar { display: block; height: 100%; width: 0; background: var(--accent-hi); border-radius: inherit; }
.cs-card.is-past { opacity: 0.4; }
.cs-card.is-nc .cs-name { color: var(--muted); font-weight: 600; }
.cs-card.is-current {
    width: 100px; background: linear-gradient(180deg, rgb(59 130 246 / 0.35), rgb(29 78 216 / 0.2)); border-color: var(--accent-hi);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.18), 0 12px 30px -12px rgb(37 99 235 / 0.9);
}
.cs-card.is-current .cs-name { font-size: 1.5rem; color: #fff; }
.cs-card.is-current .cs-progress { background: rgb(255 255 255 / 0.12); }
.cs-card .diagram-piano { width: 64px; height: auto; }
.cs-card.is-current .diagram-piano { width: 82px; }
.cs-card.is-current .diagram-guitar { width: 54px; height: auto; }
.no-diagrams .cs-card { width: auto; min-width: 68px; padding: 12px 14px 9px; }
.no-diagrams .cs-card.is-current { min-width: 88px; }
.cs-card.is-unsure { position: relative; }
.cs-card.is-unsure::after {
    content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--amber, #f59e0b); box-shadow: 0 0 0 2px var(--surface);
}
.cs-card.is-current.is-unsure::after { box-shadow: 0 0 0 2px rgb(29 78 216 / 0.4); }

/* Diagrams */
.diagram { display: block; overflow: visible; }
.dg-fret { stroke: var(--border-strong); stroke-width: 1; }
.dg-string { stroke: #6f82a6; stroke-width: 1; }
.dg-nut { fill: var(--text); }
.dg-dot { fill: var(--accent-hi); }
.dg-root { fill: var(--cyan); }
.dg-open { fill: none; stroke: var(--text-2); stroke-width: 1.2; }
.dg-mark { fill: var(--muted); font-size: 8px; font-family: var(--font); }
.dg-fretno { fill: var(--muted); font-size: 7px; font-family: var(--mono); }
.dg-muted { fill: var(--muted); font-size: 14px; }
.cs-card.is-current .dg-dot { fill: #fff; }
.cs-card.is-current .dg-root { fill: var(--cyan); }
.cs-card.is-current .dg-string { stroke: #9fb2d6; }
.pk-white { fill: #d9e2f2; stroke: #0b1324; stroke-width: 0.8; }
.pk-black { fill: #0b1324; }
.pk-on { fill: var(--accent-hi); }
.pk-root { fill: var(--cyan); }
.pk-black.pk-on { fill: #2563eb; }
.pk-black.pk-root { fill: #0891b2; }

/* Chords in this song */
.used-chords { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.used-chord { display: grid; justify-items: center; gap: 4px; padding: 8px 10px 6px; min-width: 72px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.used-name { font-weight: 800; font-size: 1rem; white-space: nowrap; }

/* Bar grid */
.bar-grid { --beats: 4; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 460px; overflow-y: auto; padding: 2px; scroll-behavior: smooth; }
.bar {
    position: relative; display: block; min-width: 0; text-align: left; padding: 18px 8px 8px; font: inherit; color: var(--text); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: background 0.15s, border-color 0.15s;
}
.bar:hover { border-color: var(--border-strong); }
.bar-no { position: absolute; top: 4px; left: 8px; font-size: 0.62rem; color: var(--muted); font-family: var(--mono); }
.bar-slots { display: grid; grid-template-columns: repeat(var(--beats), minmax(0, 1fr)); gap: 3px; }
.slot {
    min-width: 0; min-height: 30px; display: flex; align-items: flex-end; padding-bottom: 3px; overflow: hidden; text-overflow: ellipsis;
    font-weight: 800; font-size: 1.05rem; white-space: nowrap; border-bottom: 3px solid var(--surface-3); transition: border-color 0.08s;
}
.bar.multi .slot { font-size: 0.86rem; }
.slot.is-repeat { color: var(--text-2); font-weight: 600; }
.slot.is-unsure { border-bottom-style: dashed; border-bottom-color: var(--amber, #f59e0b); }
.bar.is-now { border-color: var(--accent-hi); background: var(--accent-soft); }
.slot.is-now { border-bottom-color: var(--accent-hi); }
.slot.is-now.is-unsure { border-bottom-color: var(--amber, #f59e0b); }
@media (max-width: 820px) {
    .bar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cp-options { width: 100%; justify-content: space-between; }
}

.setup-help { display: grid; gap: 8px; margin-top: 10px; justify-items: start; color: var(--text); }
.setup-help pre { margin: 0; padding: 8px 12px; border-radius: 8px; background: rgb(0 0 0 / 0.35); color: #fde68a; font-size: 0.82rem; white-space: pre-wrap; word-break: break-all; }

/* Grid/flex children must be allowed to shrink, or wide content (chord strip, tables) stretches the page. */
.studio-main, .studio-side, .setlist-main, .setlist-side, .tab-panel, .card, .panel-grid > * { min-width: 0; }
.used-chord .diagram-piano { width: 96px; height: auto; }
