@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;
}

/* ── UG Rendered content (copied from songs.css) ────────────────────────── */

.ug-meta-bar {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 14px 4px;
    border-bottom: 1px solid var(--border);
}
.ug-section { padding: 10px 14px 4px; }
.ug-section + .ug-section { padding-top: 6px; }
.ug-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.ug-end-marker {
    text-align: center;
    color: var(--text-muted);
    font-size: 18px;
    letter-spacing: 0.05em;
    padding: 32px 0 48px;
    opacity: 0.6;
}
.ug-line { line-height: 1; margin-bottom: 2px; }
.ug-chords {
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 400;
    white-space: pre;
    color: var(--blue);
    line-height: 1.4;
}
.ug-lyrics {
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 400;
    white-space: pre;
    color: var(--text);
    line-height: 1.5;
}
.ug-tab-block {
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    font-size: 11px;
    white-space: pre;
    overflow-x: auto;
    color: var(--text-muted);
    margin: 4px 0 8px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

/* ── UG Full-Screen Reader (copied from songs.css) ──────────────────────── */

#ug-reader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}
.ug-reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
}
.ug-rh-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.ug-rh-art { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; margin-right: 6px; }
.ug-rh-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ug-rh-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.ug-reader-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.ug-reader-scroll .ug-chords,
.ug-reader-scroll .ug-lyrics,
.ug-reader-scroll .ug-tab-block { font-size: var(--ug-font-size, 20px); }
.ug-reader-scroll .ug-tab-block { margin-bottom: 24px; }
.ug-reader-content { max-width: 960px; margin: 0 auto; padding: 8px 12px; }
.ug-reader-scroll .ug-section { padding-top: 40px; }
.ug-reader-scroll .ug-section:first-child { padding-top: 8px; }
.ug-reader-scroll .ug-section-label { font-size: 16px; letter-spacing: 0.08em; margin-bottom: 6px; }
/* ── UG Versions sheet ───────────────────────────────────────────────────── */
.ug-versions-sheet { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; justify-content: flex-end; }
.ug-versions-sheet.hidden { display: none; }
.ug-versions-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.ug-versions-panel { position: relative; background: var(--card-bg, #fff); border-radius: 16px 16px 0 0; max-height: 70vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.ug-versions-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ug-versions-title { font-size: 16px; font-weight: 600; }
.ug-versions-close { background: none; border: none; font-size: 18px; color: var(--text-secondary); cursor: pointer; padding: 4px 8px; }
.ug-versions-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ug-version-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ug-version-item:last-child { border-bottom: none; }
.ug-version-item:active { background: var(--bg); }
.ug-version-item.active { background: rgba(212, 98, 42, 0.06); }
.ug-version-badge { display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--accent); background: rgba(212, 98, 42, 0.10); padding: 2px 6px; border-radius: 3px; flex-shrink: 0; }
.ug-version-info { flex: 1; min-width: 0; }
.ug-version-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ug-version-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.ug-version-check { color: var(--accent); font-size: 16px; font-weight: 700; flex-shrink: 0; }
.ug-versions-loading { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 13px; color: var(--text-secondary); border-top: 1px solid var(--border); }
.ug-versions-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }

/* ── 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); }

/* 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 cannot manually scroll — position is synced from host */
.ug-reader-participant .ug-reader-scroll {
    overflow: hidden;
    touch-action: none;
}
/* 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-chord {
    cursor: pointer;
}
.ug-reader-content .ug-chord:active { opacity: 0.6; }
.ug-reader-content .ug-tab-block .ug-chord { color: var(--blue); }
.ug-reader-content .ug-repeat-marker {
    color: #888;
    font-size: 0.85em;
    margin-left: 4px;
}
.ug-reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 64px;
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0 6px;
    gap: 2px;
}
.ug-tb-group { display: flex; align-items: center; gap: 2px; }
.ug-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2, var(--surface));
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.ug-tb-btn:active { background: var(--border); }
#ug-tb-versions { width: auto; padding: 0 12px; font-size: 12px; font-weight: 600; }
.ug-tb-autoscroll {
    padding: 0 12px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface2, var(--surface));
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ug-tb-autoscroll.active { background: var(--blue, #007aff); border-color: var(--blue, #007aff); color: #fff; }
.ug-tb-autoscroll:active { opacity: 0.75; }
.ug-tb-font { font-size: 11px; width: 28px; }
.ug-tb-speed-group { gap: 4px; }
.ug-tb-icon { font-size: 14px; line-height: 1; }
.ug-tb-speed { width: 144px; cursor: pointer; accent-color: var(--blue, #007aff); }
.ug-tb-key-btn {
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    min-width: 34px;
}
.ug-tb-capo-val {
    font-size: 12px;
    font-weight: 600;
    min-width: 56px;
    white-space: nowrap;
}
.ug-tb-transpose-group {
    position: relative;
}
.ug-key-picker {
    position: absolute;
    z-index: 400;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.ug-key-picker button {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    min-width: 34px;
    text-align: center;
    transition: background 0.1s;
}
.ug-key-picker button:hover { background: var(--surface-hover, #f0f0f0); }
.ug-key-picker button.active {
    background: var(--blue, #007aff);
    color: #fff;
    border-color: var(--blue, #007aff);
}

#ug-chord-popup {
    display: none;
    position: fixed;
    z-index: 300;
    width: 162px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    overflow: hidden;
}
.ug-cp-header { display: flex; align-items: center; justify-content: center; padding: 8px 0 2px; }
.ug-cp-name { font-size: 16px; font-weight: 700; color: var(--text); }
.ug-cp-diagram { display: flex; justify-content: center; align-items: center; padding: 4px 0; min-height: 80px; }
.ug-cp-no-diagram { font-size: 12px; color: var(--text-muted); padding: 16px; text-align: center; }
.ug-cp-nav { display: flex; align-items: center; justify-content: center; padding: 2px 8px 8px; gap: 8px; }
.ug-cp-idx { font-size: 11px; color: var(--text-muted); min-width: 28px; text-align: center; }

/* Override dark overlay button styling inside the light chord popup */
#ug-chord-popup .ug-tb-btn {
    border-color: var(--border, #e5e5ea);
    background: var(--surface2, #f2f2f7);
    color: var(--text, #1c1c1e);
}
#ug-chord-popup .ug-tb-btn:active { background: var(--border, #e5e5ea); }

/* ── 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;
}


/* ── 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-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: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: 0.6;
}

.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;
}

.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-songs-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.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); }

/* ── Theory button + picker + levels (synced from songs.css) ────────────── */
.ug-tb-theory-btn {
    width: auto;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.ug-tb-theory-btn.active {
    background: var(--accent, #d4622a);
    color: #fff;
}
#ug-theory-group { position: relative; }

.ug-theory-picker {
    position: fixed;
    background: var(--surface, #1c1c1e);
    border: 1px solid var(--border, #38383a);
    border-radius: 10px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    min-width: 120px;
}
.ug-theory-picker.hidden { display: none; }

.ug-theory-level {
    display: block;
    width: 100%;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text, #e5e5e7);
    cursor: pointer;
    transition: background 0.1s;
}
.ug-theory-level:hover { background: var(--surface2, #2c2c2e); }
.ug-theory-level.active { background: var(--accent, #d4622a); color: #fff; }
.ug-theory-off {
    color: var(--text-muted, #6e6e73);
    border-top: 1px solid var(--border, #38383a);
    border-radius: 0 0 7px 7px;
    margin-top: 2px;
    padding-top: 8px;
}

/* ── Tempo slider (in toolbar) ──────────────────────────────────── */
.ug-tb-tempo-group { gap: 6px; align-items: center; }
.ug-tb-tempo-group.hidden { display: none; }
.ug-tb-tempo-label {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted, #6e6e73);
    min-width: 28px;
    text-align: center;
}
.ug-tb-tempo-label::after { content: ' bpm'; font-size: 9px; }
.ug-tb-tempo-slider { width: 70px; accent-color: var(--accent, #d4622a); }

/* ── 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);
}

/* ── Section progression label ─────────────────────────────────── */
.ug-section-prog {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: none;
    color: var(--accent, #d4622a);
    opacity: 0.85;
    vertical-align: middle;
}

/* ── Playing chord highlight / pulse ────────────────────────────── */
@keyframes chord-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 98, 42, 0.0); }
    50%      { box-shadow: 0 0 0 4px rgba(212, 98, 42, 0.3); }
}
.chord-playing {
    border-radius: 3px;
    animation: chord-pulse 0.8s ease-in-out infinite;
    background: rgba(212, 98, 42, 0.15);
}

/* ── Reader header right group + Spotify + Scale (synced from songs.css) ── */
.ug-rh-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.ug-spotify-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #1DB954;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    padding: 0;
}
.ug-spotify-toggle:hover { background: #1ed760; }
.ug-spotify-toggle.hidden { display: none; }
.ug-spotify-toggle svg { pointer-events: none; }

.ug-spotify-embed {
    position: fixed;
    top: 48px;
    right: 12px;
    z-index: 1060;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.ug-spotify-embed.hidden { display: none; }
.ug-spotify-embed iframe { display: block; border-radius: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   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"] .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; }

/* 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;
}

/* 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-chip-av {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}
.participant-chip-av.is-host::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    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; }

/* ═══════════════════════════════════════════════════════════════════════════
   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; }

/* ── Scale fretboard toggle button ───────────── */
.ug-scale-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #d8d0c6;
    background: #f0ebe3;
    color: #8a8070;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}
.ug-scale-toggle:hover { background: #e8e0d6; color: #6a6055; border-color: #c4baa8; }
.ug-scale-toggle.active {
    background: #c87a4e;
    color: #fff;
    border-color: #b56a3e;
    box-shadow: 0 1px 4px rgba(200, 110, 60, 0.25);
}
.ug-scale-toggle.hidden { display: none; }
.ug-scale-toggle svg { pointer-events: none; }

/* ── Scale fretboard panel ──────── */
.ug-scale-panel {
    position: absolute;
    top: 52px;
    right: 8px;
    z-index: 55;
    background: rgba(252, 249, 244, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 10px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.10),
        0 1px 4px rgba(0, 0, 0, 0.06),
        inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    padding: 8px 10px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ug-scale-panel.hidden { display: none; }

.ug-scale-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    padding: 0 2px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.ug-scale-header:active { cursor: grabbing; }

.ug-scale-label {
    font-size: 10px;
    font-weight: 700;
    color: #6a6258;
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ug-scale-mode-label {
    font-size: 9px;
    color: #9a9490;
    white-space: nowrap;
    font-style: italic;
}

.ug-scale-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ug-scale-close {
    background: none;
    border: none;
    color: #b0a8a0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.ug-scale-close:hover { color: #6a6258; background: rgba(0, 0, 0, 0.06); }

.ug-scale-type-toggle {
    display: flex;
    gap: 0;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.ug-scale-type-btn {
    background: transparent;
    border: none;
    color: #9a9490;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}
.ug-scale-type-btn:first-child { border-right: 1px solid rgba(0, 0, 0, 0.08); }
.ug-scale-type-btn.active { background: rgba(200, 110, 60, 0.12); color: #b06830; }
.ug-scale-type-btn:hover:not(.active) { background: rgba(0, 0, 0, 0.04); color: #6a6258; }

/* ── Scale fretboard grid ─────────────────────────────────────── */
.ug-scale-fretboard {
    width: fit-content;
    background: #f0ebe3;
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2px 0;
}
.ug-sf-inner { display: inline-block; min-width: max-content; }
.ug-sf-fret-numbers { display: flex; align-items: center; height: 14px; }
.ug-sf-fret-num {
    width: 32px;
    text-align: center;
    font-size: 8px;
    font-weight: 600;
    color: #a09888;
    flex-shrink: 0;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Courier New', monospace;
}
.ug-sf-fret-num-muted { width: 32px; flex-shrink: 0; }
.ug-sf-string-label-cell {
    width: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ug-sf-string-label {
    font-size: 9px;
    font-weight: 700;
    color: #a09888;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Courier New', monospace;
}
.ug-sf-string-row { display: flex; align-items: center; }
.ug-sf-cell {
    width: 32px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(
        to bottom,
        transparent calc(50% - 0.5px),
        #c8c0b4 calc(50% - 0.5px),
        #c8c0b4 calc(50% + 0.5px),
        transparent calc(50% + 0.5px)
    );
    border-right: 1px solid #d8d0c6;
}
.ug-sf-string-label-cell + .ug-sf-cell { border-right: 2.5px solid #8a8070; }
.ug-sf-dot {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #ddd5c8;
    border: 1px solid #c4baa8;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.ug-sf-dot-root {
    background: #c87a4e;
    border: 1px solid #b56a3e;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 1px 3px rgba(0, 0, 0, 0.15);
}
.ug-sf-note-text {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Courier New', monospace;
    color: #6a6055;
}
.ug-sf-dot-root .ug-sf-note-text { color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   SESSION ENDED — full-screen slide-up (replaces bottom-sheet overlay)
   ═══════════════════════════════════════════════════════════════════════════ */
.session-ended-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    padding-top: calc(var(--safe-top) + 16px);
    animation: session-slide-up 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

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

.session-ended-screen.hidden {
    display: none !important;
}

.session-ended-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 0 24px 24px;
}

.session-ended-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 0 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.session-ended-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 16px;
    display: block;
}

.session-ended-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

/* recap-content sits inside session-ended-hero — headline + sub */
.session-ended-hero .recap-headline {
    font-size: 42px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.session-ended-hero .recap-sub {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* recap-songs below the hero */
.session-ended-screen .recap-songs {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    max-height: none;
    overflow-y: visible;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.session-ended-screen .recap-song-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}
.session-ended-screen .recap-song-item:last-child {
    border-bottom: none;
}

.session-ended-screen .recap-song-art {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}

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

.session-ended-screen .recap-song-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-ended-screen .recap-song-artist {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-ended-footer {
    padding: 16px 24px calc(16px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

[data-theme="dark"] .session-ended-screen .recap-song-item { background: var(--card-bg); }
[data-theme="dark"] .session-ended-screen .recap-song-art-placeholder { background: var(--surface2); }

/* ═══════════════════════════════════════════════════════════════════════════
   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; }

[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) ──────────────────────────────────── */
.session-ended-icon { color: var(--accent); }
.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 {
    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 { border-bottom: none; }
.ta-song: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-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; }

.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 ────────────────────────────────────────────────────────── */
    .home-body {
        max-width: 600px;
        margin: 0 auto;
        padding-left: 24px;
        padding-right: 24px;
    }

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

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

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

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

    /* ── Host view — constrain queue content ──────────────────────────────── */
    .invite-section {
        display: flex;
        justify-content: center;
    }

    .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: var(--content-max);
        margin-left: auto;
        margin-right: auto;
    }

    /* ── Participant view — constrain queue ───────────────────────────────── */
    #view-participant .queue-section,
    #view-participant .queue-section-played {
        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); }
    }

    /* ── Session ended — centered card ────────────────────────────────────── */
    .session-ended-screen {
        background: rgba(0, 0, 0, 0.5);
        align-items: center;
        justify-content: center;
        padding: 24px;
        animation: none;
    }

    .session-ended-inner {
        max-width: 480px;
        width: 100%;
        background: var(--bg);
        border-radius: var(--radius);
        overflow-y: auto;
        max-height: calc(100dvh - 120px);
    }

    .session-ended-footer {
        max-width: 480px;
        width: 100%;
        border-radius: 0 0 var(--radius) var(--radius);
        position: static;
    }

    .session-ended-hero { padding: 32px 0 24px; }

    /* ── 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 — constrain ────────────────────────────────────── */
    .ug-reader-toolbar {
        max-width: 600px;
        margin: 0 auto;
        border-radius: 12px 12px 0 0;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }

    /* ── 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; }

    /* ── Session ended — larger recap ─────────────────────────────────────── */
    .session-ended-inner { max-width: 520px; }
    .session-ended-footer { max-width: 520px; }
    .session-ended-hero .recap-headline { font-size: 48px; }

    /* ── 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;
    }

    /* ── Recap song items — more spacious ─────────────────────────────────── */
    .session-ended-screen .recap-song-item { padding: 13px 16px; gap: 14px; }
    .session-ended-screen .recap-song-art,
    .session-ended-screen .recap-song-art-placeholder { width: 44px; height: 44px; }
    .session-ended-screen .recap-song-name { font-size: 16px; }

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

    /* ── UG Reader toolbar — wider ────────────────────────────────────────── */
    .ug-reader-toolbar {
        max-width: 700px;
        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; }

    .session-ended-inner { max-width: 560px; }
    .session-ended-footer { max-width: 560px; }

    .ug-reader-toolbar { max-width: 760px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   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; }

    .session-ended-hero .recap-headline { font-size: 36px; }
    .session-ended-inner { padding: 0 20px 20px; }

    /* Tighter invite collapsed */
    .invite-collapsed { padding: 8px 12px; }
    .participant-chip-av { width: 26px; height: 26px; font-size: 10px; }

    /* 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; }

    .session-ended-hero { padding: 20px 0 16px; }
    .session-ended-hero .recap-headline { font-size: 32px; }

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

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