/*
 * myhouse-app.com, pagina iniziale.
 * Il mondo è quello dell'app (apps/mobile/src/theme/tokens.ts): fondo smaltato freddo, calamite
 * bianche, rosso-arancio e ambra del logo, un colore pieno per categoria, Nunito per titoli e
 * calamite, font di sistema per il resto. In alto il tetto del logo con le stanze della casa;
 * sotto, lo scontrino che si smista negli scomparti; in fondo il biglietto per diventare tester.
 */
@font-face { font-family: "Nunito"; src: url("fonts/nunito-latin.woff2") format("woff2"); font-weight: 600 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Material Symbols Rounded"; src: url("fonts/material-symbols-rounded-sito.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: block; }

:root {
  color-scheme: light;
  --enamel: #ECEFEE;
  --enamel-2: #E3E8E6;
  --sheen: rgba(255, 255, 255, 0.75);
  --ink: #1E2321;
  --ink-2: #58625E;
  --line: #D5DBD8;
  --magnet: #FFFFFF;
  --door: #F4F7F6;
  --paper: #FBFBF9;
  --paper-ink: #2A2D2C;
  --paper-mute: #596060;
  --placeholder: #6B7571;
  --orange: #C2410C;
  --orange-ink: #B23C0B;
  --orange-deep: #9A330A;
  --amber: #F5A00F;
  --on-amber: #2A1A05;
  --on-amber-2: #5A3A08;
  --charcoal: #2B2B2B;
  --on-charcoal: #FFFFFF;
  --food: #C2410C; --food-t: #B23C0B; --food-s: #FCE4D8;
  --med: #1E7B5C;  --med-t: #16684D;  --med-s: #D6F0E4;
  --home: #F5A00F; --home-t: #8A5600; --home-s: #FDECC9;
  --wear: #3F5BB5; --wear-t: #3550A6; --wear-s: #DFE5FA;
  --ok: #16684D;
  --bad: #B3261E;
  --shadow: rgba(30, 40, 36, 0.16);
  --shadow-deep: rgba(30, 40, 36, 0.34);
  --lift: 0 1px 1px var(--shadow), 0 6px 14px -6px var(--shadow);
  --lift-high: 0 2px 2px var(--shadow), 0 22px 36px -18px var(--shadow-deep);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --f-display: "Nunito", ui-rounded, system-ui, sans-serif;
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 16px;
  --side-l: max(40px, env(safe-area-inset-left, 0px));
  --side-r: max(40px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --enamel: #151918;
    --enamel-2: #1C2220;
    --sheen: rgba(255, 255, 255, 0.05);
    --ink: #EDF1EF;
    --ink-2: #A2ACA8;
    --line: #2D3432;
    --magnet: #222927;
    --door: #2A3230;
    --paper: #E9EAE6;
    --placeholder: #8C9692;
    --orange-ink: #FF9B66;
    --amber: #E9981F;
    --charcoal: #EDF1EF;
    --on-charcoal: #151918;
    --food-t: #FF9B66; --food-s: #3B2318;
    --med-t: #6FD6AC;  --med-s: #15352A;
    --home-t: #F4B955; --home-s: #3A2C10;
    --wear: #4A65C2; --wear-t: #A9BBFF; --wear-s: #222B4A;
    --ok: #6FD6AC;
    --bad: #FFB4AB;
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-deep: rgba(0, 0, 0, 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--enamel); color: var(--ink);
  font: 400 17px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 8px; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 900; letter-spacing: -0.025em; line-height: 1.02; text-wrap: balance; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 999px; background: var(--charcoal); color: var(--on-charcoal); font: 800 15px/1 var(--f-display); text-decoration: none; }
.skip:focus { top: 12px; }

/* Icone: Material Symbols Rounded, le stesse dell'app. */
.ms {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal;
  font-size: 22px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; flex: none;
  font-feature-settings: "liga"; -webkit-font-feature-settings: "liga";
  font-variation-settings: "FILL" 1, "wght" 500, "opsz" 24, "GRAD" 0; user-select: none;
}

/* ===== Barra ===== */
.nav { position: relative; z-index: 20; height: 72px; display: flex; align-items: center; gap: 28px; padding-left: var(--side-l); padding-right: var(--side-r); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 38px; height: 38px; }
.brand span { font: 900 24px/1 var(--f-display); letter-spacing: -0.02em; }
.nav ul { display: flex; gap: 6px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav ul a { display: inline-flex; align-items: center; height: 42px; padding: 0 14px; border-radius: 999px; font: 600 15px/1 var(--f-ui); color: var(--ink-2); text-decoration: none; transition: background-color 160ms ease, color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .nav ul a:hover { background: var(--enamel-2); color: var(--ink); } }
.cta {
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--charcoal); color: var(--on-charcoal); font: 800 15px/1 var(--f-display); letter-spacing: 0.005em;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}
.cta:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .cta:hover { opacity: 0.9; } }

/* ===== Modulo tester: l'unico gesto della pagina ===== */
.wait { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: min(100%, 480px); }
.wait label { font: 700 14px/1.35 var(--f-ui); color: var(--ink-2); }
.wait .row { width: 100%; justify-self: stretch; display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--magnet); box-shadow: var(--lift); transition: box-shadow 200ms var(--ease-out); }
.wait .row:focus-within { box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.35), var(--lift); }
.wait input { flex: 1 1 0; width: 0; min-width: 0; border: 0; background: transparent; outline: none; font: 500 17px/1 var(--f-ui); color: var(--ink); padding: 0 8px 0 16px; height: 48px; caret-color: var(--orange); }
.wait input::placeholder { color: var(--placeholder); }
.wait button {
  flex: none; height: 48px; padding: 0 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--orange); color: #fff; font: 900 16px/1 var(--f-display); letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
@media (hover: hover) and (pointer: fine) { .wait button:hover { background: var(--orange-deep); } }
.wait button:active { transform: scale(0.97); }
.wait button[disabled] { opacity: 0.7; cursor: progress; }
.wait .msg { min-height: 1.35em; font: 600 14px/1.35 var(--f-ui); color: var(--ink-2); }
.wait .msg:empty { min-height: 0; }
.wait .msg[data-tone="ok"] { color: var(--ok); }
.wait .msg[data-tone="bad"] { color: var(--bad); }
.wait.done .row, .wait.done label, .wait.done .fine { display: none; }
.wait .fine { font: 500 13px/1.4 var(--f-ui); color: var(--ink-2); }
.attic .wait .fine { text-align: center; }
.wait[aria-busy="true"] .row { opacity: 0.85; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ===== Atomi del mondo dell'app ===== */
.mag { background: var(--magnet); color: var(--ink); border-radius: var(--r); box-shadow: var(--lift); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.mag b { font: 800 16px/1.2 var(--f-display); letter-spacing: -0.005em; }
.mag small { font: 500 13px/1.3 var(--f-ui); color: var(--ink-2); }
.tag { justify-self: start; margin-top: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font: 700 12px/24px var(--f-ui); white-space: nowrap; background: var(--enamel-2); color: var(--ink-2); }
.tag.food { background: var(--food-s); color: var(--food-t); }
.tag.med { background: var(--med-s); color: var(--med-t); }
.tag.home { background: var(--home-s); color: var(--home-t); }
.tag.wear { background: var(--wear-s); color: var(--wear-t); }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font: 900 13px/1 var(--f-display); color: #fff; box-shadow: 0 0 0 2px var(--magnet); }
/* Il terzo colore avatar dell'app (#B7740A) è scurito per reggere il testo bianco. */
.av.g { background: #C2410C; } .av.m { background: #3B3633; } .av.s { background: #946005; }
.hamster { position: relative; aspect-ratio: 1; }
.hamster > svg, .hamster > img { width: 100% !important; height: 100% !important; display: block; }
[data-live] { display: inline-block; transition: opacity 180ms var(--ease-out), filter 180ms var(--ease-out), translate 180ms var(--ease-out); }
[data-live].is-out { opacity: 0; filter: blur(4px); translate: 0 3px; }
.cat-food { --cat: var(--food); --cat-t: var(--food-t); }
.cat-med { --cat: var(--med); --cat-t: var(--med-t); }
.cat-home { --cat: var(--home); --cat-t: var(--home-t); }
.cat-wear { --cat: var(--wear); --cat-t: var(--wear-t); }

/* ===== Hero: la casa in sezione ===== */
.hero { padding-bottom: 40px; }
.house { position: relative; container-type: inline-size; width: min(1360px, calc(100% - 80px)); margin: 4px auto 0; }
.roof { position: absolute; inset: 0 0 auto 0; width: 100%; height: auto; overflow: visible; pointer-events: none; }
.roof path { fill: none; stroke: var(--orange); stroke-linecap: round; stroke-linejoin: round; }
.roof-wide path { stroke-width: 56; }
.roof-tall { display: none; }
.roof-tall path { stroke-width: 30; }
.attic { position: relative; z-index: 2; padding-top: 12.2cqw; width: min(54cqw, 740px); margin-inline: auto; display: grid; justify-items: center; text-align: center; gap: 18px; }
.attic h1 { font-size: clamp(40px, 4.45cqw, 66px); }
.attic h1 span { display: block; }
.attic h1 span + span { color: var(--orange-ink); }
.lede { font-size: clamp(17px, 1.36cqw, 20px); color: var(--ink-2); max-width: 36ch; text-wrap: pretty; }
.attic .wait { margin-top: 6px; justify-items: center; }
.attic .wait label, .attic .wait .msg { text-align: center; }

.rooms { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; padding-inline: 6.4cqw; margin-top: 3.2cqw; }
.plate { position: absolute; z-index: 2; left: 9cqw; bottom: calc(100% + 22px); display: grid; gap: 8px; padding: 12px 16px 13px; border-radius: 14px; background: var(--magnet); box-shadow: var(--lift); rotate: -2deg; }
.plate b { font: 900 18px/1 var(--f-display); letter-spacing: -0.01em; }
.plate .who { display: flex; align-items: center; }
.plate .who .av + .av { margin-left: -7px; }
.plate .who small { margin-left: 10px; font: 600 13px/1 var(--f-ui); color: var(--ink-2); }
/* Il criceto sta in piedi sul tetto della stanza dei farmaci: disegno di 400 px, piedi a 354. */
.rooms > .hamster { position: absolute; z-index: 2; right: 9cqw; bottom: calc(100% - 1.6cqw); width: 14.5cqw; max-width: 220px; }

.room { position: relative; border-radius: 30px; padding: 20px 22px 22px; color: #fff; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 14px; }
.room.food { grid-row: span 2; background: var(--food); }
.room.med { background: var(--med); }
.room.home { background: var(--home); color: var(--on-amber); }
.room.wear { grid-column: 1 / -1; background: var(--wear); }
.room-head { display: flex; align-items: center; gap: 10px; }
.room-head .ms { font-size: 26px; }
.room-head h3 { font-size: 24px; line-height: 1; letter-spacing: -0.01em; }
.room-head p { font: 600 14px/1 var(--f-ui); margin-left: 2px; }
.room.home .room-head p { opacity: 1; color: var(--on-amber-2); }
.shelf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.room.wear .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fridge {
  position: relative; border-radius: 22px; padding: 18px 18px 20px 30px; color: var(--ink);
  background: linear-gradient(90deg, transparent 0 calc(100% - 8px), var(--sheen) calc(100% - 8px)), var(--door);
  box-shadow: inset 0 0 0 1px rgba(30, 40, 36, 0.06), 0 14px 26px -16px rgba(60, 20, 0, 0.55);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
}
.fridge::before { content: ""; position: absolute; left: 11px; top: 26px; width: 7px; height: 96px; border-radius: 4px; background: var(--line); }
.mag.wide { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.mag.wide .txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mag.fill { background: var(--food); color: #fff; }
.mag.fill small { color: rgba(255, 255, 255, 0.92); }
.mag .ms.lead { font-size: 24px; }
.pill { flex: none; min-height: 38px; padding: 9px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font: 800 14px/1 var(--f-display); background: #fff; color: var(--orange-deep); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); transition: transform 140ms var(--ease-out); }
.pill .ms { font-size: 18px; }
.pill.green { background: var(--med); color: #fff; }
.pill.is-pressed { transform: scale(0.94); }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.note { position: relative; margin-top: 4px; padding: 18px 16px 14px; border-radius: 6px; background: var(--magnet); rotate: -1.4deg; box-shadow: 0 1px 1px var(--shadow), 0 12px 18px -12px var(--shadow); display: grid; gap: 3px; }
.note::before, .pin { content: ""; position: absolute; top: -9px; left: 50%; translate: -50% 0; width: 22px; height: 22px; border-radius: 50%; background: var(--amber); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14), 0 3px 5px rgba(0, 0, 0, 0.2); }
.note b { font: 900 19px/1.15 var(--f-display); }
.note span { font: 500 14px/1.35 var(--f-ui); color: var(--ink-2); }
.bubble {
  position: absolute; z-index: 5; top: 14px; right: 16px; display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--magnet); color: var(--ink);
  box-shadow: var(--lift-high); font: 700 14px/1.2 var(--f-ui); white-space: nowrap;
  transform-origin: top right; opacity: 0; scale: 0.94; translate: 0 -4px;
  transition: opacity 220ms var(--ease-out), scale 220ms var(--ease-out), translate 220ms var(--ease-out);
}
.bubble.is-on { opacity: 1; scale: 1; translate: 0 0; }
.bubble-slot { display: none; }
.demo-note { position: relative; z-index: 1; margin: 16px 0 0; text-align: center; font: 600 13.5px/1.4 var(--f-ui); color: var(--ink-2); }

/* ===== Come funziona: lo scontrino che si smista ===== */
.how {
  /* Colonne in percentuale del contenitore (largo al massimo 1600px), non dello schermo: sui monitor larghi la colonna centrale non si schiaccia. */
  display: grid; grid-template-columns: minmax(260px, 26%) minmax(260px, 1fr) minmax(340px, 34%);
  grid-template-areas: "receipt head head" "receipt copy bins" "receipt lane bins";
  grid-template-rows: auto auto 1fr; column-gap: clamp(28px, 3.4vw, 56px);
  max-width: 1600px; margin-inline: auto; padding-block: 112px 120px; padding-left: var(--side-l); padding-right: var(--side-r);
  scroll-margin-top: 8px;
}
.how-head { grid-area: head; }
.how-head h2 { font-size: clamp(36px, 3.7vw, 58px); }
.how-head h2 span { display: block; }
.how-head h2 span + span { color: var(--orange-ink); }
.how-copy { grid-area: copy; padding-top: 22px; }
.how-copy .lede { max-width: 38ch; }
.receipt-area { grid-area: receipt; position: relative; padding-top: 18px; }
.receipt-hold { position: relative; rotate: -3deg; transform-origin: 50% 0; filter: drop-shadow(0 1px 1px var(--shadow)) drop-shadow(0 18px 22px var(--shadow)); }
.receipt {
  --z: 9px; position: relative; background: var(--paper); color: var(--paper-ink);
  padding: 30px 26px 34px; font: 500 13.5px/1.62 var(--f-mono); letter-spacing: -0.01em; text-transform: uppercase;
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--z)) 51% repeat-x, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) 51% repeat-x;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--z)) 51% repeat-x, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--z)) 51% repeat-x;
}
.receipt .c { text-align: center; }
.receipt .shop { font-weight: 700; font-size: 15px; }
.receipt .dash { height: 0; border-top: 1.5px dashed #9AA19E; margin: 10px 0 8px; }
.receipt .cols, .receipt .ln, .receipt .tot { display: grid; grid-template-columns: minmax(0, 1fr) auto 4.6em; gap: 10px; }
.receipt .cols { color: var(--paper-mute); font-size: 12px; }
.receipt .cols span:last-child, .receipt .ln span:last-child, .receipt .tot span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.receipt .ln { position: relative; border-radius: 4px; transition: background-color 240ms ease; }
.receipt .ln span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt .ln::before { content: ""; position: absolute; left: -15px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 2px; background: var(--cat, transparent); scale: 0.4; opacity: 0; transition: scale 260ms var(--ease-out), opacity 200ms ease; }
.receipt .ln.is-read::before { scale: 1; opacity: 1; }
.receipt .ln.is-now { background: rgba(194, 65, 12, 0.12); }
.receipt .tot { font-weight: 700; font-size: 15px; margin-top: 2px; }
.receipt .tot.is-done { color: #B23C0B; }
.receipt .bye { margin-top: 14px; color: var(--paper-mute); font-size: 12px; }
.receipt-hold .pin { z-index: 3; top: -12px; width: 30px; height: 30px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14), 0 4px 7px rgba(0, 0, 0, 0.22); }
.finder { position: absolute; z-index: 5; inset: -16px -14px; pointer-events: none; opacity: 0; scale: 1.04; transition: opacity 260ms var(--ease-out), scale 420ms var(--ease-out); }
.finder.is-on { opacity: 1; scale: 1; }
.finder i { position: absolute; width: 34px; height: 34px; border: 4px solid var(--orange); }
.finder i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.finder i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.finder i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.finder i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }

.lane { grid-area: lane; position: relative; min-height: 150px; display: grid; align-content: center; justify-items: start; gap: 12px; }
.chip { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: var(--r); background: var(--magnet); color: var(--ink); box-shadow: var(--lift-high); width: min(100%, 380px); }
.chip .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cat); color: #fff; flex: none; }
.chip .ico.on-amber { color: var(--on-amber); }
.chip .t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chip b { font: 800 17px/1.2 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip small { font: 700 13px/1.2 var(--f-ui); color: var(--cat-t); }
.chip .p { font: 800 16px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.lane .chip { opacity: 0; translate: -18px 0; transition: opacity 240ms var(--ease-out), translate 320ms var(--ease-out); }
.lane .chip.is-in { opacity: 1; translate: 0 0; }
.lane .done { display: flex; align-items: center; gap: 10px; font: 800 17px/1.3 var(--f-display); color: var(--ok); opacity: 0; transition: opacity 260ms var(--ease-out); }
.lane .done.is-in { opacity: 1; }
.lane .done .ms { font-size: 26px; }
.flyer { position: fixed; z-index: 30; margin: 0; pointer-events: none; transform-origin: 0 0; }

.bins-house { grid-area: bins; position: relative; display: grid; align-content: start; gap: 18px; padding-top: 4px; }
.mini-roof { width: 100%; height: auto; display: block; overflow: visible; margin-bottom: -10px; }
.mini-roof path { fill: none; stroke: var(--orange); stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.bins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-inline: 5%; }
.bin { border-radius: 20px; padding: 12px 14px 14px; color: #fff; min-height: 96px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; min-width: 0; }
.bin.food { grid-row: span 2; background: var(--food); }
.bin.med { background: var(--med); }
.bin.home { background: var(--home); color: var(--on-amber); }
.bin.wear { grid-column: 1 / -1; background: var(--wear); min-height: 0; }
.bin header { display: flex; align-items: center; gap: 7px; font: 900 18px/1 var(--f-display); }
.bin header .ms { font-size: 21px; }
.bin header .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bin header .n { margin-left: auto; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.22); font: 900 14px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.bin.home header .n { background: rgba(42, 26, 5, 0.12); }
.bin ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.bin li { padding: 5px 10px; border-radius: 9px; background: var(--magnet); color: var(--ink); font: 700 13.5px/1.2 var(--f-ui); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bin li .s { display: none; }
.bin li.is-new { animation: land 420ms var(--ease-out); }
@keyframes land { from { scale: 1.14; } }
.bump { animation: bump 360ms var(--ease-out); }
@keyframes bump { 40% { scale: 1.2; } }
.money { padding-inline: 5%; display: grid; gap: 10px; }
.money .row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.money h3 { margin: 0; font: 800 16px/1.2 var(--f-display); color: var(--ink-2); }
.money .sum { font: 900 32px/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.split { display: flex; height: 14px; gap: 3px; }
.split i { height: 100%; border-radius: 4px; width: 0; transition: width 520ms var(--ease-out); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 600 13.5px/1.2 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.legend b { color: var(--ink); font-weight: 700; }

/* ===== Chiusura: il biglietto sul frigo ===== */
.close { padding: 24px var(--side-r) 120px var(--side-l); display: grid; justify-items: center; }
.ticket {
  position: relative; width: min(100%, 760px); padding: 46px 48px 40px; border-radius: 8px; background: var(--magnet);
  box-shadow: 0 1px 1px var(--shadow), 0 30px 46px -28px var(--shadow-deep); rotate: -1deg;
  display: grid; gap: 18px; justify-items: start;
}
.ticket .pin { top: -15px; width: 34px; height: 34px; }
.ticket h2 { font-size: clamp(32px, 3.4vw, 46px); }
.ticket p { font-size: 18px; color: var(--ink-2); max-width: 52ch; text-wrap: pretty; }
.ticket .wait { margin-top: 6px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px 10px; list-style: none; margin: 0; padding: 0; }
.steps li { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 8px; border-radius: 999px; background: var(--enamel-2); font: 700 14.5px/1 var(--f-ui); color: var(--ink); }
.steps .ms { font-size: 20px; color: var(--orange-ink); }

.foot { border-top: 1px solid var(--line); }
.foot-in { max-width: 1600px; margin-inline: auto; padding-block: 28px 36px; padding-left: var(--side-l); padding-right: var(--side-r); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.foot p { color: var(--ink-2); font-size: 15px; margin-right: auto; }
.foot-link, .wait .fine a, .doc a { color: var(--orange-ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.foot-link { font-size: 15px; }
@media (hover: hover) and (pointer: fine) { .foot-link:hover, .wait .fine a:hover, .doc a:hover { text-decoration-thickness: 2.5px; } }

/* ===== Informativa: lo stesso biglietto sul frigo, in versione da leggere ===== */
.back { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px 0 12px; border-radius: 999px; color: var(--ink); background: var(--enamel-2); font: 800 15px/1 var(--f-display); text-decoration: none; transition: transform 160ms var(--ease-out); }
.back:active { transform: scale(0.97); }
.back .ms { font-size: 20px; }
.doc-wall { padding: 36px var(--side-r) 96px var(--side-l); display: grid; justify-items: center; }
.doc {
  position: relative; width: min(100%, 760px); padding: 52px 56px 44px; border-radius: 8px; background: var(--magnet);
  box-shadow: 0 1px 1px var(--shadow), 0 30px 46px -28px var(--shadow-deep);
}
.doc .pin { top: -15px; width: 34px; height: 34px; }
.doc h1 { font-size: clamp(34px, 3.6vw, 48px); margin-bottom: 14px; }
.doc .intro { font-size: 19px; color: var(--ink-2); max-width: 58ch; margin-bottom: 8px; text-wrap: pretty; }
.doc h2 { font-size: 22px; letter-spacing: -0.01em; line-height: 1.2; margin: 34px 0 8px; }
.doc p { max-width: 66ch; line-height: 1.65; text-wrap: pretty; }
.nw { white-space: nowrap; }
.doc .updated { margin-top: 36px; font-size: 14px; color: var(--ink-2); }

/* ===== Ingresso orchestrato una volta ===== */
@media (prefers-reduced-motion: no-preference) {
  .roof path { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1100ms var(--ease-io) 80ms forwards; }
  /* Titolo, testo e modulo sono già visibili: si assestano soltanto. */
  .attic > * { animation: settle 700ms var(--ease-out) both; }
  .plate { animation: rise 700ms var(--ease-out) both; }
  .attic > :nth-child(1) { animation-delay: 380ms; }
  .attic > :nth-child(2) { animation-delay: 460ms; }
  .attic > :nth-child(3) { animation-delay: 540ms; }
  .plate { animation-delay: 760ms; }
  .room { animation: room 760ms var(--ease-out) both; }
  .room.food { animation-delay: 620ms; } .room.med { animation-delay: 700ms; }
  .room.home { animation-delay: 780ms; } .room.wear { animation-delay: 860ms; }
  .room .mag, .room .note, .room .fridge { animation: stick 520ms var(--ease-out) both; animation-delay: calc(900ms + var(--i, 0) * 70ms); }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; translate: 0 14px; filter: blur(6px); } }
@keyframes settle { from { translate: 0 10px; } }
@keyframes room { from { opacity: 0.6; translate: 0 28px; } }
@keyframes stick { from { opacity: 0; scale: 1.05; } }

/* ===== Tablet: titolo e testo sopra, scontrino e casa affiancati ===== */
@media (max-width: 1040px) {
  .how { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); grid-template-areas: "head head" "copy copy" "receipt bins" "lane lane"; grid-template-rows: auto; column-gap: 32px; }
  .how-copy { padding: 16px 0 32px; }
}

/* ===== Telefono ===== */
@media (max-width: 860px) {
  .how {
    grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
    grid-template-areas: "head head" "copy copy" "receipt bins" "lane lane";
    grid-template-rows: auto; column-gap: 14px; padding-block: 72px 80px;
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .how-head h2 { font-size: clamp(30px, 8.6vw, 42px); }
  .how-copy { padding: 14px 0 26px; }
  .receipt { --z: 6px; padding: 20px 10px 22px 16px; font-size: 11px; line-height: 1.55; letter-spacing: -0.03em; }
  .receipt .shop { font-size: 11.5px; }
  .receipt .cols, .receipt .bye, .receipt .hide-s { display: none; }
  .receipt .ln, .receipt .tot { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
  .receipt .ln span:nth-child(2), .receipt .tot span:nth-child(2) { display: none; }
  .receipt .ln::before { left: -12px; width: 6px; height: 6px; margin-top: -3px; }
  .receipt .tot { font-size: 11.5px; }
  .receipt-hold .pin { width: 22px; height: 22px; top: -9px; }
  .finder { inset: -10px -8px; }
  .finder i { width: 22px; height: 22px; border-width: 3px; }
  .bins-house { gap: 10px; }
  .mini-roof path { stroke-width: 34; }
  .bins { padding-inline: 0; gap: 6px; }
  .bin { border-radius: 14px; padding: 8px 8px 9px; min-height: 64px; gap: 6px; }
  .bin header { font-size: 13px; gap: 4px; }
  .bin header .nm { display: none; }
  .bin header .ms { font-size: 17px; }
  .bin header .n { min-width: 20px; height: 20px; font-size: 11px; padding: 0 5px; }
  .bin li { font-size: 11px; padding: 3px 6px; border-radius: 6px; }
  .bin li .l { display: none; }
  .bin li .s { display: inline; }
  .bin ul { gap: 4px; }
  .money { padding-inline: 0; gap: 6px; }
  .money h3 { font-size: 12.5px; }
  .money .sum { font-size: 20px; }
  .split { height: 9px; }
  .legend { display: none; }
  .lane { min-height: 92px; padding-top: 18px; justify-items: stretch; }
  .chip { width: 100%; }
}
@media (max-width: 760px) {
  .nav { height: 64px; gap: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .nav ul { display: none; }
  .nav .cta { margin-left: auto; height: 42px; padding: 0 16px; font-size: 14px; }
  .brand img { width: 34px; height: 34px; }
  .brand span { font-size: 22px; }
  .wait button { padding: 0 16px; font-size: 15px; }
  .wait input { font-size: 16px; padding-left: 12px; }

  .house { width: calc(100% - 32px); }
  .roof-wide { display: none; }
  .roof-tall { display: block; }
  .attic { width: 100%; padding-top: 47cqw; gap: 14px; }
  .attic h1 { font-size: clamp(32px, 9.4cqw, 42px); }
  .lede { font-size: 16.5px; }
  .attic .wait { width: 100%; }
  .plate { display: none; }
  /* Sul telefono il criceto abita il sottotetto: il riferimento torna alla casa intera. */
  .rooms { position: static; padding-inline: 0; margin-top: 6px; gap: 10px; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
  .rooms > .hamster { left: 50%; right: auto; bottom: auto; translate: -50% 0; top: 13.5cqw; width: 30cqw; }
  .room { border-radius: 22px; padding: 14px 12px; gap: 10px; }
  .room-head { gap: 6px; }
  .room-head .ms { font-size: 20px; }
  .room-head h3 { font-size: 18px; }
  .room-head p { display: none; }
  .shelf { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .room.wear .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fridge { padding: 12px 10px 12px 18px; gap: 8px; border-radius: 16px; }
  .fridge::before { left: 6px; width: 5px; top: 18px; height: 64px; }
  .mag { padding: 10px; border-radius: 13px; }
  .mag b { font-size: 14px; }
  .mag small { font-size: 12px; }
  .mag.wide { display: grid; gap: 8px; padding: 10px; }
  .mag.wide .ms.lead { display: none; }
  .pill { min-height: 32px; padding: 7px 10px; font-size: 13px; justify-self: start; }
  .duo { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tag { font-size: 11px; height: 22px; line-height: 22px; padding: 0 7px; }
  .hide-s { display: none; }
  /* Sul telefono i fumetti stanno in uno spazio loro, tra il modulo e la casa: non coprono nessuna stanza. */
  .bubble-slot { display: block; position: relative; height: 42px; margin-top: 16px; }
  .bubble-slot .bubble { top: 0; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: 100%; font-size: 12.5px; transform-origin: top center; }

  .close { padding: 8px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
  .ticket { padding: 36px 20px 26px; rotate: 0deg; }
  .ticket p { font-size: 16.5px; }
  .doc-wall { padding: 20px max(12px, env(safe-area-inset-right, 0px)) 64px max(12px, env(safe-area-inset-left, 0px)); }
  .doc { padding: 40px 20px 30px; }
  .doc .intro { font-size: 17px; }
  .back { height: 42px; font-size: 14px; }
  .foot-in { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

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