/* ═══════════════════════════════════════════════════
   PASSAPORTO DEL VINO — stile Sovra Naturale
   Fonte: design system «Sovra Naturale» (locandine del festival).
   Ordine: font → token → base → componenti → schermate → dialog.
   ═══════════════════════════════════════════════════ */

/* ───── FONT (OFL, serviti in locale per PWA e canvas) ───── */
@font-face { font-family: 'Gochi Hand'; src: url('/assets/fonts/GochiHand-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Patrick Hand'; src: url('/assets/fonts/PatrickHand-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bowlby One'; src: url('/assets/fonts/BowlbyOne-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }

/* ───── TOKEN ───── */
:root {
  /* Primitivi */
  --viola: #5e4795;
  --viola-notte: #3f2f6b;
  --burro: #fef0af;
  --panna: #fff9e3;
  --rosa: #f6b4be;
  /* Rosa per testo su viola: 5,4:1 contro i 4,3:1 di --rosa, leggibile anche al sole. */
  --rosa-luce: #fad2d8;
  --lilla: #cebfe0;
  --paglia: #efe09f;
  --oro: #ffe68c;

  /* Tipografia */
  --font-display: 'Gochi Hand', 'Patrick Hand', 'Comic Sans MS', cursive;
  --font-hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --font-blocco: 'Bowlby One', 'Arial Black', sans-serif;
  /* Le cifre di Gochi Hand si confondono (5/S): i numeri usano Patrick Hand */
  --font-numeri: var(--font-hand);

  /* Spazi */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-10: 40px;
  --space-16: 64px;

  /* Raggi, tratti, ombre */
  --radius-sm: 12px;
  --radius-lg: 32px;
  --radius-pill: 999px;
  --radius-onda: 40px 56px 44px 60px / 52px 40px 60px 44px;
  --stroke-segno: 3px;
  --stroke-cornice: 6px;
  --shadow-sfalsata: 10px 10px 0 var(--rosa);
  --shadow-pill: 4px 4px 0 var(--rosa);

  /* Velo dei dialog: viola-notte pieno, senza blur */
  --velo: rgba(63, 47, 107, 0.78);

  /* Forma smerlata del bollino, usata come maschera */
  --smerlo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 6.5A10.6 10.6 0 0 1 68.9 10.8A10.6 10.6 0 0 1 84 22.9A10.6 10.6 0 0 1 92.4 40.3A10.6 10.6 0 0 1 92.4 59.7A10.6 10.6 0 0 1 84 77.1A10.6 10.6 0 0 1 68.9 89.2A10.6 10.6 0 0 1 50 93.5A10.6 10.6 0 0 1 31.1 89.2A10.6 10.6 0 0 1 16 77.1A10.6 10.6 0 0 1 7.6 59.7A10.6 10.6 0 0 1 7.6 40.3A10.6 10.6 0 0 1 16 22.9A10.6 10.6 0 0 1 31.1 10.8A10.6 10.6 0 0 1 50 6.5Z'/%3E%3C/svg%3E");
}

/* Tema burro: fondo giallo, testo viola (default). */
:root, [data-theme="burro"] {
  --surface: var(--burro);
  --surface-alt: var(--lilla);
  --ink: var(--viola);
  --ink-strong: var(--viola-notte);
  --ink-accent: var(--viola-notte);
  --panel: var(--viola);
  --on-panel: var(--burro);
  --line: var(--viola);
  --focus: var(--viola-notte);
  --field: var(--panna);
  --pill: var(--rosa);
  --on-pill: var(--viola-notte);
}

/* Tema viola: fondo viola, testo burro. */
[data-theme="viola"] {
  --surface: var(--viola);
  --surface-alt: var(--lilla);
  --ink: var(--burro);
  --ink-strong: var(--panna);
  --ink-accent: var(--rosa-luce);
  --panel: var(--burro);
  --on-panel: var(--viola);
  --line: var(--burro);
  --focus: var(--burro);
  --field: var(--panna);
  --pill: var(--lilla);
  --on-pill: var(--viola-notte);
}

/* ───── BASE ───── */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { background: var(--burro); }
body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.4;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ───── LAYOUT ───── */
.screen { display: none; min-height: 100dvh; flex-direction: column; background: var(--surface); color: var(--ink); }
.screen.active { display: flex; }

/* ───── COMPONENTI: testi ricorrenti ───── */
.onboarding-eyebrow, .dna-eyebrow, .wine-detail-eyebrow, .dna-teaser-label,
.section-title, .rating-section-title, .radar-label, .input-label, .story-eyebrow, .tutorial-eyebrow, .tutorial-count {
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

.empty-state-text { font-size: 16px; line-height: 1.45; color: var(--ink); }
.empty-state-text a { font-weight: 400; }

/* ───── COMPONENTI: bottoni a capsula ───── */
.btn-primary, .btn-save, .share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 12px var(--space-6) 10px;
  background: var(--panel);
  color: var(--on-panel);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pill);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.btn-primary { width: 100%; margin-top: var(--space-2); }
.btn-primary:active:not(:disabled), .btn-save:active:not(:disabled), .share-btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--rosa);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  padding: 10px var(--space-6) 8px;
  background: transparent;
  color: var(--ink);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease;
}
.btn-secondary:active:not(:disabled) { transform: translateY(2px); }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled), .btn-save:hover:not(:disabled), .share-btn:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled) { background: var(--rosa); color: var(--viola-notte); }
}

button:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

/* Pulsanti tondi (indietro, impostazioni, chiudi) */
.back-btn, .dna-back, .gear-btn, .settings-close, .story-close, .story-variants button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border: var(--stroke-segno) solid var(--line);
  border-radius: 50%;
  font-family: var(--font-hand);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease;
}
.back-btn:active, .dna-back:active, .gear-btn:active, .settings-close:active { transform: scale(0.94); }
.gear-btn svg { width: 22px; height: 22px; stroke-width: 2; transition: transform 300ms ease; }
@media (hover: hover) and (pointer: fine) {
  .back-btn:hover, .dna-back:hover, .gear-btn:hover, .settings-close:hover, .story-close:hover, .story-variants button:hover {
    background: var(--rosa); color: var(--viola-notte); border-color: var(--viola);
  }
  .gear-btn:hover svg { transform: rotate(45deg); }
}

/* ───── COMPONENTI: campi ───── */
.input-group { margin-bottom: var(--space-4); text-align: left; }
.input-label { display: block; margin: 0 0 var(--space-2) var(--space-4); }
.input-field {
  width: 100%;
  min-height: 52px;
  padding: 12px 22px 10px;
  background: var(--field);
  color: var(--viola-notte);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  font-size: 19px;
  line-height: 1.2;
  outline: none;
  transition: box-shadow 150ms ease;
}
.input-field::placeholder { color: var(--viola); opacity: 0.85; }
.input-field:focus { box-shadow: var(--shadow-pill); }
.input-field:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.input-field[readonly] { background: transparent; color: var(--ink); border-style: dashed; }

/* Consenso classifica: checkbox con etichetta libera */
.input-group > label:not(.input-label) {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
}
input[type="checkbox"] { width: 24px; height: 24px; flex-shrink: 0; margin-top: 1px; accent-color: var(--viola); cursor: pointer; }

/* ───── COMPONENTI: etichette a pillola ───── */
.rating-pill, .wine-tag, .dna-tag, .cantina-chip, .you-badge, .fiera-badge, .tap-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rating-pill { padding: 6px 12px 4px; background: var(--rosa); color: var(--viola-notte); font-size: 15px; }
.wine-tag { padding: 6px 14px 4px; background: var(--rosa); color: var(--viola-notte); font-size: 16px; }
.dna-tag { padding: 8px 16px 6px; background: var(--lilla); color: var(--viola-notte); font-size: 16px; }
.cantina-chip { padding: 10px 18px 8px; background: var(--lilla); color: var(--viola-notte); font-size: 17px; white-space: normal; }
.you-badge { margin-left: var(--space-2); padding: 4px 10px 3px; background: var(--viola); color: var(--burro); font-size: 14px; vertical-align: middle; }

/* ───── COMPONENTI: bollino smerlato ───── */
.stat-number, .wine-bottle, .top-3 .leaderboard-rank {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
}
.stat-number::before, .wine-bottle::before, .top-3 .leaderboard-rank::before,
.stat-number::after, .wine-bottle::after, .top-3 .leaderboard-rank::after {
  content: '';
  position: absolute;
  z-index: -1;
  -webkit-mask: var(--smerlo) center / 100% 100% no-repeat;
  mask: var(--smerlo) center / 100% 100% no-repeat;
}
.stat-number::before, .wine-bottle::before, .top-3 .leaderboard-rank::before { inset: 0; background: var(--line); }
.stat-number::after, .wine-bottle::after, .top-3 .leaderboard-rank::after { inset: 4px; background: var(--bollino, var(--panna)); }

/* ───── TOAST ───── */
.toast {
  position: fixed;
  bottom: 104px;
  left: 50%;
  z-index: 300;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 22px 10px;
  white-space: normal;
  overflow-wrap: anywhere;
  background: var(--viola);
  color: var(--burro);
  border: var(--stroke-segno) solid var(--burro);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pill);
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.2;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  transition: opacity 250ms ease, transform 250ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--rosa); color: var(--viola-notte); border-color: var(--viola); box-shadow: 4px 4px 0 var(--viola); }

/* ═══════════════════════════════════════════════════
   SCHERMATE
   ═══════════════════════════════════════════════════ */

/* ───── CARICAMENTO (tema viola) ───── */
#screen-loading { justify-content: center; align-items: center; padding: var(--space-10) var(--space-6); }
#screen-loading .onboarding-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); min-height: 70dvh; }
#screen-loading .empty-state-text { text-align: center; }
#screen-loading .btn-secondary { width: auto; min-width: 180px; }

.wine-loader {
  --size: 92px;
  --wine-top: var(--rosa);
  --wine-bottom: var(--rosa);
  width: var(--size);
  aspect-ratio: 120 / 180;
  display: inline-block;
  margin: 0 auto;
}
.wine-loader svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wine-loader .glass-outline { fill: none; stroke: var(--line); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.wine-loader .liquid-group { transform: translateY(140px); animation: wl-fillDrain 4.6s infinite; }
.wine-loader .liquid-surface { transform-box: fill-box; transform-origin: center; fill: var(--wine-top); animation: wl-surfaceRipple 2.3s ease-in-out infinite; }
.wine-loader .pour-stream { transform-box: fill-box; transform-origin: top center; fill: var(--wine-top); opacity: 0; transform: scaleY(0); animation: wl-pourStream 4.6s infinite; }

@keyframes wl-fillDrain {
  0%   { transform: translateY(140px); animation-timing-function: ease-in; }
  8%   { transform: translateY(140px); animation-timing-function: cubic-bezier(.45,0,.55,1); }
  38%  { transform: translateY(24px);  animation-timing-function: cubic-bezier(.34,1.4,.64,1); }
  46%  { transform: translateY(30px);  animation-timing-function: ease-out; }
  52%  { transform: translateY(26px);  animation-timing-function: linear; }
  70%  { transform: translateY(26px);  animation-timing-function: cubic-bezier(.6,0,.85,.2); }
  92%  { transform: translateY(140px); animation-timing-function: ease-out; }
  100% { transform: translateY(140px); }
}
@keyframes wl-pourStream {
  0%   { opacity: 0; transform: scaleY(0) translateX(0); }
  7%   { opacity: 0; }
  9%   { opacity: 1; transform: scaleY(.15) translateX(-1px); }
  16%  { transform: scaleY(.55) translateX(1px); }
  23%  { transform: scaleY(.85) translateX(-1px); }
  31%  { transform: scaleY(1)   translateX(1px); }
  37%  { opacity: 1; transform: scaleY(1) translateX(0); }
  41%  { opacity: 0; transform: scaleY(.3) translateX(0); }
  100% { opacity: 0; }
}
@keyframes wl-surfaceRipple {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.03, .82); }
}

.loading-text-carousel { position: relative; height: 34px; width: 100%; margin-top: var(--space-4); }
.loading-text-carousel span {
  position: absolute;
  inset: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
  opacity: 0;
  animation: fadeText 7.5s infinite;
}
.loading-text-carousel span:nth-child(2) { animation-delay: 2.5s; }
.loading-text-carousel span:nth-child(3) { animation-delay: 5s; }
@keyframes fadeText {
  0% { opacity: 0; transform: translateY(6px); }
  8%, 25% { opacity: 1; transform: translateY(0); }
  33%, 100% { opacity: 0; transform: translateY(-6px); }
}

/* ───── ONBOARDING (tema burro) ───── */
#screen-onboarding { justify-content: center; align-items: center; padding: var(--space-10) var(--space-6); }
.onboarding-inner { width: 100%; max-width: 400px; text-align: center; }
#onboarding-resend-btn, #onboarding-reset-btn { margin-top: var(--space-3); }

.event-brand { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.event-brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.event-brand-welcome { width: 230px; margin: 0 auto var(--space-6); }
.event-brand-compact { width: 92px; }
.passport-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }

.onboarding-eyebrow { margin-bottom: var(--space-4); }

/* La nuvola: il pezzo centrale della schermata, con l'ombra rosa. */
.onboarding-title {
  margin: 0 auto var(--space-6);
  padding: var(--space-6) var(--space-6) 28px;
  max-width: 340px;
  background: var(--panel);
  color: var(--on-panel);
  border-radius: var(--radius-onda);
  box-shadow: var(--shadow-sfalsata);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
}
.onboarding-title em {
  display: block;
  margin: 6px 0 4px;
  font-family: var(--font-blocco);
  font-size: clamp(26px, 9vw, 40px);
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--rosa-luce);
}

.onboarding-sub { margin-bottom: var(--space-6); font-size: 19px; line-height: 1.4; }
#screen-onboarding .empty-state-text { margin: var(--space-2) 0 var(--space-3); }

.fiera-badge {
  margin-top: var(--space-10);
  padding: 10px 22px 8px;
  background: var(--rosa);
  color: var(--viola-notte);
  border: var(--stroke-segno) solid var(--viola);
  font-size: 18px;
  transform: rotate(-2deg);
}
.fiera-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--viola); }
.fiera-name { font-family: var(--font-display); font-size: 22px; }

/* ───── HOME / PASSAPORTO (tema burro) ───── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 20px;
  background: var(--surface);
  border-bottom: var(--stroke-segno) solid var(--line);
}
.top-bar-logo { font-family: var(--font-display); font-size: 28px; line-height: 1; text-transform: uppercase; color: var(--ink); }
.top-bar-right { display: flex; align-items: center; gap: var(--space-3); }

.tap-hint { padding: 7px 14px 5px; background: var(--rosa); color: var(--viola-notte); font-size: 15px; }
.tap-hint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--viola); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.home-content { flex: 1; overflow-y: auto; padding: var(--space-6) 20px 120px; }

/* Statistiche come bollini */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-bottom: var(--space-10); }
.stat-card { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; }
.stat-card:nth-child(2) { --bollino: var(--rosa); }
.stat-card:nth-child(3) { --bollino: var(--lilla); }
.stat-number {
  width: 88px;
  height: 88px;
  font-family: var(--font-numeri);
  font-size: 40px;
  line-height: 1;
  color: var(--viola-notte);
}
.stat-card:nth-child(1) .stat-number { transform: rotate(-6deg); }
.stat-card:nth-child(3) .stat-number { transform: rotate(5deg); }
.stat-label { font-size: 15px; line-height: 1.1; letter-spacing: 0.04em; text-transform: uppercase; }

/* Teaser Wine DNA: la nuvola della home */
.dna-teaser {
  position: relative;
  margin: 0 var(--space-2) var(--space-10) 0;
  padding: var(--space-6) 28px;
  background: var(--panel);
  color: var(--on-panel);
  border-radius: var(--radius-onda);
  box-shadow: var(--shadow-sfalsata);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.dna-teaser:active { transform: translate(4px, 4px); box-shadow: 6px 6px 0 var(--rosa); }
.dna-teaser .dna-teaser-label { color: var(--on-panel); margin-bottom: var(--space-2); }
.dna-teaser-text { margin-bottom: var(--space-4); font-family: var(--font-display); font-size: 28px; line-height: 1.05; text-transform: uppercase; }
.dna-teaser-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px 6px;
  background: var(--rosa);
  color: var(--viola-notte);
  border-radius: var(--radius-pill);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dna-teaser-arrow { font-family: system-ui, sans-serif; font-size: 16px; }

/* Intestazione di sezione */
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-4); }
.section-title { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.02em; }
.section-count { font-family: var(--font-numeri); font-size: 24px; color: var(--ink); }

/* Card vino */
.wine-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  padding: var(--space-4) 20px;
  background: var(--panna);
  color: var(--viola);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background-color 150ms ease, transform 120ms ease;
}
.wine-card:active { transform: translateY(2px); background: var(--paglia); }
@media (hover: hover) and (pointer: fine) { .wine-card:hover { background: var(--paglia); } }
.wine-card-color { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: var(--stroke-segno) solid var(--line); }
.wine-card-info { flex: 1; min-width: 0; }
.wine-card-name { display: -webkit-box; margin-bottom: 4px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-family: var(--font-display); font-size: 24px; line-height: 1.05; text-transform: uppercase; overflow-wrap: anywhere; }
.wine-card-cantina { margin-bottom: var(--space-2); font-size: 16px; line-height: 1.2; }
.wine-card-ratings { display: flex; flex-wrap: wrap; gap: 6px; }
.wine-card-score { flex-shrink: 0; font-family: var(--font-numeri); font-size: 36px; line-height: 1; color: var(--viola); }

/* Stato vuoto */
.empty-state { padding: var(--space-10) var(--space-6); text-align: center; color: var(--ink); }
.empty-state-icon {
  width: 72px;
  height: 128px;
  margin: 0 auto var(--space-4);
  background: url('/assets/story/bottle.png') center / contain no-repeat;
  font-size: 0;
  transform: rotate(-8deg);
}
.empty-state-title { margin-bottom: var(--space-2); font-family: var(--font-display); font-size: 28px; line-height: 1.05; text-transform: uppercase; }

/* Barra di navigazione */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-2) max(var(--space-3), env(safe-area-inset-bottom));
  background: var(--burro);
  border-top: var(--stroke-segno) solid var(--viola);
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 4px 4px;
  background: none;
  color: var(--viola);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.nav-tab svg { width: 24px; height: 24px; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-tab.active { background: var(--rosa); color: var(--viola-notte); }

@media (max-width: 480px) {
  .top-bar { padding: 10px var(--space-4); gap: var(--space-2); }
  .top-bar .tap-hint { display: none; }
  .passport-brand { gap: 10px; }
}
@media (max-height: 740px) {
  #screen-onboarding { padding: var(--space-6); }
  .event-brand-welcome { width: 190px; margin-bottom: var(--space-4); }
  .onboarding-title { font-size: 30px; padding: 18px var(--space-6) 22px; margin-bottom: var(--space-4); }
  .onboarding-title em { font-size: clamp(24px, 8.4vw, 34px); }
  .onboarding-sub { margin-bottom: var(--space-4); font-size: 17px; }
  #screen-onboarding .fiera-badge { margin-top: var(--space-6); }
}

/* ───── DETTAGLIO VINO (testata viola, corpo burro) ───── */
.wine-hero {
  position: relative;
  padding: 76px var(--space-6) 52px;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  border-radius: 0 0 48% 52% / 0 0 44px 30px;
}
.back-btn { position: fixed; top: 16px; left: 16px; z-index: 100; background: var(--burro); color: var(--viola); border-color: var(--viola); box-shadow: 3px 3px 0 var(--rosa); }
.wine-bottle {
  --bollino: var(--burro);
  width: 116px;
  height: 116px;
  margin: 0 auto var(--space-4);
  transform: rotate(-6deg);
}
.wine-bottle img { width: auto; height: 84px; display: block; }
.wine-detail-eyebrow { margin-bottom: var(--space-2); }
.wine-detail-name { margin-bottom: var(--space-2); font-family: var(--font-display); font-size: 42px; font-weight: 400; line-height: 1; text-transform: uppercase; overflow-wrap: anywhere; }
.wine-detail-meta { font-size: 18px; line-height: 1.4; }

.wine-detail-content { padding: var(--space-6) 20px 128px; }
.wine-desc {
  margin-bottom: var(--space-6);
  padding: 20px var(--space-6);
  background: var(--panna);
  color: var(--viola);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-lg);
  font-size: 19px;
  line-height: 1.45;
}
.wine-desc:empty { display: none; }
#wine-status:not(:empty) { margin-bottom: var(--space-4); font-size: 17px; }
#wine-retry-btn { margin-bottom: var(--space-6); }

/* Slider di valutazione */
.rating-section { margin-bottom: var(--space-10); }
.rating-section-title { margin-bottom: var(--space-4); font-family: var(--font-display); font-size: 28px; letter-spacing: 0.02em; }
.slider-row { margin-bottom: var(--space-6); }
.slider-labels { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-2); }
.slider-label-name { font-size: 19px; text-transform: uppercase; letter-spacing: 0.04em; }
.slider-label-value { font-family: var(--font-numeri); font-size: 28px; line-height: 1; }
.slider-ends { display: flex; justify-content: space-between; margin-top: 6px; }
.slider-end { font-size: 15px; }

input[type="range"] {
  width: 100%;
  height: 16px;
  -webkit-appearance: none;
  appearance: none;
  /* Riempimento netto: due campiture, nessuna sfumatura */
  background: linear-gradient(to right, var(--viola) var(--val, 50%), var(--lilla) var(--val, 50%));
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}
input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  background: var(--rosa);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 150ms ease;
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--rosa);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: 50%;
  cursor: pointer;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }

/* Chip emozione */
.emozione-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-6); }
.emo-chip {
  min-height: 44px;
  padding: 10px 18px 8px;
  background: var(--panna);
  color: var(--viola);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 150ms ease, transform 120ms ease;
}
.emo-chip:active { transform: translateY(2px); }
.emo-chip.selected { background: var(--rosa); color: var(--viola-notte); box-shadow: 3px 3px 0 var(--viola); }
@media (hover: hover) and (pointer: fine) { .emo-chip:not(.selected):hover { background: var(--paglia); } }

/* CTA fissa */
.wine-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: var(--space-3) 20px max(20px, env(safe-area-inset-bottom));
  background: var(--burro);
  border-top: var(--stroke-segno) solid var(--viola);
}
.wine-cta .btn-secondary { flex: 1; }
.btn-save { flex: 2; width: 100%; }

/* ───── WINE DNA (tema viola) ───── */
#screen-dna { position: relative; overflow-y: auto; }
.dna-top-bar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-4) 0; }
.dna-top-bar .dna-back { position: static; margin: 0; }

.dna-header { padding: var(--space-6) var(--space-6) var(--space-10); text-align: center; }
.dna-eyebrow { margin-bottom: var(--space-3); }
.dna-title { margin-bottom: var(--space-2); font-family: var(--font-display); font-size: 52px; font-weight: 400; line-height: 0.95; text-transform: uppercase; }
.dna-subtitle { font-size: 18px; line-height: 1.35; }

.dna-content { flex: 1; overflow-y: auto; padding: 0 20px 128px; }
.dna-content > .empty-state-text { margin-top: var(--space-4); }

/* La nuvola del profilo: pezzo centrale della schermata */
.dna-profile-card {
  margin: 0 var(--space-2) var(--space-10) 0;
  padding: 28px;
  background: var(--panel);
  color: var(--on-panel);
  border-radius: var(--radius-onda);
  box-shadow: var(--shadow-sfalsata);
}
.dna-loading { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-6); font-size: 18px; text-align: center; }
.dna-spinner, .loading-spinner {
  width: 40px;
  height: 40px;
  border: 5px solid var(--lilla);
  border-top-color: var(--rosa);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-spinner { border-color: var(--lilla); border-top-color: var(--viola); }
@keyframes spin { to { transform: rotate(360deg); } }

.dna-generated-text { font-size: 20px; line-height: 1.45; color: var(--on-panel); }
.dna-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 20px; }

/* Profilo sensoriale */
.radar-section, .cantine-section { margin-bottom: var(--space-10); }
.radar-label { margin-bottom: var(--space-4); font-family: var(--font-display); font-size: 28px; letter-spacing: 0.02em; }
.radar-bars { display: flex; flex-direction: column; gap: var(--space-4); }
.radar-bar-row { display: flex; align-items: center; gap: var(--space-3); }
.radar-bar-name { width: 104px; flex-shrink: 0; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; }
.radar-bar-track { flex: 1; height: 18px; overflow: hidden; background: var(--lilla); border: var(--stroke-segno) solid var(--line); border-radius: var(--radius-pill); }
.radar-bar-fill { height: 100%; background: var(--rosa); border-radius: var(--radius-pill); transition: width 1s ease; }
.radar-bar-value { width: 48px; flex-shrink: 0; font-family: var(--font-numeri); font-size: 26px; line-height: 1; text-align: right; color: var(--ink-accent); }

.cantina-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.share-btn {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: calc(100vw - 40px);
  transform: translateX(-50%);
  white-space: nowrap;
}
.share-btn:active:not(:disabled) { transform: translateX(-50%) translate(3px, 3px); }

/* ───── CLASSIFICA (tema burro) ───── */
#screen-leaderboard { position: relative; min-height: 100dvh; overflow-y: auto; padding-bottom: 120px; }
#screen-leaderboard .dna-header { padding-bottom: var(--space-6); }
.leaderboard-content { margin-top: var(--space-2); padding: 0 20px; }
.leaderboard-content > .empty-state-text { margin: var(--space-6) 0 var(--space-4); }
.leaderboard-content > .btn-secondary { margin-top: var(--space-4); }
.leaderboard-list { display: flex; flex-direction: column; gap: var(--space-3); padding: 0; margin: 0; list-style: none; }

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 20px var(--space-3) var(--space-3);
  background: var(--panna);
  color: var(--viola);
  border: var(--stroke-segno) solid var(--line);
  border-radius: var(--radius-pill);
  opacity: 0;
  animation: slideUpFade 0.4s ease forwards;
}
.leaderboard-item.top-3 { padding-top: var(--space-4); padding-bottom: var(--space-4); border-radius: var(--radius-lg); }
.leaderboard-item.is-self { background: var(--rosa); color: var(--viola-notte); box-shadow: 4px 4px 0 var(--viola); }

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  background: var(--lilla);
  color: var(--viola-notte);
  border-radius: 50%;
  font-family: var(--font-numeri);
  font-size: 22px;
  line-height: 1;
}
.top-3 .leaderboard-rank { width: 64px; height: 64px; background: none; font-size: 32px; }
.leaderboard-item.top-3:nth-child(1) { --bollino: var(--rosa); }
.leaderboard-item.top-3:nth-child(2) { --bollino: var(--lilla); }
.leaderboard-item.top-3:nth-child(3) { --bollino: var(--oro); }
.leaderboard-item.top-3.is-self { --bollino: var(--panna); }

.leaderboard-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.leaderboard-name { font-family: var(--font-display); font-size: 22px; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.leaderboard-count { font-size: 17px; }
.leaderboard-count strong { font-family: var(--font-numeri); font-size: 22px; font-weight: 400; }

@keyframes slideUpFade {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ───── IMPOSTAZIONI (foglio dal basso) ───── */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--velo);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.settings-overlay.open { display: block; opacity: 1; }

.settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-3) var(--space-6) max(var(--space-10), env(safe-area-inset-bottom));
  background: var(--burro);
  color: var(--viola);
  border-top: var(--stroke-cornice) solid var(--viola);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}
.settings-panel.open { transform: translateY(0); }
.settings-handle { width: 56px; height: 6px; margin: 0 auto 20px; background: var(--viola); border-radius: var(--radius-pill); }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
.settings-title { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1; text-transform: uppercase; }
.settings-body { margin-bottom: var(--space-2); }
.settings-panel .empty-state-text { font-size: 15px; }
.settings-footer { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-6); }
.settings-footer .btn-primary { margin-top: 0; }

/* ═══════════════════════════════════════════════════
   DIALOG
   ═══════════════════════════════════════════════════ */

/* ───── TUTORIAL DOPO L’ACCESSO ───── */
body.tutorial-open { overflow: hidden; }
.tutorial-dialog {
  margin: auto;
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: var(--space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--burro);
  color: var(--viola);
  border: var(--stroke-cornice) solid var(--viola);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sfalsata);
  font-family: var(--font-hand);
}
.tutorial-dialog[open] { animation: tutorial-appear 220ms ease-out; }
.tutorial-dialog::backdrop { background: var(--velo); }
.tutorial-topline { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.tutorial-skip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  flex-shrink: 0;
  padding: 6px 14px 4px;
  background: transparent;
  color: var(--viola);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.tutorial-skip:hover { background: var(--rosa); color: var(--viola-notte); }
.tutorial-skip span { font-size: 22px; line-height: 1; }
.tutorial-art { padding: var(--space-3) 0 var(--space-6); text-align: center; color: var(--viola); }
.tutorial-art svg { display: block; width: 200px; height: 120px; margin: 0 auto var(--space-3); }
.tutorial-art-paper { fill: var(--panna); }
.tutorial-art-label { fill: var(--rosa); }
.tutorial-sticker {
  display: inline-block;
  padding: 8px 18px 6px;
  background: var(--rosa);
  color: var(--viola-notte);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  transform: rotate(-3deg);
}
.tutorial-count { margin-bottom: var(--space-2); font-size: 15px; }
.tutorial-title { margin-bottom: var(--space-3); font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1; text-transform: uppercase; color: var(--viola); }
.tutorial-description { font-size: 18px; line-height: 1.45; }
.tutorial-hint { margin-top: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--lilla); color: var(--viola-notte); border-radius: var(--radius-sm); font-size: 16px; line-height: 1.4; }
.tutorial-progress { display: flex; gap: 6px; justify-content: center; margin: var(--space-6) 0 var(--space-4); }
.tutorial-progress span { width: 12px; height: 12px; border: 2px solid var(--viola); border-radius: var(--radius-pill); background: transparent; transition: width 180ms ease, background-color 180ms ease; }
.tutorial-progress .is-current { width: 32px; background: var(--rosa); }
.tutorial-progress .is-complete { background: var(--viola); }
.tutorial-actions { display: flex; align-items: center; gap: var(--space-3); }
.tutorial-dialog .tutorial-actions button { margin: 0; min-height: 52px; }
.tutorial-dialog .tutorial-actions .btn-secondary { width: auto; flex-shrink: 0; padding: 10px 18px 8px; }
.tutorial-dialog .tutorial-actions .btn-primary { flex: 1; }
@keyframes tutorial-appear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 380px), (max-height: 700px) {
  .tutorial-dialog { padding: 18px; }
  .tutorial-art { padding: 4px 0 18px; }
  .tutorial-art svg { width: 160px; height: 96px; }
  .tutorial-title { font-size: 30px; }
  .tutorial-progress { margin-top: 18px; }
}
@media (max-height: 600px) {
  .tutorial-dialog { padding: var(--space-4); }
  .tutorial-art { padding: 0 0 var(--space-3); }
  .tutorial-art svg { width: 110px; height: 66px; margin-bottom: 4px; }
  .tutorial-sticker { font-size: 17px; padding: 5px 14px 3px; }
  .tutorial-title { font-size: 27px; margin-bottom: var(--space-2); }
  .tutorial-description { font-size: 17px; line-height: 1.4; }
  .tutorial-hint { font-size: 15px; margin-top: var(--space-3); padding: 10px; }
  .tutorial-progress { margin: var(--space-4) 0 var(--space-3); }
  .tutorial-dialog .tutorial-actions button { font-size: 19px; }
}

/* ───── COMPOSITORE DI STORIE ───── */
body.story-open { overflow: hidden; }
.story-dialog {
  box-sizing: border-box;
  width: min(880px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--burro);
  color: var(--viola);
  border: var(--stroke-cornice) solid var(--viola);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sfalsata);
  font-family: var(--font-hand);
}
.story-dialog::backdrop { background: var(--velo); }
.story-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.story-heading, .story-intro, .story-footer { flex-shrink: 0; }
.story-dialog [hidden] { display: none !important; }
.story-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.story-eyebrow { margin: 0 0 6px; font-size: 15px; }
.story-heading h2 { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1; text-transform: uppercase; color: var(--viola); }
.story-close { font-size: 28px; }
.story-intro { margin: 10px 0 22px; font-size: 18px; line-height: 1.4; }
.story-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; align-items: center; overflow-y: auto; min-height: 0; padding: 5px; }
.story-art-column { min-width: 0; }
.story-preview-wrap {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  max-width: min(322px, calc((100dvh - 380px) * .5625));
  margin: auto;
  overflow: hidden;
  background: var(--panna);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-sm);
  touch-action: pan-y;
}
.story-preview-wrap canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; }
.story-preview-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-family: var(--font-display); font-size: 32px; line-height: 1.1; text-transform: uppercase; color: var(--viola); }
.story-preview-wrap[aria-busy="true"]::after { content: ''; position: absolute; z-index: 2; bottom: 0; left: 0; height: 6px; width: 100%; background: var(--rosa); animation: story-pulse 1s ease-in-out infinite alternate; }
.story-variants { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-3); }
.story-variants span { font-size: 16px; }
.story-summary { margin: 0 0 20px; font-size: 18px; line-height: 1.4; color: var(--viola); }
.story-palette-field { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.story-palette-field legend { margin-bottom: var(--space-3); font-family: var(--font-display); font-size: 22px; text-transform: uppercase; }
.story-palettes { display: flex; flex-wrap: wrap; gap: 8px; }
/* Il campione mostra le due tinte piatte della palette, divise in diagonale */
.story-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: var(--stroke-segno) solid var(--viola);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--swatch-a) 50%, var(--swatch-b) 50%);
  cursor: pointer;
}
.story-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--burro), 0 0 0 6px var(--viola); }
.story-swatch[aria-pressed="true"]::after { content: '✓'; color: var(--viola-notte); font-size: 22px; font-weight: bold; }
.story-theme-selection { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-3); font-size: 16px; }
.story-auto {
  min-height: 40px;
  padding: 8px 16px 6px;
  background: transparent;
  color: var(--viola);
  border: var(--stroke-segno) solid var(--viola);
  border-radius: var(--radius-pill);
  font-family: var(--font-hand);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.story-auto[aria-pressed="true"] { background: var(--viola); color: var(--burro); }
.story-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 58px; border-top: 2px dashed var(--viola); font-size: 18px; cursor: pointer; }
.story-toggle small { display: block; margin-top: 2px; font-size: 15px; }
.story-note, .story-save-hint { font-size: 16px; line-height: 1.4; }
.story-note { margin: var(--space-3) 0; }
.story-status { min-height: 32px; margin: 14px 0 8px; font-size: 16px; line-height: 1.4; }
.story-footer { margin-top: 10px; padding-top: 14px; border-top: var(--stroke-segno) solid var(--viola); }
.story-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; }
.story-dialog .story-actions button { margin: 0; min-height: 52px; font-size: 20px; }
.story-save-hint { margin: 10px 0 0; text-align: center; font-size: 15px; }
.story-dialog button:disabled { cursor: wait; }
@keyframes story-pulse { from { opacity: .3; } to { opacity: 1; } }
@media (max-width: 620px) {
  .story-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 18px; border-width: var(--stroke-segno); border-radius: 24px; box-shadow: 4px 4px 0 var(--rosa); }
  .story-heading h2 { font-size: 28px; }
  .story-intro { margin: 8px 0 10px; font-size: 16px; }
  .story-workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .story-preview-wrap { max-width: min(260px, 24vh); max-width: min(260px, 24dvh); }
  .story-summary { margin-bottom: var(--space-3); text-align: center; }
  .story-options { max-width: 380px; width: 100%; margin: auto; }
  .story-palettes { justify-content: space-between; }
  .story-palette-field { margin-bottom: var(--space-3); }
  .story-dialog .story-actions button { padding: 10px 8px 8px; font-size: 16px; letter-spacing: 0; }
}
@media (max-width: 360px) { .story-palettes { display: grid; grid-template-columns: repeat(3, 44px); justify-content: space-around; gap: 10px; } }

/* ───── SCHERMI LARGHI: colonna centrale come un foglio ───── */
@media (min-width: 720px) {
  .home-content, .wine-detail-content, .dna-content, .leaderboard-content, .dna-header, .wine-hero > :not(.back-btn):not(.wine-bottle) {
    width: 100%;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  .stats-row { gap: var(--space-6); }
  .wine-cta { justify-content: center; }
  .wine-cta > * { max-width: 600px; }
}

/* ───── PAGINA PRIVACY ───── */
.privacy-page { max-width: 720px; margin: 0 auto; padding: var(--space-10) var(--space-6) var(--space-16); font-size: 19px; line-height: 1.55; }
.privacy-page h1 { margin-bottom: var(--space-6); font-family: var(--font-display); font-size: 52px; font-weight: 400; line-height: 1; text-transform: uppercase; }
.privacy-page h2 { margin: var(--space-10) 0 var(--space-4); font-family: var(--font-display); font-size: 30px; font-weight: 400; line-height: 1.05; text-transform: uppercase; }
.privacy-page p, .privacy-page li { margin-bottom: var(--space-4); }
.privacy-page p:first-of-type { padding: var(--space-4) var(--space-6); background: var(--rosa); color: var(--viola-notte); border: var(--stroke-segno) solid var(--viola); border-radius: var(--radius-lg); }
.privacy-page ul { padding-left: var(--space-6); }
.privacy-page > a { display: inline-flex; margin-top: var(--space-6); padding: 12px var(--space-6) 10px; background: var(--viola); color: var(--burro); border-radius: var(--radius-pill); box-shadow: var(--shadow-pill); font-family: var(--font-display); font-size: 22px; text-decoration: none; text-transform: uppercase; }

/* ───── MOVIMENTO RIDOTTO ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .wine-loader .liquid-group, .wine-loader .pour-stream, .wine-loader .liquid-surface { animation: none !important; }
  .wine-loader .liquid-group { transform: translateY(26px); }
  .wine-loader .pour-stream { opacity: 0; }
  .loading-text-carousel span { animation: none; }
  .loading-text-carousel span:first-child { opacity: 1; }
  .tap-hint-dot, .dna-spinner, .loading-spinner, .story-preview-wrap[aria-busy="true"]::after { animation: none; }
  .leaderboard-item { animation: none; opacity: 1; }
  .tutorial-dialog[open] { animation: none; }
}
