:root {
  --bg: #0a0a0d;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --text-muted: #9a9aa3;
  --radius: 18px;
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  --bg: #f3f3f6;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-hover: rgba(255, 255, 255, 0.85);
  --border: rgba(0, 0, 0, 0.06);
  --text: #17171a;
  --text-muted: #6b6b74;
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ---------- Aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform;
}

:root[data-theme="light"] .blob {
  opacity: 0.22;
}

.blob-a {
  width: 420px;
  height: 420px;
  background: #1db954;
  top: -140px;
  left: -120px;
  animation: floatA 22s ease-in-out infinite;
}

.blob-b {
  width: 380px;
  height: 380px;
  background: #a238ff;
  bottom: -160px;
  right: -100px;
  animation: floatB 26s ease-in-out infinite;
}

.blob-c {
  width: 320px;
  height: 320px;
  background: #fa243c;
  top: 35%;
  left: 55%;
  opacity: 0.2;
  animation: floatC 30s ease-in-out infinite;
}

.grain {
  position: fixed;
  top: -10%;
  left: -10%;
  right: -10%;
  bottom: -10%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainDrift 1.2s steps(4) infinite;
}

@keyframes grainDrift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -4%); }
  75% { transform: translate(-2%, -2%); }
  100% { transform: translate(0, 0); }
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(50px, 70px); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-60px, -50px); }
}
@keyframes floatC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.12); }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 10;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.icon-moon {
  opacity: 0;
  transform: scale(0.6) rotate(-40deg);
}

:root[data-theme="light"] .icon-sun {
  opacity: 0;
  transform: scale(0.6) rotate(40deg);
}
:root[data-theme="light"] .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* ---------- Layout ---------- */
.page {
  width: 100%;
  max-width: 560px;
  padding: 72px 24px 140px;
  display: flex;
  flex-direction: column;
  gap: 44px;
  position: relative;
}

/* ---------- Fade-in entrance ---------- */
.fade-in {
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .link-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .blob,
  .avatar::after,
  .eq span,
  .hero-wave span,
  .grain {
    animation: none !important;
  }
  .aurora {
    transition: none !important;
    transform: none !important;
  }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(140deg, #1db954, #a238ff);
  box-shadow: var(--shadow);
  margin-bottom: 6px;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 50%;
  background: inherit;
  filter: blur(16px);
  opacity: 0.5;
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.18); opacity: 0.7; }
}

.avatar svg {
  width: 30px;
  height: 30px;
}

.hero h1 {
  font-family: "Poppins", sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero .tagline {
  color: var(--text-muted);
  font-size: 15px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Signature visuelle : reprend le motif de l'icône équaliseur en plus grand format */
.hero-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 22px;
  margin-top: 14px;
  opacity: 0.6;
}

.hero-wave span {
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #1db954, #a238ff);
  animation: eqBounce 1.6s ease-in-out infinite;
}

.hero-wave span:nth-child(1) { height: 30%; animation-delay: -1.4s; }
.hero-wave span:nth-child(2) { height: 55%; animation-delay: -1.1s; }
.hero-wave span:nth-child(3) { height: 80%; animation-delay: -1.6s; }
.hero-wave span:nth-child(4) { height: 45%; animation-delay: -0.7s; }
.hero-wave span:nth-child(5) { height: 100%; animation-delay: -1.9s; }
.hero-wave span:nth-child(6) { height: 60%; animation-delay: -0.3s; }
.hero-wave span:nth-child(7) { height: 90%; animation-delay: -1.2s; }
.hero-wave span:nth-child(8) { height: 40%; animation-delay: -0.9s; }
.hero-wave span:nth-child(9) { height: 70%; animation-delay: -1.7s; }
.hero-wave span:nth-child(10) { height: 35%; animation-delay: -0.5s; }
.hero-wave span:nth-child(11) { height: 55%; animation-delay: -1.3s; }

/* ---------- Section label ---------- */
.section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.eq span {
  width: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  animation: eqBounce 1s ease-in-out infinite;
}

.eq span:nth-child(1) { height: 40%; animation-delay: -0.9s; }
.eq span:nth-child(2) { height: 100%; animation-delay: -0.5s; }
.eq span:nth-child(3) { height: 65%; animation-delay: -0.2s; }

@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* ---------- Player ---------- */
.player {
  display: flex;
  flex-direction: column;
}

.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 4px;
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto 16px;
}

.tab {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease;
}

.tab.is-active {
  color: #0a0a0d;
}

:root[data-theme="light"] .tab.is-active {
  color: #fff;
}

.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  border-radius: 999px;
  background: var(--text);
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.player-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.player-frame-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.player-frame-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1db954;
  box-shadow: 0 0 8px currentColor;
  transition: background 0.25s ease;
}

.player-frame-header a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.player-frame-header a:hover {
  color: var(--text);
}

.player-frame-header a svg {
  width: 13px;
  height: 13px;
}

.player-frame-body {
  min-height: 352px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-pane {
  width: 100%;
}

.player-frame iframe {
  display: block;
  width: 100%;
  border: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.player-frame iframe.is-loaded {
  opacity: 1;
}

.player-placeholder {
  padding: 44px 26px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.player-placeholder code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
}

.player-placeholder a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

:root[data-theme="light"] .player-placeholder code {
  background: rgba(0, 0, 0, 0.08);
}

.skeleton {
  width: 100%;
  height: 352px;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

/* ---------- Links ---------- */
.links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  will-change: transform;
}

.link-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 22%, transparent),
    transparent 70%
  );
  transition: opacity 0.35s ease;
}

.link-card:hover::before {
  opacity: 1;
}

.link-card > * {
  position: relative;
  z-index: 1;
}

.links > a:nth-of-type(1) { animation-delay: 0.24s; }
.links > a:nth-of-type(2) { animation-delay: 0.3s; }
.links > a:nth-of-type(3) { animation-delay: 0.36s; }
.links > a:nth-of-type(4) { animation-delay: 0.42s; }
.links > a:nth-of-type(5) { animation-delay: 0.48s; }

.link-card:hover {
  transform: translateY(-3px);
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 16px 32px -18px color-mix(in srgb, var(--accent) 55%, transparent);
}

.link-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  transition: transform 0.2s ease;
}

.link-card:hover .link-icon {
  transform: scale(1.06);
}

.link-icon svg {
  width: 20px;
  height: 20px;
}

.link-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.link-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.link-card:hover .link-arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.footer-admin-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-admin-link:hover {
  color: var(--text);
}

.kbd-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0.7;
}

.kbd-hint kbd {
  display: inline-block;
  min-width: 16px;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 10.5px;
}

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

@media (max-width: 420px) {
  .page {
    padding: 60px 18px 100px;
  }
  .hero h1 {
    font-size: 24px;
  }
}

/* ---------- Focus & pressed states ---------- */
.tab:focus-visible,
.theme-toggle:focus-visible,
.link-card:focus-visible,
.player-frame-header a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 35%, transparent);
}

.tabs {
  border-radius: 999px;
}

.theme-toggle:active {
  transform: scale(0.94);
}

.tab:active {
  transform: scale(0.96);
}

.link-card:active {
  transform: scale(0.98);
}

/* ---------- Scrollbar ---------- */
html {
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
