:root {
  --bg: #0b0b0f;
  --surface: #15151c;
  --surface-2: #1d1d26;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f6;
  --muted: #9a9aa8;
  --accent: #ff3b5c;
  --accent-2: #ff8a3d;
  --live: #ff3b5c;
  --ok: #25d366;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 59, 92, 0.18), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(255, 138, 61, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
[hidden] { display: none !important; }

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand-name { font-weight: 700; font-size: 1.05rem; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.badge-live {
  color: #fff;
  background: rgba(255, 59, 92, 0.15);
  border: 1px solid rgba(255, 59, 92, 0.5);
}

.badge-off {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.topbar .badge-live { animation: livePulse 2s ease-in-out infinite; }

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 59, 92, 0); }
}

/* ===== Bandeau défilant ===== */
.ticker {
  display: flex;
  align-items: center;
  max-width: 992px;
  width: calc(100% - 48px);
  margin: 0 auto 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  font-size: 0.85rem;
}

.ticker-label {
  flex: none;
  padding: 9px 12px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}

.ticker-content {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker 90s linear infinite;
}

.ticker:hover .ticker-content { animation-play-state: paused; }

.ticker-item { padding: 0 28px; color: var(--muted); }
.ticker-item b { color: var(--text); font-weight: 600; }
.ticker-item.is-admin b { color: var(--accent); }

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ===== Layout ===== */
.layout {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 24px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-content: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-head h2 { font-size: 1rem; font-weight: 700; }

/* ===== Player ===== */
.player {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: center;
  padding: 28px;
}

.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 20px 50px rgba(255, 59, 92, 0.25);
}

.cover-logo {
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  z-index: 1;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.cover-freq {
  position: absolute;
  bottom: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0.9;
}

.cover-ring {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
}

body[data-state="playing"] .cover-ring { animation: spin 12s linear infinite; }

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

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.player-info h1 { font-size: 2.2rem; font-weight: 800; }

.mic-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  vertical-align: 2px;
}

.mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.mic-banner.is-talking {
  color: #fff;
  background: rgba(255, 59, 92, 0.18);
  border-color: rgba(255, 59, 92, 0.6);
}

.mic-banner.is-talking .mic-dot {
  background: var(--live);
  animation: livePulse 1.2s ease-in-out infinite;
}
.player-info p { margin: 6px 0 0; }

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

body[data-state="playing"] .status { color: var(--text); }

.eq { display: flex; align-items: flex-end; gap: 3px; height: 16px; }

.eq span {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

body[data-state="playing"] .eq span { animation: eq 0.9s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: -0.3s !important; }
.eq span:nth-child(3) { animation-delay: -0.6s !important; }
.eq span:nth-child(4) { animation-delay: -0.15s !important; }
.eq span:nth-child(5) { animation-delay: -0.45s !important; }

@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

.controls {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
}

.play {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(255, 59, 92, 0.4);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.play:hover { transform: scale(1.05); }
.play:active { transform: scale(0.97); }
.play:focus-visible, .icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.play svg { width: 30px; height: 30px; fill: currentColor; grid-area: 1 / 1; }
.play .icon-pause, .play .spinner { display: none; }
body[data-state="playing"] .play .icon-play { display: none; }
body[data-state="playing"] .play .icon-pause { display: block; }
body[data-state="loading"] .play .icon-play { display: none; }
body[data-state="loading"] .play .spinner { display: block; }

.spinner {
  grid-area: 1 / 1;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 240px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; grid-area: 1 / 1; }
.icon-btn .icon-muted { display: none; }
body.is-muted .icon-btn .icon-vol { display: none; }
body.is-muted .icon-btn .icon-muted { display: block; }

input[type="range"] {
  --fill: 80%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--text) var(--fill), rgba(255, 255, 255, 0.15) var(--fill));
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

/* ===== Programme ===== */
.schedule-list { list-style: none; margin: 0; padding: 0; }

.schedule-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.schedule-list li + li { margin-top: 2px; }
.schedule-list .slot { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 92px; font-size: 0.82rem; }
.schedule-list .slot-title { flex: 1; font-weight: 600; }
.schedule-list .is-past { opacity: 0.45; }
.schedule-list .is-live { background: rgba(255, 59, 92, 0.1); }
.schedule-list .badge { padding: 3px 8px; font-size: 0.64rem; }

/* ===== Messages ===== */
.messages { display: flex; flex-direction: column; }

#messageDisplay {
  flex: 1;
  margin: 0;
  padding: 20px;
  min-height: 110px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  font-size: 1.05rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#messageDisplay.is-fading { opacity: 0; transform: translateY(4px); }
#messageDisplay.is-admin { border-left-color: var(--accent-2); background: rgba(255, 138, 61, 0.08); }

#messageDisplay cite {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-style: normal;
  color: var(--muted);
}

#messageDisplay cite:not(:empty)::before { content: '— '; }

.message-form { margin-top: 16px; display: grid; gap: 8px; }

.message-form textarea,
.message-form input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.message-form textarea:focus,
.message-form input:focus { outline: none; border-color: rgba(255, 59, 92, 0.6); }

.form-row { display: flex; gap: 8px; }
.form-row input { flex: 1; }
.form-status { margin: 0; min-height: 1em; font-size: 0.8rem; color: var(--muted); }

.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:active { transform: scale(0.98); }

.btn-whatsapp { flex: 1; background: var(--ok); color: #06240f; }
.btn-whatsapp:hover { background: #1fbe5a; }

.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #262632; }

/* ===== Hors antenne ===== */
.offair {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
}

.offair h1 { font-size: 2rem; margin-top: 18px; }
.offair p { color: var(--muted); line-height: 1.6; }

.offair-dot {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink { 50% { opacity: 0.2; } }

/* ===== Footer ===== */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 28px;
  font-size: 0.8rem;
}

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .player { grid-template-columns: 1fr; text-align: center; gap: 22px; }
  .cover { width: min(240px, 70vw); margin: 0 auto; }
  .status, .controls { justify-content: center; }
}

@media (max-width: 480px) {
  .topbar, .layout, .footer { padding-left: 16px; padding-right: 16px; }
  .brand-name { display: none; }
  .card { padding: 20px; }
  .player-info h1 { font-size: 1.7rem; }
  .controls { flex-direction: column; gap: 16px; }
  .volume { width: 100%; }
  .footer { justify-content: center; text-align: center; }
  .ticker { width: calc(100% - 32px); }
  .form-row { flex-wrap: wrap; }
  .form-row input { flex: 1 1 40%; }
  .form-row .btn { flex: 1 1 100%; }
  .mic-banner { display: flex; width: fit-content; margin: 0 auto 10px; }
}

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

/* Son YouTube joué à l'antenne */
.track-card { margin: 10px 0 14px; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.04); max-width: 340px; }
.track-title { margin: 4px 0 10px; font-weight: 600; overflow-wrap: anywhere; }
.track-frame { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; pointer-events: none; }
.track-frame iframe { width: 100%; height: 100%; display: block; }

/* La vidéo du son YouTube s'affiche dans la pochette, à la place du logo Æ */
.cover-video { position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; background: #000; }
.cover.has-track .cover-video { opacity: 1; }
.cover-video iframe { position: absolute; top: 0; left: 50%; height: 100%; width: 177.78%; transform: translateX(-50%); border: 0; }
