/* CRICRI FM — charte "Studio Nuit" : charbon profond, ambre → magenta */
:root {
  --bg: #0b0b12;
  --card: rgba(255,255,255,.045);
  --card-brd: rgba(255,255,255,.09);
  --txt: #f4efe9;
  --muted: #9b95a6;
  --amber: #ff9a3d;
  --magenta: #ff2d78;
  --grad: linear-gradient(135deg, var(--amber), var(--magenta));
  --radius: 18px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100dvh;
  overflow-x: hidden;
}
.bg-glow {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 42% at 50% -6%, rgba(255,154,61,.20), transparent 70%),
    radial-gradient(46% 34% at 82% 12%, rgba(255,45,120,.14), transparent 70%),
    radial-gradient(50% 40% at 12% 34%, rgba(126,63,255,.12), transparent 72%);
}
.grain {
  position: fixed; inset: -50%; z-index: -1; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 20% { transform: translate(-3%,2%); }
  40% { transform: translate(2%,-3%); } 60% { transform: translate(-2%,-2%); } 80% { transform: translate(3%,3%); }
}

.app {
  max-width: 520px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px; min-height: 100dvh;
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--grad);
  box-shadow: 0 0 14px rgba(255,120,60,.8);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.8); opacity: .7; } }
.brand-name {
  font-weight: 900; font-size: 19px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.live-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(255,45,120,.5); color: #ff5c93;
  background: rgba(255,45,120,.08);
}
.live-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--magenta); animation: blink 1.4s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.live-badge.off { border-color: rgba(255,255,255,.18); color: var(--muted); background: rgba(255,255,255,.04); }
.live-badge.off .dot { background: var(--muted); animation: none; }

/* ---------- vinyle + visualiseur ---------- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0 0; }
.vinyl-wrap { position: relative; width: min(66vw, 268px); aspect-ratio: 1; filter: drop-shadow(0 18px 42px rgba(0,0,0,.6)); }
.vinyl { width: 100%; height: 100%; animation: spin 5s linear infinite; animation-play-state: paused; }
.vinyl.spinning { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
#viz { width: 100%; height: 64px; opacity: .9; }

/* ---------- now playing ---------- */
.now { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.now-label { font-size: 10px; letter-spacing: .28em; color: var(--muted); font-weight: 700; }
.now h2 {
  font-size: clamp(22px, 6vw, 30px); font-weight: 850; line-height: 1.15;
  text-shadow: 0 4px 24px rgba(255,120,60,.18);
}
.clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.now-artist { color: #d9b8ff; font-size: 15px; font-weight: 500; min-height: 20px; }
.listeners { font-size: 12px; color: var(--muted); margin-top: 4px; }
.listeners b { color: var(--txt); }

/* ---------- contrôles ---------- */
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 4px 0; }
.play-btn {
  position: relative; width: 82px; height: 82px; border-radius: 50%;
  border: none; cursor: pointer; color: #1a0a08;
  background: var(--grad);
  box-shadow: 0 10px 34px rgba(255,77,97,.45), inset 0 -3px 10px rgba(0,0,0,.18);
  display: grid; place-items: center;
  transition: transform .15s ease, box-shadow .3s;
}
.play-btn:active { transform: scale(.94); }
.play-btn svg { width: 40px; height: 40px; }
.play-ring {
  position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(255,120,90,.35);
  opacity: 0; transition: opacity .3s;
}
.play-btn.playing .play-ring { opacity: 1; animation: ring 2.2s ease-out infinite; }
@keyframes ring {
  0% { transform: scale(.94); opacity: .8; }
  100% { transform: scale(1.28); opacity: 0; }
}
.vol-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--card-brd);
  padding: 10px 16px; border-radius: 999px;
}
.vol-ic { width: 20px; height: 20px; color: var(--muted); flex: none; }
#volume { -webkit-appearance: none; appearance: none; width: 108px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--amber) var(--p, 80%), rgba(255,255,255,.14) var(--p, 80%)); outline: none; }
#volume::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: pointer;
}
#volume::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: #fff; cursor: pointer; }

/* ---------- sections ---------- */
.sec h3 { font-size: 11px; letter-spacing: .24em; color: var(--muted); font-weight: 800; margin-bottom: 10px; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--card-brd);
  padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip .when { color: var(--amber); font-weight: 800; font-size: 12px; white-space: nowrap; }
.chip .t { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hist li {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--card); border: 1px solid var(--card-brd);
  padding: 10px 14px; border-radius: 14px; font-size: 14px;
}
.hist .ago { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.hist .cat {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: rgba(126,63,255,.16); color: #b79bff;
  flex: none;
}

/* ---------- footer ---------- */
.foot {
  margin-top: auto; padding-top: 8px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 12px;
}
.admin-link {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--card-brd); color: var(--muted);
  transition: color .2s, border-color .2s;
}
.admin-link:hover { color: var(--amber); border-color: rgba(255,154,61,.4); }
.admin-link svg { width: 19px; height: 19px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(80px);
  background: #1d1d28; color: var(--txt);
  padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--card-brd); box-shadow: 0 12px 34px rgba(0,0,0,.5);
  transition: transform .3s ease; z-index: 50; max-width: 88vw; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }

@media (min-width: 560px) {
  .app { padding-top: 34px; gap: 26px; }
}
