:root {
  --fondo: #f6f3ee;          /* the warm white behind the screen */
  --schermo: #fffdfa;        /* the app screen */
  --bordo: rgba(32, 28, 22, 0.08);
  --linea: #ebe6de;
  --testo: #1c1a17;
  --testo-2: #6f6a62;
  --testo-3: #a8a299;
  --accento: #e2552b;        /* the one accent: the scan line, the lit bars, the added state */
  --accento-tenue: #fbe9e2;
  --feed: #e4dfd6;           /* the camera feed, kept abstract */
  --feed-2: #d3cdc2;
  --pacco: #efe9de;          /* the package surface */
  --pacco-2: #e3dccd;
  --barre: #8d877c;          /* the bars before they are read */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.6vh, 26px) 12px;
}

/* ---- the screen-shaped card ---- */
.screen {
  position: relative;
  width: min(360px, calc(100vw - 24px));
  height: min(600px, calc(100vh - 2 * clamp(10px, 2.6vh, 26px)));
  display: flex;
  flex-direction: column;
  background: var(--schermo);
  border-radius: clamp(20px, 4.4vh, 30px);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 2px rgba(32, 28, 22, 0.04),
    0 12px 30px -14px rgba(32, 28, 22, 0.18),
    0 40px 70px -36px rgba(32, 28, 22, 0.26);
}
.screen::after { /* a hairline of light along the top edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(10px, 2.4vh, 16px) clamp(12px, 3.6vw, 18px) clamp(8px, 1.8vh, 12px);
}
.brand { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 660; font-stretch: 106%; letter-spacing: 0.005em; }
.brand svg { width: 16px; height: 16px; fill: none; stroke: var(--testo); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.listbtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 6px 0 10px; border-radius: 999px;
  background: #f3efe8; box-shadow: inset 0 0 0 1px var(--bordo);
  font-size: 12.5px; font-weight: 560; color: var(--testo-2);
}
.listbtn svg { width: 14px; height: 14px; fill: none; stroke: var(--testo-2); stroke-width: 1.6; stroke-linecap: round; }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--testo); color: #fff; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}

/* ---- the rolling digits ---- */
.roll { display: inline-flex; height: 1.2em; line-height: 1.2em; overflow: hidden; font-variant-numeric: tabular-nums; vertical-align: top; }
.roll .d { display: inline-block; height: 1.2em; overflow: hidden; }
.roll .d__col { display: flex; flex-direction: column; }
.roll .d__col span, .roll .s { display: block; height: 1.2em; line-height: 1.2em; }

/* ---- the viewfinder ---- */
.vf {
  position: relative; flex: 1; min-height: 0;
  margin: 0 clamp(8px, 2.4vw, 12px) clamp(8px, 2.4vw, 12px);
  border-radius: clamp(14px, 3.2vh, 22px);
  overflow: hidden;
  cursor: pointer;
}
.vf__feed { /* an abstract camera feed: a soft warm surface with a light falling from the top left */
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 22% 8%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
    radial-gradient(140% 100% at 50% 120%, var(--feed-2), rgba(211, 205, 194, 0) 70%),
    var(--feed);
}
.vf__feed::after { /* a faint vignette */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 70% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(40, 32, 20, 0.12));
}
.scene { position: absolute; inset: 0; display: grid; place-items: center; }
.pack { width: min(74%, 230px, 46vh); aspect-ratio: 1 / 0.92; margin-top: -6%; }
.pack__drift {
  position: relative; width: 100%; height: 100%;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--pacco) 0%, var(--pacco-2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -14px 24px -18px rgba(60, 46, 26, 0.25),
    0 2px 4px rgba(50, 40, 25, 0.08),
    0 18px 30px -18px rgba(50, 40, 25, 0.35);
}
.pack__seam { position: absolute; left: 10%; right: 10%; top: 9%; height: 1px; background: rgba(60, 46, 26, 0.12); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
.pack__fold { position: absolute; left: 0; top: 0; bottom: 0; width: 22%; border-radius: 14px 0 0 14px; background: linear-gradient(90deg, rgba(60, 46, 26, 0.06), rgba(60, 46, 26, 0)); }
.label {
  position: absolute; left: 12%; right: 12%; bottom: 13%;
  padding: 7% 7% 5%;
  border-radius: 6px; background: #fffefb;
  box-shadow: 0 0 0 1px rgba(60, 46, 26, 0.06), 0 1px 2px rgba(60, 46, 26, 0.08);
}
.code { display: block; width: 100%; height: auto; overflow: visible; }
.code rect { fill: var(--barre); }
.code text { fill: var(--testo); font-family: "Mona Sans Variable", system-ui, sans-serif; font-size: 6.4px; font-weight: 520; font-variant-numeric: tabular-nums; letter-spacing: 0.4px; }

.reticle { position: absolute; inset: 0; pointer-events: none; }
.cn { position: absolute; left: 0; top: 0; width: 18px; height: 18px; border: 0 solid #fff; filter: drop-shadow(0 1px 1.5px rgba(40, 30, 15, 0.22)); }
.cn--tl { border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 7px; }
.cn--tr { border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 7px; }
.cn--bl { border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 7px; }
.cn--br { border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 7px; }
.cn.is-lock { border-color: var(--accento); }
.beam {
  position: absolute; left: 0; top: 0; width: 1.5px; height: 40px; opacity: 0;
  background: var(--accento); border-radius: 1px;
  box-shadow: 0 0 0 0.5px rgba(226, 85, 43, 0.25), 0 0 10px 1px rgba(226, 85, 43, 0.28);
}

.hint {
  position: absolute; left: 50%; bottom: clamp(10px, 2.6vh, 16px); transform: translateX(-50%);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(255, 253, 250, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 2px 8px -4px rgba(40, 30, 15, 0.25);
  font-size: 12px; font-weight: 540; color: var(--testo-2);
}
.hint span { display: inline-block; }

/* ---- the product card that rises ---- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 0 clamp(14px, 4.2vw, 20px) clamp(12px, 2.8vh, 18px);
  background: var(--schermo);
  border-radius: clamp(18px, 3.8vh, 26px) clamp(18px, 3.8vh, 26px) 0 0;
  box-shadow: 0 -1px 0 var(--bordo), 0 -18px 34px -22px rgba(40, 30, 15, 0.28);
}
.grab { display: block; width: 100%; padding: clamp(7px, 1.6vh, 10px) 0 clamp(6px, 1.4vh, 10px); }
.grab span { display: block; width: 34px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--linea); }

.prod { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.prod__name { font-size: clamp(15px, 3.6vh, 17px); font-weight: 640; font-stretch: 104%; letter-spacing: -0.005em; line-height: 1.2; }
.prod__meta { margin-top: 3px; font-size: 12px; color: var(--testo-2); }
.price { font-size: clamp(15px, 3.6vh, 17px); font-weight: 650; line-height: 1.2; white-space: nowrap; }

.nutri { margin: clamp(8px, 2.2vh, 14px) 0 clamp(10px, 2.4vh, 16px); display: grid; gap: clamp(5px, 1.3vh, 8px); }
.row { display: grid; grid-template-columns: 56px 1fr 62px; align-items: center; gap: 10px; font-size: 12px; }
.row__k { color: var(--testo-2); }
.row__bar { position: relative; height: 4px; border-radius: 2px; background: #f0ebe3; overflow: hidden; }
.row__bar span { position: absolute; inset: 0; border-radius: inherit; background: var(--testo); transform-origin: left center; transform: scaleX(0); }
.row__v { position: relative; height: 1.3em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 560; }
.row__word, .row__exact { position: absolute; right: 0; top: 0; line-height: 1.3em; white-space: nowrap; transition: opacity 0.28s ease, transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }
.row__exact { opacity: 0; transform: translateY(6px); }
.sheet.is-exact .row__word { opacity: 0; transform: translateY(-6px); }
.sheet.is-exact .row__exact { opacity: 1; transform: translateY(0); }
.sheet.is-exact .row__bar span { background: var(--accento); }
.row__bar span { transition: background-color 0.3s ease; }

.add {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: clamp(38px, 8.6vh, 44px); border-radius: 999px;
  color: #fff; font-size: 14px; font-weight: 600; font-stretch: 104%;
}
.add__bg { position: absolute; inset: 0; border-radius: inherit; background: var(--testo); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px -8px rgba(28, 26, 23, 0.6); transition: background-color 0.3s ease; }
.add.is-added .add__bg { background: var(--accento); }
.add__ico, .add__label { position: relative; }
.add__ico { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.add__tick { stroke-dasharray: 1; stroke-dashoffset: 1; }
.add__label { display: inline-block; }

@media (hover: hover) {
  .listbtn:hover { color: var(--testo); }
}

@media (max-height: 470px) {
  .prod__meta { display: none; }
  .hint { bottom: 8px; padding: 4px 10px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .row__word, .row__exact { transition: opacity 0.3s ease; transform: none !important; }
}
