/* ==========================================================================
   LIORA WEB PLAYER
   1 Tokens · 2 Base · 3 Top bar · 4 Gate · 5 Layout & cards · 6 Now playing · 7 Controls
   8 Side panel · 9 Queue · 10 Lyrics · 11 Effects · 12 Toasts · 13 Responsive
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
    --bg: #0d0e12;
    --card: rgba(255, 255, 255, 0.045);
    --card-strong: rgba(255, 255, 255, 0.075);
    --line: rgba(255, 255, 255, 0.08);
    --text: #eceef3;
    --muted: #9aa0ad;
    --gold: #ffb800;
    --gold-2: #ff8008;
    --violet: #9b59b6;
    --danger: #f2555a;
    --ok: #3ddc84;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f3f4f8;
    --card: rgba(255, 255, 255, 0.72);
    --card-strong: rgba(255, 255, 255, 0.95);
    --line: rgba(20, 22, 30, 0.1);
    --text: #16181f;
    --muted: #5d6270;
    --shadow: 0 18px 44px rgba(30, 34, 60, 0.16);
    color-scheme: light;
}

/* 2. BASE ------------------------------------------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#bg {
    position: fixed;
    inset: -10%;
    z-index: -1;
    background: radial-gradient(60% 50% at 20% 10%, rgba(155, 89, 182, 0.35), transparent 70%),
                radial-gradient(50% 45% at 90% 80%, rgba(255, 184, 0, 0.18), transparent 70%),
                var(--bg);
    background-size: cover;
    background-position: center;
    filter: blur(70px) saturate(1.5) brightness(0.6);
    opacity: 1;
    transition: background-image 0.8s var(--ease);
}
#bg.art { background-blend-mode: normal; }
[data-theme="light"] #bg { filter: blur(80px) saturate(1.2) brightness(1.25); opacity: 0.6; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }

svg.i { width: 1em; height: 1em; fill: currentColor; display: block; }

/* 3. TOP BAR ---------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: linear-gradient(to bottom, rgba(13, 14, 18, 0.7), transparent);
}
[data-theme="light"] .topbar { background: linear-gradient(to bottom, rgba(243, 244, 248, 0.85), transparent); }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: 0.2px; }
.brand img { border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 184, 0, 0.5); }
.brand b { color: var(--gold); font-weight: 700; }

.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 999px;
    background: var(--card-strong); border: 1px solid var(--line);
    font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.chip-voice::before { content: "🔊"; }
.chip-dj { color: var(--gold); border-color: rgba(255, 184, 0, 0.4); }

.avatars { display: flex; }
.avatars img {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid var(--bg); margin-left: -8px; background: var(--card-strong);
}
.avatars img:first-child { margin-left: 0; }
.avatars .more { margin-left: 6px; font-size: 12px; color: var(--muted); align-self: center; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ghost-link { text-decoration: none; font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 8px; transition: 0.15s var(--ease); }
.ghost-link:hover { color: var(--text); background: var(--card); }

/* 4. GATE (login / server picker / errors) ---------------------------------- */
.gate { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 20px; }
.gate-card {
    width: min(560px, 100%); text-align: center; padding: 40px 32px;
    background: var(--card); border: 1px solid var(--line); border-radius: 28px;
    box-shadow: var(--shadow); backdrop-filter: blur(22px);
}
.gate-icon { font-size: 48px; margin-bottom: 8px; filter: drop-shadow(0 6px 18px rgba(255, 184, 0, 0.35)); }
.gate h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.3px; }
.gate p { margin: 0 auto 22px; color: var(--muted); max-width: 42ch; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; padding: 12px 22px; border-radius: 999px; font-weight: 600; text-decoration: none;
    background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1200;
    box-shadow: 0 10px 28px rgba(255, 152, 0, 0.3); transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(255, 152, 0, 0.38); }

.server-list { display: grid; gap: 10px; margin-top: 8px; text-align: left; }
.server {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none;
    background: var(--card-strong); border: 1px solid var(--line); border-radius: var(--radius-sm);
    transition: 0.15s var(--ease);
}
.server:hover { border-color: rgba(255, 184, 0, 0.5); transform: translateX(3px); }
.server img, .server .ph { width: 38px; height: 38px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 700; flex: none; }
.server .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { font-size: 12px; color: var(--ok); display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); animation: pulse 1.8s infinite; }

@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }

/* 5. LAYOUT & CARDS --------------------------------------------------------- */
.player { padding: 8px clamp(16px, 4vw, 40px) 48px; max-width: 1280px; margin: 0 auto; }

.banner {
    margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-sm);
    background: rgba(255, 184, 0, 0.1); border: 1px solid rgba(255, 184, 0, 0.35); color: var(--text); font-size: 14px;
}

.grid { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 24px; align-items: start; }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    backdrop-filter: blur(22px); box-shadow: var(--shadow);
}

/* 6. NOW PLAYING ------------------------------------------------------------- */
.now { padding: 24px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 76px; }

.art-wrap { position: relative; }
.art {
    aspect-ratio: 1 / 1; width: 100%; border-radius: 18px; overflow: hidden; position: relative;
    background: linear-gradient(135deg, #3a2a52, #1d1a2a 60%, #4a3510);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5); display: grid; place-items: center;
}
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade 0.5s var(--ease); }
.art-fallback { font-size: 64px; opacity: 0.55; }
.art.playing { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.012); } }
@keyframes fade { from { opacity: 0; } }

.badge {
    position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); color: #fff; border: 1px solid rgba(255, 255, 255, 0.15);
}

.np-meta { min-height: 74px; }
.np-title { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.2px; overflow-wrap: anywhere; }
.np-title a { text-decoration: none; }
.np-title a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.np-artist { margin: 4px 0 0; color: var(--muted); }
.np-req { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.scrub { display: flex; align-items: center; gap: 10px; }
.time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); min-width: 40px; }
.time:last-child { text-align: right; }

.bar { position: relative; flex: 1; height: 22px; cursor: pointer; touch-action: none; display: flex; align-items: center; }
.bar::before { content: ""; position: absolute; left: 0; right: 0; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
[data-theme="light"] .bar::before { background: rgba(20, 22, 30, 0.14); }
.bar-fill { position: absolute; left: 0; height: 6px; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.bar-thumb { position: absolute; left: 0; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); transform: scale(0); transition: transform 0.15s var(--ease); }
.bar:hover .bar-thumb, .bar.scrubbing .bar-thumb, .bar:focus-visible .bar-thumb { transform: scale(1); }
.bar.locked { cursor: default; }
.bar.locked .bar-thumb { display: none; }
.bar.live .bar-fill { width: 100% !important; background: linear-gradient(90deg, #ff4d4d, #ff8a3d); }
.bar-tip {
    position: absolute; bottom: 24px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; font-size: 12px;
    background: rgba(0, 0, 0, 0.8); color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.12s; font-variant-numeric: tabular-nums;
}
.bar:hover .bar-tip, .bar.scrubbing .bar-tip { opacity: 1; }

/* 7. CONTROLS ---------------------------------------------------------------- */
.transport { display: flex; align-items: center; justify-content: center; gap: 14px; }
.icon-btn {
    width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text);
    display: grid; place-items: center; font-size: 22px; transition: 0.15s var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--card-strong); transform: scale(1.06); }
.icon-btn.on { color: var(--gold); }
.icon-btn:disabled, .pill-btn:disabled, .play-btn:disabled { opacity: 0.4; }
.play-btn {
    width: 68px; height: 68px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 30px; color: #1a1200;
    background: linear-gradient(135deg, var(--gold), var(--gold-2)); box-shadow: 0 12px 30px rgba(255, 152, 0, 0.35);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.play-btn:hover:not(:disabled) { transform: scale(1.06); box-shadow: 0 16px 38px rgba(255, 152, 0, 0.45); }
.play-btn:active:not(:disabled) { transform: scale(0.96); }

.extras { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 13px;
    background: var(--card-strong); border: 1px solid var(--line); transition: 0.15s var(--ease);
}
.pill-btn:hover:not(:disabled) { border-color: rgba(255, 184, 0, 0.5); }
.pill-btn.on { color: var(--gold); border-color: rgba(255, 184, 0, 0.55); background: rgba(255, 184, 0, 0.1); }
.pill-btn.liked { color: #ff5c8a; border-color: rgba(255, 92, 138, 0.5); background: rgba(255, 92, 138, 0.1); }
.pill-btn.danger:hover:not(:disabled) { color: var(--danger); border-color: rgba(242, 85, 90, 0.6); }

.vol { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 160px; }
.vol input { flex: 1; }
.vol-num { font-size: 12.5px; color: var(--muted); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
#vol-icon { font-size: 18px; color: var(--muted); display: grid; }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); outline-offset: 6px; }
[data-theme="light"] input[type="range"] { background: rgba(20, 22, 30, 0.16); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); cursor: pointer; }
input[type="range"]:disabled { opacity: 0.4; }

/* 8. SIDE PANEL -------------------------------------------------------------- */
.side { padding: 8px 8px 12px; min-height: 560px; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
    background: none; border: 0; padding: 10px 14px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 600; white-space: nowrap;
    border-bottom: 2px solid transparent; transition: 0.15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--gold); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--card-strong); font-size: 12px; text-align: center; color: var(--muted); }
.pane { padding: 14px 10px 0; display: flex; flex-direction: column; flex: 1; min-height: 0; }

.add { display: flex; gap: 8px; margin-bottom: 10px; }
.add input[type="text"] {
    flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--card-strong); color: var(--text); font: inherit; outline: none; transition: 0.15s var(--ease);
}
.add input[type="text"]:focus { border-color: rgba(255, 184, 0, 0.6); box-shadow: 0 0 0 4px rgba(255, 184, 0, 0.12); }
.add input::placeholder { color: var(--muted); }
.next-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.next-toggle input { accent-color: var(--gold); }
.add-btn { border: 0; padding: 0 20px; border-radius: 999px; font-weight: 700; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1200; }
.add-btn:disabled { opacity: 0.5; }

.q-tools { display: flex; align-items: center; gap: 12px; padding: 4px 6px 10px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 2px 4px; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover:not(:disabled) { color: var(--text); }
.link-btn:disabled { opacity: 0.4; text-decoration: none; }

.empty { margin: auto; padding: 40px 0; color: var(--muted); text-align: center; }

/* 9. QUEUE -------------------------------------------------------------------- */
.queue { list-style: none; margin: 0; padding: 0 2px 0 0; overflow-y: auto; max-height: 520px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.q-item {
    display: grid; grid-template-columns: 26px 46px 1fr auto; align-items: center; gap: 10px;
    padding: 7px 8px; border-radius: 14px; border: 1px solid transparent; position: relative; transition: background 0.15s var(--ease), border-color 0.15s;
}
.q-item:hover { background: var(--card-strong); }
.q-item.dragging { background: var(--card-strong); border-color: rgba(255, 184, 0, 0.55); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); z-index: 3; transition: none; }
.q-item.new { animation: slide-in 0.35s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } }
.handle {
    background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 0; cursor: grab; touch-action: none; user-select: none; display: grid; place-items: center;
}
.handle:active { cursor: grabbing; }
.handle:disabled { opacity: 0.25; cursor: default; }
.q-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--card-strong); display: grid; place-items: center; font-size: 18px; overflow: hidden; }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.q-meta { min-width: 0; }
.q-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-end { display: flex; align-items: center; gap: 4px; }
.q-dur { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.q-act { display: none; gap: 2px; }
.q-item:hover .q-act, .q-item:focus-within .q-act { display: flex; }
.q-item:hover .q-dur, .q-item:focus-within .q-dur { display: none; }
.q-act button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; font-size: 16px; }
.q-act button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.q-act button.rm:hover:not(:disabled) { color: var(--danger); }
.q-act button:disabled { opacity: 0.3; }
.q-auto { font-size: 11px; color: var(--violet); margin-left: 6px; }
.history .q-item { grid-template-columns: 46px 1fr auto; }
.history .q-act { display: none !important; }

/* 10. LYRICS ------------------------------------------------------------------ */
.lyrics { overflow-y: auto; overflow-x: hidden; max-height: 560px; position: relative; padding: 24px 10px 200px; scroll-behavior: smooth; scrollbar-width: thin; }
.ly-line {
    font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; line-height: 1.3; margin: 0 0 14px; color: var(--muted); opacity: 0.55;
    transition: color 0.25s var(--ease), opacity 0.25s var(--ease), transform 0.25s var(--ease); transform-origin: left center; cursor: pointer; overflow-wrap: anywhere;
}
.ly-line:hover { opacity: 0.85; }
.ly-line.active { color: var(--text); opacity: 1; transform: scale(1.03); }
.ly-line.past { opacity: 0.4; }
.ly-plain { white-space: pre-wrap; color: var(--text); font-size: 16px; line-height: 1.7; }
.ly-note { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

/* 11. EFFECTS ------------------------------------------------------------------ */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 22px; }
.fx {
    text-align: left; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card-strong);
    display: flex; flex-direction: column; gap: 2px; transition: 0.15s var(--ease);
}
.fx:hover:not(:disabled) { border-color: rgba(255, 184, 0, 0.5); transform: translateY(-1px); }
.fx.on { border-color: var(--gold); background: rgba(255, 184, 0, 0.12); box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.1); }
.fx .fx-name { font-weight: 600; }
.fx .fx-blurb { font-size: 12px; color: var(--muted); }
.fx:disabled { opacity: 0.45; }
.speed { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 16px; border-radius: var(--radius-sm); background: var(--card-strong); border: 1px solid var(--line); }
.speed label { display: flex; justify-content: space-between; }
.speed b { color: var(--gold); font-variant-numeric: tabular-nums; }
.speed .link-btn { justify-self: start; }

/* 12. TOASTS ------------------------------------------------------------------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
    padding: 12px 16px; border-radius: 14px; background: rgba(24, 25, 31, 0.94); color: #fff; border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); animation: toast-in 0.25s var(--ease); font-size: 14px;
}
.toast.err { border-color: rgba(242, 85, 90, 0.7); }
.toast.ok { border-color: rgba(61, 220, 132, 0.5); }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* 13. RESPONSIVE ----------------------------------------------------------------- */
@media (max-width: 960px) {
    .grid { grid-template-columns: 1fr; }
    .now { position: static; }
    .art { max-width: 420px; margin: 0 auto; }
    .side { min-height: 0; }
    .queue { max-height: none; }
    .lyrics { max-height: 60vh; }
    .crumbs { display: none; }
}
@media (max-width: 520px) {
    .now { padding: 18px; }
    .add { flex-wrap: wrap; }
    .add input[type="text"] { flex-basis: 100%; }
    .add-btn { padding: 10px 22px; }
    .vol { margin-left: 0; width: 100%; }
    .q-item { grid-template-columns: 28px 42px 1fr auto; gap: 8px; }
    .q-act { display: flex; }
    .q-item .q-dur { display: none; }
    .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
