@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');

/* Jam Session — styles
   Mirrors songs.css visual language: iOS-like, mobile-first, accent orange. */

:root {
    --accent: #d4622a;
    --accent-dim: rgba(212,98,42,0.08);
    /* Aliases so UGReader (from songs.css) resolves correctly in jam context */
    --surface: var(--card-bg, #ffffff);
    --surface2: var(--bg, #f2f2f7);
    --text-muted: var(--text-secondary, #6e6e73);
    --blue: #0055c8;
    --accent-dark: #b5511f;
    --bg: #f2f2f7;
    --card-bg: #ffffff;
    --text: #1c1c1e;
    --text-secondary: #6e6e73;
    --border: #e5e5ea;
    --radius: 12px;
    --radius-sm: 8px;
    --header-h: 52px;
    --accent-bg: rgba(212, 98, 42, 0.09);
    --playing-bg: rgba(212, 98, 42, 0.05);
    --nav-h: 56px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; cursor: default; }

/* Restore text cursor only for actual text inputs */
input[type="text"], input[type="search"], input[type="password"],
input[type="email"], input[type="url"], input[type="number"],
input:not([type]), textarea { cursor: text; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Views ─────────────────────────────────────────────────────────────── */

.view { min-height: 100dvh; display: flex; flex-direction: column; }
#view-host, #view-participant { padding-bottom: calc(var(--nav-h) + 64px + env(safe-area-inset-bottom, 0px)); }
.hidden { display: none !important; }

/* ── Top bar ────────────────────────────────────────────────────────────── */

.top-bar {
    height: calc(var(--header-h) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.app-logo {
    width: 26px;
    height: 29px;
    flex-shrink: 0;
}

.app-name {
    font-family: 'Permanent Marker', cursive;
    font-size: 17px;
    color: var(--accent);
    white-space: nowrap;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    line-height: 1;
}

.top-bar-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.top-bar-action {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 15px;
    cursor: pointer;
    padding: 6px 0;
}
.top-bar-action.danger { color: #ff3b30; }

.top-bar-back {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 15px;
    cursor: pointer;
    padding: 6px 0;
    min-width: 60px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-full { width: 100%; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */

.text-input {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.text-input:focus { border-color: var(--accent); }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Login view ─────────────────────────────────────────────────────────── */

#view-login {
    align-items: center;
    justify-content: center;
    padding: 32px 24px calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

.center-wrap {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.app-icon { font-size: 56px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.app-logo-hero { width: 56px; height: 63px; }
.app-title { font-size: 28px; font-weight: 700; }
.app-subtitle { font-size: 15px; color: var(--text-secondary); margin-bottom: 8px; }

.login-card {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── Home view ──────────────────────────────────────────────────────────── */

.home-body {
    padding: 28px 20px calc(var(--nav-h) + var(--safe-bottom) + 16px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.welcome-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.join-row {
    display: flex;
    gap: 10px;
}
.join-input {
    flex: 1;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.error-msg {
    color: #ff3b30;
    font-size: 14px;
}

/* ── Session banner (host) ───────────────────────────────────────────────── */

.session-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.room-code-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.room-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.room-code {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent);
}

.qr-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    background: var(--border);
}

/* ── Participants bar ────────────────────────────────────────────────────── */

.participants-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
}

.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.participant-chip.is-host {
    background: var(--accent-bg);
    color: var(--accent-dark);
}
.host-crown { font-size: 12px; }

/* ── Host song section ───────────────────────────────────────────────────── */

.host-song-section {
    flex: 1;
    padding: 16px 20px calc(32px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.section-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.song-search-wrap {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 20;
    overflow: hidden;
}

.suggestion-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:active { background: var(--bg); }

.sugg-name { font-size: 15px; font-weight: 600; color: var(--text); }
.sugg-artist { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.current-song-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.current-song-name { font-size: 18px; font-weight: 700; }
.current-song-artist { font-size: 14px; color: var(--text-secondary); margin-top: 3px; }

.tab-section { display: flex; flex-direction: column; gap: 10px; }

.tab-list { display: flex; flex-direction: column; gap: 8px; }

.tab-pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
    width: 100%;
}
.tab-pick-item:active { background: var(--bg); }
.tab-pick-item.selected { border-color: var(--accent); background: var(--accent-bg); }

.tab-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.tab-label { font-size: 14px; font-weight: 500; flex: 1; color: var(--text); }
.tab-meta { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

.no-tabs-hint {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 0;
}

/* ── Participant view ────────────────────────────────────────────────────── */

.waiting-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 24px;
}
.waiting-icon { display: flex; align-items: center; justify-content: center; color: var(--accent); }
.waiting-text { font-size: 16px; color: var(--text-secondary); }

.song-header-card {
    padding: 20px 20px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}
.song-header-name { font-size: 22px; font-weight: 700; }
.song-header-artist { font-size: 15px; color: var(--text-secondary); margin-top: 3px; }

.song-meta-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.meta-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--accent-bg);
    padding: 4px 10px;
    border-radius: 20px;
}

.tab-area {
    padding: 16px 20px calc(32px + var(--safe-bottom));
    flex: 1;
    overflow-y: auto;
}

.ug-tab-rendered {
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    color: var(--text);
}

.tab-external-link {
    display: inline-flex;
    align-items: center;
    padding: 14px 18px;
    background: var(--card-bg);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.tab-empty {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    padding-top: 32px;
}

/* ── Session ended overlay ───────────────────────────────────────────────── */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: flex-end;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
}

.overlay-card {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 28px 24px calc(20px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.overlay-icon { font-size: 40px; text-align: center; }
.overlay-card h2 { font-size: 22px; font-weight: 700; text-align: center; }

.recap-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.recap-value { font-size: 15px; color: var(--text); line-height: 1.5; }

/* ── Jam banner inside UGReader overlay ─────────────────────────────────── */

.jam-reader-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: var(--accent-bg);
    border-bottom: 1px solid #f0cebc;
    flex-shrink: 0;
    min-height: 0;
}

.jam-banner-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.jam-banner-room {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #d4622a);
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.jam-banner-sep {
    font-size: 12px;
    color: var(--accent-dark, #b5511f);
    opacity: 0.5;
    flex-shrink: 0;
}

.jam-banner-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark, #b5511f);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Karaoke "Midnight Karaoke" reader theme ─────────────────────── */

/* Background — multi-layer gradient */
#ug-reader-overlay {
    background:
        radial-gradient(ellipse 120% 80% at 20% 15%, rgba(15,25,60,0.6), transparent 60%),
        radial-gradient(ellipse 100% 100% at 80% 85%, rgba(30,15,45,0.5), transparent 50%),
        linear-gradient(160deg, #0a0e1a 0%, #111832 35%, #1a1028 65%, #0c1f2e 100%);
}
/* Vignette overlay */
#ug-reader-overlay::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 0%, rgba(0,0,0,0.35) 100%);
}

/* Lyrics — warm white with cool glow */
#ug-reader-overlay .ug-lyrics {
    color: #f0f0f5;
    font-weight: 700;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.4);
    paint-order: stroke fill;
    text-shadow: 0 0 8px rgba(200,210,240,0.15);
}
/* Chords — amber gold with warm glow */
#ug-reader-overlay .ug-chords {
    color: #ffc940;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(255,201,64,0.35), 0 0 16px rgba(255,180,40,0.15);
}
/* Section labels — cyan-teal accent */
#ug-reader-overlay .ug-section-label {
    color: #5de0d8;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(93,224,216,0.25);
}
/* Tab blocks — cool muted blue-grey */
#ug-reader-overlay .ug-tab-block { color: rgba(180,195,220,0.75); }
#ug-reader-overlay .ug-tab-block .ug-chord { color: #ffc940; text-shadow: 0 0 4px rgba(255,201,64,0.2); }

/* Header — frosted glass */
#ug-reader-overlay .ug-reader-header {
    background: rgba(8,10,20,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom-color: rgba(255,255,255,0.06);
    position: relative; z-index: 2;
}
#ug-reader-overlay .ug-rh-title { color: #f0f0f5; }
#ug-reader-overlay .ug-rh-meta { color: rgba(255,255,255,0.45); }
#ug-reader-overlay .ug-rh-close { color: rgba(255,255,255,0.5); }
#ug-reader-overlay .ug-rh-stats { color: rgba(255,255,255,0.75); }
#ug-reader-overlay .ug-rh-stats b { color: #ffc940; }

/* Toolbar — frosted glass */
#ug-reader-overlay .ug-reader-toolbar {
    background: rgba(8,10,20,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top-color: rgba(255,255,255,0.06);
    position: relative; z-index: 2;
}
#ug-reader-overlay .ug-tb-btn {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
}
#ug-reader-overlay .ug-tb-autoscroll {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
}
#ug-reader-overlay .ug-tb-autoscroll.active { background: #2979ff; border-color: #2979ff; color: #fff; }
#ug-reader-overlay .ug-tb-font { color: rgba(255,255,255,0.6); }
#ug-reader-overlay .ug-tb-instrument-btn { color: #ffc940; }
.ug-instrument-wrap { position: relative; }
.ug-instrument-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #2a2a2e;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    z-index: 120;
    min-width: 110px;
}
.ug-instrument-menu.hidden { display: none; }
.ug-instrument-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.ug-instrument-option:hover { background: rgba(255,255,255,0.08); }
.ug-instrument-option:active { opacity: 0.7; }
.ug-instrument-option.active { color: #ffc940; font-weight: 600; }
#ug-reader-overlay .ug-tb-speed { accent-color: #2979ff; }

/* Scroll area */
#ug-reader-overlay .ug-reader-scroll {
    background: transparent;
    position: relative; z-index: 1;
}

/* Chord-playing animation — gold pulse */
#ug-reader-overlay .chord-playing {
    animation: karaoke-chord-pulse 0.8s ease-in-out infinite;
    background: rgba(255,201,64,0.12);
}
@keyframes karaoke-chord-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,201,64,0); }
    50%      { box-shadow: 0 0 0 5px rgba(255,201,64,0.25); }
}

/* Misc elements */
#ug-reader-overlay .ug-repeat-marker { color: rgba(255,255,255,0.35); }
#ug-reader-overlay .ug-end-marker { color: rgba(255,255,255,0.3); }
#ug-reader-overlay .ug-tb-star-btn.starred { color: #ffc940; }
#ug-reader-overlay .ug-tb-theory-btn { color: rgba(255,255,255,0.5); }
#ug-reader-overlay .ug-tb-theory-btn.active { background: #ffc940; color: #0a0e1a; border-color: #ffc940; }
#ug-reader-overlay .ug-tb-chord-scroll-btn { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
#ug-reader-overlay .ug-tb-chord-scroll-btn.active { background: #e0723a; border-color: #e0723a; color: #fff; }
#ug-reader-overlay .ug-tb-trippy-btn { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
#ug-reader-overlay .ug-tb-key-btn { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); }
#ug-reader-overlay .ug-tb-capo-val { color: rgba(255,255,255,0.5); }
#ug-reader-overlay .ug-tb-tempo-label { color: rgba(255,255,255,0.5); }
#ug-reader-overlay .ug-tb-tempo-slider { accent-color: #ffc940; }
#ug-reader-overlay .ug-tb-save-btn { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }

/* Participants cannot close the reader — only the host can */
.ug-reader-participant .ug-rh-close { display: none; }
/* Participants follow the host but may scroll ahead to read on their own.
   position:relative anchors the "band is here" marker to the scroll content. */
.ug-reader-participant .ug-reader-scroll {
    position: relative;
}
/* Hide scroll, speed, and version controls for participants — host controls pacing */
/* Transpose group is visible so participants can adjust key/capo locally */
.ug-reader-participant .ug-tb-autoscroll { display: none; }
.ug-reader-participant .ug-tb-speed-group { display: none; }
.ug-reader-participant .ug-tb-meta-group { display: none; }
.ug-reader-participant #ug-versions-group { display: none; }
.ug-reader-participant #ug-star-group { display: none; }
.ug-reader-participant #ug-theory-group { display: none !important; }
.ug-reader-participant #ug-theory-tempo-group { display: none !important; }

.ug-reader-content .ug-repeat-marker {
    color: #888;
    font-size: 0.85em;
    margin-left: 4px;
}

/* ── Look-ahead: "Back to the jam" pill (participant scrolled away) ───────── */
.jam-lookahead-pill {
    position: absolute;
    left: 50%;
    bottom: 92px;
    transform: translateX(-50%);
    z-index: 30;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: var(--accent, #d4622a);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.16s ease;
}
.jam-lookahead-pill:active { transform: translateX(-50%) scale(0.95); }
.jam-lookahead-pill.hidden { display: none; }

/* ── Look-ahead: "band is here" marker (where the host actually is) ───────── */
.jam-host-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed var(--accent, #d4622a);
    pointer-events: none;
    z-index: 20;
}
.jam-host-marker.hidden { display: none; }
.jam-host-marker-label {
    position: absolute;
    left: 12px;
    top: -10px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent, #d4622a);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
/* ── Jam-specific mobile reader overrides ── */
@media (max-width: 768px) {
    /* Jam mode: hide speed/autoscroll + row break on mobile — single row */
    .ug-tb-speed-group {
        display: none !important;
    }
    .ug-tb-autoscroll {
        display: none !important;
    }
    .ug-tb-row-break {
        display: none !important;
    }
    /* Single row: transpose, font. Hide capo + instrument on mobile. */
    .ug-tb-transpose-group { order: 1 !important; }
    .ug-tb-capo-group     { display: none !important; }
    #ug-font-group        { order: 2 !important; }
    #ug-instrument-group  { display: none !important; }
    #ug-versions-group    { order: 3 !important; }
}

/* ── Queue layout ────────────────────────────────────────────────────────── */

.queue-section {
    padding-bottom: 4px;
}

.queue-section:last-child {
    padding-bottom: calc(24px + var(--safe-bottom));
}

.queue-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 8px;
}

.queue-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-secondary);
}


.btn-queue-add {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}
.btn-queue-add:active { opacity: 0.6; }

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 4px;
}

.queue-empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 20px 12px;
}

.play-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 16px 6px;
    padding: 7px 18px;
    background: var(--accent, #d4622a);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}
.play-next-btn:active {
    opacity: 0.8;
}
.play-next-btn svg {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}


/* ── Played section toggle ───────────────────────────────────────────────── */

.queue-section-played {
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.queue-section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.queue-section-toggle:active { opacity: 0.7; }

/* Played header carries the collapse toggle and the Edit affordance on one row. */
.queue-section-headrow { display: flex; align-items: center; }
.queue-section-headrow .queue-section-toggle { flex: 1; min-width: 0; }
.queue-section-edit {
    flex-shrink: 0;
    margin-right: 20px;
    padding: 5px 11px;
    background: var(--accent-bg, rgba(0,0,0,0.06));
    color: var(--accent);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.queue-section-edit:active { opacity: 0.7; }

/* A Jammed card's remove button only exists in edit mode — tapping the card normally
   re-opens the sheet to read, and a live × there would be far too easy to catch. */
.queue-section-played .song-card-played .song-card-remove-btn { display: none; }
.queue-section-played.editing .song-card-played .song-card-remove-btn { display: flex; }

.played-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.toggle-chevron {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: auto;
}

/* ── Queue card ──────────────────────────────────────────────────────────── */

.queue-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    overflow: hidden;
}

/* Cards with host actions use flex row so info + buttons sit side-by-side */
.queue-card-playing,
.queue-card-queued,
.queue-card-played {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.queue-card-playing {
    border-left: 3px solid var(--accent);
    background: var(--playing-bg);
}

.queue-card-queued {
    border-left: 3px solid transparent;
}

.queue-card-played,
.queue-card-played-ro {
    opacity: 0.65;
}

.queue-card-info {
    padding: 12px 14px 10px;
    flex: 1;
    min-width: 0;
}

.queue-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-card-artist {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-card-tab {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.queue-card-tab.no-tab {
    font-style: italic;
    opacity: 0.7;
}

.queue-card-played-at {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    opacity: 0.7;
}

.queue-card-tab.tab-expandable {
    cursor: pointer;
    color: var(--accent);
}
.queue-card-tab.tab-expandable:active { opacity: 0.7; }

.tab-badge-chevron {
    margin-left: 4px;
    font-size: 13px;
    line-height: 1;
    opacity: 0.75;
}

.tab-mini-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Queue card action buttons ───────────────────────────────────────────── */

.queue-card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 8px 8px 8px 0;
    flex-shrink: 0;
}

.queue-action-btn {
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 6px;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}
.queue-action-btn:active { background: var(--bg); }

.star-btn { color: var(--border); font-size: 18px; }
.star-btn.starred { color: #f0a030; }
.remove-btn { color: #ff3b30; }

/* ── Drag handle ─────────────────────────────────────────────────────────── */
.queue-drag-handle {
    display: flex;
    align-items: center;
    padding: 0 6px 0 10px;
    color: var(--border);
    font-size: 18px;
    cursor: grab;
    touch-action: none;
    flex-shrink: 0;
    align-self: stretch;
}
.queue-drag-handle:active { cursor: grabbing; }

.queue-dragging {
    opacity: 0.5;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

/* ── Tab picker (expandable inside queue card) ───────────────────────────── */

.queue-tab-picker {
    width: 100%;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tab-picker-loading,
.tab-picker-empty {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 6px;
}

/* ── Full-width Play Now row (queued cards only) ──────────────────────────── */

.queue-play-row {
    width: 100%;
    padding: 8px 10px 10px;
    border-top: 1px solid var(--border);
}

.queue-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}
.queue-play-btn:active { opacity: 0.75; }

/* ── Participant queue wrap ───────────────────────────────────────────────── */

#participant-queue-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Add Song modal ───────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: flex-end;
    z-index: 50;
}

.modal-card {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px 20px calc(16px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 80dvh;
    overflow-y: visible;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

.add-song-status {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    padding: 4px 0;
}

/* Inside the modal, suggestions flow inline — no floating dropdown */
.modal-card .song-search-wrap { position: static; }
.modal-card .suggestions-list {
    position: static;
    box-shadow: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-height: 260px;
    overflow-y: auto;
}

/* ── Shared song-card component (buildSongCard from card.js) ─────────────── */

.song-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    overflow: hidden;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.12s;
}

.song-card.song-card-tappable {
    cursor: pointer;
}

.song-card.song-card-tappable:active {
    box-shadow: 0 0 0 rgba(0,0,0,0);
    transform: scale(0.99);
}

.song-card.song-card-playing {
    border-left: 3px solid var(--accent);
    background: var(--playing-bg);
}

.song-card.song-card-played {
    opacity: 1;
}

.song-card-drag {
    display: flex;
    align-items: center;
    padding: 0 4px 0 8px;
    color: var(--border);
    font-size: 18px;
    cursor: grab;
    flex-shrink: 0;
    align-self: stretch;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.song-card-drag:active { cursor: grabbing; }

.song-card-art {
    width: 72px;
    height: 72px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 6px;
    align-self: center;
    margin: 8px 0 8px 8px;
}

.song-card-art-placeholder {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--border);
    border-radius: 6px;
    align-self: center;
    margin: 8px 0 8px 8px;
}

.song-card-info {
    flex: 1;
    min-width: 0;
    padding: 10px 10px 10px 12px;
}

.song-card-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.song-card-artist {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-card-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.song-card-tab-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--accent);
    background: rgba(212, 98, 42, 0.10);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.song-card-tab-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-size: 12px;
}

.song-card-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    opacity: 0.8;
}

.song-card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 8px 8px 4px;
    flex-shrink: 0;
    align-self: stretch;
    justify-content: center;
}

.song-card-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 6px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.song-card-btn:active { background: var(--bg); }

.song-card-star-btn {
    font-size: 18px;
    color: var(--border);
}

.song-card-star-btn.starred { color: #f0a030; }

.song-card-remove-btn {
    color: #ff3b30;
    font-size: 14px;
}

.song-card-done-btn {
    font-size: 11px;
    font-weight: 700;
    color: #34c759;
    border: 1px solid rgba(52,199,89,0.3) !important;
    border-radius: 6px;
    padding: 3px 10px;
    letter-spacing: 0.02em;
}
.song-card-done-btn:active { background: rgba(52,199,89,0.1); }

.tab-switch-btn {
    color: var(--accent);
    opacity: 0.7;
}
.tab-switch-btn:active { opacity: 1; }

.song-card.dragging {
    opacity: 0.5;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

/* ── Past Sessions ───────────────────────────────────────────────────────── */

.past-sessions-section {
    margin-top: 20px;
    padding: 0;
}

.past-sessions-header {
    padding: 8px 16px 6px;
}

.past-sessions-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.past-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0 16px;
}

.past-session-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--card-bg);
    cursor: pointer;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
}

.past-session-item:active {
    background: var(--bg);
}

.past-session-info {
    flex: 1;
    min-width: 0;
}

.past-session-date {
    font-size: 14px;
    font-weight: 600;
}

.past-session-people {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.past-session-count {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.past-session-chevron {
    color: var(--border);
    font-size: 10px;
    flex-shrink: 0;
}

/* Past Session Detail */
.past-session-detail {
    padding: 0 16px 100px;
}

.past-session-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.past-session-back-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 0;
}

.past-session-detail-title {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Past-session detail: Share + Edit actions, clickable rows, remove-in-edit */
.past-session-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.past-session-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--accent-bg, rgba(0,0,0,0.06));
    color: var(--accent);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.past-session-action-btn:active { opacity: 0.7; }
.past-session-action-btn.primary { background: var(--accent); color: #fff; }
.past-session-action-btn.spotify { background: rgba(29, 185, 84, 0.14); color: #179443; }
.past-session-action-btn:disabled { opacity: 0.6; cursor: default; }
.recap-spotify-link { color: #179443; font-weight: 600; text-decoration: none; }
.past-session-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Past-session detail: who was there, with an Add button to fix the roster after the fact */
.past-session-people {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.past-add-people { margin: -4px 0 12px; }
.past-session-people .participant-remove { display: none; }
.past-session-detail.editing .past-session-people .participant-remove { display: inline; }

.past-session-songs-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.past-song-item:not(.openable),
.past-session-detail.editing .past-song-item { cursor: default; }
.past-song-open-chevron {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 18px;
    flex-shrink: 0;
}
.past-song-remove {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 5px 6px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--red, #ff3b30);
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.past-song-remove:hover { background: rgba(255, 59, 48, 0.12); }
.past-session-detail.editing .past-song-remove { display: inline-flex; }
.past-session-detail.editing .past-song-open-chevron { display: none; }
.past-song-item .past-song-drag { display: none; padding: 0 2px; margin-left: -4px; }
.past-session-detail.editing .past-song-drag { display: flex; }
.past-song-item.dragging {
    position: relative;
    z-index: 2;
    opacity: 0.6;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.past-session-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    margin: 8px 0 24px;
    padding: 11px;
    background: none;
    border: 1px solid rgba(255, 59, 48, 0.35);
    border-radius: 10px;
    color: var(--red, #ff3b30);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.past-session-delete-btn:active { background: rgba(255, 59, 48, 0.12); }

.past-song-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.past-song-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.past-song-art {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.past-song-art-placeholder {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.past-song-info {
    flex: 1;
    min-width: 0;
}

.past-song-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.past-song-artist {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.past-song-tab {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Bottom Nav ──────────────────────────────────────────── */
.sm-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.sm-nav-btn {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0;
    cursor: pointer;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.sm-nav-btn.active { color: var(--accent); }
.sm-nav-btn:active { opacity: 0.7; }

.sm-nav-icon { font-size: 20px; line-height: 1; }
.sm-nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }

/* ── Search bar (fixed above nav, or at bottom when nav hidden) ── */
.play-search-bar {
    position: fixed;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    z-index: 99;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
}
/* When nav is hidden (host/participant views), search bar sits at bottom */
.sm-nav.hidden ~ .play-search-bar,
.play-search-bar.no-nav {
    bottom: env(safe-area-inset-bottom, 0px);
}
.play-search-bar.hidden { display: none; }

.play-search-input-wrap { position: relative; }

.play-search-input {
    width: 100%;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    transition: border-color 0.15s;
}
.play-search-input:focus { border-color: var(--accent); }

/* Typeahead pops UP from the bottom search bar */
.play-typeahead {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 -8px 28px rgba(0,0,0,0.14);
    max-height: 340px;
    overflow-y: auto;
    z-index: 102;
    -webkit-overflow-scrolling: touch;
}
.play-typeahead.hidden { display: none; }

/* Typeahead rows */
.sm-typeahead-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sm-typeahead-item:last-child { border-bottom: none; }
.sm-typeahead-item:active,
.sm-typeahead-item.focused { background: var(--accent-dim); }

.sm-typeahead-thumb {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}
.sm-song-thumb-placeholder {
    background: var(--border);
}
.sm-typeahead-info { flex: 1; min-width: 0; }
.sm-typeahead-title { font-size: 15px; font-weight: 600; color: var(--text); }
.sm-typeahead-artist { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.play-typeahead-item {
    display: flex;
    align-items: center;
    position: relative;
}

.play-typeahead-add-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 18px;
    line-height: 1;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}
.play-typeahead-add-btn:active,
.play-typeahead-add-btn:disabled { background: var(--surface2); }

/* ── UG Scrape overlay ────────────────────────────────────── */
.sm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent, #d4622a);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.play-scrape-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.play-scrape-overlay.hidden { display: none; }
.play-scrape-msg {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    padding: 0 32px;
}
.play-scrape-hint {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    text-align: center;
}
.play-scrape-dismiss {
    margin-top: 4px;
    padding: 8px 28px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
}
.play-scrape-dismiss:hover { background: rgba(255,255,255,0.18); }

/* ── Function color coding ────────────── */
.fn-tonic        { color: #5B9BD5 !important; }
.fn-subdominant  { color: #70AD47 !important; }
.fn-dominant     { color: #E85D5D !important; }
.fn-nondiatonic  { color: #E8A84C !important; }

/* ── Theory chord display ───────────────────────────────────────── */
.theory-roman { font-weight: 700; font-size: 1em; }
.theory-chord-sub { font-size: 0.8em; opacity: 0.55; font-weight: 400; }
.theory-hidden { font-weight: 600; opacity: 0.5; font-size: 0.9em; letter-spacing: 0.02em; }

/* ── Peek tooltip ───────────────────────────────────────────────── */
.theory-peek {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface, #1c1c1e);
    border: 1px solid var(--border, #38383a);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text, #e5e5e7);
    white-space: nowrap;
    pointer-events: none;
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}
.theory-peek.visible { opacity: 1; }

.theory-learn .ug-chord,
.theory-practice .ug-chord,
.theory-ear .ug-chord,
.theory-memory .ug-chord {
    position: relative;
    cursor: pointer;
}
.theory-practice .ug-chord,
.theory-ear .ug-chord,
.theory-memory .ug-chord {
    -webkit-tap-highlight-color: transparent;
}

/* ── Section play button ────────────────────────────────────────── */
.ug-theory-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border, #38383a);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted, #6e6e73);
    font-size: 11px;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    padding: 0;
}
.ug-theory-play-btn:hover { background: var(--surface2, #2c2c2e); color: var(--text, #e5e5e7); }
.ug-theory-play-btn.playing {
    background: var(--accent, #d4622a);
    color: #fff;
    border-color: var(--accent, #d4622a);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg: #111113;
    --card-bg: #1c1c1e;
    --surface: #1c1c1e;
    --surface2: #252528;
    --border: #38383a;
    --text: #f2f2f7;
    --text-secondary: #98989e;
    --text-muted: #98989e;
    --accent: #e0723a;
    --accent-dim: rgba(224, 114, 58, 0.15);
    --accent-dark: #c85a1f;
    --accent-bg: rgba(224, 114, 58, 0.14);
    --playing-bg: rgba(224, 114, 58, 0.08);
    --blue: #4da3ff;
    --radius: 12px;
    --radius-sm: 8px;
}
[data-theme="dark"] .top-bar,
[data-theme="dark"] .participants-bar,
[data-theme="dark"] .session-banner,
[data-theme="dark"] .invite-section,
[data-theme="dark"] .invite-expanded,
[data-theme="dark"] .invite-collapsed {
    background: var(--card-bg);
    border-color: var(--border);
}
[data-theme="dark"] .queue-card { background: var(--card-bg); }
[data-theme="dark"] .modal-card { background: var(--card-bg); }
[data-theme="dark"] .overlay-card { background: var(--card-bg); }
[data-theme="dark"] .past-sessions-list { background: var(--border); }
[data-theme="dark"] .past-session-item { background: var(--card-bg); }
[data-theme="dark"] .past-session-item:active { background: var(--surface2); }
[data-theme="dark"] .past-song-item { background: var(--card-bg); }
[data-theme="dark"] .login-card { background: var(--card-bg); }
[data-theme="dark"] .text-input {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .btn-secondary {
    background: var(--surface2);
    color: var(--text);
}
[data-theme="dark"] .participant-chip { background: var(--surface2); }
[data-theme="dark"] .participant-chip.is-host { background: var(--accent-bg); color: var(--accent); }
[data-theme="dark"] .queue-tab-picker { background: var(--surface2); }
[data-theme="dark"] .play-search-bar { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .play-search-input { background: var(--surface2); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .play-typeahead { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .sm-typeahead-item { border-color: var(--border); }
[data-theme="dark"] .add-people-input { background: var(--surface2); border-color: var(--border); }
[data-theme="dark"] .add-people-list { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .add-people-row:active { background: var(--accent-dim); }
[data-theme="dark"] .sm-typeahead-item:active,
[data-theme="dark"] .sm-typeahead-item.focused { background: var(--accent-dim); }
[data-theme="dark"] .song-card { background: var(--card-bg); }
[data-theme="dark"] .song-card-art-placeholder { background: var(--surface2); color: var(--border); }
[data-theme="dark"] .queue-section-toggle { color: var(--text); }
[data-theme="dark"] .waiting-jammers-label { color: var(--text-secondary); }
[data-theme="dark"] #view-login {
    background: linear-gradient(160deg, #1a1209 0%, #2c1c0c 55%, #1a1209 100%);
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */
.theme-toggle {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}
.theme-toggle:active { opacity: 0.7; }
.theme-toggle::before { content: '☽'; }
[data-theme="dark"] .theme-toggle::before { content: '☀'; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN — warm gradient entry moment
   ═══════════════════════════════════════════════════════════════════════════ */
#view-login {
    background: linear-gradient(160deg, #fdf0e8 0%, #f5e0d0 55%, #fdf0e8 100%);
}
[data-theme="dark"] #view-login {
    background: linear-gradient(160deg, #1a1209 0%, #2c1c0c 55%, #1a1209 100%);
}
#view-login .app-title { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
#view-login .app-subtitle { font-size: 15px; }
#view-login .center-wrap { gap: 16px; }
#view-login .app-logo-hero { width: 72px; height: 81px; }

/* ═══════════════════════════════════════════════════════════════════════════
   HOME — stronger Start a Jam CTA
   ═══════════════════════════════════════════════════════════════════════════ */
.jam-start-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
    box-shadow: 0 2px 12px rgba(212, 98, 42, 0.35);
}
.jam-start-btn:active { opacity: 0.82; }
.jam-start-icon { font-size: 26px; flex-shrink: 0; }
.jam-start-text { flex: 1; text-align: left; }
.jam-start-label { font-size: 17px; font-weight: 700; display: block; }
.jam-start-sub { font-size: 12px; opacity: 0.82; display: block; margin-top: 1px; }
.jam-start-chevron { font-size: 18px; opacity: 0.7; flex-shrink: 0; }

/* Starting: the note taps out a beat and the chevron becomes a spinner while the room
   is set up, so the tap reads as heard straight away. */
.jam-start-btn.is-starting { cursor: progress; }
.jam-start-btn.is-starting .jam-start-icon { animation: jam-start-beat 0.6s ease-in-out infinite; }
.jam-start-btn.is-starting .jam-start-chevron {
    width: 18px;
    height: 18px;
    font-size: 0;
    opacity: 1;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jam-start-spin 0.7s linear infinite;
}
@keyframes jam-start-beat {
    0%, 100% { transform: scale(1); }
    35%      { transform: scale(1.18) rotate(-6deg); }
}
@keyframes jam-start-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .jam-start-btn.is-starting .jam-start-icon { animation: none; }
    .jam-start-btn.is-starting .jam-start-chevron { animation-duration: 1.6s; }
}

/* Past session cards — richer treatment */
.past-session-item {
    padding: 14px 16px;
}
.past-session-date { font-size: 15px; font-weight: 700; }
.past-session-people { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.past-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 3px 9px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INVITE SECTION (replaces session-banner + participants-bar)
   ═══════════════════════════════════════════════════════════════════════════ */
.invite-section {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Single compact invite bar — QR always visible + code + Share + joined chips.
   Own class names (invite-bar-*) so the older expanded/collapsed !important rules
   below don't apply. */
.invite-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
}
.invite-bar-qr {
    width: 76px;
    height: 76px;
    border-radius: 8px;
    background: var(--border);
    display: block;
    flex-shrink: 0;
}
.invite-bar-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.invite-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.invite-bar-code {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent);
    line-height: 1;
}

/* Expanded: room code + QR + URL */
.invite-expanded {
    padding: 16px 20px;
}
.invite-inner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.invite-code-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.invite-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}
.invite-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.invite-code {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 5px;
    color: var(--accent);
    line-height: 1;
}
.invite-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--accent-bg);
    color: var(--accent);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
}
.invite-copy-btn:active { opacity: 0.7; }
.invite-copy-btn.copied {
    background: rgba(48, 209, 88, 0.15);
    color: #30d158;
}
.invite-url {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.4;
}
.invite-qr-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.invite-qr {
    width: 110px;
    height: 110px;
    border-radius: var(--radius-sm);
    background: var(--border);
    display: block;
}
.invite-qr-hint {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* Collapsed: participant chips + re-invite */
.invite-collapsed {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 48px;
}
.participant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.participant-name {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--accent-bg);
    color: var(--accent-dark, var(--accent));
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.participant-name.is-host {
    background: var(--accent);
    color: #fff;
}
.participant-chip-av.is-host::after {
    /* legacy — kept for any remaining references */
    display: none;
    border: 2px solid var(--bg);
}
.invite-reshare-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--accent-bg);
    color: var(--accent);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.invite-reshare-btn:active { opacity: 0.7; }

/* ── Host: add people who are here but haven't joined ───────────────────── */
/* Only the input lives in normal flow. The results float over whatever is below, at a
   fixed maximum height, so typing never resizes the invite bar or moves the QR code. */
.invite-add-btn { gap: 4px; }
.add-people {
    position: relative;
    margin-top: 2px;
}
.add-people.hidden { display: none; }
.add-people-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 16px;            /* 16px+ keeps iOS from zooming on focus */
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.add-people-input:focus { border-color: var(--accent); }
.add-people-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
}
.add-people-list {
    max-height: min(320px, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    animation: add-people-in 120ms ease-out;
}
.add-people-list.hidden { display: none; }
@keyframes add-people-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .add-people-list { animation: none; }
}
.add-people-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
}
.add-people-row:last-child { border-bottom: none; }
.add-people-row:active { background: var(--accent-bg); }
.add-people-row.in-room { color: var(--text-secondary); cursor: default; }
.add-people-row.in-room:active { background: none; }
.add-people-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.add-people-name { display: flex; align-items: center; gap: 6px; }
.add-people-sub {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.add-people-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 8px;
    background: var(--accent-bg);
    color: var(--accent);
}
.add-people-invite { background: var(--accent-bg); }
.add-people-invite .add-people-name { color: var(--accent); }
.add-people-state { flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--accent); }
.add-people-row.in-room .add-people-state { font-weight: 500; color: var(--text-secondary); }
.add-people-empty { padding: 10px 12px; font-size: 13px; color: var(--text-secondary); }
/* Errors sit inside the popover, above the list, so they never push the page either */
.add-people-error {
    display: block;
    margin-bottom: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #ff453a;
    background: var(--surface);
    border: 1px solid rgba(255, 69, 58, 0.35);
    border-radius: 10px;
}
.add-people-error.hidden { display: none; }
.participant-remove {
    margin-left: 5px;
    padding: 0 2px;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.55;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.participant-remove:active { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   NOW PLAYING — card strip treatment (CSS-only, no JS change needed)
   ═══════════════════════════════════════════════════════════════════════════ */
.song-card-playing {
    border-left: none !important;
    background: var(--playing-bg) !important;
    align-items: flex-start;
}
.song-card-playing::before {
    content: '▶  NOW PLAYING';
    display: block;
    width: 100%;
    padding: 5px 14px 4px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    font-family: inherit;
    flex-shrink: 0;
}
.song-card-playing .song-card-name { font-size: 16px; font-weight: 700; }
.song-card-playing .song-card-art,
.song-card-playing .song-card-art-placeholder {
    width: 60px;
    height: 60px;
    align-self: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PARTICIPANT WAITING STATE — with jammer list
   ═══════════════════════════════════════════════════════════════════════════ */
.waiting-pulse {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.waiting-pulse::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: var(--accent-dim);
    animation: waiting-ring 2.4s ease-in-out infinite;
}
@keyframes waiting-ring {
    0%, 100% { transform: scale(0.85); opacity: 0.5; }
    50%       { transform: scale(1.1);  opacity: 0.15; }
}
.waiting-jammers {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.waiting-jammers-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}
.waiting-state .participant-chips {
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SESSION ENDED — celebratory recap
   ═══════════════════════════════════════════════════════════════════════════ */
.recap-headline {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    color: var(--accent);
    letter-spacing: -0.5px;
    margin: 4px 0;
}
.recap-sub {
    font-size: 14px;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.recap-songs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.recap-song-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.recap-song-art {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.recap-song-art-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.recap-song-info { flex: 1; min-width: 0; }
.recap-song-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recap-song-artist {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.overlay-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SESSION ENDED — the night's recap
   Phones: a full-screen slide-up. 600px+: one card sized to its content, centred
   over a dim backdrop. The one visual moment is the covers of what was played,
   fanned like records left out on the table; everything else is quiet system type:
   a plain-sentence headline, the lineup in the same chips as the host view, then
   the setlist in played order.
   ═══════════════════════════════════════════════════════════════════════════ */
.session-ended-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    animation: session-slide-up 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}
.session-ended-screen.hidden { display: none !important; }

@keyframes session-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.session-ended-card {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.session-ended-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 12px;
}

.session-ended-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 8px 18px;
}

/* Covers: each one offset and tilted by its distance (--o) from the middle */
.recap-covers {
    position: relative;
    width: 100%;
    height: 112px;
    margin-bottom: 20px;
}
.recap-cover {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 96px;
    height: 96px;
    margin-left: -48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.16);
    transform: translateX(calc(var(--o) * 46px)) rotate(calc(var(--o) * 5deg - 2deg));
}
/* Pinned to the top-right corner of the last cover shown */
.recap-cover-more {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(calc(var(--o) * 46px + 30px));
    padding: 3px 9px;
    border-radius: 12px;
    background: var(--text);
    color: var(--card-bg);
    font-size: 12px;
    font-weight: 700;
}
.recap-covers-empty {
    position: absolute;
    top: 14px;
    left: 50%;
    width: 80px;
    height: 80px;
    margin-left: -40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent);
}
.recap-spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid rgba(212, 98, 42, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: jam-start-spin 0.7s linear infinite;
}

.session-ended-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.3px;
    color: var(--text);
}
.session-ended-hero .recap-sub {
    margin: 4px 0 0;
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-secondary);
}
.session-ended-screen.is-pending .session-ended-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Lineup — same chips as the host view, wrapped and centred under the headline */
.recap-lineup {
    padding: 0 4px 22px;
    text-align: center;
}
.recap-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
.recap-lineup .recap-sitin { margin-top: 10px; }

.recap-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 2px 6px;
}

/* Setlist — numbered in played order, hairlines between songs, no boxes-in-boxes */
.setlist {
    list-style: none;
    border-top: 1px solid var(--border);
}
.setlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--border);
}
.setlist-item:last-child { border-bottom: none; }
.setlist-num {
    width: 22px;
    flex-shrink: 0;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}
.setlist-art {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
}
.setlist-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.setlist-name,
.setlist-artist {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.setlist-name { font-size: 15px; font-weight: 600; color: var(--text); }
.setlist-artist { font-size: 13px; color: var(--text-secondary); }

/* Small after-the-fact notes, e.g. the crew playlist tidy-up */
.recap-notes:empty { display: none; }
.recap-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}
.recap-note.is-error { background: rgba(255, 59, 48, 0.08); color: #c4291f; }

.session-ended-footer {
    flex-shrink: 0;
    padding: 12px 20px calc(16px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}
.session-ended-footer .btn:disabled { opacity: 0.45; }

@media (min-width: 600px) {
    .session-ended-screen {
        background: rgba(0, 0, 0, 0.5);
        align-items: center;
        justify-content: center;
        padding: 24px;
        animation: none;
    }
    .session-ended-card {
        flex: 0 1 auto;
        max-width: 460px;
        max-height: min(780px, calc(100dvh - 48px));
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
        animation: sheet-fade-in 0.22s ease-out;
    }
    .session-ended-inner { padding: 0 28px 16px; }
    .session-ended-hero { padding: 36px 8px 20px; }
    .session-ended-footer { padding: 16px 28px 20px; }
}

@media (min-width: 1024px) {
    .session-ended-card { max-width: 500px; }
}

@media (max-width: 374px) {
    .session-ended-hero { padding: 24px 4px 14px; }
    .recap-cover { width: 84px; height: 84px; margin-left: -42px; transform: translateX(calc(var(--o) * 38px)) rotate(calc(var(--o) * 5deg - 2deg)); }
    .session-ended-title { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    .session-ended-screen, .session-ended-card { animation: none; }
    .recap-spinner { animation-duration: 1.6s; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   END SESSION CONFIRM — styled sheet (replaces native confirm())
   ═══════════════════════════════════════════════════════════════════════════ */
.end-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-end;
    padding-bottom: var(--safe-bottom);
}

.end-confirm-overlay.hidden { display: none !important; }

.end-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.end-confirm-sheet {
    position: relative;
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 28px 24px calc(20px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
    animation: sheet-slide-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.end-confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.end-confirm-icon { font-size: 32px; line-height: 1; }

.end-confirm-title {
    font-size: 20px;
    font-weight: 700;
}

.end-confirm-msg {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.end-confirm-btns {
    display: flex;
    gap: 10px;
}

.end-confirm-btn { flex: 1; }

.end-confirm-end-btn {
    background: #ff3b30;
    color: #fff;
}

.end-confirm-end-btn:active { opacity: 0.8; }

/* Quiet secondary exit under End Jam — throws the jam away instead of saving it.
   First tap arms it (turns red and says what happens), second tap deletes. */
.end-confirm-delete {
    align-self: center;
    margin-top: -8px;
    padding: 6px 10px;
    background: none;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.end-confirm-delete:hover { color: var(--text); }
.end-confirm-delete.armed {
    color: #ff3b30;
    font-weight: 600;
    text-decoration-color: currentColor;
}
.end-confirm-delete:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[data-theme="dark"] .end-confirm-sheet { background: var(--card-bg); }

/* ═══════════════════════════════════════════════════════════════════════════
   INVITE SECTION — stacked centered layout
   ═══════════════════════════════════════════════════════════════════════════ */
.invite-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 20px 20px 16px !important;
}

.invite-code-area {
    flex: unset !important;
    width: 100% !important;
    align-items: center !important;
    text-align: center !important;
    gap: 8px !important;
}

.invite-code {
    font-size: 44px !important;
    letter-spacing: 10px !important;
    line-height: 1 !important;
    display: block;
    text-indent: 10px; /* visual compensation for letter-spacing on last char */
}

.invite-copy-btn {
    font-size: 14px !important;
    padding: 9px 20px !important;
}

.invite-qr-area {
    gap: 6px !important;
}

.invite-qr {
    width: 130px !important;
    height: 130px !important;
    border-radius: 10px !important;
}

.invite-url {
    font-size: 11px !important;
    text-align: center !important;
    color: var(--text-secondary) !important;
    word-break: break-all;
    max-width: 280px;
    line-height: 1.5 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUEUE SECTION HEADERS — more presence
   ═══════════════════════════════════════════════════════════════════════════ */
.queue-section-header {
    padding: 16px 20px 10px !important;
}

.queue-section-title {
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    color: var(--text-secondary) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME VIEW — greeting inside body
   ═══════════════════════════════════════════════════════════════════════════ */
.home-greeting {
    padding: 4px 0 8px;
}

.home-greeting-name {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
}

.home-greeting-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}


/* ── SVG icon colouring (replaces emoji) ──────────────────────────────────── */
.end-confirm-icon   { color: var(--text-secondary); }
.jam-start-icon     { display: flex; align-items: center; }
.recap-song-art-placeholder { color: var(--border); }
.past-song-art-placeholder  { color: var(--border); }

/* ── Unified typeahead sections (shared with songs.css) ───────────────────── */
.ta-section {
    padding: 8px 16px 4px;
    font-size: 11px; font-weight: 700;
    letter-spacing: .5px; text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.ta-artist-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    background: var(--accent-bg);
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.ta-artist-card:active { background: var(--accent-dim); }

.ta-artist-photo {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
    border: 2px solid rgba(212,98,42,.25); overflow: hidden;
}
.ta-artist-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ta-artist-info { flex: 1; min-width: 0; }
.ta-artist-name { font-size: 16px; font-weight: 700; color: var(--text); }
.ta-artist-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ta-artist-cta  { font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 3px; }
.ta-in-lib-pill {
    font-size: 11px; font-weight: 600; color: var(--green);
    background: rgba(30,138,64,.1); border: 1px solid rgba(30,138,64,.25);
    border-radius: 4px; padding: 1px 6px; display: inline-block; margin-top: 3px;
}
.ta-artist-arrow { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }

.ta-song, .ta-album {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.ta-song:last-child, .ta-album:last-child { border-bottom: none; }
.ta-song:active, .ta-album:active { background: var(--accent-dim); }
.ta-thumb {
    width: 40px; height: 40px; border-radius: 5px;
    background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0; overflow: hidden;
}
.ta-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ta-info { flex: 1; min-width: 0; }
.ta-title { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ta-artist-line { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.ta-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.played-badge {
    font-size: 10px; font-weight: 600; color: var(--blue);
    background: rgba(0,85,200,.08); border: 1px solid rgba(0,85,200,.2);
    border-radius: 4px; padding: 2px 6px; white-space: nowrap;
}
[data-theme="dark"] .played-badge { background: rgba(77,163,255,.12); border-color: rgba(77,163,255,.25); }

.ta-stage-badge { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.ta-stage-badge[data-stage="want_to_learn"]  { background: #ebebf0; color: #5a5a60; }
.ta-stage-badge[data-stage="early"]          { background: #dde8fc; color: var(--blue); }
.ta-stage-badge[data-stage="middle"]         { background: #fdf0d0; color: var(--yellow); }
.ta-stage-badge[data-stage="getting_close"]  { background: #fde8d8; color: var(--orange); }
.ta-stage-badge[data-stage="perfected"]      { background: #d6f0dd; color: var(--green); }
[data-theme="dark"] .ta-stage-badge[data-stage="want_to_learn"]  { background: #2a2a30; color: #98989e; }
[data-theme="dark"] .ta-stage-badge[data-stage="early"]          { background: rgba(77,163,255,.15); color: var(--blue); }
[data-theme="dark"] .ta-stage-badge[data-stage="middle"]         { background: rgba(255,214,10,.12); color: var(--yellow); }
[data-theme="dark"] .ta-stage-badge[data-stage="getting_close"]  { background: rgba(255,159,10,.12); color: var(--orange); }
[data-theme="dark"] .ta-stage-badge[data-stage="perfected"]      { background: rgba(48,209,88,.12); color: var(--green); }

.ta-add-btn {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1.5px solid var(--border); background: var(--surface);
    color: var(--text-muted); font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: all .12s; font-family: var(--font); line-height: 1;
}
.ta-add-btn:active, .ta-add-btn:hover {
    border-color: var(--accent); color: var(--accent); background: var(--accent-dim);
}

/* ── Artist drill-down panel (jam) ───────────────────────────────────────── */
.artist-drill {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 120;
}
.artist-drill.open { transform: translateX(0); }

@media (min-width: 700px) {
    .artist-drill {
        right: auto;
        width: 100%;
        max-width: var(--content-max);
        left: 50%;
        transform: translateX(calc(-50% + 100vw));
        box-shadow: -20px 0 60px rgba(0,0,0,.14), 20px 0 60px rgba(0,0,0,.14);
    }
    .artist-drill.open { transform: translateX(-50%); }

    .drill-hdr { height: 60px; }
    .drill-hdr-title { font-size: 18px; }

    .drill-artist-strip { padding: 20px 24px; gap: 18px; }
    .drill-artist-avatar { width: 72px; height: 72px; font-size: 36px; }
    .drill-artist-name { font-size: 20px; }
    .drill-artist-sub { font-size: 14px; }

    .drill-filter { padding: 10px 20px; }
    .drill-section-label { padding: 14px 24px 6px; }
    .drill-song { padding: 12px 24px; }
    .drill-thumb { width: 46px; height: 46px; }
}

.drill-hdr {
    height: 52px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex; align-items: center; padding: 0 4px 0 0; flex-shrink: 0;
}
.drill-back-btn {
    background: none; border: none; color: var(--accent);
    font-size: 22px; cursor: pointer; padding: 8px 12px; line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.drill-hdr-title { flex: 1; font-size: 17px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drill-hdr-count { font-size: 13px; color: var(--text-muted); padding-right: 16px; }

.drill-artist-strip {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-shrink: 0;
}
.drill-artist-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; flex-shrink: 0; border: 2px solid var(--border); overflow: hidden;
}
.drill-artist-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.drill-artist-meta { flex: 1; }
.drill-artist-name { font-size: 18px; font-weight: 700; color: var(--text); }
.drill-artist-sub  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.drill-filter {
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 12px; display: flex; gap: 6px;
    overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
}
.drill-filter::-webkit-scrollbar { display: none; }
.dchip {
    flex-shrink: 0; padding: 5px 12px; border-radius: 20px;
    border: 1.5px solid var(--border); background: var(--surface);
    color: var(--text-muted); font-size: 12px; font-weight: 600;
    cursor: pointer; white-space: nowrap; font-family: var(--font);
    transition: all .12s; -webkit-tap-highlight-color: transparent;
}
.dchip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.drill-song-list { flex: 1; overflow-y: auto; background: var(--surface); -webkit-overflow-scrolling: touch; }

.drill-section-label {
    padding: 12px 16px 4px;
    font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    color: var(--text-muted); background: var(--surface2);
}

.drill-song {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .1s;
}
.drill-song:last-child { border-bottom: none; }
.drill-song:active { background: var(--accent-dim); }
.drill-num { width: 18px; font-size: 12px; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.drill-song--fresh { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.drill-song--fresh .drill-num { color: var(--accent); font-weight: 700; }
.drill-fresh-tag {
    display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 10px;
    background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
    letter-spacing: .3px; text-transform: uppercase; vertical-align: 1px;
}
.drill-thumb {
    width: 40px; height: 40px; border-radius: 5px;
    background: var(--surface2); display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0; overflow: hidden;
}
.drill-thumb img { width: 100%; height: 100%; object-fit: cover; }
.drill-info { flex: 1; min-width: 0; }
.drill-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drill-album { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drill-right { flex-shrink: 0; }

.drill-add-btn {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1.5px solid var(--border); background: var(--surface);
    color: var(--text-muted); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; -webkit-tap-highlight-color: transparent; transition: all .12s; line-height: 1;
}
.drill-add-btn:active, .drill-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.drill-loading, .drill-empty { padding: 40px 24px; text-align: center; color: var(--text-muted); font-size: 14px; line-height: 1.5; }

.drill-scroll-sentinel { height: 1px; }
.drill-loading-more { display: flex; justify-content: center; align-items: center; padding: 16px; }

/* ── AI Vibe search (Discover with AI typeahead row + drill panel) ── */
.ta-ai-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
    background: var(--accent-bg);
}
.ta-ai-row:active { background: var(--accent-dim); }
.ta-ai-thumb {
    background: linear-gradient(135deg, var(--accent), #ffb37a);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Album drill: square cover instead of a round artist photo; every row would repeat the cover, so hide thumbs. */
.artist-drill.album-mode .drill-artist-avatar,
.artist-drill.album-mode .drill-artist-avatar img { border-radius: 6px; }
.artist-drill.album-mode .drill-thumb { display: none; }
.artist-drill.album-mode .drill-artist-name { white-space: normal; line-height: 1.3; }
.artist-drill.ai-vibe .drill-filter { display: none; }
.artist-drill.ai-vibe .drill-artist-avatar {
    background: linear-gradient(135deg, var(--accent), #ffb37a);
    border-color: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.artist-drill.ai-vibe .drill-artist-name {
    white-space: normal;
    line-height: 1.3;
}
.drill-queued-badge {
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    padding: 3px 7px;
    white-space: nowrap;
    background: var(--accent-bg);
    color: var(--accent);
}

.drill-load-more-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 16px;
    padding: 10px 0;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s, border-color .12s;
}
.drill-load-more-btn:hover, .drill-load-more-btn:active { background: var(--accent-dim); border-color: var(--accent); }
.drill-load-more-btn:disabled { opacity: 0.5; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (600px+)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {

    /* ── Content container ────────────────────────────────────────────────── */
    :root { --content-max: 900px; }

    /* ── Home view ────────────────────────────────────────────────────────── */
    /* Centred blocks inside a flex column need width: 100% — auto side margins otherwise
       shrink them to their content, so the page painted narrow and then jumped wide once
       Past Sessions loaded. Same for every max-width + auto-margin block below. */
    .home-body {
        width: 100%;
        max-width: var(--content-max);
        margin: 0 auto;
        padding-left: 24px;
        padding-right: 24px;
    }

    .home-greeting-name { font-size: 28px; }

    .past-sessions-section {
        width: 100%;
        max-width: var(--content-max);
        margin-left: auto;
        margin-right: auto;
    }

    .past-sessions-list { margin: 0; }

    .past-session-detail {
        width: 100%;
        max-width: var(--content-max);
        margin-left: auto;
        margin-right: auto;
    }

    /* ── Host view ────────────────────────────────────────────────────────── */
    /* .invite-section stays a plain block: as a centring flexbox its lineup bar shrank to
       its content, so the chips never wrapped — a narrow strip with few people, spilling
       off both edges with many. Full width matches the host queue below it. */

    .invite-expanded {
        max-width: var(--content-max);
        width: 100%;
    }

    .invite-collapsed {
        max-width: var(--content-max);
        width: 100%;
        margin: 0 auto;
    }

    /* Override the forced-column layout for invite-inner on tablet+:
       show code area + QR side-by-side */
    .invite-inner {
        flex-direction: row !important;
        align-items: center !important;
        gap: 24px !important;
        padding: 20px 24px 16px !important;
    }

    .invite-code-area {
        align-items: flex-start !important;
        text-align: left !important;
    }

    .invite-code {
        font-size: 36px !important;
        letter-spacing: 8px !important;
        text-indent: 8px;
    }

    .invite-url {
        text-align: left !important;
    }

    #view-host .queue-section,
    #view-host .queue-section-played {
        max-width: none;
    }

    /* ── Participant view — constrain queue ───────────────────────────────── */
    #view-participant .queue-section,
    #view-participant .queue-section-played {
        width: 100%;
        max-width: var(--content-max);
        margin-left: auto;
        margin-right: auto;
    }

    /* ── Search bar — center constrained ──────────────────────────────────── */
    .play-search-bar {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 100%;
        max-width: calc(var(--content-max) + 32px);
    }

    /* ── Bottom nav — constrain (match practice/play pages) ─────────────── */
    .sm-nav {
        max-width: var(--content-max);
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
    }

    /* ── Modals: end-confirm as centered dialog ──────────────────────────── */
    .end-confirm-overlay {
        align-items: center;
        justify-content: center;
        padding-bottom: 0;
    }

    .end-confirm-sheet {
        max-width: 400px;
        border-radius: var(--radius);
        animation: sheet-fade-in 0.22s ease-out;
    }

    @keyframes sheet-fade-in {
        from { opacity: 0; transform: scale(0.95); }
        to   { opacity: 1; transform: scale(1); }
    }

    /* ── Queue cards — slightly more spacious ─────────────────────────────── */
    .queue-list { padding: 0 20px 4px; }

    .song-card-art,
    .song-card-art-placeholder {
        margin: 10px 0 10px 10px;
    }

    .song-card-info { padding: 12px 12px 12px 14px; }

    /* ── Typeahead — wider + rounded ──────────────────────────────────────── */
    .play-typeahead {
        max-height: 400px;
        border-radius: 16px;
    }

    /* ── UG Reader toolbar — full width on desktop ───────────────────────── */

    /* ── Waiting state — more generous ────────────────────────────────────── */
    .waiting-state { padding: 48px 32px; gap: 20px; }
    .waiting-icon svg { width: 48px; height: 48px; }
    .waiting-text { font-size: 17px; }

    /* ── Past session detail — wider song items ──────────────────────────── */
    .past-song-item { padding: 12px 14px; }
    .past-song-art,
    .past-song-art-placeholder { width: 44px; height: 44px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — DESKTOP (1024px+)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

    :root { --content-max: 1100px; }

    /* ── Home view — more generous spacing ────────────────────────────────── */
    .home-body {
        padding-top: 40px;
        gap: 18px;
    }

    .home-greeting-name { font-size: 32px; }
    .home-greeting-sub { font-size: 15px; }

    .jam-start-btn { padding: 20px 24px; }
    .jam-start-label { font-size: 18px; }

    .join-input { font-size: 20px; }

    /* ── Invite section — larger code on desktop ─────────────────────────── */
    .invite-code {
        font-size: 40px !important;
        letter-spacing: 10px !important;
    }

    .invite-qr {
        width: 140px !important;
        height: 140px !important;
    }

    /* ── Queue — more spacious cards ──────────────────────────────────────── */
    .queue-list { gap: 10px; }

    .song-card-art,
    .song-card-art-placeholder {
        width: 80px;
        height: 80px;
        margin: 10px 0 10px 12px;
    }

    .song-card-name { font-size: 16px; }
    .song-card-artist { font-size: 14px; }
    .song-card-info { padding: 14px 14px 14px 16px; }

    /* ── Bottom nav — desktop width (inherits --content-max from breakpoint) */

    .sm-nav-btn { gap: 4px; }
    .sm-nav-label { font-size: 12px; }

    /* ── End confirm — slightly wider ─────────────────────────────────────── */
    .end-confirm-sheet { max-width: 440px; }


    /* ── Waiting state — more dramatic ────────────────────────────────────── */
    .waiting-icon svg { width: 56px; height: 56px; }
    .waiting-text { font-size: 18px; }
    .waiting-pulse::before { inset: -16px; }

    /* ── Top bar — a touch more height ────────────────────────────────────── */
    .top-bar {
        padding-left: 20px;
        padding-right: 20px;
    }
    .top-bar-title { font-size: 18px; }

    /* ── Search bar — wider on desktop ────────────────────────────────────── */
    .play-search-bar {
        max-width: calc(var(--content-max) + 40px);
    }

    .play-search-input { font-size: 17px; padding: 13px 18px; }

    /* ── Typeahead — more generous ────────────────────────────────────────── */
    .play-typeahead { max-height: 440px; }

    .sm-typeahead-item { padding: 12px 18px; }
    .sm-typeahead-thumb { width: 44px; height: 44px; }
    .sm-typeahead-title { font-size: 16px; }

    /* ── Artist drill — wider panel on desktop ────────────────────────────── */
    .artist-drill {
        max-width: 520px;
    }


    /* ── Past sessions — richer cards ─────────────────────────────────────── */
    .past-session-item { padding: 16px 18px; }
    .past-session-date { font-size: 16px; }

    .ug-reader-toolbar {
        height: 68px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — WIDE DESKTOP (1440px+)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1440px) {

    :root { --content-max: 1400px; }

    .home-body { padding-top: 48px; }
    .home-greeting-name { font-size: 34px; }


    /* toolbar stays full-width */
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤374px) — tighten spacing for SE/mini
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 374px) {

    .home-body { padding: 20px 16px calc(var(--nav-h) + var(--safe-bottom) + 12px); gap: 12px; }
    .home-greeting-name { font-size: 22px; }
    .jam-start-btn { padding: 14px 16px; gap: 10px; }
    .jam-start-label { font-size: 15px; }
    .jam-start-sub { font-size: 11px; }

    .invite-code { font-size: 28px !important; letter-spacing: 6px !important; }
    .invite-qr { width: 90px !important; height: 90px !important; }
    .invite-copy-btn { font-size: 13px !important; padding: 7px 16px !important; }

    .queue-list { padding: 0 12px 4px; }
    .song-card-art,
    .song-card-art-placeholder { width: 56px; height: 56px; margin: 6px 0 6px 6px; }
    .song-card-info { padding: 8px 8px 8px 10px; }
    .song-card-name { font-size: 14px; }
    .song-card-artist { font-size: 12px; }

    .play-search-bar { padding: 8px 12px; }
    .play-search-input { padding: 10px 14px; font-size: 15px; }

    .sm-nav-label { font-size: 10px; }

    .queue-section-header { padding: 12px 16px 8px !important; }

    .past-sessions-list { margin: 0 12px; }
    .past-session-item { padding: 10px 12px; }
    .past-session-date { font-size: 14px; }
    .past-session-people { font-size: 11px; }

    .end-confirm-sheet { padding: 24px 20px calc(16px + var(--safe-bottom)); }
    .end-confirm-title { font-size: 18px; }
    .end-confirm-btns { flex-direction: column; gap: 8px; }


    /* Tighter invite collapsed */
    .invite-collapsed { padding: 8px 12px; }
    .participant-name { font-size: 11px; padding: 3px 8px; }

    /* Tighter typeahead */
    .play-typeahead { max-height: 280px; }
    .sm-typeahead-item { padding: 8px 12px; gap: 10px; }
    .sm-typeahead-thumb { width: 36px; height: 36px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANDSCAPE MODE — reduce vertical usage
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {

    .top-bar { --header-h: 44px; }
    .sm-nav { --nav-h: 48px; }
    .sm-nav-label { display: none; }
    .sm-nav-btn { padding: 4px 0; }

    .home-body { padding-top: 16px; gap: 10px; }
    .home-greeting { padding: 0 0 4px; }
    .home-greeting-name { font-size: 20px; }
    .jam-start-btn { padding: 12px 16px; }

    .waiting-state { padding: 16px 24px; gap: 12px; }
    .waiting-icon svg { width: 32px; height: 32px; }
    .waiting-pulse::before { inset: -8px; }

    .invite-inner { padding: 12px 16px 10px !important; }
    .invite-code { font-size: 28px !important; }
    .invite-qr { width: 80px !important; height: 80px !important; }


    .ug-reader-toolbar { height: 52px; }

    .queue-section-header { padding: 10px 20px 6px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BIG SEARCH — scaled-up song search, results, and the artist / AI-search
   drill-down list for jam. Two tiers: a moderate bump on phones and the
   across-the-room size from 700px up. Appended last on purpose: same-
   specificity rules here win over the earlier responsive blocks.
   Mirrors songs.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Search bar + results — phone tier */
.play-search-bar { padding: 12px 16px; }
.play-search-input {
    padding: 14px 18px;
    font-size: 20px;
    border-radius: 14px;
    border-width: 2px;
}
.play-search-input:focus { box-shadow: 0 0 0 4px var(--accent-dim); }

.play-typeahead {
    bottom: calc(100% + 8px);
    max-height: min(58vh, 460px);
    border-radius: 16px;
}
.play-typeahead .sm-typeahead-item { padding: 12px 16px; gap: 13px; }
.play-typeahead .sm-typeahead-thumb { width: 50px; height: 50px; }
.play-typeahead .sm-typeahead-title { font-size: 19px; }
.play-typeahead .sm-typeahead-artist { font-size: 16px; }
.play-typeahead-add-btn { width: 34px; height: 34px; font-size: 22px; }

.ta-section { padding: 10px 16px 6px; font-size: 14px; }
.ta-artist-card { padding: 13px 16px; gap: 13px; }
.ta-artist-photo { width: 62px; height: 62px; font-size: 27px; }
.ta-artist-name { font-size: 20px; }
.ta-artist-sub { font-size: 15px; }
.ta-artist-cta { font-size: 15px; }
.ta-in-lib-pill { font-size: 13px; padding: 2px 7px; }
.ta-artist-arrow { font-size: 24px; }
.ta-song, .ta-album { padding: 12px 16px; gap: 13px; }
.ta-thumb { width: 50px; height: 50px; font-size: 21px; border-radius: 6px; }
.ta-title { font-size: 19px; }
.ta-artist-line { font-size: 16px; }
.ta-right { gap: 10px; }
.played-badge { font-size: 12px; padding: 3px 7px; }
.ta-stage-badge { font-size: 12px; padding: 3px 7px; }
.ta-add-btn { width: 38px; height: 38px; font-size: 24px; border-radius: 10px; }
.ta-ai-row { padding: 13px 16px; gap: 13px; }
.ta-ai-thumb { font-size: 21px; }

/* Artist / AI-search drill-down list — phone tier */
.drill-hdr { height: 58px; }
.drill-back-btn { font-size: 24px; padding: 8px 13px; }
.drill-hdr-title { font-size: 20px; }
.drill-hdr-count { font-size: 15px; padding-right: 16px; }
.drill-artist-strip { padding: 14px 16px; gap: 14px; }
.drill-artist-avatar { width: 64px; height: 64px; font-size: 32px; }
.artist-drill.ai-vibe .drill-artist-avatar { font-size: 26px; }
.drill-artist-name { font-size: 21px; }
.drill-artist-sub { font-size: 15px; }
.drill-filter { padding: 9px 12px; gap: 7px; }
.dchip { padding: 7px 14px; font-size: 14px; border-radius: 22px; }
.drill-section-label { padding: 12px 16px 6px; font-size: 12px; }
.drill-song { padding: 12px 16px; gap: 13px; }
.drill-num { width: 22px; font-size: 14px; }
.drill-thumb { width: 50px; height: 50px; font-size: 21px; border-radius: 7px; }
.drill-name { font-size: 18px; }
.drill-album { font-size: 15px; }
.drill-add-btn { width: 38px; height: 38px; font-size: 24px; }
.drill-queued-badge { font-size: 12px; padding: 3px 8px; }
.drill-loading, .drill-empty { font-size: 17px; padding: 40px 24px; }
.drill-load-more-btn { font-size: 17px; padding: 12px 0; border-radius: 12px; }
.play-typeahead-item .sm-typeahead-item { padding: 12px 16px; gap: 13px; }

/* Taller search bar needs more room under the last queue card */
.queue-list { padding-bottom: 76px; }

/* ── Tablet and up: full across-the-room scale ─────────────────────────── */
@media (min-width: 700px) {
    /* Search bar + results */
    .play-search-bar { padding: 19px 24px; }
    .play-search-input {
        padding: 24px 27px;
        font-size: 34px;
        border-radius: 20px;
        border-width: 2.5px;
    }
    .play-search-input:focus { box-shadow: 0 0 0 5px var(--accent-dim); }

    .play-typeahead {
        bottom: calc(100% + 12px);
        max-height: min(65vh, 790px);
        border-radius: 22px;
    }
    .play-typeahead .sm-typeahead-item { padding: 20px 24px; gap: 19px; }
    .play-typeahead .sm-typeahead-thumb { width: 76px; height: 76px; }
    .play-typeahead .sm-typeahead-title { font-size: 30px; }
    .play-typeahead .sm-typeahead-artist { font-size: 23px; }
    .play-typeahead-add-btn { width: 54px; height: 54px; font-size: 35px; }

    .ta-section { padding: 16px 24px 10px; font-size: 20px; }
    .ta-artist-card { padding: 21px 24px; gap: 19px; }
    .ta-artist-photo { width: 90px; height: 90px; font-size: 41px; }
    .ta-artist-name { font-size: 30px; }
    .ta-artist-sub { font-size: 21px; }
    .ta-artist-cta { font-size: 21px; }
    .ta-in-lib-pill { font-size: 18px; padding: 3px 10px; }
    .ta-artist-arrow { font-size: 38px; }
    .ta-song, .ta-album { padding: 20px 24px; gap: 19px; }
    .ta-thumb { width: 76px; height: 76px; font-size: 32px; border-radius: 10px; }
    .ta-title { font-size: 30px; }
    .ta-artist-line { font-size: 23px; }
    .ta-right { gap: 16px; }
    .played-badge { font-size: 17px; padding: 5px 11px; }
    .ta-stage-badge { font-size: 17px; padding: 5px 11px; }
    .ta-add-btn { width: 60px; height: 60px; font-size: 38px; border-radius: 14px; }
    .ta-ai-row { padding: 21px 24px; gap: 19px; }
    .ta-ai-thumb { font-size: 32px; }

    /* Artist / AI-search drill-down list */
    .drill-hdr { height: 78px; }
    .drill-back-btn { font-size: 36px; padding: 10px 18px; }
    .drill-hdr-title { font-size: 28px; }
    .drill-hdr-count { font-size: 21px; padding-right: 22px; }
    .drill-artist-strip { padding: 20px 22px; gap: 20px; }
    .drill-artist-avatar { width: 92px; height: 92px; font-size: 46px; }
    .artist-drill.ai-vibe .drill-artist-avatar { font-size: 38px; }
    .drill-artist-name { font-size: 30px; }
    .drill-artist-sub { font-size: 21px; }
    .drill-filter { padding: 12px 16px; gap: 10px; }
    .dchip { padding: 10px 20px; font-size: 21px; border-radius: 26px; }
    .drill-section-label { padding: 16px 22px 8px; font-size: 18px; }
    .drill-song { padding: 16px 22px; gap: 18px; }
    .drill-num { width: 30px; font-size: 20px; }
    .drill-thumb { width: 68px; height: 68px; font-size: 28px; border-radius: 9px; }
    .drill-name { font-size: 26px; }
    .drill-album { font-size: 21px; }
    .drill-add-btn { width: 52px; height: 52px; font-size: 32px; }
    .drill-queued-badge { font-size: 17px; padding: 5px 11px; }
    .drill-loading, .drill-empty { font-size: 24px; padding: 48px 28px; }
    .drill-load-more-btn { font-size: 24px; padding: 16px 0; border-radius: 14px; }
    .play-typeahead-item .sm-typeahead-item { padding: 20px 24px; gap: 19px; }

    .queue-list { padding-bottom: 96px; }
}

/* Wider drill panel on desktop so the larger rows aren't cramped */
@media (min-width: 1024px) {
    .artist-drill { max-width: 760px; }
}

/* Transient note (e.g. a jammed song with no saved sheet to reopen) */
.jam-note {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 96px);
    transform: translateX(-50%) translateY(8px);
    max-width: min(90vw, 460px);
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--text);
    color: var(--bg);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 200;
}
.jam-note.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
    .jam-note { font-size: 22px; padding: 16px 24px; border-radius: 14px; }
}

/* Reader banner note — marks a private look-back at an already-jammed song */
.jam-banner-note {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
@media (min-width: 700px) {
    .jam-banner-note { font-size: 15px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LINEUP + CREWS
   Chip language: solid orange = host, tinted = in the lineup, dashed outline =
   guest (here in person, not one of the regulars), green dot = on their own phone.
   ═══════════════════════════════════════════════════════════════════════════ */
.lineup-bar {
    position: relative;
    padding: 10px 16px 12px;
}
.lineup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.crew-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-btn svg { color: var(--text-secondary); }
.crew-btn:disabled svg { display: none; }
.crew-btn-small { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.invite-bar.hidden { display: none; }
.invite-section .invite-bar { border-top: 1px solid var(--border); }

/* Crew list popover (host header + a past jam's "move to crew") */
.crew-menu {
    position: absolute;
    left: 16px;
    top: 40px;
    z-index: 45;
    min-width: 230px;
    max-width: calc(100% - 32px);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}
.crew-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 11px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.crew-menu-row:last-child { border-bottom: none; }
.crew-menu-row:active { background: var(--accent-bg); }
.crew-menu-row.active { font-weight: 700; }
.crew-menu-check { color: var(--accent); font-weight: 700; }
.crew-menu-new {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: var(--bg);
}
.crew-menu-new .add-people-input { padding: 6px 10px; }

.lineup-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.lineup-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1.5px solid transparent;
    border-radius: 14px;
    background: var(--accent-bg);
    color: var(--accent-dark, var(--accent));
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
}
button.lineup-chip { cursor: pointer; }
.lineup-chip.is-host { background: var(--accent); color: #fff; }
.lineup-chip.is-guest {
    background: transparent;
    border-style: dashed;
    border-color: var(--accent);
}
.lineup-chip.menu-open { box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--accent); }
.lineup-chip-inst { font-weight: 500; opacity: 0.72; }
.lineup-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #30d158;
    flex-shrink: 0;
}
.lineup-chip-x,
.lineup-chip-tap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.lineup-chip-x { margin-left: 2px; font-size: 16px; line-height: 1; opacity: 0.6; }
.lineup-add-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}
.lineup-add-btn:active { opacity: 0.7; }
.lineup-bar .add-people { margin-top: 10px; }

/* Chip menu: what someone's playing tonight, guest, remove */
.chip-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
}
.chip-menu-head { display: flex; align-items: center; gap: 8px; }
.chip-menu-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; }
.chip-menu-guest {
    padding: 3px 10px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.chip-menu-guest.active { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.chip-menu-remove {
    padding: 3px 4px;
    background: none;
    border: none;
    color: #ff3b30;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.inst-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.inst-pill {
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.inst-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Add-people: a new name-only person, as a jammer or a guest */
.add-people-new { cursor: default; }
.add-people-new:active { background: none; }
.add-people-new-btns { display: flex; gap: 6px; flex-shrink: 0; }
.add-people-kind {
    padding: 4px 10px;
    border: none;
    border-radius: 12px;
    background: var(--accent-bg);
    color: var(--accent);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.add-people-kind[data-kind="guest"] { background: none; border: 1.5px dashed var(--accent); }

/* "Picked by Rich" under a song that came off the crew playlist */
.song-card-pick {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "with Penny drums" under a song */
.song-card-sitins {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark, var(--accent));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lineup-inst-word { font-weight: 500; color: var(--text-secondary); }

/* Reader banner: who sat in on the song that's showing */
.jam-banner-sitin {
    margin-left: auto;
    min-width: 0;
    padding: 2px 0;
    background: none;
    border: none;
    color: var(--accent-dark, var(--accent));
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* End-of-jam lineup check */
.end-confirm-lineup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.end-confirm-lineup .participant-chips { justify-content: center; flex: none; }

/* Sheets that open over the reader (sit-ins) or home (edit crew) */
.jam-sheet { z-index: 400; }
.jam-sheet-panel {
    gap: 12px;
    max-height: 88vh;
    overflow-y: auto;
    padding-top: 18px;
}
.jam-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jam-sheet-title { font-size: 18px; font-weight: 700; }
.jam-sheet-done {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.jam-sheet-sub { margin-top: -6px; font-size: 14px; color: var(--text-secondary); }
.jam-sheet-empty { font-size: 13px; color: var(--text-secondary); }
.jam-sheet .participant-chips { flex: none; }
.sitin-list { max-height: 38vh; animation: none; }

.crew-sheet-body { display: flex; flex-direction: column; gap: 18px; }
.crew-field { display: flex; flex-direction: column; gap: 6px; }
.crew-field-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.crew-section-title { font-size: 16px; font-weight: 700; }
.crew-section-hint { margin-top: 2px; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.crew-group-title { margin: 14px 0 2px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.crew-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.crew-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.crew-person-name { font-size: 15px; font-weight: 600; }
.crew-person-name-input {
    width: 100%;
    padding: 0 0 1px;
    background: none;
    border: none;
    border-bottom: 1px dashed var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    outline: none;
}
.crew-person-name-input:focus { border-bottom-color: var(--accent); }
.crew-person-sub { font-size: 12px; color: var(--text-secondary); }

/* Past Sessions: crew filter, crew tag, move-to-crew */
.past-sessions-header { display: flex; align-items: center; justify-content: space-between; }
.past-crew-edit {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.crew-filter {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.crew-filter::-webkit-scrollbar { display: none; }
.past-session-crew {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    vertical-align: 1px;
}
.past-session-meta { position: relative; margin: -4px 0 10px; }
.past-session-meta .crew-menu { left: 0; top: 28px; }

.recap-guests { margin-top: 2px; }
.recap-sitin { margin-top: 4px; font-size: 14px; color: var(--text-secondary); }

[data-theme="dark"] .chip-menu,
[data-theme="dark"] .crew-menu-new { background: var(--surface2); }
[data-theme="dark"] .inst-pill { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .crew-menu { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .past-session-crew { background: var(--surface2); }
[data-theme="dark"] .lineup-chip.is-host { background: var(--accent-bg); color: var(--accent); }
.crew-filter .dchip { padding: 5px 12px; font-size: 13px; border-radius: 20px; }
/* Past jam's who-was-there chips: same guest/instrument language as the live lineup */
.participant-name .lineup-chip-inst { font-weight: 500; opacity: 0.72; }
.participant-name.is-guest { background: transparent; border: 1.5px dashed var(--accent); padding: 2.5px 8.5px; }

/* ── Crew playlist tray: a strip of covers, only songs nobody has picked yet ── */
.crew-tray { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.crew-tray-head { display: flex; align-items: center; }
.crew-tray-head .crew-tray-toggle { flex: 1; min-width: 0; }
.crew-tray-head .toggle-chevron { margin-left: 0; }
.crew-tray-open {
    flex-shrink: 0;
    margin-right: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.crew-tray.collapsed .crew-tray-body { display: none; }

/* "+ Add a song" (tray head + outside-jam sheet) */
.crew-tray-add {
    flex-shrink: 0;
    margin-right: 12px;
    padding: 5px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-tray-add:active { transform: scale(0.96); }
.crew-tray-add-block { margin: 10px 0 4px; }
/* In a jam: "Showing picks from tonight's people · Show everyone's" */
.crew-tray-filter { padding: 4px 16px 0; font-size: 12px; color: var(--text-secondary); }
.crew-tray-filter button { background: none; border: none; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; }

/* Your own app-added pick: × to take it off the playlist */
.crew-tile-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-tile-remove:disabled { opacity: 0.5; }
.crew-tile.is-removing { opacity: 0.4; }

/* The "+ Add a song" search sheet */
.crew-add-input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 11px 14px;
    font: inherit;
    font-size: 16px; /* no zoom-on-focus on iOS */
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.crew-add-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.crew-add-note { margin: 8px 2px 4px; }
.crew-add-note.crew-add-error { color: #c5303e; }
.crew-add-results { max-height: min(55vh, 440px); overflow-y: auto; margin-top: 4px; }
.crew-add-row { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.crew-add-cover { width: 44px; height: 44px; flex-shrink: 0; border-radius: 4px; overflow: hidden; background: var(--surface2); }
.crew-add-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crew-add-text { flex: 1; min-width: 0; }
.crew-add-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crew-add-artist { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crew-add-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.crew-add-btn:disabled { cursor: default; }
.crew-add-btn.is-on, .crew-add-btn:disabled { background: var(--surface2); color: var(--text-secondary); }

/* Sort: Genre · Person · Date added */
.crew-sort { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.crew-sort button {
    padding: 5px 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-sort button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.crew-sort .crew-random { margin-left: auto; color: var(--text); }

/* One row of covers per genre / person / date bucket */
.crew-group + .crew-group { margin-top: 14px; }
.crew-group-head { display: flex; align-items: baseline; gap: 6px; padding: 0 16px 6px; }
.crew-group-name { font-size: 14px; font-weight: 700; }
.crew-group-count { font-size: 13px; color: var(--text-secondary); }
.crew-group-add {
    margin-left: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.crew-group-add:disabled { opacity: 0.4; cursor: default; }

.crew-strip {
    display: flex;
    gap: 10px;
    padding: 2px 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding: 0 16px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* fade the right edge so it reads as "more this way" */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.crew-strip::-webkit-scrollbar { display: none; }
.crew-strip:empty { display: none; }

.crew-tile {
    position: relative;
    flex: 0 0 108px;
    width: 108px;
    scroll-snap-align: start;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.crew-tile:last-child { margin-right: 24px; }
.crew-tile-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 108px;
    height: 108px;
    padding: 0;
    overflow: hidden;
    background: var(--surface2);
    border: none;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-tile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crew-tile-cover:active { transform: scale(0.97); }
.crew-tile-initial { font-size: 40px; font-weight: 700; color: var(--text-secondary); }
/* Host: tapping the cover plays it now; the badge says so */
.crew-tile-play {
    position: absolute;
    left: 6px;
    bottom: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 2px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 50%;
}
.crew-tile-add {
    position: absolute;
    top: 74px;
    right: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--card-bg);
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.crew-tile-add:active { transform: scale(0.92); }
.crew-tile-add .i-check { display: none; }
.crew-tile.is-added .crew-tile-add { background: var(--green, #34c759); }
.crew-tile.is-added .crew-tile-add .i-plus { display: none; }
.crew-tile.is-added .crew-tile-add .i-check { display: block; }
.crew-tile.is-added { opacity: 0.55; transform: translateY(-2px); }
.crew-tile-cover:focus-visible, .crew-tile-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.crew-tile-title {
    margin-top: 7px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.crew-tile-artist, .crew-tile-meta {
    font-size: 12px;
    line-height: 1.3;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* No tab yet: a tag on the cover's top-left, so the meta line can name whose pick it is */
.crew-tile-notab {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    background: var(--orange, #ff9500);
    color: #fff;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
}
.crew-tray-note { padding: 2px 20px 0; font-size: 14px; color: var(--text-secondary); }

/* Host whose crew has no playlist yet */
.crew-link-prompt {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 0;
    padding: 10px 14px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.crew-link-prompt:active { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
    .crew-tile, .crew-tile-cover:active, .crew-tile-add:active { transition: none; transform: none; }
}

/* Edit crew → Spotify playlist */
.crew-playlist-linked { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.crew-playlist-linked .queue-section-edit { margin-right: 0; }
.crew-playlist-name {
    flex: 1; min-width: 0;
    font-size: 15px; font-weight: 600; color: var(--accent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crew-playlist-form { display: flex; gap: 8px; margin-top: 10px; }
.crew-playlist-form .add-people-input { flex: 1; min-width: 0; }
.crew-playlist-save {
    flex-shrink: 0;
    padding: 0 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.crew-playlist-save:disabled { opacity: 0.5; }
.crew-adders { margin-top: 18px; }
/* "Rain Dogs (Tom Waits) · …" — enough to match the account against Spotify's Added by column */
.crew-adder-samples { font-size: 11px; color: var(--text-secondary); opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Home → a crew playlist to browse: the tray's rows run edge to edge of the sheet */
/* Fixed height so switching sorts doesn't resize the sheet; rows wrap into a grid to scroll down */
.crew-playlist-sheet-panel { gap: 10px; height: 88vh; }
.crew-playlist-sheet-panel .crew-strip {
    flex-wrap: wrap;
    row-gap: 14px;
    overflow: visible;
    -webkit-mask-image: none;
            mask-image: none;
}
.crew-playlist-sheet-panel .crew-tile:last-child { margin-right: 0; }
.crew-playlist-sheet-panel .crew-section-hint { margin-top: -4px; }
.crew-playlist-sheet-panel .crew-tray-open { margin: 0; font-size: inherit; }
.crew-playlist-sheet-panel .crew-tray-body { margin: 0 -24px; }
.crew-playlist-sheet-panel .crew-tray-note { padding: 0 24px; }
.crew-playlist-status { margin-top: 8px; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }

/* Recap: played songs taken off the crew playlist */

/* Edit crew: each person's usual instrument */
.crew-person-inst {
    flex-shrink: 0;
    max-width: 44%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}
[data-theme="dark"] .crew-person-inst { background: var(--surface2); }

/* Where the jam is: "at Dan's" beside the crew, and the "Where are we?" prompt */
.place-btn {
    margin-right: auto;
    padding: 2px 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.lineup-head .crew-btn { flex-shrink: 0; }
.where-prompt {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--accent-bg);
}
.where-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.where-title { font-size: 14px; font-weight: 700; color: var(--text); }
.where-dismiss {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.where-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.where-places { display: flex; flex-wrap: wrap; gap: 6px; }
.where-chip {
    padding: 4px 11px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.where-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.where-new { display: flex; gap: 6px; }
.where-new .add-people-input { padding: 6px 10px; background: var(--card-bg); }
.crew-place-name {
    width: 100%;
    padding: 0 0 1px;
    background: none;
    border: none;
    border-bottom: 1px dashed var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    outline: none;
}
.crew-place-name:focus { border-bottom-color: var(--accent); }
.crew-place-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #ff3b30;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.past-session-place { font-weight: 500; color: var(--text-secondary); }
.jam-start-btn:disabled { opacity: 0.75; }
[data-theme="dark"] .where-chip,
[data-theme="dark"] .where-new .add-people-input { background: var(--surface2); }

/* Edit crew → place maps */
.crew-place-wrap { border-bottom: 1px solid var(--border); }
.crew-place-wrap .crew-person { border-bottom: none; }
.crew-place-map-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: none;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.crew-place-map-box { padding: 0 0 12px; }
.crew-place-map {
    height: 190px;
    border-radius: 10px;
    overflow: hidden;
    isolation: isolate;          /* keep Leaflet's own z-indexes inside the map */
    background: var(--bg);
}
.crew-place-map-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.crew-place-map-hint { font-size: 12px; color: var(--text-secondary); }
/* The pin: the app's orange dot with a white ring, so it reads on any map tile */
.place-pin {
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: grab;
}
.place-pin:active { cursor: grabbing; }

/* Past jam: "at Dan's" / "Where was this?" beside its crew */
.past-session-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.past-place-btn { margin-right: 0; font-size: 13px; }
.past-place-btn.is-empty { color: var(--accent); }
.past-session-meta .past-place-menu { left: auto; right: 0; }

/* "Something else…": name a new instrument (Jon's tuba) */
.inst-pill-new { border-style: dashed; color: var(--text-secondary); }
.inst-new { display: flex; gap: 6px; flex: 1 1 100%; }
.inst-new .add-people-input { padding: 5px 10px; font-size: 16px; }

/* Past jam: tap a person for what they played */
.past-person-tap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.participant-name.menu-open { box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--accent); }
#past-people-menu { margin: 4px 0 12px; }

/* ── Autoplay (host): the Up Next switch and the "Up next" countdown after closing a song ── */
.autoplay-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.autoplay-switch {
    position: relative;
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: var(--border);
    transition: background .15s ease;
}
.autoplay-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: transform .15s ease;
}
.autoplay-toggle[aria-pressed="true"] { color: var(--text); }
.autoplay-toggle[aria-pressed="true"] .autoplay-switch { background: var(--accent); }
.autoplay-toggle[aria-pressed="true"] .autoplay-switch::after { transform: translateX(12px); }

.jam-autoplay {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
    transform: translateX(-50%) translateY(12px);
    width: min(calc(100vw - 32px), 420px);
    padding: 16px 18px 14px;
    border-radius: 16px;
    background: var(--text);
    color: var(--bg);
    box-shadow: 0 10px 32px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 210;
}
.jam-autoplay.visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.jam-autoplay-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.jam-autoplay-song { margin-top: 2px; font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jam-autoplay-sub { font-size: 14px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jam-autoplay-sub:empty { display: none; }
.jam-autoplay-bar { margin: 12px 0; height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); overflow: hidden; }
.jam-autoplay-bar span { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.jam-autoplay.visible .jam-autoplay-bar span { animation: jam-autoplay-drain var(--secs, 5s) linear forwards; }
@keyframes jam-autoplay-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.jam-autoplay-actions { display: flex; gap: 10px; }
.jam-autoplay-actions button {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    border: 1px solid rgba(127,127,127,.45);
    background: none;
    color: inherit;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.jam-autoplay-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Random pick roulette: the dance party's record wheel, full screen on every screen ── */
.jam-roulette {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.4vh, 22px);
    padding: 16px;
    color: #f2ead8;
    background:
        radial-gradient(circle at 50% 42%, rgba(217,164,65,.14), transparent 36%),
        repeating-radial-gradient(circle at 50% 42%, transparent 0 70px, rgba(217,164,65,.025) 70px 71px),
        radial-gradient(circle at 50% 50%, #2a1a38, #160d20 75%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.jam-roulette.visible { opacity: 1; pointer-events: auto; }
.jam-roulette-eyebrow {
    font-size: clamp(12px, 1.8vh, 15px);
    font-weight: 800;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: #d9a441;
}
.jam-roulette-box {
    position: relative;
    width: min(94vw, 64vh);
    aspect-ratio: 1;
}
.jam-roulette-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 22px 60px rgba(0,0,0,.55)); }
.jam-roulette-wheel { will-change: transform; }
.jam-roulette-wedge-text {
    fill: #d9a441;
    font-family: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
    font-size: 36px;          /* sized to read from across the room on a TV */
    font-weight: 600;
    letter-spacing: 1px;
}
.jam-roulette-needle {
    position: absolute;
    top: -2%;
    left: 50%;
    width: 6%;
    aspect-ratio: 1 / 1.5;
    transform: translateX(-50%);
    transform-origin: 50% 18%;
    z-index: 2;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,.6));
}
.jam-roulette-needle.bounce { animation: jam-roulette-needle .55s cubic-bezier(.3,2.2,.4,1); }
@keyframes jam-roulette-needle { 0% { rotate: 0deg; } 25% { rotate: 14deg; } 55% { rotate: -7deg; } 80% { rotate: 3deg; } 100% { rotate: 0deg; } }
.jam-roulette-result {
    min-height: clamp(96px, 16vh, 150px);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .35s ease, transform .35s ease;
}
.jam-roulette.landed .jam-roulette-result { opacity: 1; transform: none; }
.jam-roulette-title {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 800;
    font-size: clamp(26px, 5vh, 46px);
    line-height: 1.05;
}
.jam-roulette-artist { margin-top: 4px; font-size: clamp(15px, 2.4vh, 22px); color: #b9aec9; }
.jam-roulette-by { margin-top: 10px; font-size: clamp(18px, 3vh, 28px); }
.jam-roulette-by strong { color: #edbb55; }
/* Landscape (laptop, TV): the wheel takes the height of the screen and the result sits beside it */
@media (min-aspect-ratio: 5/4) {
    .jam-roulette {
        display: grid;
        grid-template-columns: auto minmax(0, 34vw);
        grid-template-rows: 1fr auto 1fr;
        column-gap: 4vw;
        row-gap: 14px;
        justify-content: center;
        align-items: center;
    }
    .jam-roulette-box { grid-column: 1; grid-row: 1 / 4; width: min(90vh, 58vw); }
    .jam-roulette-eyebrow { grid-column: 2; grid-row: 1; align-self: end; text-align: left; }
    .jam-roulette-result { grid-column: 2; grid-row: 2 / 4; align-self: start; text-align: left; min-height: 0; }
    .jam-roulette-title { font-size: clamp(30px, 6.5vh, 72px); }
    .jam-roulette-artist { font-size: clamp(17px, 3.2vh, 32px); }
    .jam-roulette-by { font-size: clamp(18px, 3.4vh, 34px); }
}
.jam-roulette-confetti { position: fixed; width: 10px; height: 16px; z-index: 2001; pointer-events: none; }

/* ── Whole albums: drill buttons + the album block in Up Next ── */
.drill-album-actions {
    display: flex; gap: 10px; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drill-album-actions.hidden,
.artist-drill:not(.album-mode) .drill-album-actions { display: none; }
.drill-album-btn {
    flex: 1; padding: 11px 0; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
    font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.drill-album-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.drill-album-btn:disabled { opacity: .55; cursor: default; }

/* Header card sits on top of its tracks; header + tracks share an accent rail so the
   run reads as one block. Folded tracks are hidden (the next track stays visible). */
.album-run-hdr {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 10px 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent-bg);
    border-left: 3px solid var(--accent);
    margin-top: 4px;
}
.album-run-art {
    width: 44px; height: 44px; border-radius: 6px; overflow: hidden; flex-shrink: 0;
    background: var(--surface2, var(--border));
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.album-run-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-run-info { flex: 1; min-width: 0; }
.album-run-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark, var(--accent)); }
.album-run-name { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-run-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-run-toggle, .album-run-remove {
    flex-shrink: 0; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px;
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text-secondary);
    font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.album-run-remove.armed { background: #c0392b; border-color: #c0392b; color: #fff; font-size: 12px; }
.song-card.in-album { margin-left: 12px; border-left: 3px solid var(--accent-dim); }
.song-card.album-folded { display: none; }
.song-card-album {
    margin-top: 2px; font-size: 12px; font-weight: 600;
    color: var(--accent-dark, var(--accent));
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── How to host (help sheet) ─────────────────────────────────────────── */
.jam-help-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.jam-help-btn:active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
#view-host .top-bar .jam-help-btn { margin-right: 8px; }

.jam-help-panel { gap: 14px; }
.help-steps {
    list-style: none;
    counter-reset: help-step;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.help-steps li {
    counter-increment: help-step;
    position: relative;
    padding-left: 34px;
    font-size: 15px;
    line-height: 1.45;
}
.help-steps li::before {
    content: counter(help-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.help-section-title {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.help-faq { border-top: 1px solid var(--border); }
.help-faq:last-child { border-bottom: 1px solid var(--border); }
.help-faq summary {
    list-style: none;
    padding: 12px 22px 12px 0;
    position: relative;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.help-faq summary::-webkit-details-marker { display: none; }
.help-faq summary::after {
    content: '›';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 20px;
    transition: transform 0.15s;
}
.help-faq[open] summary::after { transform: translateY(-50%) rotate(90deg); }
.help-faq p {
    padding: 0 0 12px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.help-faq p b { color: var(--text); }

/* ── Spin, next to the host's search box: the mini wheel spins, the ▴ picks what from ── */
.jam-search-row { display: flex; align-items: stretch; gap: 8px; }
.jam-search-row .play-search-input-wrap { flex: 1; min-width: 0; }
/* One bordered pill holding both halves, so the hover outline goes all the way round */
.jam-spin {
    position: relative;
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    transition: border-color 0.15s;
}
.jam-spin:hover,
.jam-spin:has(.jam-spin-more[aria-expanded="true"]) { border-color: var(--accent); }
.jam-spin-btn,
.jam-spin-more {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 0;
    background: none;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    transition: background-color 0.15s;
}
.jam-spin-btn {
    flex-direction: column;
    gap: 1px;
    min-width: 60px;
    padding: 4px 10px;
    border-radius: 10.5px 0 0 10.5px;
}
.jam-spin-more {
    width: 30px;
    padding: 0;
    border-left: 1.5px solid var(--border);
    border-radius: 0 10.5px 10.5px 0;
    color: var(--text-secondary);
}
.jam-spin-btn:hover, .jam-spin-more:hover { background: var(--accent-dim); }
.jam-spin-btn:active, .jam-spin-more:active,
.jam-spin-more[aria-expanded="true"] { background: var(--accent-dim); }
/* The mini roulette wheel: the full-screen wheel's colours. It turns a notch on hover and
   spins while the room's wheel is spinning. */
.jam-spin-wheel { display: block; width: 22px; height: 22px; flex-shrink: 0; }
.jam-spin-wheel-rotor { transform-origin: 0 0; transition: transform 0.45s cubic-bezier(.3,1.6,.5,1); }
.jam-spin-btn:hover .jam-spin-wheel-rotor { transform: rotate(45deg); }
.jam-spin-btn.is-spinning .jam-spin-wheel-rotor { animation: jam-spin-wheel 0.9s linear infinite; }
@keyframes jam-spin-wheel { to { transform: rotate(360deg); } }
.crew-sort .crew-random { display: inline-flex; align-items: center; gap: 6px; }
.crew-random-wheel { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) {
    .jam-spin-wheel-rotor { transition: none; }
    .jam-spin-btn:hover .jam-spin-wheel-rotor { transform: none; }
    .jam-spin-btn.is-spinning .jam-spin-wheel-rotor { animation: none; }
}
.jam-spin-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* The source menu pops up from the bar, like the typeahead */
.jam-spin-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    width: min(290px, calc(100vw - 24px));
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 -8px 28px rgba(0,0,0,0.14);
    z-index: 102;
}
.jam-spin-menu.hidden { display: none; }
.jam-spin-menu-head {
    padding: 6px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.jam-spin-opt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.jam-spin-opt:hover, .jam-spin-opt:active { background: var(--accent-dim); }
.jam-spin-opt-check { width: 14px; flex-shrink: 0; color: var(--accent); font-weight: 700; }
.jam-spin-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jam-spin-opt-label { font-size: 15px; font-weight: 600; }
.jam-spin-opt-sub { font-size: 12px; color: var(--text-secondary); }
.jam-spin-opt.is-empty .jam-spin-opt-label { color: var(--text-secondary); }

@media (min-width: 700px) {
    .jam-search-row { gap: 12px; }
    .jam-spin { border-radius: 20px; }
    .jam-spin-btn { min-width: 92px; padding: 6px 16px; border-radius: 18.5px 0 0 18.5px; }
    .jam-spin-more { width: 44px; border-radius: 0 18.5px 18.5px 0; }
    .jam-spin-wheel { width: 36px; height: 36px; }
    .crew-random-wheel { width: 16px; height: 16px; }
    .jam-spin-label { font-size: 13px; }
    .jam-spin-menu { width: 340px; }
    .jam-spin-opt-label { font-size: 17px; }
    .jam-spin-opt-sub { font-size: 14px; }
}
