/* Radio Libre — style v6 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1d212a;
  --border: #262b36;
  --text: #e8eaf0;
  --muted: #8b93a3;
  --accent: #e11d48;          /* rose radio */
  --accent2: #7c3aed;
  --ok: #22c55e;
  --radius: 12px;
}

html, body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
body { padding-bottom: 140px; } /* room pour la playbar fixe */

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 0; }
header h1 { font-size: 1.5rem; letter-spacing: 0.2px; }
.tagline { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 18px; }
.panel h2 { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.8rem; }

/* cartes stations */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: pointer; transition: transform .12s, border-color .12s;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card.playing { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(225,29,72,.35); }
.card .logo { width: 56px; height: 56px; border-radius: 8px; background: #242936; object-fit: contain; }
.card .name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* recherche */
#searchform { display: flex; gap: 8px; }
#q { flex: 1; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 0.95rem; }
#q:focus { outline: none; border-color: var(--accent); }
#country {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 10px; font-size: 0.9rem;
}
#searchform button {
  background: var(--accent); border: none; border-radius: 8px; color: white;
  padding: 10px 16px; font-weight: 600; cursor: pointer; font-size: 0.9rem;
}
#searchform button:hover { filter: brightness(1.1); }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.results:empty::after { content: ''; }
.results-msg { color: var(--muted); font-size: 0.85rem; padding: 8px 2px; grid-column: 1/-1; }

/* badge version dans le header */
.appver {
  font-size: 0.45em;
  color: #6b7280;
  vertical-align: super;
  font-weight: 400;
  margin-left: 0.35em;
}

/* ============ PLAYBAR v6 ============ */
.player {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #1a1e27 0%, #14171e 100%);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.45);
  z-index: 50;
}

.artwrap {
  width: 72px; height: 72px; flex: none; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #262b36, #171a21);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.artwrap img { width: 100%; height: 100%; object-fit: cover; display: none; }
.artwrap img.loaded { display: block; }
.artph { font-size: 1.7rem; color: var(--muted); }

.playerright { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.playerinfo { min-width: 0; }
.infotop { display: flex; align-items: center; gap: 10px; }
#nowname {
  color: white; font-weight: 700; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
.livedot { display: flex; align-items: center; gap: 5px; color: var(--accent); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; flex: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ticker : titre qui défile */
.ticker { overflow: hidden; white-space: nowrap; position: relative; min-height: 1.1rem; }
#nowtrack {
  display: inline-block; color: var(--muted); font-size: 0.85rem; padding-right: 60px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; vertical-align: bottom;
}
#nowtrack.scrolling {
  max-width: none; text-overflow: unset; overflow: visible;
  animation: scrolltxt 14s linear infinite;
}
@keyframes scrolltxt { 0%,12% { transform: translateX(0); } 88%,100% { transform: translateX(calc(-100% + 140px)); } }

.ctrlrow { display: flex; align-items: center; gap: 12px; }
#btnplay {
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(135deg, var(--accent), #be123c);
  color: white; border: none; border-radius: 999px;
  padding: 10px 22px; font-size: 0.95rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(225,29,72,.4);
  transition: transform .1s, filter .12s;
}
#btnplay:hover { filter: brightness(1.12); }
#btnplay:active { transform: scale(.97); }
#btnplay .pi { font-size: 0.72rem; line-height: 1; }
#btnplay.playing { background: linear-gradient(135deg, #3f4759, #2b303c); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.plabel { font-size: 0.88rem; }

/* bouton cast */
#btncast {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  font-size: 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .12s, color .12s;
}
#btncast:hover { border-color: var(--accent); color: var(--text); }
#btncast.casting { border-color: var(--accent); color: var(--accent); background: rgba(225,29,72,.12); }

.status { color: var(--muted); font-size: 0.78rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.status.err { color: #f87171; }
.status.ok { color: var(--ok); }

@media (max-width: 480px) {
  .artwrap { width: 60px; height: 60px; }
  #btnplay { padding: 9px 18px; }
  .plabel { display: none; } /* icône seule sur petit écran */
  #btnplay .pi { font-size: 0.95rem; }
  .status { display: none; }
}