:root {
  --bg: #080605;
  --bg-elevated: #0e0b09;
  --surface: #12100d;
  --surface-hover: #18130f;
  --surface-strong: #1d1612;
  --text: #e2d9cf;
  --text-strong: #f2ebe3;
  --muted: #968a80;
  --dim: #665b53;
  --blood: #84261f;
  --blood-bright: #a8342a;
  --blood-soft: rgba(132, 38, 31, .16);
  --line: rgba(205, 181, 157, .12);
  --line-strong: rgba(205, 181, 157, .22);
  --sidebar: 244px;
  --player: 94px;
  --radius: 6px;
  --shadow: 0 22px 55px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); scrollbar-color: #4e2922 #0a0806; }
body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  isolation: isolate;
}
button, input, select { font: inherit; }
button, a, input, select { outline-offset: 3px; }
a { color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background: url('/assets/noise.png') repeat;
  opacity: .045;
  mix-blend-mode: screen;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0, 0, 0, .58);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  height: calc(100vh - var(--player));
  background: #070504;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(18, 14, 11, .99), rgba(8, 6, 5, .995)),
    #0c0907;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(125deg, transparent 0 48%, rgba(151, 43, 34, .035) 49%, transparent 50%),
    repeating-linear-gradient(0deg, transparent 0 58px, rgba(255, 255, 255, .009) 59px);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 7px 20px;
  text-decoration: none;
}
.brand-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45));
}
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy strong {
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  letter-spacing: .09em;
  line-height: 1;
}
.brand-copy small {
  color: #8c6a61;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-stack { position: relative; display: grid; gap: 4px; }
.nav-stack a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #978a80;
  text-decoration: none;
  font-size: 13px;
  font-weight: 720;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.nav-stack a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 3px;
  background: transparent;
}
.nav-stack a:hover {
  color: var(--text-strong);
  background: rgba(255, 255, 255, .025);
  border-color: rgba(205, 181, 157, .07);
}
.nav-stack a.active {
  color: var(--text-strong);
  background: linear-gradient(90deg, rgba(132, 38, 31, .17), rgba(132, 38, 31, .035));
  border-color: rgba(151, 48, 39, .22);
}
.nav-stack a.active::before { background: var(--blood-bright); box-shadow: 0 0 12px rgba(168, 52, 42, .35); }
.nav-stack svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-separator { height: 1px; margin: 20px 8px; background: var(--line); }
.sidebar-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 9px;
  border-top: 1px solid var(--line);
}
.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #7f9a70;
  box-shadow: 0 0 12px rgba(127, 154, 112, .35);
}
.sidebar-status div { display: grid; gap: 2px; min-width: 0; }
.sidebar-status strong { color: #9f938a; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-status small { color: #625851; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 72% -14%, rgba(121, 31, 24, .11), transparent 31%),
    linear-gradient(180deg, #0d0a08 0, #090706 260px, #080605 100%);
}
.content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .11;
  background: repeating-linear-gradient(118deg, transparent 0 54px, rgba(215, 190, 164, .018) 55px, transparent 56px 116px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  padding: 0 clamp(18px, 2.4vw, 38px);
  border-bottom: 1px solid rgba(205, 181, 157, .06);
  background: rgba(8, 6, 5, .84);
  backdrop-filter: blur(18px);
}
.history-buttons { display: flex; gap: 8px; }
.icon-btn,
.player-btn,
.play-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(12, 9, 7, .9);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.icon-btn:hover { color: var(--text-strong); border-color: rgba(154, 61, 50, .52); background: #15100d; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.route-label { color: #756960; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.admin-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(124, 54, 45, .62);
  border-radius: var(--radius);
  color: #b6a89e;
  background: rgba(84, 26, 21, .12);
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: .15s ease;
}
.admin-link:hover { color: var(--text-strong); border-color: #87342b; background: rgba(132, 38, 31, .18); }
.admin-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.view {
  position: relative;
  z-index: 1;
  width: min(100%, 1640px);
  margin: 0 auto;
  padding: 28px clamp(22px, 3vw, 48px) 64px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 3px 0 28px;
}
.page-heading h1 {
  margin: 0;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 3vw, 44px);
  line-height: 1.05;
  letter-spacing: -.025em;
  font-weight: 700;
}
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.page-count { color: #77685f; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 30px;
}
.metric {
  position: relative;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(24, 18, 15, .78), rgba(13, 10, 8, .82));
  overflow: hidden;
}
.metric::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, var(--blood), transparent);
}
.metric strong { display: block; color: var(--text-strong); font-family: Georgia, "Times New Roman", serif; font-size: 23px; line-height: 1.05; }
.metric span { display: block; margin-top: 5px; color: #776a60; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.section { margin-top: 30px; }
.section:first-of-type { margin-top: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  color: #e7ded4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  letter-spacing: -.01em;
}
.section-head span { color: #6d6159; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.quick-track {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 42px;
  align-items: center;
  min-width: 0;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(30, 23, 19, .82), rgba(15, 11, 9, .82));
  overflow: hidden;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.quick-track:hover { transform: translateY(-1px); border-color: rgba(145, 53, 43, .55); background: linear-gradient(90deg, #211713, #15100d); box-shadow: 0 16px 34px rgba(0, 0, 0, .24); }
.quick-track.active { border-color: #8f3028; background: linear-gradient(90deg, rgba(132, 38, 31, .19), rgba(20, 14, 11, .9)); box-shadow: inset 2px 0 #9b3128; }
.quick-cover { position: relative; width: 76px; height: 76px; overflow: hidden; background: #17110e; border-right: 1px solid var(--line); }
.quick-cover img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.07) saturate(.72) brightness(.88); }
.no-cover { display: grid; place-items: center; width: 100%; height: 100%; background: radial-gradient(circle at 50% 38%, #2a1a15, #0d0907 68%); color: #6e2b24; font-family: Georgia, serif; font-size: 26px; font-weight: 700; }
.quick-meta { min-width: 0; padding: 0 13px; }
.quick-meta strong, .quick-meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-meta strong { color: #e1d6ca; font-family: Georgia, "Times New Roman", serif; font-size: 15px; }
.quick-meta span { margin-top: 4px; color: #7f736a; font-size: 11px; }
.quick-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border: 1px solid #84382f;
  border-radius: 50%;
  color: #eee5dc;
  background: #752019;
  cursor: pointer;
  opacity: .75;
  transition: .15s ease;
}
.quick-track:hover .quick-play, .quick-track.active .quick-play { opacity: 1; background: #932a22; }
.quick-play svg { width: 13px; height: 13px; fill: currentColor; stroke: none; transform: translateX(1px); }

.library-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 10, 8, .58);
  overflow: hidden;
}
.library-header,
.library-row {
  display: grid;
  grid-template-columns: 44px minmax(240px, 1.6fr) minmax(140px, 1fr) minmax(90px, .65fr) 86px 44px;
  align-items: center;
  gap: 14px;
  min-width: 760px;
}
.library-header {
  min-height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: #6e6259;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.library-row {
  position: relative;
  min-height: 64px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(205, 181, 157, .07);
  color: #8b7f76;
  cursor: pointer;
  transition: background .14s ease, box-shadow .14s ease;
}
.library-row:last-child { border-bottom: 0; }
.library-row:hover { background: linear-gradient(90deg, rgba(132, 38, 31, .09), rgba(255, 255, 255, .01)); }
.library-row.active { background: linear-gradient(90deg, rgba(132, 38, 31, .16), rgba(255, 255, 255, .006)); box-shadow: inset 2px 0 var(--blood-bright); }
.row-index { color: #63564e; font-family: Georgia, serif; font-size: 11px; text-align: center; }
.title-cell { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.mini-cover { position: relative; width: 46px; height: 46px; overflow: hidden; border: 1px solid var(--line); background: #17110e; }
.mini-cover img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.06) saturate(.72) brightness(.88); }
.title-copy { min-width: 0; }
.title-copy strong, .title-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-copy strong { color: #ded4ca; font-size: 13px; font-weight: 700; }
.title-copy small { margin-top: 3px; color: #766a62; font-size: 11px; }
.library-row .cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.row-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  justify-self: end;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #83776f;
  background: transparent;
  cursor: pointer;
  transition: .14s ease;
}
.library-row:hover .row-play, .library-row.active .row-play { color: #e5d9ce; border-color: #613029; background: rgba(117, 32, 25, .42); }
.row-play svg { width: 12px; height: 12px; fill: currentColor; transform: translateX(1px); }
.table-scroll { overflow-x: auto; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(680px, 100%);
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0d0a08;
  color: #897b72;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-box:focus-within { border-color: #773229; box-shadow: 0 0 0 2px rgba(132, 38, 31, .08); }
.search-box svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: #5f554e; }
.sort-select {
  min-height: 44px;
  margin-left: auto;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #a3978e;
  background: #0d0a08;
  font-size: 12px;
  cursor: pointer;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 52px 24px;
  border: 1px dashed #4c2b25;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(65, 24, 20, .035);
}
.empty strong { color: #c3b2a5; font-family: Georgia, serif; font-size: 18px; }
.empty span { font-size: 12px; }
.empty a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 4px;
  padding: 0 12px;
  border: 1px solid #643129;
  border-radius: var(--radius);
  color: #c4aaa3;
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.empty a:hover { border-color: #8d382f; color: #ede1d7; background: rgba(132, 38, 31, .11); }

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(430px, 1.55fr) minmax(180px, 1fr);
  align-items: center;
  gap: 20px;
  height: var(--player);
  padding: 10px 20px;
  border-top: 1px solid rgba(135, 48, 39, .68);
  background: linear-gradient(180deg, rgba(17, 12, 10, .995), rgba(7, 5, 4, .998));
  box-shadow: 0 -18px 52px rgba(0, 0, 0, .44);
}
.player::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(166, 49, 40, .7) 25%, rgba(96, 39, 32, .75) 50%, rgba(166, 49, 40, .7) 75%, transparent);
}
.now-playing { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cover-mini { width: 58px; height: 58px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 4px; background: #16110e; }
.cover-mini img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.07) saturate(.72) brightness(.9); }
.track-meta { display: grid; gap: 3px; min-width: 0; }
.track-meta strong, .track-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta strong { color: #e5dbd1; font-size: 13px; }
.track-meta span { color: #776c64; font-size: 11px; }
.player-center { display: grid; gap: 7px; width: 100%; justify-self: center; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; }
.player-btn { width: 34px; height: 34px; border-radius: 50%; transition: color .14s ease, background .14s ease; }
.player-btn:hover { color: #e7ddd3; background: rgba(255, 255, 255, .035); }
.player-btn.active { color: #b84a3e; background: rgba(132, 38, 31, .08); }
.player-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.play-main {
  width: 40px;
  height: 40px;
  margin: 0 3px;
  border: 1px solid #983d33;
  border-radius: 50%;
  color: #f2e8de;
  background: #7c211a;
  box-shadow: 0 7px 22px rgba(0, 0, 0, .32);
  transition: background .14s ease, transform .14s ease, border-color .14s ease;
}
.play-main:hover { background: #9a2b23; border-color: #ba4d41; transform: scale(1.035); }
.play-main svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.play-main svg.pause-icon { fill: currentColor; }
.timeline { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 9px; color: #6d625b; font-size: 9px; font-variant-numeric: tabular-nums; }
.timeline span:first-child { text-align: right; }
.timeline span:last-child { text-align: left; }
input[type="range"] { accent-color: var(--blood-bright); cursor: pointer; }
.timeline input, .volume-wrap input { width: 100%; min-width: 0; }
.volume-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.volume-wrap input { max-width: 108px; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 116px;
  z-index: 1200;
  min-width: 220px;
  padding: 11px 14px;
  border: 1px solid #7a554a;
  border-radius: var(--radius);
  color: #180e0a;
  background: #d8cbbf;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(9px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.loading-list { display: grid; gap: 8px; }
.loading-row { height: 64px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(100deg, #110d0b, #18120f, #110d0b); animation: skeleton 1.15s ease-in-out infinite alternate; }
@keyframes skeleton { from { opacity: .35; } to { opacity: .65; } }

@media (max-width: 1120px) {
  .recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-header, .library-row { grid-template-columns: 40px minmax(220px, 1.5fr) minmax(130px, 1fr) 82px 42px; }
  .library-header > :nth-child(4), .library-row > :nth-child(4) { display: none; }
  .player { grid-template-columns: minmax(190px, .8fr) minmax(390px, 1.5fr) minmax(140px, .7fr); }
}

@media (max-width: 840px) {
  :root { --player: 146px; }
  .app-shell { grid-template-columns: 1fr; height: calc(100vh - var(--player)); }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--player);
    z-index: 35;
    display: block;
    height: 62px;
    padding: 0 8px;
    border: 0;
    border-top: 1px solid rgba(135, 48, 39, .48);
    background: rgba(9, 7, 6, .98);
    backdrop-filter: blur(16px);
  }
  .brand, .sidebar-separator, .sidebar-status { display: none; }
  .nav-stack { grid-template-columns: repeat(3, 1fr); height: 100%; gap: 2px; }
  .nav-stack a { flex-direction: column; justify-content: center; gap: 4px; min-height: 100%; padding: 3px; border: 0; border-radius: 0; font-size: 9px; }
  .nav-stack a::before { top: auto; left: 25%; right: 25%; bottom: 0; width: auto; height: 2px; }
  .content { padding-bottom: 62px; }
  .topbar { height: 58px; padding: 0 14px; }
  .route-label { display: none; }
  .topbar { grid-template-columns: 1fr 1fr; }
  .view { padding: 22px 14px 46px; }
  .page-heading { align-items: flex-start; margin-bottom: 22px; }
  .page-heading h1 { font-size: 31px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric { padding: 12px; min-height: 66px; }
  .metric strong { font-size: 20px; }
  .recent-grid { grid-template-columns: 1fr; }
  .library-header, .library-row { grid-template-columns: 38px minmax(210px, 1fr) minmax(120px, .8fr) 42px; min-width: 560px; }
  .library-header > :nth-child(4), .library-row > :nth-child(4), .library-header > :nth-child(5), .library-row > :nth-child(5) { display: none; }
  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 58px 68px;
    gap: 4px 10px;
    padding: 8px 12px 10px;
  }
  .now-playing { grid-column: 1; grid-row: 1; }
  .cover-mini { width: 50px; height: 50px; }
  .volume-wrap { grid-column: 2; grid-row: 1; }
  .volume-wrap input { display: none; }
  .player-center { grid-column: 1 / -1; grid-row: 2; gap: 5px; }
  .player-controls { min-height: 34px; }
  .play-main { width: 38px; height: 38px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .sort-select { margin-left: 0; width: 100%; }
}

@media (max-width: 520px) {
  .admin-link span { display: none; }
  .admin-link { width: 34px; padding: 0; border-radius: 50%; }
  .metrics { gap: 6px; }
  .metric { padding: 10px; }
  .metric strong { font-size: 18px; }
  .metric span { font-size: 8px; }
  .quick-track { grid-template-columns: 66px minmax(0, 1fr) 40px; min-height: 66px; }
  .quick-cover { width: 66px; height: 66px; }
  .page-count { display: none; }
  .section-head h2 { font-size: 19px; }
}

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

/* ===== Cranux UI v3 — bibliothèque type Spotify + lecture en cours ===== */
.home-section { margin-top: 24px; }
.section-link {
  color: #9f9188;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section-link:hover { color: var(--text-strong); }

.spotify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 18px;
}
.track-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(27, 21, 17, .86), rgba(15, 11, 9, .9));
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.track-card:hover,
.track-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(142, 55, 45, .42);
  background: linear-gradient(180deg, rgba(38, 28, 23, .96), rgba(19, 14, 11, .95));
  box-shadow: 0 18px 38px rgba(0, 0, 0, .24);
}
.track-card.active {
  border-color: rgba(161, 54, 44, .72);
  background: linear-gradient(180deg, rgba(65, 28, 23, .9), rgba(22, 14, 11, .95));
}
.track-card-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: #15100d;
  box-shadow: 0 14px 32px rgba(0,0,0,.32);
}
.track-card-cover > img,
.card-no-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.track-card-cover > img {
  display: block;
  filter: contrast(1.06) saturate(.78) brightness(.9);
  transition: filter .18s ease, transform .22s ease;
}
.track-card:hover .track-card-cover > img,
.track-card.active .track-card-cover > img {
  filter: contrast(1.08) saturate(.94) brightness(.96);
  transform: scale(1.012);
}
.card-no-cover { font-size: 58px; }
.card-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid #9c3c31;
  border-radius: 50%;
  color: #f3e9df;
  background: #84261f;
  box-shadow: 0 10px 24px rgba(0,0,0,.42);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease, background .16s ease;
}
.track-card:hover .card-play,
.track-card:focus-visible .card-play,
.track-card.active .card-play {
  opacity: 1;
  transform: translateY(0);
}
.card-play:hover { background: #a8342a; }
.card-play svg { width: 17px; height: 17px; fill: currentColor; }
.track-card-copy { min-width: 0; padding: 12px 2px 4px; }
.track-card-copy strong,
.track-card-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-card-copy strong { color: #e7ddd4; font-size: 14px; }
.track-card-copy span { margin-top: 6px; color: #7e726a; font-size: 11px; }

.player { cursor: default; }
.now-playing {
  position: relative;
  padding: 4px 8px 4px 4px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .16s ease;
}
.now-playing:hover,
.now-playing:focus-visible { background: rgba(255,255,255,.035); outline: none; }
.open-now-playing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  color: #72665e;
  opacity: .75;
}
.now-playing:hover .open-now-playing { color: #cdbfb4; opacity: 1; }
.open-now-playing svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.now-playing-view[hidden] { display: none !important; }
.now-playing-view {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 28px;
}
.now-playing-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(4, 3, 2, .82);
  backdrop-filter: blur(18px);
  cursor: default;
}
.now-playing-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  max-height: calc(100vh - 56px);
  overflow: auto;
  border: 1px solid rgba(176, 77, 64, .42);
  border-radius: 14px;
  background:
    radial-gradient(circle at 28% 20%, rgba(123, 39, 31, .16), transparent 28%),
    linear-gradient(145deg, #17110e, #0a0706 72%);
  box-shadow: 0 42px 100px rgba(0,0,0,.65);
}
.now-playing-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: url('/assets/noise.png') repeat;
  opacity: .04;
}
.now-playing-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.now-playing-header > div { display: grid; gap: 2px; }
.now-playing-header span { color: #d7ccc2; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.now-playing-header small { color: #675c55; font-size: 10px; }
.close-now-playing { flex: 0 0 auto; }
.expanded-player-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(300px, .95fr) minmax(330px, 1.05fr);
  align-items: center;
  gap: clamp(34px, 6vw, 74px);
  padding: clamp(30px, 5vw, 68px);
}
.expanded-cover-wrap { min-width: 0; }
.expanded-cover {
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(204, 180, 155, .18);
  border-radius: 8px;
  background: #120d0a;
  box-shadow: 0 34px 70px rgba(0,0,0,.48);
}
.expanded-cover img { width: 100%; height: 100%; display: block; object-fit: cover; filter: contrast(1.07) saturate(.84) brightness(.94); }
.expanded-meta { min-width: 0; }
.expanded-kicker { color: #8f3a31; font-size: 10px; font-weight: 850; letter-spacing: .14em; }
.expanded-meta h2 {
  margin: 12px 0 8px;
  color: #f0e7de;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 62px);
  line-height: .98;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.expanded-meta > p { margin: 0; color: #aa9d93; font-size: 15px; }
.expanded-meta .expanded-album { min-height: 18px; margin-top: 8px; color: #71665e; font-size: 11px; }
.expanded-timeline { margin-top: 34px; }
.expanded-timeline input { width: 100%; }
.expanded-timeline > div {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #746960;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.expanded-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 22px;
}
.expanded-secondary,
.expanded-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}
.expanded-secondary {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  color: #a99b91;
  background: rgba(255,255,255,.025);
}
.expanded-secondary:hover { color: #eee4da; border-color: rgba(154,61,50,.58); }
.expanded-play {
  width: 64px;
  height: 64px;
  border: 1px solid #a4473a;
  color: #f7eee6;
  background: #87271f;
  box-shadow: 0 14px 32px rgba(0,0,0,.34);
}
.expanded-play:hover { background: #a32e25; transform: scale(1.025); }
.expanded-secondary svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.expanded-play svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
body.now-playing-open { overflow: hidden; }

@media (max-width: 980px) {
  .spotify-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
  .expanded-player-layout { grid-template-columns: minmax(250px, .9fr) minmax(300px, 1.1fr); gap: 30px; padding: 32px; }
}

@media (max-width: 700px) {
  .spotify-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .track-card { padding: 9px; }
  .card-play { opacity: 1; transform: none; width: 40px; height: 40px; }
  .now-playing-view { padding: 0; place-items: stretch; }
  .now-playing-panel { width: 100%; max-height: 100%; min-height: 100%; border: 0; border-radius: 0; }
  .expanded-player-layout { grid-template-columns: 1fr; align-items: start; gap: 24px; padding: 24px 20px 34px; }
  .expanded-cover { width: min(82vw, 430px); }
  .expanded-meta { text-align: left; }
  .expanded-meta h2 { font-size: clamp(34px, 10vw, 50px); }
  .expanded-controls { margin-top: 18px; }
}

@media (max-width: 420px) {
  .spotify-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .track-card { padding: 7px; }
  .track-card-copy strong { font-size: 12px; }
  .track-card-copy span { font-size: 10px; }
  .expanded-cover { width: min(88vw, 390px); }
  .expanded-player-layout { padding-inline: 16px; }
}
