/* ============================================================================
   Serenata — tema dark notturno
   ============================================================================ */

:root {
  --accent-hue: 12;
  --bg: oklch(0.16 0.012 320);
  --bg-2: oklch(0.20 0.014 320);
  --fg: oklch(0.94 0.008 80);
  --fg-dim: oklch(0.72 0.012 80);
  --fg-faint: oklch(0.50 0.014 320);
  --line: oklch(0.30 0.012 320);
  --accent: oklch(0.72 0.16 var(--accent-hue));
  --accent-soft: oklch(0.72 0.16 var(--accent-hue) / 0.18);
  --accent-glow: oklch(0.72 0.16 var(--accent-hue) / 0.35);

  --font-display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 0%, oklch(0.22 0.02 var(--accent-hue) / 0.4), transparent 60%),
    var(--bg);
}

/* Background layers */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-stars {
  opacity: 0;
  transition: opacity 0.5s ease;
  background-image:
    radial-gradient(1px 1px at 12% 18%, white, transparent),
    radial-gradient(1px 1px at 78% 32%, white, transparent),
    radial-gradient(1.5px 1.5px at 33% 65%, white, transparent),
    radial-gradient(1px 1px at 88% 78%, white, transparent),
    radial-gradient(1px 1px at 51% 12%, white, transparent),
    radial-gradient(1px 1px at 22% 88%, white, transparent),
    radial-gradient(1.5px 1.5px at 65% 48%, white, transparent),
    radial-gradient(1px 1px at 9% 50%, white, transparent),
    radial-gradient(1px 1px at 95% 15%, white, transparent),
    radial-gradient(1px 1px at 42% 92%, white, transparent),
    radial-gradient(1px 1px at 58% 78%, white, transparent),
    radial-gradient(1px 1px at 7% 75%, white, transparent);
}
html[data-stars="on"] .bg-stars { opacity: 0.35; }
html[data-vibe="stellare"][data-stars="on"] .bg-stars { opacity: 0.6; }

.bg-grain {
  opacity: 0;
  transition: opacity 0.5s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}
html[data-grain="on"] .bg-grain { opacity: 0.12; }

/* App container — phone width */
.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================================================
   HOME
   ============================================================================ */

.home {
  padding: 56px 24px 32px;
  gap: 0;
  position: relative;
}

.home-header {
  text-align: center;
  margin-bottom: 56px;
}

.home-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 18px;
}

.home-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 56px;
  line-height: 1.0;
  margin: 0;
  color: var(--fg);
  letter-spacing: -0.01em;
}

html[data-vibe="romantico"] .home-title {
  font-size: 48px;
}

.home-sub {
  margin-top: 22px;
  font-size: 14px;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 22px;
  background: oklch(0.21 0.014 320 / 0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--fg);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
}

.card:active {
  transform: scale(0.98);
  background: oklch(0.24 0.016 320 / 0.8);
  border-color: var(--accent-soft);
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--accent-soft);
    background: oklch(0.23 0.016 320 / 0.8);
  }
}

.card-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 38px;
  font-weight: 400;
  color: var(--accent);
  min-width: 48px;
  line-height: 1;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--fg);
  margin-bottom: 4px;
}

.card-artist {
  font-size: 13px;
  color: var(--fg-dim);
  letter-spacing: 0.01em;
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  color: var(--fg-faint);
}

.card-duration {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.card-arrow {
  color: var(--fg-dim);
}

.home-flourish {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  opacity: 0.5;
}

/* ============================================================================
   PLAYER
   ============================================================================ */

.player {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.player-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: oklch(0.16 0.012 320 / 0.92);
  backdrop-filter: blur(10px);
}

.player-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 14px;
}

.scroll-progress {
  height: 3px;
  background: oklch(0.30 0.012 320 / 0.5);
}

.scroll-progress-bar {
  width: 10%;
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid oklch(0.42 0.016 320);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:active {
  background: oklch(0.24 0.014 320);
  border-color: oklch(0.55 0.016 320);
}

.player-meta {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.player-meta-num {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
  opacity: 0.85;
}

.player-meta-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-duration {
  font-size: 12px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

/* Lyrics scroll */
.lyrics-scroll {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
}
.lyrics-scroll::-webkit-scrollbar { width: 0; display: none; }

.lyrics-inner {
  padding: 42px 28px;
  text-align: center;
}

.lyrics-spacer-bottom { height: 14vh; }

.lyrics-artist {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 10px;
}

.lyrics-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 24px;
}

.lyrics-rule {
  width: 40px;
  height: 1px;
  background: var(--accent);
  margin: 0 auto 40px;
  opacity: 0.7;
}

.lyric-line {
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: 0.01em;
  margin: 2px 0;
  text-wrap: pretty;
}

.lyric-marker {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 28px 0 14px;
  opacity: 0.8;
}

.lyric-gap { height: 22px; }

.lyrics-end {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.lyrics-end-mark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--fg-faint);
  letter-spacing: 0.1em;
}

/* Fade overlays for lyrics */
.lyrics-fade-top,
.lyrics-fade-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 90px;
  pointer-events: none;
  z-index: 2;
}
.lyrics-fade-top {
  top: 71px; /* below top bar */
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}
.lyrics-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

/* FAB canzone successiva */
.next-fab-wrap {
  position: fixed;
  right: 20px;
  bottom: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  animation: fab-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fab-in {
  from { opacity: 0; transform: translateX(16px) scale(0.85); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.next-fab-label {
  background: oklch(0.20 0.014 320 / 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  text-align: right;
}

.next-fab-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 2px;
}

.next-fab-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  color: var(--fg);
  white-space: nowrap;
}

.next-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: oklch(0.16 0.012 320);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  /* box-shadow: 0 4px 24px var(--accent-glow); */
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.next-fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ============================================================================
   Vibe variants
   ============================================================================ */

html[data-vibe="romantico"] .lyric-line {
  font-size: 20px;
}

html[data-vibe="stellare"] body {
  background:
    radial-gradient(ellipse at 50% 0%, oklch(0.22 0.025 270 / 0.5), transparent 60%),
    radial-gradient(ellipse at 80% 90%, oklch(0.20 0.02 var(--accent-hue) / 0.3), transparent 50%),
    var(--bg);
}
