/* Stile del menù cartaceo di Bar Ruocco: carta avorio, Playfair Display, Allura, cornici bronzo, illustrazioni a tratto. */
/* font del menù cartaceo, ospitati nel sito: nessuna chiamata a server esterni */
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400 900; font-display: swap; src: url(../assets/fonts/playfair.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 400 700; font-display: swap; src: url(../assets/fonts/playfair-italic.woff2) format('woff2'); }
@font-face { font-family: 'Allura'; font-style: normal; font-weight: 400; font-display: swap; src: url(../assets/fonts/allura.woff2) format('woff2'); }

:root {
  --paper: #f3eadb;
  --paper-2: #efe4d1;
  --vetrina: #e6d9c0;       /* i riquadri beige che ospitano le fette nel menù */
  --vetrina-2: #dccbad;
  --card: #fbf6ec;
  --ink: #3b2416;           /* titoli */
  --ink-2: #765a47;         /* voci e corsivi */
  --line: rgba(118, 90, 71, .28);
  --bronze: #b8945f;        /* cornici e "dal 1882" */
  --wa: #13804a;

  --serif: 'Playfair Display', Georgia, serif;
  --script: 'Allura', cursive;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  accent-color: var(--ink);
  caret-color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; } /* nascosto vuol dire nascosto, anche per i pulsanti con un display proprio */
.i { width: 22px; height: 22px; flex-shrink: 0; }
h1, h2, h3, h4 { text-wrap: balance; }

.screen { position: fixed; inset: 0; display: none; opacity: 0; transition: opacity .5s var(--ease-out); }
.screen.is-active { display: flex; }
.screen.is-in { opacity: 1; }

/* ---------- Cornice con angoli, come le pagine del menù ---------- */
.frame { position: relative; border: 1px solid var(--bronze); }
.frame::before {
  content: ''; position: absolute; inset: -7px; pointer-events: none;
  --c: linear-gradient(var(--bronze), var(--bronze));
  background:
    var(--c) top left / 16px 1px, var(--c) top left / 1px 16px,
    var(--c) top right / 16px 1px, var(--c) top right / 1px 16px,
    var(--c) bottom left / 16px 1px, var(--c) bottom left / 1px 16px,
    var(--c) bottom right / 16px 1px, var(--c) bottom right / 1px 16px;
  background-repeat: no-repeat;
}

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 24px; border-radius: 4px;
  font-family: var(--serif); font-weight: 600; font-size: 17px; text-decoration: none;
  transition: transform .2s var(--ease-out), background-color .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: 0 10px 20px -14px rgba(59, 36, 22, .9); }
.btn-primary .i { transition: transform .25s var(--ease-out); }
@media (hover: hover) { .btn-primary:hover .i { transform: translateX(3px); } }
.btn-icon { width: 54px; padding: 0; border: 1px solid var(--line); color: var(--ink); }
.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 10px 20px -14px rgba(19, 128, 74, .9); }
.btn-link { display: inline-flex; align-items: center; gap: 6px; padding: 10px; font-style: italic; font-size: 16px; color: var(--ink-2); }
.btn-link .i { width: 18px; height: 18px; }

/* ---------- Copertina ---------- */
#intro { overflow-y: auto; scroll-snap-type: y proximity; }
#intro.is-active { display: block; }
.cover {
  min-height: 100svh; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: calc(18px + var(--safe-t)) 20px calc(18px + var(--safe-b));
  position: relative; overflow: hidden; isolation: isolate; background: var(--paper);
}
.cover-logo { width: 150px; height: auto; }
.hero { margin: 14px 0 0; line-height: .9; font-weight: 400; }
.hero-main { display: block; font-size: clamp(76px, 23vw, 128px); font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.hero-script { position: relative; display: inline-block; margin-top: -.18em; font-family: var(--script); font-size: clamp(42px, 12.5vw, 70px); color: #6b4a35; transform: rotate(-3deg); }
.hero-script::after { content: ''; position: absolute; left: 2%; right: 8%; bottom: .2em; border-top: 1.5px solid #6b4a35; }
/* la vetrina è alta quanto alzatina + fetta (circa 1,06 × la larghezza dell'alzatina) e si ridimensiona
   sullo spazio verticale rimasto, così la fetta non sale mai sul titolo */
.cover-scene { --sw: clamp(190px, calc((100svh - 456px) / 1.06), min(80vw, 360px)); position: relative; width: 100%; height: calc(var(--sw) * 1.06); margin: 6px 0 0; flex-shrink: 0; }
/* la fascia beige che sfuma fino al piano su cui poggia l'alzatina, come nel PDF: segue l'alzatina, non la pagina */
.cover-scene::before {
  content: ''; position: absolute; z-index: -1; left: -100vw; right: -100vw; bottom: calc(var(--sw) * .1); height: 100vh;
  background: linear-gradient(to top, var(--vetrina-2), #eee2cd 30%, rgba(243, 234, 219, 0) 75%);
  border-bottom: 1px solid var(--paper-2);
}
.cover-stand { position: absolute; left: 50%; bottom: 0; width: var(--sw); height: auto; transform: translateX(-50%); }
/* la fetta dipinta del menù appoggiata sul piatto dell'alzatina */
.cover-slice { position: absolute; left: 50%; bottom: calc(var(--sw) * .6714 * .74); width: calc(var(--sw) * .7); height: auto; transform: translateX(-50%); }
.cover-arc { width: min(86vw, 330px); height: auto; margin-top: 6px; overflow: visible; }
.cover-arc text { font-family: var(--serif); font-style: italic; font-size: 17px; fill: var(--ink-2); }
.cover-actions { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 8px; }
.cover-actions .btn-primary { width: 100%; }

/* ---------- Frontespizio ---------- */
.frontispiece { min-height: 100svh; scroll-snap-align: start; display: grid; place-items: center; padding: 28px 22px calc(28px + var(--safe-b)); }
.legal { width: min(100%, 460px); margin-top: 22px; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.legal p { margin: 0 0 4px; }
.frontispiece { grid-template-rows: 1fr auto; }
.frontispiece .frame { width: min(100%, 460px); padding: 26px 22px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.chef { width: min(62vw, 250px); height: auto; }
.front-logo { width: 190px; height: auto; margin-top: 8px; }
.motto { margin: 10px 0 0; font-style: italic; font-size: 17px; color: var(--ink-2); }
.caps { margin: 6px 0 18px; font-size: 13px; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-2); }
.toc { width: 100%; display: flex; flex-direction: column; }
.toc button { display: flex; align-items: baseline; gap: 8px; padding: 14px 2px; text-align: left; border-top: 1px solid var(--line); font-size: 19px; font-weight: 700; }
.toc button i { flex: 1; border-bottom: 1.5px dotted var(--ink-2); transform: translateY(-4px); }
.toc button em { font-size: 14px; font-weight: 400; color: var(--ink-2); }

/* ---------- Configuratore ---------- */
#builder { flex-direction: column; }
.stage-wrap { position: relative; height: 41dvh; min-height: 280px; flex-shrink: 0; background: linear-gradient(180deg, var(--paper) 0%, var(--vetrina) 62%, var(--vetrina-2) 100%); }
.stage { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; }
.stage:active { cursor: grabbing; }
.stage canvas { display: block; }
.stage-logo { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: 104px; height: auto; pointer-events: none; z-index: 2; }

.fab {
  position: absolute; top: calc(12px + var(--safe-t)); z-index: 2;
  height: 42px; min-width: 42px; padding: 0 10px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); font-size: 14px; font-weight: 600;
}
.fab-left { left: 14px; }
.fab-right { right: 14px; padding: 0 13px 0 10px; }
.fab .i { width: 19px; height: 19px; }
.fab[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.stage-hint { position: absolute; left: 0; right: 0; bottom: 24px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-style: italic; font-size: 13px; color: var(--ink-2); pointer-events: none; transition: opacity .6s; }
.stage-hint .i { width: 18px; height: 18px; }
.stage-hint.is-hidden { opacity: 0; }
/* avviso sempre presente: l'anteprima è un'idea, la torta la fa a mano il pasticcere */
.stage-note {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2; margin: 0;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 6px 12px; border: 1px solid var(--bronze); border-radius: 3px; background: rgba(251, 246, 236, .94);
  font-style: italic; font-size: 13px; color: var(--ink); pointer-events: none;
}
.stage-note .i { width: 16px; height: 16px; color: var(--bronze); }
.stage-note[hidden] { display: none; }
.stage-hint { bottom: 62px; }

/* riquadro "Fatta a mano" nel riepilogo */
.handmade { display: flex; gap: 14px; align-items: flex-start; padding: 16px; margin: 6px 6px 18px; background: var(--card); }
.handmade > .i { width: 30px; height: 30px; color: var(--bronze); flex-shrink: 0; margin-top: 2px; }
.handmade h4 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.handmade p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }

/* Come nasce */
.story-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 0; font-style: italic; font-size: 15px; color: var(--ink); border-bottom: 1px solid var(--bronze); }
.story-link .i { width: 18px; height: 18px; color: var(--bronze); }
.story-link-lg { margin: 0 6px 18px; font-size: 16px; }
.story-body { display: flex; flex-direction: column; gap: 18px; }
.story-intro { margin: 0; font-style: italic; font-size: 16px; color: var(--ink-2); }
.story-text { margin: 0; font-size: 16.5px; line-height: 1.65; color: var(--ink); }
.story-text::first-letter { float: left; font-size: 3.2em; line-height: .85; font-weight: 700; padding: 4px 8px 0 0; color: var(--ink); }
.story-sec + .story-sec { padding-top: 16px; border-top: 1px dotted var(--line); }
.story-pick { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.story-sec:has(.story-text) .story-pick { padding: 12px; background: var(--card); }
.story-pick .thumb { width: 74px; flex-shrink: 0; }
.story-pick strong { display: block; font-size: 17px; margin: 1px 0 0; }
.story-pick p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.story-meta { display: block; margin-bottom: 4px; font-style: italic; font-size: 13.5px; color: var(--bronze); }

/* etichette dell'anatomia, come a pagina 3 */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; display: flex; align-items: center; gap: 6px; transition: opacity .35s; }
.label::before { content: ''; width: 20px; flex-shrink: 0; border-top: 1.5px dotted var(--ink); }
.label span { display: flex; flex-direction: column; min-width: 0; padding: 3px 8px 4px; border-radius: 3px; background: rgba(251, 246, 236, .92); box-shadow: 0 4px 10px -8px rgba(59, 36, 22, .6); line-height: 1.15; }
.label i { font-size: 16px; font-weight: 700; color: var(--ink); }
.label b { font-weight: 400; font-size: 13.5px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.label.is-active i { font-weight: 700; }
.label.is-active b { color: var(--ink); }

/* min-width: 0: le file di giorni e orari scorrono dentro il pannello invece di allargarlo */
.sheet { position: relative; z-index: 1; flex: 1; min-height: 0; min-width: 0; margin-top: -14px; border-radius: 14px 14px 0 0; background: var(--paper); box-shadow: 0 -10px 24px -18px rgba(59, 36, 22, .5); display: flex; flex-direction: column; }
.steps { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; padding: 6px 20px 0; border-bottom: 1px solid var(--line); mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 24px), transparent); }
.steps::-webkit-scrollbar { display: none; }
.step { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; padding: 12px 0 10px; font-size: 15px; color: var(--ink-2); border-bottom: 1.5px solid transparent; margin-bottom: -1px; }
.step .i { width: 14px; height: 14px; color: var(--bronze); }
.step.is-active { color: var(--ink); font-weight: 700; border-color: var(--ink); }

.panel { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 20px 26px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--vetrina-2) transparent; }
.panel-anim > * { animation: rise .5s var(--ease-out) both; }
.panel-anim > *:nth-child(2) { animation-delay: .04s; }
.panel-anim > *:nth-child(n+3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* titolo di sezione: grassetto, filetto che corre a destra, sottotitolo corsivo sotto */
.section-head { position: relative; margin: 0 0 22px; padding-right: 92px; }
.section-head h2, .section-head h3 { margin: 0; display: inline-block; min-width: 62%; padding-bottom: 2px; border-bottom: 1px solid var(--ink); font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.section-head p { margin: 4px 0 0; font-style: italic; font-size: 15px; color: var(--ink-2); }
.decor { position: absolute; right: -6px; top: -14px; height: 104px; width: auto; max-width: 96px; object-fit: contain; opacity: .6; pointer-events: none; }
.subhead { margin: 26px 0 12px; font-size: 21px; font-weight: 400; font-style: italic; }
.subhead small { font-style: normal; font-size: 13px; color: var(--ink-2); margin-left: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 16px 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: center; transition: transform .25s var(--ease-out); }
.tile:active { transform: scale(.96); }
.thumb { position: relative; aspect-ratio: 1; border-radius: 2px; background: var(--vetrina); display: grid; place-items: center; overflow: hidden; transition: box-shadow .2s; }
.thumb img { width: 92%; height: 92%; object-fit: contain; animation: fade .4s ease both; }
.thumb.is-loading::after { content: ''; width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--vetrina-2); animation: breathe 1.4s ease-in-out infinite; }
.thumb .i { width: 38px; height: 38px; color: var(--ink-2); opacity: .5; }
@keyframes fade { from { opacity: 0; } }
@keyframes breathe { 50% { opacity: .4; } }
.tile.is-selected .thumb { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tile-badge { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); display: none; place-items: center; }
.tile-badge .i { width: 13px; height: 13px; }
.tile.is-selected .tile-badge { display: grid; animation: pop .35s var(--ease-out); }
@keyframes pop { from { transform: scale(.4); } }
.tile-name { font-size: 14.5px; line-height: 1.25; color: var(--ink); }
.tile.is-selected .tile-name { font-weight: 700; }
.tile-note { display: block; font-style: italic; font-size: 13px; color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-width: 66px; min-height: 56px; padding: 8px 16px; border-radius: 3px; border: 1px solid var(--line); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; line-height: 1.05; transition: background-color .2s, color .2s, transform .2s var(--ease-out); }
.chip:active { transform: scale(.96); }
.chip small { font-size: 12.5px; font-weight: 400; font-style: italic; color: var(--ink-2); }
.chip.is-text { font-size: 16px; font-weight: 600; }
.chip.is-selected { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-selected small { color: rgba(243, 234, 219, .78); }
.chips-gap { height: 8px; }
.price { margin: 26px 0 0; padding-top: 14px; border-top: 1px dotted var(--line); font-style: italic; font-size: 16px; color: var(--ink-2); }
.price b { font-style: normal; font-size: 22px; color: var(--ink); margin-left: 6px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.field label { font-style: italic; font-size: 15px; color: var(--ink-2); }
.field input, .field select, .field textarea { font: inherit; font-size: 17px; min-height: 50px; padding: 10px 2px; width: 100%; border: 0; border-bottom: 1px solid var(--ink-2); border-radius: 0; background: transparent; color: var(--ink); transition: border-color .2s; }
.field-select { max-width: 200px; }
.field select { appearance: none; background: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%) right 8px center / 6px 6px no-repeat, linear-gradient(-45deg, transparent 50%, var(--ink-2) 50%) right 2px center / 6px 6px no-repeat; }
/* segnaposto chiaramente diversi da un testo scritto: più chiari, corsivi, spariscono appena si scrive */
.field input::placeholder, .field textarea::placeholder { color: #84705f; font-style: italic; font-weight: 400; opacity: 1; }
.field input:focus::placeholder, .field textarea:focus::placeholder { color: transparent; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom: 2px solid var(--ink); }
.field textarea { min-height: 76px; resize: vertical; }
.row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.hint { font-style: italic; font-size: 14px; color: var(--ink-2); margin: -6px 0 18px; }
.hint.is-error { color: #9a2e19; font-style: normal; font-weight: 600; }

/* passaggio Inizia: l'anteprima si riduce a testata e si apre quando si comincia a comporre */
.stage-wrap { transition: height .6s var(--ease-out), min-height .6s var(--ease-out); }
@media (max-width: 859px) { #builder.is-start .stage-wrap { height: calc(66px + var(--safe-t)); min-height: 0; } } /* solo telefono: testata compatta */
#builder .stage, #builder .labels, #builder .stage-note, #builder .stage-hint, #builder .fab-right { transition: opacity .35s ease; }
#builder.is-start :is(.stage, .labels, .stage-note, .stage-hint, .fab-right) { opacity: 0; pointer-events: none; }
#builder.is-start .sheet { margin-top: 0; }
.stage-welcome { display: none; position: absolute; inset: 0; z-index: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 80px 24px 40px; text-align: center; pointer-events: none; }
.welcome-script { margin: 0; font-family: var(--script); font-size: clamp(44px, 4.4vw, 68px); color: #6b4a35; transform: rotate(-3deg); }
.welcome-scene { --sw: min(36vw, 52vh, 480px); position: relative; width: 100%; height: calc(var(--sw) * 1.12); }
.welcome-note { margin: 10px 0 0; font-style: italic; font-size: 16px; color: var(--ink-2); }
@media (min-width: 860px) { #builder.is-start .stage-welcome { display: flex; animation: rise .6s var(--ease-out) both; } }

/* avanzamento: passo, nome, barra; tocco = elenco dei passaggi */
.progress-row { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.progress { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px 20px; text-align: left; }
.sheet-toggle { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; font-size: 13px; font-weight: 600; }
.sheet-toggle .i { width: 16px; height: 16px; transition: transform .3s var(--ease-out); }
#builder.is-collapsed .sheet-toggle .i { transform: rotate(180deg); }
.sheet-grab { display: flex; justify-content: center; width: 100%; padding: 8px 0 2px; touch-action: none; cursor: grab; }
.sheet-grab i { width: 44px; height: 4px; border-radius: 2px; background: var(--line); }

/* pannello chiuso: la torta prende tutto lo schermo, restano passo e Avanti */
#builder.is-collapsed .stage-wrap { height: calc(100dvh - 148px - var(--safe-b)); }
#builder.is-collapsed :is(.panel, .more-hint) { display: none; }
#builder.is-collapsed .sheet { flex: 0 0 auto; }
@media (min-width: 860px) { .sheet-toggle, .sheet-grab { display: none; } }
.progress-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.progress-text small { font-size: 12.5px; font-style: italic; color: var(--ink-2); }
.progress-text b { font-size: 18px; }
.progress-all { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-style: italic; color: var(--ink-2); }
.progress-all .i { width: 16px; height: 16px; }
.progress-bar { position: absolute; left: 20px; right: 20px; bottom: -1px; height: 2px; background: transparent; pointer-events: none; }
.progress-bar i { display: block; height: 100%; background: var(--ink); transition: width .5s var(--ease-out); }
.steps-list { list-style: none; margin: 0; padding: 0; }
.steps-list li + li { border-top: 1px dotted var(--line); }
.restart { margin-top: 18px; }
.restart.is-confirm { background: #9a2e19; border-color: #9a2e19; color: #fff; font-size: 15px; }
.step-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 2px; font-size: 17px; text-align: left; }
.step-row em { margin-left: auto; font-size: 13px; color: var(--bronze); }
.step-num { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 13px; color: var(--ink-2); }
.step-num .i { width: 15px; height: 15px; color: var(--bronze); }
.step-row.is-active { font-weight: 700; }
.step-row.is-active .step-num { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* c'è altro sotto: sfumatura e invito */
.panel.has-more { -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent); }
.more-hint {
  position: absolute; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); box-shadow: 0 6px 14px -8px rgba(59, 36, 22, .5); font-size: 14px; font-style: italic; color: var(--ink);
  animation: nudge 1.6s ease-in-out infinite;
}
.more-hint .i { width: 16px; height: 16px; }
.more-hint[hidden] { display: none; }
@keyframes nudge { 50% { translate: 0 3px; } }

/* passaggio Inizia */
.start-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--card); }
.start-card > .i:first-child { width: 30px; height: 30px; color: var(--bronze); flex-shrink: 0; }
.start-card span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.start-card strong { font-size: 19px; }
.start-card em { font-size: 14px; color: var(--ink-2); }
.start-card > .i:last-child, .preset > .i { width: 18px; height: 18px; color: var(--ink-2); flex-shrink: 0; }
.presets-list { display: flex; flex-direction: column; gap: 10px; }
.presets-list .preset { width: 100%; flex-direction: row; align-items: center; gap: 14px; }
.presets-list .preset > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.presets-list .preset-cake { width: 64px; height: 50px; margin: 0; flex-shrink: 0; }

/* modulo di ritiro: tre parti, scelte rapide con il pollice */
.form-sec { margin: 26px 0 12px; padding-top: 18px; border-top: 1px dotted var(--line); font-size: 19px; font-weight: 700; }
.ritiro > .form-sec:first-child, .presets > .form-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.field-label { margin: 0 0 8px; font-style: italic; font-size: 15px; color: var(--ink-2); }
.row-2 { grid-template-columns: 1fr 1fr; }
.scroller {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 18px; padding: 2px 20px 6px;
  scroll-snap-type: x proximity; mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 22px), transparent);
}
.scroller::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0; scroll-snap-align: start; min-height: 46px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 3px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 16px; font-weight: 600; transition: background-color .2s, color .2s;
}
.giorni .pill { min-width: 58px; padding: 6px 8px; }
.pill b { font-size: 21px; line-height: 1; }
.pill small { font-size: 12px; font-weight: 400; font-style: italic; color: var(--ink-2); }
.pill.is-selected { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pill.is-selected small { color: rgba(243, 234, 219, .8); }
.pill:disabled { opacity: .4; text-decoration: line-through; }
.pill:disabled small:last-child { text-decoration: none; }

/* combinazioni pronte */
.presets { margin-bottom: 8px; }
.presets .hint { margin: -6px 0 12px; }
.preset { flex-shrink: 0; scroll-snap-align: start; width: 136px; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--card); }
.preset-cake { display: flex; flex-direction: column; height: 62px; margin-bottom: 6px; border-radius: 3px 3px 2px 2px; overflow: hidden; box-shadow: 0 6px 12px -8px rgba(59, 36, 22, .5); }
.preset strong { font-size: 15px; line-height: 1.2; }
.preset em { font-size: 13px; color: var(--ink-2); }
.presets > h4:last-child { margin-bottom: 0; }

/* riepilogo: cosa manca, e dopo l'invio */
.missing { display: flex; align-items: center; gap: 6px; width: calc(100% - 12px); margin: 22px 6px 0; padding: 12px 14px; border: 1px solid #9a2e19; border-radius: 3px; color: #9a2e19; font-size: 15px; text-align: left; }
.missing b { flex: 1; }
.missing .i { width: 18px; height: 18px; }
.btn-ghost { width: 100%; border: 1px solid var(--ink); color: var(--ink); }
.sent { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 6px 0; }
.sent-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 24px 18px; background: var(--card); width: 100%; }
.sent-card > .i { width: 40px; height: 40px; color: var(--wa); }
.sent-card h3 { margin: 0; font-size: 24px; font-weight: 700; }
.sent-card p { margin: 0; font-size: 15.5px; line-height: 1.55; }
.sent-code { font-style: italic; color: var(--ink-2); }

/* riepilogo: righe con i puntini, come le voci del menù */
.recap-frame { padding: 18px 16px 8px; margin: 8px 6px 0; }
.recap-frame ~ .hint, .recap-frame ~ .note { margin-top: 26px; }
.recap { margin: 0; }
.recap-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dotted var(--line); }
.recap-row:last-child { border-bottom: 0; }
.recap-row div { flex: 1; min-width: 0; }
.recap-row dt { font-style: italic; font-size: 14px; color: var(--ink-2); }
.recap-row dd { margin: 1px 0 0; font-size: 16.5px; color: var(--ink); }
.recap-row dd::before { content: '·'; margin-right: 3px; color: var(--ink-2); }
.recap-edit { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.recap-edit .i { width: 18px; height: 18px; }
.note { margin: 20px 0 0; font-style: italic; font-size: 14px; color: var(--ink-2); }
.message { margin-top: 14px; border-top: 1px solid var(--line); }
.message summary { padding: 14px 0; font-size: 15px; font-weight: 600; cursor: pointer; }
.message pre { margin: 0; padding: 14px; white-space: pre-wrap; font-family: var(--serif); font-size: 14px; line-height: 1.55; background: var(--vetrina); }
.sign { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.sign img { width: 74px; height: auto; }
.sign p { margin: 0; font-style: italic; font-size: 15px; color: var(--ink-2); }

.actionbar { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--paper); flex-shrink: 0; }
.actionbar .btn-primary, .actionbar .btn-wa { flex: 1; }
.actionbar [hidden] { display: none; }

/* ---------- Classiche ---------- */
#classiche { overflow-y: auto; }
#classiche.is-active { display: block; }
.page { width: min(100%, 560px); margin: 0 auto; padding: calc(14px + var(--safe-t)) 22px calc(36px + var(--safe-b)); }
.page-top { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; margin-bottom: 26px; }
.page-logo { width: 120px; height: auto; justify-self: center; }
.frame-page { padding: 24px 18px 10px; }
.classic-list { display: flex; flex-direction: column; }
.classic { border-bottom: 1px dotted var(--line); }
.classic:last-child { border-bottom: 0; }
.classic-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 13px 0; text-align: left; font-size: 19px; }
.classic-head span::before { content: '·'; margin-right: 3px; color: var(--ink-2); }
.classic-head span { flex: 1; }
.classic-head .i { width: 18px; height: 18px; color: var(--ink-2); transition: transform .3s var(--ease-out); }
.classic.is-open .classic-head { font-weight: 700; }
.classic.is-open .classic-head .i { transform: rotate(90deg); }
.classic-body { padding: 6px 0 22px; animation: rise .4s var(--ease-out) both; }
.classic-body .chips { margin-bottom: 20px; }
.classic-body .btn { width: 100%; }

/* ---------- Modale: dal basso su telefono, al centro su schermi grandi ---------- */
.modal {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92dvh;
  background: var(--paper); color: var(--ink); border-radius: 14px 14px 0 0; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -16px 40px -20px rgba(59, 36, 22, .6);
}
.modal::backdrop { background: rgba(59, 36, 22, .45); }
.modal[open] { animation: sheet-up .45s var(--ease-out) both; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.modal-inner { position: relative; margin: 18px 16px calc(18px + var(--safe-b)); padding: 22px 18px 18px; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-2); z-index: 1; }
.modal .chips { margin-bottom: 22px; }
.modal .btn-wa { width: 100%; margin-top: 4px; }
#cm-title:focus { outline: none; }
.modal-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 0; }

/* ---------- Tablet e desktop ---------- */
@media (min-width: 860px) {
  #builder { flex-direction: row; }
  .stage-wrap { flex: 1; height: auto; }
  .sheet { flex: 0 0 440px; margin: 0; border-radius: 0; border-left: 1px solid var(--line); box-shadow: none; }
  .stage-hint { bottom: 22px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .modal { margin: auto; max-width: 520px; border-radius: 6px; }
  #cm-title:focus { outline: none; }
.modal-grab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
