:root,
html[data-theme="dark"] {
  --bg: #09090b;
  --bg-elev: #0e0e11;
  --surface: #131316;
  --surface-2: #1c1c21;
  --border: #27272a;
  --border-soft: rgba(255, 255, 255, 0.07);
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;
  --accent: #d4d4d8;
  --accent-2: #a1a1aa;
  --accent-text: #fafafa;
  --accent-hover: #e4e4e7;
  --danger: #f87171;
  --focus: #52525b;
  --chart-grid: #2e3034;
  --chart-axis: #6b6e74;
  --chart-line: #62d69a;
  --chart-line-dim: #3f8f68;
  --chart-fill: #3dbf7a;
  --grade-user: #9b9ea4;
  --grade-cloud: #8499ad;
  --grade-op: #97a28e;
  --grade-admin: #c0b19c;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --space: 14px;
  --bento-gap: 18px;
  --bento-pad: 20px;
  --glass-bg: rgba(18, 20, 27, 0.62);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-highlight: rgba(255, 255, 255, 0.05);
  --shadow-soft: none;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.24);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.3);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-move: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 160ms;
  --dur-med: 280ms;
  --dur-slow: 480ms;
}

html[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-elev: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-soft: rgba(9, 9, 11, 0.06);
  --text: #09090b;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;
  --accent: #52525b;
  --accent-2: #3f3f46;
  --accent-text: #09090b;
  --accent-hover: #71717a;
  --danger: #a34f4f;
  --focus: #5c6068;
  --chart-grid: #d4d5d8;
  --chart-axis: #858890;
  --chart-line: #1a8f5a;
  --chart-line-dim: #249a66;
  --chart-fill: #249a66;
  --grade-user: #5c5f65;
  --grade-cloud: #526a80;
  --grade-op: #65745e;
  --grade-admin: #85745c;
  --glass-bg: rgba(255, 255, 255, 0.66);
  --glass-border: rgba(18, 22, 32, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.7);
  --shadow-soft: none;
  --shadow-card: 0 1px 2px rgba(20, 21, 24, 0.06), 0 10px 28px rgba(20, 21, 24, 0.06);
  --shadow-pop: 0 20px 56px rgba(20, 21, 24, 0.16), 0 3px 12px rgba(20, 21, 24, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
}

body {
  background-color: #09090b;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background-color var(--dur-med) var(--ease-move),
    color var(--dur-med) var(--ease-move);
}

/* Fixed gradient layer — composited once, never repainted on scroll
   (background-attachment: fixed on body forces full repaints) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255, 255, 255, 0.03), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 108%, rgba(255, 255, 255, 0.02), transparent 50%),
    linear-gradient(180deg, #0c0c0f 0%, #09090b 45%, #070708 100%);
}

html[data-theme="light"] body {
  background-color: #f4f4f5;
}

html[data-theme="light"] body::before {
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0, 0, 0, 0.02), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 108%, rgba(0, 0, 0, 0.02), transparent 50%),
    linear-gradient(180deg, #f1f2f5 0%, #e9ebee 50%, #e5e7ea 100%);
}

::selection {
  background: rgba(138, 143, 157, 0.35);
  color: var(--text);
}

html[data-theme="light"] ::selection {
  background: rgba(92, 96, 104, 0.22);
  color: var(--text);
}

.hidden { display: none !important; }

/* ── Brand icon devant les kickers / titres ── */
.brand-icon {
  display: inline-block;
  vertical-align: -0.18em;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.45em;
  pointer-events: none;
  flex: none;
  align-self: center;
}

/* Keyboard focus — quiet for mouse, visible ring for keyboard */
:is(button, a[href], [role="button"], [tabindex]):focus-visible {
  outline: 1.5px solid var(--focus);
  outline-offset: 2px;
}

/* Thin, theme-aware scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--focus);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.spinner {
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(15, 16, 17, 0.22);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

button.loading .spinner { display: inline-block; }
button.loading .btn-label { opacity: 0.75; }

/* Modal / panel loading (track, artist, playlist) */
.modal-loading,
.playlist-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 240px;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.modal-loading .spinner,
.playlist-modal-loading .spinner,
.chart-empty.is-loading .spinner {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
}

.modal-loading-label {
  color: var(--text-faint);
}

.chart-empty.is-loading {
  flex-direction: column;
  gap: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error,
.error-inline {
  margin: 10px 0 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
}
