:root {
  --bg: #121216;
  --bg-side: #191922;
  --surface: #1f1f29;
  --surface-2: #2a2a36;
  --hover: rgba(255, 255, 255, .07);
  --border: #2c2c38;
  --text: #ffffff;
  --muted: #a2a2ad;
  --accent: #a238ff;
  --accent-2: #b968ff;
  --danger: #ff5c6c;
  --ok: #3ccf8e;
  --player-h: 80px;
  --side-w: 240px;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-side: #f5f5f7;
  --surface: #f2f2f5;
  --surface-2: #e6e6eb;
  --hover: rgba(0, 0, 0, .05);
  --border: #e3e3e8;
  --text: #191922;
  --muted: #6c6c78;
  --shadow: 0 8px 30px rgba(0, 0, 0, .15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
i[data-icon], .ic { display: inline-flex; width: 24px; height: 24px; flex: none; }
i[data-icon] svg, .ic svg { width: 100%; height: 100%; fill: currentColor; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 999px;
  font-weight: 600; background: var(--surface-2); transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.small { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }
.btn i[data-icon] { width: 20px; height: 20px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); transition: background .15s, color .15s; flex: none;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small i[data-icon] { width: 18px; height: 18px; }
.icon-btn.big i[data-icon] { width: 32px; height: 32px; }
.icon-btn.big { width: 52px; height: 52px; }
.icon-btn.on, .icon-btn.active { color: var(--accent); }
.icon-btn.outlined { border: 1px solid var(--border); }
.play-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: transform .1s, background .15s;
}
.play-btn:hover { background: var(--accent-2); }
.play-btn:active { transform: scale(.94); }
.play-btn.huge { width: 72px; height: 72px; }
.play-btn.huge i[data-icon] { width: 40px; height: 40px; }
.play-btn.mini { display: none; }
.badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Connexion ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, rgba(162, 56, 255, .35), transparent 50%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); padding: 32px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
}
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.login-card input, .field {
  height: 44px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg); padding: 0 14px; outline: none;
}
.login-card input:focus, .field:focus { border-color: var(--accent); }
.login-error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; }

/* ---------- Structure ---------- */
.app {
  display: grid; height: 100%;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas: "side main" "player player";
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: -.5px; padding: 22px 24px 18px; }
.brand:hover { text-decoration: none; }
.brand.big { padding: 0 0 6px; font-size: 28px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background:
    linear-gradient(to top, #fff 0 0) 5px 100% / 4px 45% no-repeat,
    linear-gradient(to top, #fff 0 0) 12px 100% / 4px 80% no-repeat,
    linear-gradient(to top, #fff 0 0) 19px 100% / 4px 60% no-repeat,
    linear-gradient(135deg, #a238ff, #ef5466);
  background-origin: content-box; padding: 6px 0;
}
.sidebar {
  grid-area: side; background: var(--bg-side); display: flex; flex-direction: column;
  min-height: 0; border-right: 1px solid var(--border);
}
.side-nav { display: flex; flex-direction: column; padding: 0 12px; }
.side-nav a, .side-settings {
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px;
  border-radius: var(--radius); font-weight: 600; color: var(--muted);
}
.side-nav a:hover, .side-settings:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-nav a.active, .side-settings.active { color: var(--accent); }
.side-section { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 18px; border-top: 1px solid var(--border); padding: 14px 12px 0; }
.side-title { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.side-playlists { overflow-y: auto; flex: 1; }
.side-playlists a { display: block; padding: 7px 12px; border-radius: 6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-playlists a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-settings { margin: 8px 12px 12px; }

.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 32px;
  border-bottom: 1px solid var(--border);
}
.back-btn { display: none; }
.search-box {
  flex: 1; max-width: 520px; height: 40px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--muted);
}
.search-box:focus-within { outline: 2px solid var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box i[data-icon] { width: 20px; height: 20px; }
.offline-pill { padding: 4px 12px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; }
.dl-progress { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dl-progress::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 28px 32px 48px; scroll-behavior: smooth; }
.view > * { max-width: 1400px; margin-left: auto; margin-right: auto; }

/* ---------- Contenu ---------- */
h1.page-title { font-size: 34px; font-weight: 800; margin: 0 0 24px; letter-spacing: -.5px; }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.section-head h2 { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
.section-head a { color: var(--muted); font-weight: 600; font-size: 13px; }

.carousel {
  display: grid; grid-auto-flow: column; grid-auto-columns: 180px; gap: 20px;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 24px 20px; }
.card { min-width: 0; scroll-snap-align: start; cursor: pointer; }
.card-img { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s, filter .3s; }
.card:hover .card-img img { transform: scale(1.04); filter: brightness(.75); }
.card.round .card-img { border-radius: 50%; }
.card-play {
  position: absolute; left: 12px; bottom: 12px; opacity: 0; transform: translateY(6px);
  transition: opacity .2s, transform .2s; box-shadow: var(--shadow);
}
.card:hover .card-play { opacity: 1; transform: none; }
.card-title { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.round .card-title, .card.round .card-sub { text-align: center; }

.flow-card {
  position: relative; overflow: hidden; border-radius: 16px; padding: 32px; min-height: 200px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  background: radial-gradient(circle at 80% 20%, #ef5466 0, transparent 45%),
              radial-gradient(circle at 10% 90%, #3a7bff 0, transparent 50%),
              linear-gradient(135deg, #a238ff, #5a1fd1);
  color: #fff; margin-bottom: 40px;
}
.flow-card h2 { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.flow-card p { margin: 6px 0 0; opacity: .85; font-size: 15px; }
.flow-card .play-btn { width: 64px; height: 64px; background: #fff; color: #5a1fd1; }
.flow-card .play-btn i[data-icon] { width: 36px; height: 36px; }
.flow-waves { position: absolute; right: -40px; top: -30px; width: 260px; height: 260px; opacity: .15; }
.flow-waves svg { width: 100%; height: 100%; fill: #fff; }

/* En-tête album / playlist / artiste */
.hero { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 28px; position: relative; }
.hero-cover { width: 232px; height: 232px; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow); flex: none; background: var(--surface); }
.hero.artist .hero-cover { border-radius: 50%; }
.hero-info { min-width: 0; }
.hero-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hero-title { font-size: clamp(28px, 4vw, 52px); line-height: 1.05; font-weight: 800; margin: 8px 0 12px; letter-spacing: -1px; word-break: break-word; }
.hero-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero-meta a { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero-bg { position: absolute; inset: -28px -32px auto; height: 360px; z-index: -1; opacity: .35; filter: blur(60px) saturate(1.4); background-size: cover; background-position: center; pointer-events: none; }
.view { position: relative; isolation: isolate; }

/* Liste de titres */
.tracks { width: 100%; }
.tr {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 36px minmax(0, 4fr) minmax(0, 3fr) minmax(0, 3fr) 108px 52px 40px;
  height: 56px; padding: 0 8px; border-radius: 6px; cursor: pointer;
}
.tr:hover { background: var(--hover); }
.tr.head { height: 36px; cursor: default; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; }
.tr.head:hover { background: none; }
.tr .num { color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; position: relative; }
.tr .num .ic { display: none; width: 20px; height: 20px; }
.tr:hover .num span { display: none; }
.tr:hover .num .ic { display: inline-flex; }
.tr.playing .num span { display: none; }
.tr.playing .num::after { content: ""; display: inline-block; width: 14px; height: 14px; background:
  linear-gradient(var(--accent) 0 0) 0 100% / 3px 60% no-repeat,
  linear-gradient(var(--accent) 0 0) 5px 100% / 3px 100% no-repeat,
  linear-gradient(var(--accent) 0 0) 10px 100% / 3px 40% no-repeat; animation: eq .9s ease-in-out infinite alternate; }
.tr.playing:hover .num::after { display: none; }
@keyframes eq { to { background-size: 3px 100%, 3px 30%, 3px 90%; } }
.tr.playing .t-title { color: var(--accent); }
.t-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.t-thumb { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; flex: none; background: var(--surface); }
.t-text { min-width: 0; }
.t-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { display: none; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-artist, .t-album { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-icons { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.t-icons .icon-btn { width: 34px; height: 34px; }
.t-icons .icon-btn i[data-icon] { width: 20px; height: 20px; }
.t-icons .heart:not(.on) { opacity: 0; }
.tr:hover .t-icons .heart { opacity: 1; }
.dl-mark { color: var(--accent); width: 18px; height: 18px; }
.t-dur { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tr .more { opacity: 0; }
.tr:hover .more { opacity: 1; }
.tracks.compact .tr { grid-template-columns: 36px minmax(0, 1fr) 108px 52px 40px; }
.tracks.compact .t-artist, .tracks.compact .t-album { display: none; }
.tracks.compact .t-sub { display: block; }
.disc { padding: 18px 8px 6px; font-weight: 700; color: var(--muted); }

/* Onglets */
.tabs { display: flex; gap: 6px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: 36px; padding: 0 16px; border-radius: 999px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; background: var(--surface); color: var(--text);
}
.tab:hover { background: var(--surface-2); text-decoration: none; }
.tab.active { background: var(--text); color: var(--bg); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ic { width: 56px; height: 56px; opacity: .5; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin: 0 0 6px; }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.toolbar .field { height: 38px; flex: 1; min-width: 200px; max-width: 360px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border-radius: 12px; padding: 16px 18px; }
.stat b { display: block; font-size: 28px; font-weight: 800; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.accent b { color: var(--accent); }

/* Liste d'envies */
.wl-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px; border-radius: 8px;
}
.wl-row:hover { background: var(--hover); }
.wl-row img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; background: var(--surface); }
.wl-row .t-sub { display: block; }
.wl-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.ok { background: rgba(60, 207, 142, .15); color: var(--ok); }
.wl-actions { display: flex; gap: 2px; }
.wl-actions .icon-btn { width: 36px; height: 36px; }
.wl-actions .icon-btn i[data-icon] { width: 20px; height: 20px; }
.notice { background: var(--surface); border-left: 3px solid var(--accent); padding: 14px 16px; border-radius: 8px; margin-bottom: 20px; color: var(--muted); }
.notice b { color: var(--text); }
.notice.warn { border-left-color: var(--danger); }

/* Paramètres */
.settings { max-width: 720px !important; margin-left: 0 !important; }
.set-group { background: var(--surface); border-radius: 12px; padding: 4px 20px; margin-bottom: 20px; }
.set-group h3 { margin: 16px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row small { display: block; color: var(--muted); }
select.field { height: 38px; padding: 0 10px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

/* ---------- Lecteur ---------- */
.player {
  grid-area: player; display: grid; grid-template-columns: 200px minmax(0, 1fr) 260px; align-items: center;
  gap: 24px; padding: 0 24px; background: var(--bg-side); border-top: 1px solid var(--border); position: relative; z-index: 5;
}
.p-controls { display: flex; align-items: center; gap: 8px; }
.p-track { display: flex; align-items: center; gap: 14px; min-width: 0; }
.p-cover { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--surface); cursor: pointer; flex: none; }
.p-meta { flex: 1; min-width: 0; }
.p-line { display: flex; gap: 6px; white-space: nowrap; overflow: hidden; }
.p-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.p-sep, .p-artist { color: var(--muted); }
.p-artist { overflow: hidden; text-overflow: ellipsis; }
.p-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.p-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 36px; }
.p-time:last-child { text-align: right; }
.p-extra { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.p-extra .vol { width: 90px; flex: none; }
.p-heart.on { color: var(--accent); }
.range {
  -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 2px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--surface-2) var(--pct, 0%));
}
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .15s; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.range:hover::-webkit-slider-thumb, .range:active::-webkit-slider-thumb { opacity: 1; }
.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
.mini-progress { display: none; }

/* File d'attente */
.queue-panel {
  position: fixed; right: 0; top: 0; bottom: var(--player-h); width: 380px; max-width: 100%;
  background: var(--bg-side); border-left: 1px solid var(--border); z-index: 20; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.qp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px 20px; }
.qp-head h3 { margin: 0; font-size: 18px; }
.qp-list { overflow-y: auto; flex: 1; padding: 0 8px 16px; }
.qp-label { padding: 12px 12px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.q-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) 32px; gap: 10px; align-items: center; padding: 6px; border-radius: 6px; cursor: pointer; }
.q-item:hover { background: var(--hover); }
.q-item img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.q-item.current .t-title { color: var(--accent); }
.q-item .t-sub { display: block; }

/* Lecteur plein écran */
.fullplayer {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: stretch;
  padding: max(12px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: var(--bg); overflow: hidden; animation: slideUp .25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } }
.fp-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; filter: blur(70px) saturate(1.5) brightness(.55); transform: scale(1.3); }
.fp-top { display: flex; align-items: center; justify-content: space-between; color: #fff; }
.fp-from { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.fp-cover { width: min(100%, 52vh); aspect-ratio: 1; object-fit: cover; border-radius: 12px; margin: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: var(--surface); }
.fp-info { display: flex; align-items: center; gap: 12px; margin-top: 8px; color: #fff; }
.fp-text { flex: 1; min-width: 0; }
.fp-title { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-artist { opacity: .75; font-size: 16px; }
.fp-seek { width: 100%; margin-top: 18px; height: 5px; flex: none; }
.fp-seek::-webkit-slider-thumb { opacity: 1; }
.fp-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.7); margin-top: 6px; font-variant-numeric: tabular-nums; }
.fp-controls { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 10px; color: #fff; }
.fp-controls .icon-btn, .fp-bottom .icon-btn, .fp-top .icon-btn { color: #fff; }
.fp-controls .icon-btn.on { color: var(--accent-2); }
.fp-bottom { display: flex; justify-content: space-between; }

/* Menus */
.menu {
  position: fixed; z-index: 50; min-width: 240px; max-width: 320px; background: var(--surface-2); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; animation: fadeIn .12s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(.97); } }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 8px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head img { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; }
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button i[data-icon], .menu button .ic { width: 20px; height: 20px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-backdrop { position: fixed; inset: 0; z-index: 49; }

.toasts { position: fixed; left: 50%; bottom: calc(var(--player-h) + 20px); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 600; box-shadow: var(--shadow); animation: fadeIn .2s; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Mobile ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  :root { --player-h: 64px; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    grid-template-areas: "main" "player" "tabbar";
  }
  .sidebar { display: none; }
  .topbar { height: 56px; padding: 0 12px 0 8px; gap: 6px; border: 0; }
  .back-btn { display: inline-flex; }
  .back-btn.invisible { visibility: hidden; }
  .search-box { max-width: none; }
  .search-box.mobile-hidden { display: none; }
  .view { padding: 8px 16px 32px; }
  h1.page-title { font-size: 28px; margin-bottom: 16px; }
  .section-head h2 { font-size: 20px; }
  .carousel { grid-auto-columns: 140px; gap: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
  .card-play { display: none; }
  .flow-card { padding: 22px; min-height: 150px; }
  .flow-card h2 { font-size: 32px; }

  .hero { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .hero-cover { width: min(62vw, 260px); height: min(62vw, 260px); }
  .hero-meta, .hero-actions { justify-content: center; }
  .hero-title { font-size: 26px; margin: 4px 0 8px; }
  .hero-bg { inset: -8px -16px auto; }

  .tr { grid-template-columns: minmax(0, 1fr) auto 40px; height: 60px; padding: 0 4px; }
  .tr.head { display: none; }
  .tr .num, .tr .t-artist, .tr .t-album, .tr .t-dur { display: none; }
  .tr .t-sub { display: block; }
  .tr .more { opacity: 1; }
  .t-icons .heart { display: none; }
  .tracks.compact .tr { grid-template-columns: minmax(0, 1fr) auto 40px; }
  .tracks.numbered .tr { grid-template-columns: 28px minmax(0, 1fr) auto 40px; }
  .tracks.numbered .tr .num { display: block; }
  .tracks.numbered .t-thumb { display: none; }

  .player {
    grid-template-columns: 1fr; padding: 0 8px; margin: 0 8px 6px; border-radius: 10px; border: 0;
    background: var(--surface-2); gap: 0; height: var(--player-h);
  }
  .player.empty-player { display: none; }
  .p-controls, .p-extra, .p-progress, .p-sep { display: none; }
  .p-cover { width: 46px; height: 46px; }
  .p-line { flex-direction: column; gap: 0; }
  .p-artist { font-size: 13px; }
  .play-btn.mini { display: inline-flex; width: 40px; height: 40px; background: transparent; color: var(--text); }
  .mini-progress { display: block; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
  .mini-progress div { height: 100%; width: 0; background: var(--accent); }

  .tabbar {
    grid-area: tabbar; display: flex; background: var(--bg-side); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 10px; color: var(--muted); font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active i { color: var(--accent); }
  .tabbar i[data-icon] { width: 24px; height: 24px; }

  .queue-panel { inset: 0; width: 100%; bottom: 0; z-index: 40; }
  .menu.sheet {
    left: 0 !important; right: 0; bottom: 0; top: auto !important; max-width: none; border-radius: 16px 16px 0 0;
    padding: 8px 8px max(16px, env(safe-area-inset-bottom)); animation: slideUp .2s ease-out;
  }
  .menu-backdrop { background: rgba(0,0,0,.5); }
  .toasts { bottom: calc(var(--player-h) + 80px); }
  .wl-row { grid-template-columns: 44px minmax(0, 1fr); }
  .wl-actions { grid-column: 1 / -1; justify-content: flex-end; margin-top: -6px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat { padding: 12px; }
  .stat b { font-size: 22px; }
}
