:root {
  /* Cool-gray minimal palette (default "graphite" theme) */
  --bg: #0a0b0e;
  --bg-2: #0d0f13;
  --surface: #121419;
  --surface-2: #161a21;
  --surface-3: #1b2029;
  --text: #e9ebef;
  --text-strong: #f7f8fa;
  --muted: #878d99;
  --muted-2: #5f6573;

  /* Restrained cool accent (azure -> violet) */
  --accent: #6e9bff;
  --accent-2: #9d83ff;
  --accent-soft: rgba(110, 155, 255, 0.12);
  --accent-glow: rgba(110, 155, 255, 0.45);

  /* Ambient orb colors (themeable) */
  --orb-1: rgba(110, 155, 255, 0.1);
  --orb-2: rgba(157, 131, 255, 0.09);
  --tag: #aeb9d6;

  /* Hairline borders & radii */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Color themes (selected via <html data-color="...">) ---- */
html[data-color='aurora'] {
  --bg: #06120f;
  --bg-2: #081613;
  --surface: #0c1a17;
  --surface-2: #10231e;
  --surface-3: #153029;
  --accent: #2ee6c4;
  --accent-2: #7c5cff;
  --accent-soft: rgba(46, 230, 196, 0.12);
  --accent-glow: rgba(46, 230, 196, 0.4);
  --orb-1: rgba(46, 230, 196, 0.12);
  --orb-2: rgba(124, 92, 255, 0.13);
  --tag: #9fe9da;
}
html[data-color='sunset'] {
  --bg: #120a0e;
  --bg-2: #160d12;
  --surface: #1c1016;
  --surface-2: #241520;
  --surface-3: #2e1a26;
  --accent: #ff8a5b;
  --accent-2: #ff5c8a;
  --accent-soft: rgba(255, 138, 91, 0.12);
  --accent-glow: rgba(255, 138, 91, 0.4);
  --orb-1: rgba(255, 138, 91, 0.12);
  --orb-2: rgba(255, 92, 138, 0.12);
  --tag: #ffc4b0;
}
html[data-color='nord'] {
  --bg: #0e1116;
  --bg-2: #11151c;
  --surface: #161b22;
  --surface-2: #1c232c;
  --surface-3: #232c37;
  --accent: #88c0d0;
  --accent-2: #b48ead;
  --accent-soft: rgba(136, 192, 208, 0.12);
  --accent-glow: rgba(136, 192, 208, 0.4);
  --orb-1: rgba(136, 192, 208, 0.12);
  --orb-2: rgba(180, 142, 173, 0.11);
  --tag: #acd4e0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background: faint grid + two slowly drifting cool light orbs.
   Calm and deep — futurism through motion, not neon flash. */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: -30%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(38vw 38vw at 18% 12%, var(--orb-1), transparent 60%),
    radial-gradient(34vw 34vw at 82% 78%, var(--orb-2), transparent 60%);
  filter: blur(20px);
  animation: ambient-drift 26s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(2.5%, -2%, 0) scale(1.06);
  }
}

a {
  color: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--text-strong);
}

/* Thin refined scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
  background-clip: padding-box;
}

/* Frosted-glass surface utility (theme-aware via color-mix) */
.glass {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--border);
}

/* Page transition (set via nuxt.config app.pageTransition) */
.page-enter-active,
.page-leave-active {
  transition: opacity 0.34s var(--ease), transform 0.34s var(--ease);
}
.page-enter-from {
  opacity: 0;
  transform: translateY(10px);
}
.page-leave-to {
  opacity: 0;
  transform: translateY(-8px);
}

/* ---------- Layout: nav structure (topbar vs sidebar) ---------- */
html[data-layout='sidebar'] .app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}
html[data-layout='sidebar'] .app-header {
  grid-column: 1;
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 20px;
  padding: 26px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: none;
  border-right: 1px solid var(--border);
}
html[data-layout='sidebar'] .app-header .nav {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
html[data-layout='sidebar'] .app-header .nav-link {
  text-align: left;
  padding: 11px 16px;
}
html[data-layout='sidebar'] .app-header .brand {
  margin-bottom: 6px;
}
html[data-layout='sidebar'] .player {
  left: 248px;
}

/* ---------- Layout: content width ---------- */
html[data-width='narrow'] .app-main {
  max-width: 880px;
}
html[data-width='wide'] .app-main {
  max-width: 1480px;
}

/* ---------- Density: card grid sizing ---------- */
html[data-density='cozy'] .grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
html[data-density='compact'] .grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
html[data-density='cozy'] .card {
  padding: 11px;
  gap: 12px;
}
html[data-density='compact'] .card {
  padding: 9px;
  gap: 10px;
}

/* ---------- View: grid vs list ---------- */
html[data-view='list'] .grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
html[data-view='list'] .card {
  grid-template-columns: 52px 1fr auto;
}
html[data-view='list'] .card .thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

@media (max-width: 900px) {
  /* Sidebar collapses to a top bar on small screens */
  html[data-layout='sidebar'] .app-shell {
    display: flex;
    flex-direction: column;
  }
  html[data-layout='sidebar'] .app-header {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    border-bottom: 1px solid var(--border);
    border-right: none;
  }
  html[data-layout='sidebar'] .app-header .nav {
    flex-direction: row;
    align-items: center;
  }
  html[data-layout='sidebar'] .app-header .nav-link {
    text-align: center;
    padding: 8px 14px;
  }
  html[data-layout='sidebar'] .player {
    left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after {
    animation: none;
  }
  .page-enter-active,
  .page-leave-active {
    transition: opacity 0.18s linear;
  }
  .page-enter-from,
  .page-leave-to {
    transform: none;
  }
}
