/* =============================================================================
   Contrada Martesana — Quiz di onboarding al Palio 2026
   Stile mobile-first. Colori brand: blu navy (#0a2756) + bianco + accent oro.
   ============================================================================= */

:root {
  --c-blue:       #0a2756;
  --c-blue-700:   #143a78;
  --c-blue-500:   #2a55a3;
  --c-blue-100:   #e6ecf6;
  --c-bg:         #f7f8fb;
  --c-paper:      #ffffff;
  --c-ink:        #0e1a33;
  --c-ink-soft:   #4d566f;
  --c-muted:      #8a92a8;
  --c-line:       #d9dde7;
  --c-gold:       #f0b400;
  --c-success:    #1e8c54;
  --c-danger:     #c2371a;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(10, 39, 86, .06);
  --shadow-md: 0 6px 18px rgba(10, 39, 86, .10);
  --shadow-lg: 0 14px 40px rgba(10, 39, 86, .15);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
          Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- reset essenziale ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--c-blue-700); }

/* ---------- header ---------- */
.site-header {
  background: var(--c-blue);
  color: white;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}
.site-header__title strong {
  display: block;
  font-size: 17px;
  letter-spacing: .2px;
  line-height: 1.1;
}
.site-header__title span {
  display: block;
  font-size: 13px;
  opacity: .85;
  line-height: 1.2;
}
.site-header__title { flex: 1; min-width: 0; }
.site-header__restart {
  appearance: none;
  background: rgba(255, 255, 255, .14);
  color: white;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s ease;
}
.site-header__restart:hover { background: rgba(255, 255, 255, .24); }
.site-header__restart svg { display: block; }
@media (max-width: 420px) {
  .site-header__restart-label { display: none; }
  .site-header__restart { padding: 6px 9px; }
}

/* "Passo X di 6" è nell'header — togliamo l'eco interna agli step */
.step__progress { display: none; }

/* ---------- main ---------- */
#app {
  flex: 1;
  display: block;
  padding: 24px 18px 60px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- step base ---------- */
.step {
  display: none;
  animation: fade-up .35s ease both;
}
.step.is-active { display: block; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step__inner {
  background: var(--c-paper);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow-md);
}

.step__progress {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--c-muted);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.step__title {
  margin: 4px 0 12px;
  font-size: 30px;
  line-height: 1.2;
  color: var(--c-blue);
}

.step__hint {
  margin: 0 0 22px;
  color: var(--c-ink-soft);
}

.step__microhint {
  margin: 10px 0 0;
  font-size: 16px;
  color: var(--c-blue-700);
}

.step__quack {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--c-blue-100);
  border-radius: var(--r-md);
  font-size: 17px;
  color: var(--c-ink-soft);
}

.step__actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.step__actions .btn { flex: 1; }

/* ---------- bottoni ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--c-blue);
  color: white;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .2px;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  min-height: 52px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  background: var(--c-line);
  color: white;
  cursor: not-allowed;
  opacity: .9;
}
.btn--primary { background: var(--c-blue); }
.btn--primary:hover:not(:disabled) { background: var(--c-blue-700); }
.btn--ghost {
  background: transparent;
  color: var(--c-blue);
  border-color: var(--c-line);
}
.btn--ghost:hover { background: var(--c-blue-100); }
.btn--accent {
  background: var(--c-success);
  color: white;
}
.btn--accent:hover { background: #176b41; }
.btn--xl {
  font-size: 20px;
  padding: 17px 22px;
  min-height: 60px;
  width: 100%;
}
.btn--quiz {
  width: 100%;
  font-size: clamp(44px, 13vw, 90px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 2px;
  padding: clamp(14px, 4vw, 28px) 8px;
  min-height: auto;
  border-radius: 16px;
  background: var(--c-gold);
  color: var(--c-blue);
  box-shadow: 0 12px 24px rgba(240, 180, 0, .38);
  text-transform: uppercase;
}
.btn--quiz:hover:not(:disabled) {
  background: #ffc623;
  color: var(--c-blue);
  transform: translateY(-2px);
}
@media (min-width: 640px) {
  .btn--quiz {
    letter-spacing: 4px;
    border-radius: 28px;
  }
}
.btn--block { width: 100%; }

/* ---------- landing / hero ---------- */
.step--landing .step__inner { display: none; }
.step--landing { display: none; }
.step--landing.is-active { display: block; }

.hero {
  background: linear-gradient(180deg, var(--c-blue) 0%, var(--c-blue-700) 100%);
  color: white;
  border-radius: var(--r-lg);
  padding: 32px 22px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.hero__mascotte {
  width: 130px;
  height: auto;
  margin: 0 auto 8px;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.25));
}
.hero__countdown {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--c-gold);
  font-weight: 700;
}
.hero__title {
  margin: 0 0 14px;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -.3px;
}
.hero__lede {
  margin: 0 auto 24px;
  max-width: 460px;
  color: rgba(255,255,255,.88);
  font-size: 18px;
}
.hero__minilink {
  display: inline-block;
  margin-top: 14px;
  color: rgba(255,255,255,.85);
  font-size: 16px;
  text-decoration: underline;
}
.hero__minilink:hover { color: white; }
.hero__quack {
  margin: 22px 0 0;
  font-size: 16px;
  color: rgba(255,255,255,.78);
}
.hero__quack-author {
  display: block;
  font-size: 14px;
  margin-top: 2px;
  opacity: .75;
}

/* ---------- input ---------- */
.input {
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  font-size: 18px;
  background: white;
  color: var(--c-ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 4px var(--c-blue-100);
}
.input--lg {
  padding: 17px 18px;
  font-size: 20px;
}
.age-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 8px;
}
.input--age {
  width: 220px;
  max-width: 100%;
  font-size: 72px;
  font-weight: 800;
  text-align: center;
  padding: 18px 12px;
  border-width: 2px;
  letter-spacing: 2px;
}
.input--age::placeholder {
  color: var(--c-line);
  font-weight: 700;
}

/* ---------- autocomplete (Step Via) ---------- */
.autocomplete { position: relative; }
.autocomplete__list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0; right: 0;
  list-style: none;
  margin: 0; padding: 6px 0;
  background: white;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
}
.autocomplete__list li {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 17px;
}
.autocomplete__list li:hover,
.autocomplete__list li.is-highlighted {
  background: var(--c-blue-100);
  color: var(--c-blue);
}
.autocomplete__list .ac-partial {
  font-size: 12px;
  color: var(--c-muted);
  display: block;
  margin-top: 2px;
}

/* ---------- choice (radio/checkbox grandi) ---------- */
.choice-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--c-blue-500); background: var(--c-blue-100); }
.choice input { margin-top: 3px; accent-color: var(--c-blue); width: 18px; height: 18px; flex-shrink: 0; }
.choice input:checked + .choice__label,
.choice:has(input:checked) { border-color: var(--c-blue); background: var(--c-blue-100); }
.choice__label { font-weight: 600; color: var(--c-ink); }
.choice__sublabel {
  display: block;
  font-size: 16px;
  color: var(--c-ink-soft);
  font-weight: 400;
  margin-top: 2px;
}
.choice--rich {
  flex-wrap: wrap;
  padding: 16px 18px;
}
.choice--rich .choice__icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.choice--rich .choice__label { flex: 1; min-width: 0; }
.choice--rich .choice__sublabel { flex-basis: 100%; margin-left: 30px; }

/* ---------- form ---------- */
.exp-groups { display: grid; gap: 10px; margin-bottom: 8px; }
.exp-cat-header {
  font-weight: 700;
  color: var(--c-blue);
  font-size: 15px;
  letter-spacing: .6px;
  text-transform: uppercase;
  margin: 14px 4px 2px;
}
.exp-cat-header:first-child { margin-top: 0; }
.exp-empty-note {
  padding: 12px 14px;
  background: var(--c-blue-100);
  color: var(--c-ink-soft);
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.4;
  margin-top: 4px;
}
.exp-empty-note strong { color: var(--c-blue); }
.exp-group {
  background: white;
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}
.exp-group:hover { border-color: var(--c-blue-500); }
.exp-group--on {
  border-color: var(--c-blue);
  background: var(--c-blue-100);
}
.exp-group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.exp-group__head input {
  width: 20px;
  height: 20px;
  accent-color: var(--c-blue);
  flex-shrink: 0;
  margin: 0;
}
.exp-group__label {
  font-weight: 600;
  color: var(--c-ink);
  font-size: 17px;
}
.exp-group__details {
  display: grid;
  gap: 10px;
  padding: 12px 16px 14px;
  border-top: 1px dashed var(--c-line);
  background: white;
  animation: fade-up .25s ease both;
}
.exp-group__details[hidden] { display: none; }
.exp-group__rating-hint {
  font-size: 15px;
  color: var(--c-ink-soft);
}
.exp-pills {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
@media (min-width: 540px) {
  .exp-pills { grid-template-columns: repeat(3, 1fr); }
}
.exp-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink-soft);
  text-align: center;
  transition: all .12s ease;
  min-height: 48px;
}
.exp-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.exp-pill:hover { border-color: var(--c-blue-500); }
.exp-pill:has(input:checked) {
  background: var(--c-blue);
  border-color: var(--c-blue);
  color: white;
}

.volunteer-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #fffaf0;
  border: 1.5px solid var(--c-gold);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: var(--c-ink);
  margin-top: 4px;
  animation: fade-up .25s ease both;
}
.volunteer-toggle[hidden] { display: none; }
.volunteer-toggle input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--c-gold);
  flex-shrink: 0;
}
.volunteer-toggle strong { color: var(--c-blue); }

.form { display: grid; gap: 14px; }
.form__field { display: flex; flex-direction: column; gap: 6px; }
.form__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink-soft);
}
.form__optional {
  font-weight: 400;
  color: var(--c-muted);
  font-size: 15px;
}
.form__hint {
  font-size: 15px;
  color: var(--c-muted);
}

/* ---------- privacy ---------- */
.privacy-box {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: var(--c-blue-100);
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  cursor: pointer;
}
.privacy-box:has(input:checked) { border-color: var(--c-blue); }
.privacy-box input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--c-blue); flex-shrink: 0; }
.privacy-box__text { font-size: 17px; color: var(--c-ink); }
.privacy-box--inline { padding: 14px 16px; }
.privacy-footer {
  margin-top: 12px;
  font-size: 15px;
  color: var(--c-muted);
}

/* ---------- result ---------- */
.result__title { color: var(--c-blue); }
.result__lede { color: var(--c-ink-soft); margin: 0 0 18px; }

.result__top { display: grid; gap: 14px; }
.result-card {
  background: white;
  border: 1.5px solid var(--c-blue-100);
  border-radius: var(--r-md);
  padding: 18px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.result-card--top {
  border-color: var(--c-gold);
  background: linear-gradient(180deg, #fffaf0, #ffffff);
}
.result-card__rank {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--c-gold);
}
.result-card--top .result-card__rank { color: var(--c-blue); }
.result-card__name {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-blue);
  margin: 0;
}
.result-card__desc {
  font-size: 16px;
  color: var(--c-ink-soft);
  margin: 0;
}
.result-card__ref {
  font-size: 15px;
  color: var(--c-muted);
}
.result-card .btn { margin-top: 4px; }

.result__share--inline {
  margin: 22px 0 0;
  padding: 18px;
  background: var(--c-blue);
  color: white;
  border-radius: var(--r-md);
  text-align: center;
}
.result__share--inline h3 { margin: 0 0 4px; color: white; font-size: 19px; }
.result__share--inline p  { margin: 0 0 12px; opacity: .92; font-size: 16px; }
.result__share--inline .btn { width: 100%; }

.result__toggle-wrap { margin: 22px 0 0; }
.result__rest {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.result__share {
  margin-top: 26px;
  padding: 20px;
  background: var(--c-blue);
  color: white;
  border-radius: var(--r-md);
  text-align: center;
}
.result__share h3 { margin: 0 0 6px; color: white; }
.result__share p { margin: 0 0 14px; opacity: .9; }
.result__share .btn { width: 100%; }

.result__cta-bottom {
  margin: 26px 0 0;
  text-align: center;
  font-weight: 600;
  color: var(--c-blue);
}

/* ---------- thanks ---------- */
.step--thanks .step__inner { text-align: center; }
.thanks__mascotte {
  width: 140px;
  height: auto;
  margin: 0 auto 12px;
}
.thanks__lede { color: var(--c-ink-soft); }
.thanks__cta {
  margin: 18px 0 0;
  font-weight: 700;
  color: var(--c-blue);
}

/* ---------- footer ---------- */
.site-footer {
  padding: 20px 18px;
  text-align: center;
  color: var(--c-muted);
  font-size: 15px;
}
.site-footer__sep { margin: 0 8px; opacity: .5; }
.site-footer__link {
  color: var(--c-blue-700);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.site-footer__link:hover { color: var(--c-blue); }

/* ---------- dialog (modale Privacy) ---------- */
.dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 560px);
  width: 100%;
}
.dialog::backdrop {
  background: rgba(10, 26, 51, .55);
  backdrop-filter: blur(2px);
}
.dialog__inner {
  background: var(--c-paper);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-lg);
  color: var(--c-ink);
}
.dialog__title {
  margin: 0 0 14px;
  color: var(--c-blue);
  font-size: 24px;
  line-height: 1.2;
}
.dialog__inner p {
  margin: 0 0 12px;
  color: var(--c-ink-soft);
  line-height: 1.5;
}
.dialog__inner p strong { color: var(--c-ink); }
.dialog__inner p em { color: var(--c-blue-700); font-style: normal; font-weight: 600; }
.dialog__actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}
.dialog__actions .btn { min-width: 140px; }

/* ---------- breakpoints ---------- */
@media (min-width: 640px) {
  .step__inner { padding: 32px 30px; }
  .hero__title { font-size: 44px; }
  .step__title { font-size: 34px; }
}
