:root {
  /* Giallo Lattemiele (campionato dal logo) come accent; nero come sfondo. */
  --lm-accent: #FFEB00;
  --lm-accent-hi: #FFC800;
  --lm-accent-ink: #0e0e0e; /* colore da usare SOPRA il giallo (icone/testo) */
  --lm-bg: #0e0e0e;
  --lm-text: #ffffff;
  --lm-text-dim: rgba(255,255,255,0.62);
  --lm-surface: rgba(255,255,255,0.06);
  --lm-stroke: rgba(255,255,255,0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--lm-bg);
  color: var(--lm-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Sfondo ambientale: la cover del brano, sfocata, colora tutta la schermata */
.lm-ambient {
  position: fixed;
  inset: -12%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(64px) saturate(1.4) brightness(0.55);
  transform: scale(1.15);
  opacity: 0;
  transition: opacity 900ms ease, background-image 0ms;
}
.lm-ambient.is-ready { opacity: 1; }
.lm-ambient::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 10%, transparent 30%, rgba(0,0,0,0.55) 100%);
}

.lm-stage {
  position: relative;
  z-index: 1;
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  gap: 16px;
}

/* --- Header --- */
.lm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lm-brand { display: flex; align-items: center; }
.lm-brand-logo {
  display: block;
  height: 32px; width: auto;
  border-radius: 6px;
  /* piccolo bagliore giallo coerente con l'accent */
  box-shadow: 0 4px 14px rgba(255,235,0,0.18);
}

.lm-live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 11px; border-radius: 999px;
  background: var(--lm-surface); border: 1px solid var(--lm-stroke);
  color: var(--lm-text-dim);
}
.lm-live .lm-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.lm-live.is-live { color: var(--lm-accent-hi); }
.lm-live.is-live .lm-live-dot { background: var(--lm-accent); animation: lm-pulse 1.8s ease-out infinite; }

@keyframes lm-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,235,0,0.65); }
  70%  { box-shadow: 0 0 0 9px rgba(255,235,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,235,0,0); }
}

/* --- Center: cover + info --- */
.lm-center {
  align-self: center;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 24px; width: 100%;
}

.lm-cover-wrap {
  width: min(72vw, 360px);
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--lm-surface);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px var(--lm-stroke);
  position: relative;
}
.lm-cover {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: opacity 350ms ease;
}
.lm-cover-wrap.is-loading .lm-cover { opacity: 0.35; }

.lm-meta { max-width: 92vw; }
.lm-track {
  font-size: clamp(20px, 5.5vw, 30px);
  font-weight: 800; line-height: 1.2; margin: 0;
  letter-spacing: -0.2px;
  overflow-wrap: anywhere;
}
.lm-artist {
  font-size: clamp(14px, 3.8vw, 18px);
  color: var(--lm-text-dim); margin: 8px 0 0;
  overflow-wrap: anywhere;
}

/* --- Controls --- */
.lm-controls {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding-top: 4px;
}
.lm-play {
  width: 76px; height: 76px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--lm-accent); color: var(--lm-accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 14px 34px rgba(255,235,0,0.35);
  transition: transform 120ms ease, background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.lm-play:hover { background: var(--lm-accent-hi); }
.lm-play:active { transform: scale(0.94); }
.lm-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.lm-play svg { width: 34px; height: 34px; display: block; fill: var(--lm-accent-ink); }
.lm-play.is-busy { opacity: 0.7; pointer-events: none; }

.lm-volume {
  display: flex; align-items: center; gap: 12px;
  width: min(78vw, 320px);
  color: var(--lm-text-dim);
}
.lm-volume svg { width: 20px; height: 20px; flex-shrink: 0; }
.lm-volume input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 4px;
  background: rgba(255,255,255,0.2);
  outline: none; cursor: pointer;
}
.lm-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.lm-volume input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: none; border-radius: 50%; background: #fff;
}
.lm-volume input:focus-visible { outline: 2px solid var(--lm-accent-hi); outline-offset: 4px; }

.lm-status {
  min-height: 18px; font-size: 12px; color: var(--lm-text-dim);
  text-align: center;
}
.lm-status.is-error { color: var(--lm-accent-hi); }

.lm-install {
  display: none;
  margin: 0 auto;
  background: transparent; color: #fff;
  border: 1px solid var(--lm-stroke); border-radius: 999px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.lm-install.is-visible { display: inline-block; }
.lm-install:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  .lm-live.is-live .lm-live-dot { animation: none; }
  .lm-ambient { transition: opacity 300ms ease; }
}

@media (min-width: 720px) {
  .lm-center { flex-direction: row; gap: 40px; text-align: left; max-width: 900px; margin: 0 auto; }
  .lm-cover-wrap { width: 320px; }
  .lm-meta { flex: 1; }
  .lm-controls { align-items: flex-start; }
  .lm-volume { width: 320px; }
}
