* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg:        #0d0d14;
    --surface:   #16162a;
    --surface2:  #1e1e38;
    --border:    rgba(255,255,255,0.08);
    --accent:    #7c6af7;
    --accent2:   #f7936a;
    --text:      #f0f0f8;
    --subtext:   #9090b0;
    --success:   #6af7a0;
    --error:     #f76a6a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: 100px;
}

/* ── HEADER ── */
#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px 12px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.app-logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.venue-name {
    font-size: 13px;
    color: var(--subtext);
}

/* Search */
#search-wrap {
    position: relative;
}

#search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px 12px 42px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--subtext);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--subtext);
    font-size: 16px;
    pointer-events: none;
}

/* ── NOW PLAYING BAR ── */
#now-playing-bar {
    display: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    align-items: center;
    gap: 12px;
}

#now-playing-bar.visible {
    display: flex;
}

.np-bar-icon {
    font-size: 18px;
    animation: npPulse 1.5s ease-in-out infinite;
}

@keyframes npPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.np-bar-info {
    flex: 1;
    min-width: 0;
}

.np-bar-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-bar-artist {
    font-size: 12px;
    color: var(--subtext);
}

#hype-btn {
    background: rgba(247,195,106,0.12);
    border: 1px solid rgba(247,195,106,0.3);
    border-radius: 20px;
    color: #f7c36a;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

#hype-btn:active {
    transform: scale(0.94);
    background: rgba(247,195,106,0.25);
}

/* ── TABS ── */
#tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: var(--bg);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--subtext);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 14px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── SONG LIST ── */
#song-list {
    padding: 12px 20px;
}

.song-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 0.15s;
}

.song-item:active {
    opacity: 0.7;
}

.song-item:last-child {
    border-bottom: none;
}

.song-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

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

.song-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 13px;
    color: var(--subtext);
    margin-top: 2px;
}

.song-genre-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(124,106,247,0.12);
    border: 1px solid rgba(124,106,247,0.2);
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.song-duration {
    font-size: 12px;
    color: var(--subtext);
    flex-shrink: 0;
}

/* ── QUEUE LIST (patron view) ── */
#queue-section {
    padding: 12px 20px;
}

.queue-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    animation: fadeUp 0.3s ease;
}

.qc-position {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.qc-title {
    font-size: 16px;
    font-weight: 700;
}

.qc-artist {
    font-size: 13px;
    color: var(--subtext);
    margin-top: 2px;
}

.qc-dedication {
    margin-top: 10px;
    font-size: 13px;
    font-style: italic;
    color: var(--accent2);
    border-left: 3px solid var(--accent2);
    padding-left: 10px;
}

.qc-patron {
    font-size: 12px;
    color: var(--subtext);
    margin-top: 4px;
}

.qc-wait {
    margin-top: 8px;
    font-size: 12px;
    color: var(--subtext);
}

/* ── BOTTOM SHEET (song detail) ── */
#sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    backdrop-filter: blur(4px);
}

#sheet-overlay.visible {
    display: block;
}

#bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    padding: 28px 24px 40px;
    z-index: 201;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100%); }
    to   { transform: translateX(-50%) translateY(0); }
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 24px;
}

#sheet-song-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

#sheet-song-artist {
    font-size: 15px;
    color: var(--subtext);
    margin-bottom: 20px;
}

/* Dedication input */
.input-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--subtext);
    margin-bottom: 8px;
}

#dedication-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    resize: none;
    font-family: inherit;
    margin-bottom: 4px;
    transition: border-color 0.2s;
}

#dedication-input:focus {
    border-color: var(--accent);
}

#dedication-input::placeholder {
    color: var(--subtext);
}

#char-count {
    font-size: 11px;
    color: var(--subtext);
    text-align: right;
    margin-bottom: 20px;
}

#char-count.over {
    color: var(--error);
}

/* Name input */
#name-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    font-family: inherit;
    margin-bottom: 24px;
    transition: border-color 0.2s;
}

#name-input:focus {
    border-color: var(--accent);
}

#name-input::placeholder {
    color: var(--subtext);
}

/* Price / Queue button */
.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.price-label {
    font-size: 14px;
    color: var(--subtext);
}

.price-amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

#queue-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.5px;
}

#queue-btn:active {
    transform: scale(0.97);
    background: #6a58e0;
}

#queue-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#queue-btn.success {
    background: var(--success);
    color: var(--bg);
}

/* ── TOAST ── */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
    white-space: nowrap;
    pointer-events: none;
}

#toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast.success { border-color: var(--success); color: var(--success); }
#toast.error   { border-color: var(--error);   color: var(--error);   }

/* ── GENRE FILTER ── */
#genre-filter {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
}

#genre-filter::-webkit-scrollbar { display: none; }

.genre-chip {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--subtext);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.genre-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--subtext);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 380px) {
    #app-header { padding: 12px 16px 10px; }
    #song-list  { padding: 8px 16px; }
    .song-item  { padding: 12px 0; }
    #tabs .tab-btn { font-size: 12px; padding: 12px 0; }
    #bottom-sheet { padding: 24px 20px 36px; }
    #sheet-song-title { font-size: 19px; }
}
#bottom-sheet { -webkit-overflow-scrolling: touch; }
button, .song-item, .genre-chip, .tab-btn { touch-action: manipulation; }
