/* Flow — stile "Soft UI": gradiente pesca → lilla, schede bianche molto arrotondate, accento pervinca. */
:root {
  --pesca: #ffc9a8;
  --pesca-chiaro: #ffd9c2;
  --lilla: #c9b6f2;
  --lavanda: #e6dcfb;
  --pervinca: #7262f0;
  --pervinca-scuro: #5a4bd6;
  --testo: #3a2d66;
  --ardesia: #6b7086;
  --tenue: #a5a3b8;
  --bianco: #ffffff;
  --fondo-app: #f7f4fd;
  --ombra: 0 12px 32px rgba(90, 70, 170, 0.14);
  --gradiente: linear-gradient(180deg, var(--pesca) 0%, #f3c3c9 45%, var(--lilla) 100%);
  --gradiente-barra: linear-gradient(90deg, #b9a4f0 0%, #9c88ec 100%);
  --r-grande: 36px;
  --r-medio: 24px;
  --r-piccolo: 16px;
  --barra-h: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--testo);
  background: var(--gradiente);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

.schermo { min-height: 100dvh; }

/* ---------- Accesso ---------- */
.accesso { display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; gap: 28px; }
.accesso-logo { text-align: center; color: var(--bianco); }
.accesso-logo h1 { margin: 12px 0 4px; font-size: 44px; font-weight: 800; letter-spacing: -0.5px; }
.accesso-logo p { margin: 0; opacity: .9; }
.logo-tondo { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.35); color: var(--bianco); backdrop-filter: blur(6px); }
.logo-tondo svg { width: 36px; height: 36px; }
.scheda { background: var(--bianco); border-radius: var(--r-grande); box-shadow: var(--ombra); }
.accesso-scheda { padding: 28px 22px; display: grid; gap: 16px; max-width: 420px; width: 100%; margin: 0 auto; }
.accesso-scheda label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ardesia); }
.accesso-scheda input { border: 0; background: var(--fondo-app); border-radius: 999px; padding: 14px 18px; outline: none; }
.accesso-scheda input:focus { box-shadow: 0 0 0 2px var(--lilla); }
.errore { color: #c2416b; min-height: 1.2em; margin: 0; font-size: 14px; }
.accesso-nota { margin: 0; font-size: 13px; line-height: 1.4; opacity: .7; text-align: center; }

.bottone-primario {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--pervinca); color: var(--bianco); font-weight: 800;
  border-radius: 999px; padding: 14px 22px; box-shadow: 0 8px 20px rgba(114, 98, 240, .35);
  transition: transform .15s, background .15s;
}
.bottone-primario:active { transform: scale(.97); background: var(--pervinca-scuro); }
.bottone-primario:disabled { opacity: .6; }
.bottone-primario.piccolo { padding: 10px 18px; font-size: 14px; }
.bottone-primario svg { width: 18px; height: 18px; }
.bottone-secondario { border: 2px solid var(--lavanda); color: var(--pervinca); font-weight: 800;
  border-radius: 999px; padding: 12px 22px; margin-top: 16px; }

/* ---------- Testata ---------- */
.testata { padding: calc(env(safe-area-inset-top) + 16px) 16px 0; color: var(--bianco); }
.testata-riga { display: flex; justify-content: space-between; align-items: center; }
.testata h1 { font-size: 34px; font-weight: 800; margin: 14px 0 16px 4px; letter-spacing: -0.3px;
  text-shadow: 0 2px 12px rgba(160, 100, 140, .18); }
.icona-bottone { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.icona-bottone.chiaro { color: var(--bianco); }
.icona-bottone.viola { color: var(--pervinca); }
.icona-bottone:active { background: rgba(114, 98, 240, .1); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  color: var(--pervinca); background: var(--bianco); border: 3px solid rgba(255,255,255,.6); }

.ricerca { display: flex; align-items: center; gap: 10px; background: var(--bianco); border-radius: 999px;
  padding: 0 18px; height: 52px; color: var(--tenue); box-shadow: var(--ombra); position: relative; z-index: 2; }
.ricerca input { flex: 1; border: 0; outline: none; background: none; color: var(--testo); min-width: 0; }
.ricerca input::placeholder { color: var(--tenue); }

/* ---------- Contenitore bianco ---------- */
.contenitore {
  background: var(--bianco);
  margin-top: -26px;
  border-radius: var(--r-grande) 0 0 0;
  min-height: calc(100dvh - 160px);
  padding: 50px 0 calc(var(--barra-h) + 110px + env(safe-area-inset-bottom));
  position: relative; z-index: 1;
}
.vista { padding: 0 16px; animation: entra .25s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.titolo-sezione { font-size: 22px; font-weight: 800; margin: 4px 0 16px; }
.titolo-sezione.piccolo { font-size: 18px; margin-top: 28px; }

/* Home: menu verticale + carosello */
.home-alto { display: flex; gap: 12px; }
.menu-verticale { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; flex: none; }
.menu-verticale button { writing-mode: vertical-rl; transform: rotate(180deg); padding: 14px 7px;
  border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--tenue); }
.menu-verticale button.attivo { background: var(--lavanda); color: var(--pervinca); }

.carosello { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 16px 18px 0;
  margin-right: -16px; scrollbar-width: none; min-width: 0; flex: 1; }
.carosello::-webkit-scrollbar { display: none; }
.card { position: relative; flex: none; width: 168px; height: 236px; border-radius: 30px; overflow: hidden;
  scroll-snap-align: start; box-shadow: var(--ombra); background: var(--lavanda); text-align: left; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(40, 25, 80, .72) 100%); }
.card-testo { position: absolute; left: 16px; right: 16px; bottom: 62px; color: var(--bianco); z-index: 1; }
.card-testo strong { display: block; font-size: 16px; font-weight: 800; line-height: 1.2;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-testo span { font-size: 13px; opacity: .85; }
.card-play { position: absolute; left: 14px; bottom: 14px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  background: var(--pervinca); color: var(--bianco); display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(114, 98, 240, .5); }
.card-play svg { width: 18px; height: 18px; }
.card.genere { display: flex; align-items: flex-end; }
.card.genere .sfondo { position: absolute; inset: 0; }

/* Lista brani */
.brani-blocco { display: flex; gap: 8px; margin-top: 18px; }
.etichetta-ruotata { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 800; color: var(--tenue);
  font-size: 15px; letter-spacing: 1px; padding: 8px 4px; flex: none; align-self: flex-start; }
.lista-brani { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.brano { display: flex; align-items: center; gap: 14px; padding: 9px 6px; border-radius: var(--r-piccolo); cursor: pointer; }
.brano:active, .brano.in-ascolto { background: var(--fondo-app); }
.brano img, .brano .tondo-vuoto { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--lavanda); }
.brano-testo { flex: 1; min-width: 0; }
.brano-testo strong, .brano-testo span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brano-testo strong { font-weight: 700; font-size: 15px; }
.brano.in-ascolto strong { color: var(--pervinca); }
.brano-testo span { font-size: 13px; color: var(--ardesia); }
.brano .numero { width: 26px; text-align: center; color: var(--tenue); font-weight: 700; flex: none; }
.brano .icona-bottone { color: var(--tenue); width: 36px; height: 36px; }
.vuoto { color: var(--tenue); padding: 24px 6px; text-align: center; }

/* Dettaglio */
.indietro-testo { display: inline-flex; align-items: center; gap: 4px; color: var(--pervinca); font-weight: 700; margin-bottom: 14px; }
.indietro-testo svg { width: 18px; height: 18px; }
.dettaglio-testa { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.dettaglio-testa img { width: 120px; height: 150px; border-radius: var(--r-medio); object-fit: cover; flex: none;
  box-shadow: var(--ombra); background: var(--lavanda); }
.dettaglio-testa h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; line-height: 1.2; }
.dettaglio-testa p { margin: 0 0 12px; color: var(--ardesia); font-size: 14px; }

/* Umore */
.umore-form { display: grid; gap: 12px; }
.umore-form textarea { border: 0; resize: none; background: var(--fondo-app); border-radius: var(--r-medio);
  padding: 16px 18px; outline: none; font-size: 16px; }
.umore-form textarea:focus { box-shadow: 0 0 0 2px var(--lilla); }
.umore-rapidi { display: flex; flex-wrap: wrap; gap: 8px; }
.umore-rapidi button { background: var(--lavanda); color: var(--pervinca); border-radius: 999px; padding: 7px 14px;
  font-weight: 700; font-size: 13px; }
.stato { color: var(--ardesia); font-size: 14px; min-height: 1.2em; margin: 0; }
.stato.attesa::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  border-radius: 50%; border: 2px solid var(--lilla); border-top-color: var(--pervinca); vertical-align: -1px;
  animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.lista-flow { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.flow-voce { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-medio);
  background: linear-gradient(120deg, #fff1e8, #f1ebff); cursor: pointer; }
.flow-voce .tondo { width: 48px; height: 48px; border-radius: 50%; background: var(--gradiente); flex: none;
  display: grid; place-items: center; color: var(--bianco); }
.flow-voce strong { display: block; font-weight: 800; }
.flow-voce span { display: block; font-size: 13px; color: var(--ardesia); }
.flow-voce div { flex: 1; min-width: 0; }

/* Generi */
.griglia-generi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.griglia-generi .card { width: auto; height: 150px; }

/* Profilo */
.statistiche { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.statistiche div { background: var(--fondo-app); border-radius: var(--r-medio); padding: 16px 8px; text-align: center; }
.statistiche strong { display: block; font-size: 24px; font-weight: 800; color: var(--pervinca); }
.statistiche span { font-size: 13px; color: var(--ardesia); }

/* ---------- Mini lettore ---------- */
.mini { position: fixed; left: 12px; right: 12px; bottom: calc(var(--barra-h) + 22px + env(safe-area-inset-bottom));
  z-index: 5; background: var(--bianco); border-radius: 999px; box-shadow: var(--ombra);
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; overflow: hidden; max-width: 560px; margin: 0 auto; }
.mini img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--lavanda); flex: none; }
.mini-testo { flex: 1; min-width: 0; cursor: pointer; }
.mini-testo strong, .mini-testo span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-testo strong { font-size: 14px; }
.mini-testo span { font-size: 12px; color: var(--ardesia); }
.mini-avanzamento { position: absolute; left: 30px; right: 30px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--lavanda); }
.mini-avanzamento i { display: block; height: 100%; width: 0; background: var(--pervinca); border-radius: 3px; }

/* ---------- Barra di navigazione ---------- */
.barra { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 6;
  height: var(--barra-h); border-radius: 30px; background: var(--gradiente-barra);
  display: flex; justify-content: space-around; align-items: center; box-shadow: 0 10px 28px rgba(114, 98, 240, .35);
  max-width: 560px; margin: 0 auto; }
.barra button { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: rgba(255,255,255,.7); }
.barra button.attivo { color: var(--bianco); background: rgba(255,255,255,.22); }
.barra svg { width: 24px; height: 24px; }

/* ---------- Player a schermo intero ---------- */
.player { position: fixed; inset: 0; z-index: 10; background: var(--gradiente); display: flex; flex-direction: column;
  animation: sale .28s ease; }
@keyframes sale { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.player-testata { display: flex; justify-content: space-between; align-items: center; color: var(--bianco);
  padding: calc(env(safe-area-inset-top) + 14px) 16px 18px; font-weight: 800; font-size: 18px; }
.player-scheda { flex: 1; background: var(--bianco); border-radius: var(--r-grande) var(--r-grande) 0 0;
  padding: 26px 24px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; }
.player-copertina { width: min(72vw, 300px, 40dvh); aspect-ratio: 4 / 5; object-fit: cover; border-radius: 34px;
  box-shadow: 0 20px 44px rgba(90, 70, 170, .28); background: var(--lavanda); }
.player-scheda h2 { margin: 24px 0 4px; font-size: 23px; font-weight: 800; color: var(--testo); text-align: center; }
.player-scheda p { margin: 0; color: var(--ardesia); text-align: center; }

.onde { position: relative; width: 100%; max-width: 380px; height: 64px; margin-top: 22px; }
.onde svg { width: 100%; height: 100%; display: block; }
.onde-fondo path { fill: var(--lavanda); opacity: .75; }
.onde-fatte path { fill: var(--lilla); opacity: .85; }
.onde-fatte path + path { fill: var(--pervinca); opacity: .55; }
.onde input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.tempi { width: 100%; max-width: 380px; display: flex; justify-content: space-between; font-size: 13px;
  color: var(--tenue); font-weight: 700; margin-top: 6px; }

.controlli { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 380px; margin-top: 22px; }
.controlli .icona-bottone svg { width: 26px; height: 26px; }
.controlli .icona-bottone.spento { opacity: .4; }
.play-grande { width: 76px; height: 76px; border-radius: 50%; background: var(--pervinca); color: var(--bianco);
  display: grid; place-items: center; box-shadow: 0 12px 28px rgba(114, 98, 240, .45); transition: transform .15s; }
.play-grande:active { transform: scale(.95); }
.play-grande svg { width: 32px; height: 32px; }

@media (min-width: 720px) {
  .contenitore { max-width: 900px; margin-left: auto; margin-right: auto; border-radius: var(--r-grande) var(--r-grande) 0 0; }
  .testata { max-width: 900px; margin: 0 auto; }
  .card { width: 190px; height: 260px; }
}

.link-demo { display: block; text-align: center; color: var(--bianco); font-weight: 700; text-decoration: underline; }
