html {

            scroll-behavior: smooth;

        }



        /* Dark theme */

        html, body {

            margin: 0;

            padding: 0;

            background: #121212;

            color: #e0e0e0;

            font-family: system-ui,sans-serif;

        }



        .header-wrap {

            background: #1f1f1f;

            box-shadow: 0 1px 6px rgba(0,0,0,0.7);

        }



        .header-inner {

            max-width: 540px;

            margin: 0 auto;

            text-align: center;

            padding: 16px 0 4px;

        }



            .header-inner img {

                width: 120px;

            }



        .header-divider {

            width: 46px;

            height: 2px;

            background: #333;

            margin: 10px auto;

            border: none;

        }



        .top-zone {

            max-width: 540px;

            margin: 0 auto;

            display: flex;

            justify-content: center;

            padding: 0 8px 8px;

        }



        .search-bar-wrap {

            position: relative;

            width: 100%;

            max-width: 420px;

            display: flex;

            align-items: center;

        }



        .search-icon {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            color: #a9b4c6;
            pointer-events: none;
        }



        input#searchInput {

            width: 100%;

            padding: 12px 40px 12px 49px;

            font-size: 1em;

            border: 1px solid #333;

            border-radius: 12px;

            background: #1e1e1e;

            color: #e0e0e0;

            box-shadow: 0 2px 8px rgba(0,0,0,0.7);

            transition: border .18s,box-shadow .18s;

        }



            input#searchInput:focus {

                border-color: #555;

                outline: none;

                box-shadow: 0 4px 14px rgba(0,0,0,0.8);

            }



        #clearSearch {

            display: none;

            position: absolute;

            right: 12px;

            top: 50%;

            transform: translateY(-50%);

            background: transparent;

            border: none;

            font-size: 18px;

            color: #777;

            cursor: pointer;

            z-index: 1;

        }



        input#searchInput::-webkit-search-cancel-button {
            display: none;
        }

        .search-bar-wrap:focus-within .search-icon {
            color: #78adff;
        }

        .container {

            max-width: 540px;

            margin: 0 auto;

            padding: 12px 0;

        }



        .grid-heading {

            font-size: .95em;

            color: #bbb;

            margin: 12px 0 8px;

            font-weight: 500;

            padding-left: 11px;

        }



        .song-list {

            display: flex;

            flex-direction: column;

            gap: 6px;

            padding: 0 2px;

        }



        .song-card {

            display: flex;

            align-items: center;

            background: #1e1e1e;

            border-radius: 8px;

            box-shadow: 0 2px 8px rgba(0,0,0,0.7);

            padding: 8px 12px;

            cursor: pointer;

            transition: background .15s;

        }



            .song-card:hover {

                background: #2a2a2a;

            }



        .song-info {

            flex: 1;

            display: flex;

            flex-direction: column;

            overflow: hidden;

        }



        .song-title {

            font-weight: 600;

            font-size: 1.05em;

            color: #fff;

            line-height: 1.1em;

            margin: 0;

            display: -webkit-box;

            -webkit-line-clamp: 2;

            -webkit-box-orient: vertical;

            overflow: hidden;

            text-overflow: ellipsis;

        }



        .song-artist {

            font-size: .9em;

            color: #aaa;

            margin-top: 2px;

            display: -webkit-box;

            -webkit-line-clamp: 1;

            -webkit-box-orient: vertical;

            overflow: hidden;

            text-overflow: ellipsis;

        }



        .load-indicator {

            text-align: center;

            padding: 10px 0;

            color: #777;

            font-size: .95em;

            display: none;

        }



        /* Back to Top Button (middle center, semi-transparent) */

        #backToTop {

            display: none;

            position: fixed;

            left: 50%;

            bottom: 40px;

            transform: translateX(-50%);

            background: rgba(51, 117, 230, 0.2);

            color: #3375e6;

            border: none;

            border-radius: 23px;

            padding: 11px 36px;

            font-size: 1.25em;

            font-weight: 600;

            opacity: 0.7;

            cursor: pointer;

            transition: opacity 0.3s ease;

            pointer-events: none;

            backdrop-filter: blur(5px);

        }



            #backToTop.show {

                display: block;

                opacity: 1;

                pointer-events: auto;

            }



        .modal-bg {

            position: fixed;

            top: 0;

            left: 0;

            width: 100vw;

            height: 100vh;

            background: rgba(0,0,0,0.85);

            display: none;

            align-items: center;

            justify-content: center;

            z-index: 10000;

        }



            .modal-bg.show {

                display: flex;

            }



        .modal-content {

            background: #222;

            padding: 20px;

            border-radius: 8px;

            width: 90%;

            max-width: 400px;

            color: #e0e0e0;

            box-shadow: 0 4px 12px rgba(0,0,0,0.8);

        }



            .modal-content label {

                display: block;

                margin: 8px 0 4px;

                font-size: .9em;

                color: #bbb;

            }



            .modal-content p {

                margin: 0;

                font-size: 1.1em;

                color: #fff;

            }



            .modal-content button {

                margin-top: 16px;

                padding: 8px 14px;

                border: none;

                border-radius: 4px;

                background: #3375e6;

                color: #fff;

                cursor: pointer;

                font-size: .9em;

                transition: background .15s;

            }



                .modal-content button:hover {

                    background: #285bb5;

                }



        .modal-content { border: 1px solid #354154; border-radius: 16px; padding: 22px; box-sizing: border-box; }
        .modal-content h2 { font-size: 1.25rem; margin: 0 0 7px; color: #fff; }
        .modal-summary { margin: 10px 0 20px; padding: 12px; border-radius: 10px; background: #171e28; }
        .modal-summary strong { display: block; color: #fff; }
        .modal-summary span { display: block; color: #aeb9c9; margin-top: 4px; font-size: .9rem; }
        .modal-content label[for="singerName"] { margin-bottom: 7px; color: #d4deeb; font-weight: 600; }
        #singerName { width: 100%; box-sizing: border-box; padding: 13px 14px; border: 1px solid #48556a; background: #151b25; border-radius: 10px; color: white; font: inherit; }
        #singerName:focus { border-color: #70a7ff; outline: 2px solid #3b65a066; }
        .modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
        .modal-actions button { flex: 1; margin: 0; padding: 12px 10px; font: inherit; font-weight: 600; border-radius: 10px; }
        .modal-actions #modalClose { background: #343f4d; }
        .modal-actions #modalClose:hover { background: #435164; }
        .modal-actions #sendRequest { background: #3375e6; }
        .modal-actions #sendRequest:disabled { opacity: .55; cursor: wait; }
        #requestStatus { color: #b9c6d8; font-size: .92rem; margin-top: 14px; min-height: 1.4rem; line-height: 1.4; }
        #requestStatus[data-state="success"] { color: #91e1b4; }
        #requestStatus[data-state="error"] { color: #ffaaaa; }
        .modal-bg { padding: 12px; box-sizing: border-box; }
        .song-card:focus-visible { outline: 2px solid #7aaaff; outline-offset: 2px; }
        @media(max-width:600px) {




            .header-inner img {

                width: 100px;

            }

        }

/* Song count and request history share a single well-spaced toolbar. */
.library-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    margin: 5px 0 12px;
    padding: 0 10px;
    box-sizing: border-box;
}
.library-toolbar .grid-heading {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    font-size: .94rem;
    line-height: 1.4;
    color: #c8cbd1;
}
.history-trigger {
    appearance: none;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #3b4656;
    border-radius: 10px;
    background: #252d38;
    color: #e3ebf7;
    font: 600 .86rem/1 system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.history-trigger svg { flex: 0 0 auto; width: 18px; height: 18px; color: #a9c6ef; }
.history-trigger:hover { background: #333e4e; border-color: #596b83; }
.history-trigger:focus-visible { outline: 2px solid #78adff; outline-offset: 3px; }
@media (max-width:600px) {
    .container { padding: 12px 10px; box-sizing: border-box; }
    .library-toolbar { padding: 0 2px; gap: 8px; margin: 5px 0 12px; }
    .library-toolbar .grid-heading { font-size: .88rem; }
    .history-trigger { min-height: 40px; padding: 0 10px; gap: 6px; font-size: .82rem; }
    .history-trigger svg { width: 17px; height: 17px; }
}
.history-count { border-radius:7px; background:#2b3d55; color:#bfd7fc; padding:2px 6px; font-size:.72rem; }
.history-count[hidden], .history-clear[hidden] { display:none; }
.history-panel { max-width:440px; width:100%; max-height:min(80vh,650px); display:flex; flex-direction:column; }
.history-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.history-head h2 { margin:0 0 4px; }
.history-panel .history-subtitle { color:#aeb9c9; font-size:.86rem; }
.history-panel button.history-close { margin:0; padding:5px 9px; background:#323d4b; border-radius:8px; }
.history-list { overflow-y:auto; min-height:80px; margin:16px 0; display:flex; flex-direction:column; gap:8px; }
.history-item { background:#171e28; border:1px solid #303c4d; border-radius:10px; padding:12px 14px; }
.history-song { display:flex; flex-direction:column; gap:3px; overflow-wrap:anywhere; }
.history-song strong { color:#fff; }
.history-song span { font-size:.9rem; color:#b4c0d1; }
.history-song .history-requester { font-size:.86rem; color:#d4deeb; margin-top:7px; }
.history-song .history-meta { font-size:.78rem; color:#91a0b6; margin-top:1px; }
.history-empty { padding:22px 10px; color:#aeb9c9; text-align:center; line-height:1.5; }
.history-footer { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; border-top:1px solid #384252; padding-top:10px; }
.history-footer span { font-size:.76rem; color:#91a0b6; }
.history-panel button.history-clear { margin:0; padding:8px 10px; background:#3a2930; color:#ffbdc2; border-radius:8px; }
.history-panel button.history-clear:hover { background:#50343d; }

/* Milestone 1: venue branding + session state */
.venue-title { margin: 6px 0 0; font-size: 1.4rem; }
.session-banner { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #3a2a12; color: #f5d9a8; text-align: center; font-size: .95rem; }

/* ---------- Polish + responsive layer (Dec batch) ----------
   Mobile first: the rules above are the phone layout. From 760px the song list becomes a
   grid that uses the full width; from 1100px a third column. */
:root {
    --bg: #101216; --surface: #1a1d23; --surface-2: #22262e; --line: #2e333d;
    --text: #e8ebf0; --muted: #a3adbd; --accent: #4f8cff; --accent-strong: #2f6fe8;
    --focus: #9cc2ff; --ok: #34c77b; --warn: #f2b44c;
}
html, body { background: var(--bg); color: var(--text); }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.header-wrap { background: linear-gradient(180deg, #1b1f27, #15181e); box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(0,0,0,.35); }
.header-inner { padding: 14px 12px 6px; }
.header-inner img { width: 104px; max-height: 104px; object-fit: contain; display: block; margin: 0 auto; }
.venue-title { margin: 8px 0 0; font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; }
.header-divider { display: none; }
.top-zone { padding: 10px 12px 12px; }
.search-bar-wrap { max-width: 640px; }
input#searchInput { background: var(--surface); border-color: var(--line); box-shadow: none; font-size: 1.02rem; }
input#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }
.container { padding: 8px 12px 40px; }
.grid-heading { color: var(--muted); padding-left: 2px; }
.song-list { gap: 8px; padding: 0; }
.song-card { background: var(--surface); border: 1px solid var(--line); box-shadow: none; border-radius: 12px; padding: 12px 14px; min-height: 52px; transition: background .15s, border-color .15s, transform .15s; }
.song-card:hover { background: var(--surface-2); border-color: #3b4250; }
.song-card:active { transform: scale(.995); }
.song-artist { color: var(--muted); }
.song-card:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 3px solid var(--focus); outline-offset: 2px;
}
.session-banner { border: 1px solid #5c4520; }
.modal-content { background: var(--surface); }
.modal-summary { background: var(--surface-2); border-radius: 10px; }
.modal-actions #sendRequest { background: var(--accent-strong); }
.modal-actions #sendRequest:hover:not(:disabled) { background: var(--accent); }
#songModal .modal-content { width: min(440px, calc(100vw - 24px)); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

@media (min-width: 760px) {
    .header-wrap { position: sticky; top: 0; z-index: 50; }
    .header-inner { max-width: 1180px; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 18px; text-align: left; padding: 14px 24px 4px; }
    .header-inner img { margin: 0; width: 84px; max-height: 84px; grid-row: span 2; }
    #venueLogo[hidden] + .venue-title { grid-column: 1 / -1; }
    .venue-title { margin: 0; font-size: 1.6rem; }
    .top-zone { max-width: 1180px; justify-content: flex-start; padding: 8px 24px 14px; }
    .search-bar-wrap { max-width: 720px; }
    .container { max-width: 1180px; padding: 8px 24px 48px; }
    .song-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (min-width: 1100px) {
    .song-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Venue kiosk (tablet) mode: /{slug}?k=TOKEN. Bigger touch targets, no My Requests. */
body.kiosk .header-inner,
body.kiosk .top-zone,
body.kiosk .container { max-width: 1100px; }
@media (min-width: 760px) { body.kiosk .song-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
body.kiosk .search-bar-wrap { max-width: 720px; }
body.kiosk input#searchInput { font-size: 1.25rem; padding-top: 16px; padding-bottom: 16px; }
body.kiosk .song-card { padding: 18px 20px; min-height: 64px; }
body.kiosk .song-title { font-size: 1.2rem; }
body.kiosk .song-artist { font-size: 1.05rem; }
body.kiosk .modal-content { max-width: 560px; padding: 28px; }
body.kiosk .modal-summary { font-size: 1.2rem; }
body.kiosk #singerName { font-size: 1.25rem; padding: 16px; }
body.kiosk .modal-actions button { padding: 18px 12px; font-size: 1.15rem; }
body.kiosk #requestStatus { font-size: 1.1rem; }
body.kiosk #requestStatus[data-state="success"] {
    font-size: 1.3rem; font-weight: 700; color: #b8f5d2; background: #17432d;
    border: 1px solid #2f7a52; border-radius: 12px; padding: 14px 16px;
}
body.kiosk .history-trigger { display: none; }

/* Kiosk PIN screen + paused banner */
.kiosk-lock { background: rgba(10,12,16,.97); }
.kiosk-lock .modal-content { width: min(420px, calc(100vw - 24px)); }
.kiosk-lock-venue { color: var(--muted); margin: 0 0 8px; }
#kioskPin { width: 100%; box-sizing: border-box; font-size: 1.6rem; letter-spacing: .4em; text-align: center; padding: 14px; border-radius: 10px; border: 1px solid #48556a; background: #151b25; color: #fff; }
#kioskPin:focus { border-color: var(--accent); outline: 3px solid rgba(79,140,255,.35); }
#kioskUnlock { flex: 1; padding: 16px; font-size: 1.15rem; font-weight: 700; border-radius: 10px; background: var(--accent-strong); color: #fff; border: 0; }
#kioskPinStatus { min-height: 1.4rem; margin-top: 12px; color: var(--muted); }
#kioskPinStatus[data-state="error"] { color: #ffaaaa; }
.session-banner[data-kind="paused"] { background: #3a1f24; color: #ffd3d8; border-color: #6b2f38; }

/* ---------- Round 2 layout fixes (QC layout review) ---------- */
[hidden] { display: none !important; }
input#searchInput { min-height: 48px; padding-left: 44px; text-overflow: ellipsis; }
.search-icon { left: 14px; }
#clearSearch { min-width: 44px; min-height: 44px; }
.history-trigger { min-height: 44px; }
.history-panel button.history-close { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.history-panel button.history-clear { min-height: 44px; padding: 0 14px; }
.modal-actions button { min-height: 44px; }
@media (max-width:600px) { .history-trigger { min-height: 44px; } }
/* Unknown venue: a clean not-found page */
body.venue-missing .top-zone, body.venue-missing .library-toolbar, body.venue-missing #songList,
body.venue-missing #loadIndicator, body.venue-missing #backToTop, body.venue-missing #sessionBanner { display: none !important; }
.venue-missing-box { max-width: 520px; margin: 48px auto; padding: 28px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.venue-missing-box h2 { margin: 0 0 10px; font-size: 1.35rem; }
.venue-missing-box p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.venue-missing-home { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 10px; background: var(--accent-strong); color: #fff; text-decoration: none; font-weight: 600; }

/* "Simple slip" request style */
body.slip .top-zone, body.slip #songList, body.slip #loadIndicator, body.slip #backToTop, body.slip #gridHeading { display: none !important; }
body.slip .library-toolbar { justify-content: flex-end; }
.slip-form { max-width: 520px; margin: 16px auto 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 6px; }
.slip-form h2 { margin: 0 0 6px; font-size: 1.25rem; }
.slip-form label { margin-top: 10px; font-size: .95rem; color: #c8cfdb; }
.slip-form .optional { color: var(--muted); font-weight: 400; }
.slip-form input { min-height: 48px; padding: 10px 14px; font-size: 1rem; border-radius: 10px; border: 1px solid var(--line); background: #12151a; color: var(--text); box-sizing: border-box; width: 100%; }
.slip-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }
.slip-form button { margin-top: 16px; min-height: 48px; border: 0; border-radius: 10px; background: var(--accent-strong); color: #fff; font-size: 1.02rem; font-weight: 600; cursor: pointer; }
.slip-form button:disabled { opacity: .6; cursor: default; }
#slipStatus { min-height: 1.4rem; margin-top: 8px; color: #b9c6d8; font-size: .95rem; line-height: 1.4; }
#slipStatus[data-state="success"] { color: #91e1b4; }
#slipStatus[data-state="error"] { color: #ffaaaa; }
body.kiosk .slip-form { max-width: 640px; }
body.kiosk .slip-form input { min-height: 60px; font-size: 1.25rem; }

/* Round 2: extra songbook columns (version / key / disc ID) */
.song-meta, .modal-meta { display: block; margin-top: 2px; font-size: 0.82rem; color: var(--muted); opacity: 0.85; overflow-wrap: anywhere; }
.modal-meta { margin-top: 4px; }
