/* ======================================================
   VARIABLES & RESET
====================================================== */
:root {
  --bg:        #0a0a0f;
  --surface:   #13131c;
  --border:    #2a2a3d;
  --accent:    #e8ff57;       /* jaune-lime vif */
  --accent2:   #ff4fd8;       /* rose électrique */
  --text:      #f0f0f5;
  --muted:     #6b6b8a;
  --radius:    16px;
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
  --shadow-accent: 0 4px 24px rgba(232,255,87,.25);
  --shadow-accent-hover: 0 8px 32px rgba(232,255,87,.4);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Space Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-x: hidden;
}

/* ── FOND ANIMÉ (grille + grain) ── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.bg-grain {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ── CARTE PRINCIPALE ── */
.card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(2rem, 5vw, 3.5rem);
  width: 100%;
  max-width: 540px;
  box-shadow:
    0 0 0 1px rgba(232,255,87,.07),
    0 32px 80px rgba(0,0,0,.6),
    inset 0 1px 0 rgba(255,255,255,.05);
}

/* ── EN-TÊTE ── */
.header { text-align: center; margin-bottom: 2.5rem; }

.badge {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: .65rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 99px;
  padding: .25rem .8rem;
  margin-bottom: 1.2rem;
  opacity: .85;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -.02em;
}

h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin-top: .6rem;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── VISUALISEUR D'ONDES (animation CSS) ── */
.visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 56px;
  margin: 2rem 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.visualizer.active { opacity: 1; }

.bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite alternate;
}
.bar:nth-child(odd)  { background: var(--accent2); animation-duration: 1.5s; }
.bar:nth-child(3n)   { background: linear-gradient(to top, var(--accent), var(--accent2)); }

@keyframes wave {
  0%   { transform: scaleY(.3); opacity: .6; }
  100% { transform: scaleY(1);  opacity: 1; }
}

/* ── INFOS RADIO EN COURS ── */
.now-playing {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 2rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
}
.now-playing.playing {
  border-color: rgba(232,255,87,.3);
  background: rgba(232,255,87,.04);
}
.now-playing.searching {
  border-color: rgba(255,79,216,.4);
  background: rgba(255,79,216,.03);
}
.now-playing.error {
  border-color: rgba(255,80,80,.4);
}

.np-label {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.np-label.searching-label {
  color: var(--accent2);
}

.np-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-name.loading {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.np-genre {
  font-size: .75rem;
  color: var(--accent2);
  margin-top: .25rem;
  font-style: italic;
}

.np-idle {
  color: var(--muted);
  font-size: .85rem;
}

/* Spinner inline pour chargement */
.np-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(107,107,138,.3);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BOUTONS ── */
.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .85rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-family: 'Space Mono', monospace;
  font-size: .82rem;
  font-weight: 400;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Ripple au clic */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity .15s;
}
.btn:active::after { opacity: .08; }
.btn:hover:not(:disabled)  { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-play {
  background: var(--accent);
  color: #0a0a0f;
  box-shadow: var(--shadow-accent);
}
.btn-play:hover:not(:disabled) {
  background: #f0ff6a;
  box-shadow: var(--shadow-accent-hover);
}
.btn-play:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}
.btn-play.playing {
  background: var(--accent2);
  color: #fff;
  box-shadow: 0 4px 24px rgba(255,79,216,.25);
}
.btn-play.playing:hover:not(:disabled) {
  box-shadow: 0 8px 32px rgba(255,79,216,.4);
}

.btn-next {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-next:hover:not(:disabled) {
  border-color: var(--accent2);
  color: var(--accent2);
  box-shadow: 0 4px 24px rgba(255,79,216,.12);
}
.btn-next:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── BARRE DE VOLUME ── */
.volume-bar {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: 1.2rem;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.volume-bar:focus-within {
  border-color: rgba(232,255,87,.3);
}

.btn-mute {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: .2rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color var(--transition), transform var(--transition);
}
.btn-mute:hover { color: var(--text); transform: scale(1.1); }
.btn-mute:active { transform: scale(.95); }

.vol-on  { display: block; }
.vol-off { display: none;  }
.btn-mute.muted { color: var(--accent2); }
.btn-mute.muted .vol-on  { display: none;  }
.btn-mute.muted .vol-off { display: block; }

.vol-label {
  flex-shrink: 0;
  font-family: 'Space Mono', monospace;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  min-width: 38px;
  text-align: center;
  user-select: none;
  transition: color var(--transition);
}
.vol-label.muted { color: var(--accent2); }

.volume-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

/* ── SLIDER CUSTOM ── */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--vol, 80%),
    rgba(255,255,255,.1) var(--vol, 80%),
    rgba(255,255,255,.1) 100%
  );
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  z-index: 2;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(232,255,87,.5), 0 0 0 2px rgba(232,255,87,.15);
  transition: transform .15s, box-shadow .15s;
}
.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px rgba(232,255,87,.7), 0 0 0 4px rgba(232,255,87,.2);
}
.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(232,255,87,.5);
}

/* Track muet grisé */
.volume-slider.muted {
  background: linear-gradient(
    to right,
    rgba(255,79,216,.4) 0%,
    rgba(255,79,216,.4) 0%,
    rgba(255,255,255,.1) 0%,
    rgba(255,255,255,.1) 100%
  ) !important;
}

/* ── TOOLTIP VOLUME (aide à la lecture du %) ── */
.volume-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: .7rem;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
  z-index: 10;
}
.volume-track:hover .volume-tooltip,
.volume-slider:focus ~ .volume-tooltip {
  opacity: 1;
}

/* ── BOUTON VISITER ── */
.btn-visit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  margin-top: 1rem;
  padding: .75rem 1.4rem;
  background: rgba(232,255,87,.06);
  color: var(--accent);
  border: 1px solid rgba(232,255,87,.25);
  border-radius: var(--radius);
  font-family: 'Space Mono', monospace;
  font-size: .8rem;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.btn-visit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity .15s;
}
.btn-visit:active::after { opacity: .04; }
.btn-visit:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(232,255,87,.12);
  box-shadow: 0 6px 24px rgba(232,255,87,.15);
  color: var(--accent);
}

.visit-notice {
  font-size: .68rem;
  color: var(--muted);
  font-style: italic;
}

/* ── BOUTON RETOUR ♥️Music ── */
.btn-music {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  margin-top: 1.5rem;
  padding: .85rem 1.4rem;
  color: var(--text);
  border: 1px solid rgba(255,79,216,.35);
  border-radius: var(--radius);
  font-family: 'Space Mono', monospace;
  font-size: .82rem;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}
.btn-music::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity .15s;
}
.btn-music:active::after { opacity: .06; }
.btn-music:hover {
  transform: translateY(-2px);
  border-color: var(--accent2);
  box-shadow: 0 8px 32px rgba(255,79,216,.2);
  color: var(--accent2);
}

/* Icônes SVG inline */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ── ÉTAT DE CHARGEMENT (spinner) ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(10,10,15,.3);
  border-top-color: #0a0a0f;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MENTION RGPD ── */
.rgpd {
  margin-top: 2rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .72rem;
  line-height: 1.7;
  color: var(--muted);
  background: rgba(255,255,255,.015);
  transition: border-color var(--transition);
}
.rgpd:hover { border-color: rgba(255,255,255,.1); }
.rgpd strong { color: var(--text); }
.rgpd a { color: var(--accent2); text-decoration: underline; text-underline-offset: 3px; }
.rgpd a:hover { opacity: .8; }

/* ── PIED DE PAGE ── */
footer {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .btn-group { flex-direction: column; }
  .card { padding: 1.5rem; }
  .volume-bar { gap: .5rem; padding: .6rem .75rem; }
  .vol-label { min-width: 32px; font-size: .72rem; }
}

/* ── ANIMATIONS D'ENTRÉE ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeSlideUp .6s cubic-bezier(.4,0,.2,1) both;
}
.bg-grid {
  animation: fadeSlideUp .8s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}