/* ============================================================
   NON È QUELLO CHE SEMBRA — Stile
   ============================================================ */

:root{
  --violet: #6C3AF2;
  --violet-dark: #4B23B8;
  --pink: #FF4FA0;
  --orange: #FF8A3D;
  --yellow: #FFC93C;
  --teal: #17C3B2;
  --green: #34C77B;
  --ink: #1E1533;
  --paper: #FFFBF5;
  --card-bg: #FFFFFF;
  --shadow: 0 10px 30px rgba(30,21,51,.15);
  --radius-lg: 28px;
  --radius-md: 18px;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  font-family:'Poppins', sans-serif;
  background: var(--paper);
  color: var(--ink);
  overflow-x:hidden;
}

h1,h2,h3{
  font-family:'Baloo 2', sans-serif;
  margin:0 0 .4em 0;
}

img{ max-width:100%; display:block; }

button{
  font-family:'Poppins', sans-serif;
  cursor:pointer;
  border:none;
  background:none;
}

/* ---------------- Header progresso ---------------- */
#progress-header{
  position:fixed; top:0; left:0; right:0;
  z-index: 50;
  background: rgba(255,251,245,.92);
  backdrop-filter: blur(6px);
  padding: 10px 16px 8px;
  display:none;
  border-bottom: 3px solid var(--violet);
}
#progress-header.visible{ display:block; }

#progress-bar-track{
  height:10px;
  border-radius:10px;
  background: #E9E2FB;
  overflow:hidden;
}
#progress-bar-fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--pink), var(--violet));
  border-radius:10px;
  transition: width .4s ease;
}
#progress-label{
  font-size:.78rem;
  font-weight:700;
  color: var(--violet-dark);
  margin-top:4px;
  text-align:right;
}

/* ---------------- Layout schermate ---------------- */
#app-root{ position:relative; width:100%; min-height:100vh; }

.screen{
  display:none;
  min-height:100vh;
  width:100%;
  padding: 90px 16px 50px;
  align-items:center;
  justify-content:center;
}
.screen.active-screen{
  display:flex;
}

/* ---------------- Copertina ---------------- */
#screen-cover{
  position:relative;
  padding:0;
  min-height:100vh;
  color:#fff;
  text-align:center;
}
.cover-bg{
  position:absolute; inset:0;
  background-size:cover;
  background-position:center 30%;
  filter:saturate(1.05);
}
.cover-overlay{
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(30,21,51,0) 0%, rgba(30,21,51,0) 60%, rgba(20,14,36,.55) 82%, rgba(20,14,36,.92) 100%);
}
.cover-title-sr-only{
  position:absolute;
  width:1px; height:1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
}
.cover-content{
  position:absolute;
  left:0; right:0; bottom:0;
  z-index:2;
  max-width: 560px;
  margin: 0 auto;
  padding: 26px 24px 40px;
  text-align:center;
}
.cover-subtitle{
  font-size:1rem;
  font-weight:600;
  opacity:.97;
  margin-bottom: 22px;
  text-shadow: 0 3px 12px rgba(0,0,0,.5);
}
.cover-hint{
  margin-top:16px;
  font-size:.88rem;
  opacity:.9;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* ---------------- Card generiche ---------------- */
.stage-card{
  width:100%;
  max-width: 620px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 26px 34px;
  text-align:center;
  animation: pop-in .35s ease;
}
@keyframes pop-in{
  from{ opacity:0; transform: translateY(18px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.stage-emoji{ font-size:3rem; margin-bottom:6px; }

.stage-text{
  font-size:1rem;
  line-height:1.55;
  text-align:left;
  color:#3a3050;
}
.stage-text p{ margin: 0 0 14px 0; }

.intro-map-figure{
  margin: 4px 0 22px;
  border-radius: var(--radius-md);
  overflow:hidden;
  box-shadow: 0 8px 22px rgba(30,21,51,.18);
  background:#F4F1FF;
}
.intro-map-image{
  width:100%;
  display:block;
}
.intro-map-figure figcaption{
  font-size:.85rem;
  font-weight:600;
  color: var(--violet-dark);
  text-align:center;
  padding: 10px 14px;
}

.stop-extra-figure{
  margin: 0 0 20px;
  border-radius: var(--radius-md);
  overflow:hidden;
  box-shadow: 0 8px 22px rgba(30,21,51,.18);
  background:#F4F1FF;
}
.stop-extra-image{
  width:100%;
  display:block;
}
.stop-extra-caption{
  font-size:.85rem;
  font-weight:600;
  color: var(--violet-dark);
  text-align:center;
  padding: 10px 14px;
}

.quote-box{
  background: linear-gradient(135deg, #F1EBFF, #FFE9F5);
  border-left: 5px solid var(--violet);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 20px 0 26px;
  text-align:left;
  position:relative;
}
.quote-box i{ color: var(--violet); margin-right:8px; opacity:.6; }
.quote-box p{
  display:inline;
  font-weight:600;
  font-style:italic;
  color: var(--violet-dark);
}

/* ---------------- Bottoni ---------------- */
.btn-primary{
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color:#fff;
  font-weight:700;
  padding: 14px 26px;
  border-radius: 50px;
  font-size:1rem;
  box-shadow: 0 8px 18px rgba(108,58,242,.35);
  transition: transform .15s ease, box-shadow .15s ease;
  display:inline-flex;
  align-items:center;
  gap:10px;
  justify-content:center;
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 12px 22px rgba(108,58,242,.45); }
.btn-primary:active{ transform: translateY(0); }
.btn-primary:disabled{
  background:#D8D2E8;
  color:#8f88a3;
  box-shadow:none;
  cursor:not-allowed;
  transform:none;
}
.btn-big{ width:100%; padding:16px 26px; font-size:1.05rem; }

.btn-secondary{
  background: #FFF3D6;
  color:#8a5b00;
  font-weight:700;
  padding: 12px 22px;
  border-radius: 50px;
  font-size:.95rem;
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin: 6px 0 16px;
  border: 2px dashed var(--yellow);
}
.btn-secondary:hover{ background:#FFE9B0; }

/* ---------------- Audio player ---------------- */
.audio-player{
  display:flex;
  align-items:center;
  gap:12px;
  background: #F4F1FF;
  border-radius: 50px;
  padding: 8px 16px 8px 8px;
  margin: 18px 0 22px;
}
.audio-toggle{
  width:44px; height:44px;
  border-radius:50%;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  flex:0 0 auto;
  font-size:1rem;
  box-shadow: 0 4px 10px rgba(108,58,242,.4);
}
.audio-toggle:hover{ filter:brightness(1.08); }
.audio-track{ flex:1; }
.audio-progress{
  height:8px;
  background:#DCD4F7;
  border-radius:10px;
  overflow:hidden;
  cursor:pointer;
}
.audio-progress-fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  border-radius:10px;
}
.audio-time{
  font-size:.78rem;
  font-weight:600;
  color: var(--violet-dark);
  min-width:38px;
  text-align:right;
}

/* ---------------- Stop screen ---------------- */
.stop-top-row{ margin-bottom:10px; }
.stop-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background: var(--ink);
  color:#fff;
  font-weight:700;
  font-size:.8rem;
  padding:6px 16px;
  border-radius:30px;
}
.stop-emoji{ font-size:1rem; }

.stop-figure{
  margin: 10px 0 6px;
  border-radius: var(--radius-md);
  overflow:hidden;
  box-shadow: 0 8px 22px rgba(30,21,51,.18);
}
.stop-image{
  width:100%;
  height: 260px;
  object-fit:cover;
  display:block;
}

/* ---------------- Stepper fasi ---------------- */
.phase-stepper{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:6px;
  margin: 4px 0 22px;
}
.phase-dot{
  background:#F0ECFA;
  border-radius: 14px;
  padding: 8px 4px;
  font-size:.68rem;
  font-weight:700;
  color:#9a8fc0;
  line-height:1.2;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
}
.phase-dot span{
  width:22px; height:22px;
  border-radius:50%;
  background:#D8CFF2;
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:.72rem;
}
.phase-dot.active{
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color:#fff;
}
.phase-dot.active span{ background: rgba(255,255,255,.35); color:#fff; }
.phase-dot.done{ background:#E6F8ED; color: var(--green); }
.phase-dot.done span{ background: var(--green); color:#fff; }

/* ---------------- Pannelli fase ---------------- */
.phase-panel{ display:none; text-align:left; animation: fade-in .3s ease; }
.phase-panel.active-phase{ display:block; }
@keyframes fade-in{ from{opacity:0;} to{opacity:1;} }

.teaser-text{
  font-size:1rem;
  line-height:1.55;
  color:#3a3050;
  background:#FBF7FF;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom:18px;
}

.quiz-question{
  font-size:1.15rem;
  margin-bottom:14px;
  color: var(--ink);
}

.quiz-options{ display:flex; flex-direction:column; gap:10px; margin-bottom: 14px; }
.quiz-option{
  text-align:left;
  background:#F4F1FF;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-weight:600;
  font-size:.95rem;
  color:#3a3050;
  transition: all .15s ease;
  display:flex;
  align-items:center;
  gap:10px;
}
.quiz-option:hover{ border-color: var(--violet); }
.quiz-option .opt-letter{
  width:26px; height:26px;
  border-radius:50%;
  background:#DCD4F7;
  color:#5a4b90;
  font-size:.8rem;
  display:flex; align-items:center; justify-content:center;
  flex:0 0 auto;
}
.quiz-option.selected{ border-color: var(--violet); background:#EFE9FE; }
.quiz-option.correct{
  background: #E4F8EC;
  border-color: var(--green);
  color:#1f7a45;
}
.quiz-option.correct .opt-letter{ background: var(--green); color:#fff; }
.quiz-option.wrong{
  background: #FDECEC;
  border-color:#F16565;
  color:#a13a3a;
}
.quiz-option.wrong .opt-letter{ background:#F16565; color:#fff; }
.quiz-option.disabled{ cursor:default; }

.quiz-feedback{
  font-weight:600;
  font-size:.92rem;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin: 4px 0 16px;
  display:none;
}
.quiz-feedback.show{ display:block; animation: fade-in .3s ease; }
.quiz-feedback.ok{ background:#E4F8EC; color:#1f7a45; }
.quiz-feedback.info{ background:#FFF3D6; color:#8a5b00; }

/* Reveal cos'è */
.reveal-box{
  background: linear-gradient(135deg, #FFF0D6, #FFE1EC);
  border-radius: var(--radius-md);
  padding: 26px 20px;
  text-align:center;
  margin-bottom: 20px;
}
.reveal-kicker{
  text-transform:uppercase;
  font-size:.75rem;
  font-weight:800;
  letter-spacing:.05em;
  color: var(--pink);
  margin-bottom:8px;
}
.reveal-title{ font-size:1.5rem; color: var(--ink); margin-bottom:4px; }
.reveal-author{ font-weight:600; color:#6b5f8a; font-size:.95rem; }

/* Inganno */
.inganno-phrase{
  font-size:1rem;
  line-height:1.55;
  background:#FFF7E6;
  border-left:5px solid var(--yellow);
  border-radius: var(--radius-md);
  padding:14px 16px;
  margin-bottom:14px;
}
.inganno-hint{
  display:none;
  font-size:.95rem;
  line-height:1.5;
  background:#EAFBF6;
  border-left:5px solid var(--teal);
  border-radius: var(--radius-md);
  padding:14px 16px;
  margin-bottom:18px;
  font-weight:600;
  color:#0f6a5c;
}
.inganno-hint.show{ display:block; animation: fade-in .3s ease; }

/* Frase finale */
.final-quote-box{
  background: var(--ink);
  color:#fff;
  border-radius: var(--radius-md);
  padding: 22px 20px;
  margin-bottom:22px;
  text-align:left;
}
.final-quote-box i{ color: var(--yellow); margin-right:8px; opacity:.8; }
.final-quote{
  display:inline;
  font-weight:600;
  font-style:italic;
  font-size:1.02rem;
  line-height:1.5;
}

/* ---------------- Outro recap ---------------- */
.recap-list{
  list-style:none;
  padding:0; margin: 6px 0 20px;
  text-align:left;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.recap-list li{
  background:#F4F1FF;
  border-radius: var(--radius-md);
  padding:10px 14px;
  font-size:.9rem;
  line-height:1.4;
}
.recap-list .was{ color:#9a8fc0; font-weight:600; }
.recap-list .is{ color: var(--violet-dark); font-weight:700; }

.outro-footer{
  margin-top:22px;
  font-size:.82rem;
  color:#9a8fc0;
  font-weight:600;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 480px){
  .stage-card{ padding:24px 18px 28px; }
  .stop-image{ height:200px; }
  .phase-dot{ font-size:.62rem; padding:7px 3px; }
  .phase-dot span{ width:20px; height:20px; font-size:.66rem; }
}

/* Copertina su schermi stretti: l'immagine (con titolo integrato) è larga
   quanto lo schermo e non viene tagliata; i contenuti interattivi stanno
   in un pannello a tinta unita sotto, così il titolo del poster resta leggibile. */
@media (max-width: 600px){
  #screen-cover.active-screen{
    display:flex;
    flex-direction:column;
    min-height:100vh;
  }
  #screen-cover{
    display:none;
  }
  .cover-bg{
    position:relative;
    width:100%;
    aspect-ratio: 1024 / 724;
    background-size:cover;
    background-position:center top;
    flex:0 0 auto;
  }
  .cover-overlay{
    position:relative;
    inset:auto;
    background:none;
    height:0;
  }
  .cover-content{
    position:relative;
    left:auto; right:auto; bottom:auto;
    flex:1 1 auto;
    background: linear-gradient(180deg, var(--ink), var(--violet-dark));
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:28px 24px 40px;
    margin:0;
  }
}
