@font-face {
  font-family: Lora;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/lora-400.woff2") format("woff2");
}
@font-face {
  font-family: Lora;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/lora-600.woff2") format("woff2");
}
@font-face {
  font-family: Lora;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/lora-700.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/opensans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/opensans-600.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/opensans-700.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/opensans-800.woff2") format("woff2");
}

:root {
  --bg: #0c0818;
  --bg-elev: #141022;
  --bg-card: #1a1630;
  --bg-card-soft: #1c1834;
  --purple: #3c30a7;
  --purple-soft: #4a3fbe;
  --gold: #f0c419;
  --gold-soft: #e4c56a;
  --gold-deep: #c9a20e;
  --text: #f7f4ee;
  --text-dim: #c5c0b6;
  --text-mute: #9a9488;
  --line: rgba(240, 196, 25, 0.22);
  --day-border: rgba(247, 244, 238, 0.16);
  --nav-h: 68px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font-serif: Lora, Georgia, "Times New Roman", serif;
  --font-sans: "Open Sans", Inter, "Segoe UI", sans-serif;
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  background: var(--bg);
}
body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

.app {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bg);
}

.vista {
  display: none;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}
.vista.is-on { display: flex; }

.schermo {
  flex: 1;
  min-width: 0;
  padding: calc(var(--safe-top) + 18px) 22px calc(var(--nav-h) + var(--safe-bot) + 20px);
  overflow-x: hidden;
  overflow-y: auto;
}
.schermo--accesso {
  padding-bottom: calc(var(--safe-bot) + 32px);
  justify-content: flex-start;
}

/* ===== Marca (tela de e-mail) ===== */
.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 36px;
}
.marca img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.marca-nome {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  color: var(--gold-soft);
  margin: 0;
}

.titolo {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--text);
}
.titolo--schermo { font-size: 28px; margin-bottom: 10px; }

.lead {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
}
.campo label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
}
.campo input {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--day-border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 18px;
}
.campo input:focus {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--gold);
}
.errore {
  margin: -8px 0 16px;
  font-size: 16px;
  color: #f0c8b4;
  min-height: 1.2em;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.btn-oro {
  background: var(--gold);
  color: #111;
  box-shadow: 0 0 24px rgba(240, 196, 25, 0.28);
}
.btn-oro:hover, .btn-oro:focus-visible { background: #ffd84a; color: #111; }
.btn-oro:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  margin-top: 8px;
}
.btn-ghost:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-ghost:disabled {
  opacity: 0.45;
  cursor: default;
}

.campo-codice input {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-height: 64px;
  padding-left: 0.35em;
}
.lead--piccolo {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--text-mute);
}
#vista-codice { margin-top: 8px; }

/* ===== Sessioni ===== */
.sessioni-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 20px;
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.sessioni-kicker svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.disco-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 22px;
}
.disco {
  position: relative;
  width: min(236px, 68vw);
  aspect-ratio: 1;
}
.disco-anello {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 7px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(240, 196, 25, 0.15);
}
.disco-logo {
  position: absolute;
  inset: 11%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
}
.disco-logo-giro {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  transform-origin: center center;
  animation: giro-logo 24s linear infinite;
  will-change: transform;
}
@keyframes giro-logo {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.player-titolo {
  margin: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.player-durata {
  margin: 6px 0 0;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

.barra {
  margin: 22px 4px 0;
  touch-action: none;
}
.barra-track {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}
.barra-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(247, 244, 238, 0.18);
}
.barra-fill {
  position: absolute;
  left: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--gold);
  width: 0%;
  pointer-events: none;
}
.barra-thumb {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--gold);
  transform: translateY(-50%);
  left: 0%;
  pointer-events: none;
  box-shadow: 0 0 0 6px rgba(240, 196, 25, 0.06);
}
.barra-tempi {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.avvertenza {
  margin: 18px 12px 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-mute);
}
.avvertenza--sinistra {
  text-align: left;
  margin: 18px 0 0;
}

.schermo--sessioni {
  display: flex;
  flex-direction: column;
}
.play-wrap {
  display: flex;
  justify-content: center;
  margin: 22px 0 8px;
}
.schermo--sessioni .play-wrap {
  margin-top: auto;
  padding-top: 12px;
}
.btn-play {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gold);
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 0 32px rgba(240, 196, 25, 0.35);
  flex: 0 0 auto;
}
.btn-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn-play svg { width: 32px; height: 32px; }
.btn-play .icona-play { margin-left: 3px; }
.btn-play #icona-pausa { display: none !important; }
.btn-play.is-playing #icona-play { display: none !important; }
.btn-play.is-playing #icona-pausa { display: block !important; }

/* ===== Come usarla ===== */
.card-cuffie {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 6px 0 22px;
  padding: 16px 16px 16px 14px;
  background: var(--bg-card);
  border-radius: 16px;
}
.card-cuffie .icona {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  color: var(--gold);
}
.card-cuffie p {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--text);
}

.passi { list-style: none; margin: 0 0 26px; padding: 0; }
.passi li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.4;
}
.passi li:last-child { margin-bottom: 0; }
.passo-n {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sottotitolo-oro {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--font-sans);
}
.blocco p {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}
.blocco p:last-child { margin-bottom: 0; }

.guida-apertura {
  min-height: calc(100dvh - var(--nav-h) - var(--safe-bot) - var(--safe-top) - 38px);
  display: flex;
  flex-direction: column;
}
.guida-piu {
  margin-top: 8px;
  padding-top: 28px;
  border-top: 1px solid rgba(247, 244, 238, 0.08);
}
.guida-piu h2 {
  margin: 28px 0 10px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.guida-piu h3 {
  margin: 20px 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-soft);
}
.guida-piu p, .guida-piu li {
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}
.guida-piu ul, .guida-piu ol {
  margin: 0 0 12px;
  padding-left: 1.2em;
}
.guida-piu li { margin: 0 0 8px; }
.guida-piu p { margin: 0 0 12px; }
.guida-piu a { color: var(--gold-soft); text-decoration: underline; }

/* ===== Calendario ===== */
.cal-lead {
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.45;
  color: var(--text-dim);
}
.cal-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mute);
}
.cal-meta-destra {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-meta-destra::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex: 0 0 auto;
}

.settimana { margin: 0 0 10px; }
.settimana-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.giorni {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.giorno {
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--day-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.giorno.is-sel {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.giorno.is-fatto {
  background: rgba(240, 196, 25, 0.16);
  border-color: var(--gold);
  color: var(--gold);
}
.giorno.is-fatto.is-sel {
  background: var(--gold);
  color: #111;
}
.giorno:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.cal-azione { margin: 18px 0 8px; }

/* ===== Tab bar ===== */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  height: calc(var(--nav-h) + var(--safe-bot));
  padding: 6px 8px var(--safe-bot);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
  border-top: 1px solid rgba(247, 244, 238, 0.08);
  z-index: 20;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
}
.tab svg {
  width: 22px;
  height: 22px;
}
.tab.is-on { color: var(--gold); }
.tab:focus-visible { outline: 3px solid var(--gold); outline-offset: -4px; }

/* ===== Foglio "segna oggi" ===== */
.foglio {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
.foglio-card {
  width: min(430px, 100%);
  padding: 24px 22px calc(var(--safe-bot) + 24px);
  background: var(--bg-elev);
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(240, 196, 25, 0.16);
  border-bottom: 0;
}
.foglio-card h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
}
.foglio-card p {
  margin: 0 0 22px;
  font-size: 18px;
  color: var(--text-dim);
}

audio { display: none; }

@media (min-width: 431px) {
  body {
    background:
      radial-gradient(ellipse 50% 40% at 50% 0%, rgba(60, 48, 167, 0.18), transparent 60%),
      #07050f;
  }
  .app {
    box-shadow: 0 0 0 1px rgba(247, 244, 238, 0.06), 0 20px 80px rgba(0, 0, 0, 0.45);
    min-height: 100dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .disco-logo-giro {
    animation: none;
    will-change: auto;
  }
}
