:root {
  --fondo: #f3efe8;          /* the warm counter behind the screen */
  --schermo: #fffdf9;        /* the till screen */
  --tessera: #f7f3ec;        /* the item tiles */
  --tessera-2: #efe9df;
  --linea: rgba(36, 28, 22, 0.08);
  --testo: #221b16;
  --testo-2: #75695f;
  --testo-3: #aa9f95;
  --accento: #c4532d;        /* the one accent: the +1 that flies, the quantities, Charge, the change due */
  --accento-tenue: #f8e7de;
  --banconota: #f1ece1;      /* the drawn notes */
  --banconota-2: #ddd4c4;
}

* { 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; }
.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(8px, 3vh, 28px) clamp(8px, 3vw, 28px);
}

/* ---- the till screen ---- */
.till {
  position: relative;
  display: flex; flex-direction: column;
  width: min(860px, 100%);
  height: min(500px, 100%);
  background: var(--schermo);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(36, 28, 22, 0.09),
    0 0 0 5px rgba(255, 253, 249, 0.7),
    0 0 0 6px rgba(36, 28, 22, 0.07),
    0 2px 3px rgba(36, 28, 22, 0.04),
    0 18px 40px -20px rgba(60, 40, 25, 0.28),
    0 50px 80px -50px rgba(60, 40, 25, 0.3);
}
.till::before { /* a hairline of light along the top of the glass */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0) 18%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.bar {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: clamp(30px, 7vh, 42px); padding: 0 clamp(12px, 2.4vw, 18px);
  border-bottom: 1px solid var(--linea);
  font-size: 12px; color: var(--testo-2); white-space: nowrap;
}
.bar__mark { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--testo); font-stretch: 106%; letter-spacing: 0.005em; }
.bar__mark svg { width: 16px; height: 16px; fill: none; stroke: var(--testo); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.bar__order { font-weight: 550; display: inline-flex; gap: 4px; }
.bar__no { display: inline-block; color: var(--testo);  }
.bar__till { display: inline-flex; align-items: center; gap: 6px;  }
.bar__sep { width: 1px; height: 10px; background: var(--linea); }

.body { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr clamp(230px, 34%, 290px); }

/* ---- the item grid ---- */
.menu {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr;
  gap: clamp(6px, 1.2vw, 10px); padding: clamp(10px, 2vw, 16px); min-height: 0;
}
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  text-align: left; padding: clamp(8px, 1.6vh, 12px) clamp(9px, 1.4vw, 12px); min-height: 0;
  touch-action: manipulation;
}
.tile__bg {
  position: absolute; inset: 0; border-radius: 13px; pointer-events: none;
  background: linear-gradient(180deg, var(--tessera) 0%, var(--tessera-2) 100%);
  box-shadow: inset 0 0 0 1px rgba(36,28,22,0.05), inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 1px rgba(36,28,22,0.03);
  transition: box-shadow .35s ease;
}
.tile__ring { /* a thin accent ring once the item is in the order */
  position: absolute; inset: 0; border-radius: 13px; pointer-events: none;
  box-shadow: inset 0 0 0 1.25px var(--accento); opacity: 0; transition: opacity .3s ease;
}
.tile.is-in .tile__ring { opacity: 0.55; }
.tile__cat, .tile__name, .tile__price { position: relative; }
.tile__cat { font-size: 10.5px; font-weight: 550; letter-spacing: 0.04em; text-transform: uppercase; color: var(--testo-3); font-stretch: 112%; }
.tile__name { display: block; font-size: clamp(13px, 1.9vw, 16px); font-weight: 620; letter-spacing: -0.015em; line-height: 1.15; transition: font-stretch .4s cubic-bezier(.3,1.6,.5,1); }
.tile__price { display: block; margin-top: 3px; font-size: 12.5px; color: var(--testo-2);  }
.tile__qty {
  position: absolute; top: 7px; right: 7px; min-width: 22px; height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--accento); color: #fff;
  font-size: 11px; font-weight: 650; 
  box-shadow: 0 3px 8px -3px rgba(196,83,45,0.6), inset 0 1px 0 rgba(255,255,255,0.25);
  opacity: 0; transform: scale(0.6);
}
.tile:focus-visible { outline: 2px solid var(--testo); outline-offset: 2px; border-radius: 13px; }
@media (hover: hover) {
  .tile:hover .tile__bg { box-shadow: inset 0 0 0 1px rgba(36,28,22,0.09), inset 0 1px 0 rgba(255,255,255,0.9), 0 8px 18px -10px rgba(60,40,25,0.28); }
  .tile:hover .tile__name { font-stretch: 110%; }
  .bill:not(:disabled):hover .bill__face { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(36,28,22,0.1), 0 10px 18px -10px rgba(60,40,25,0.35); }
  .back:hover { color: var(--testo); }
}

/* ---- the order ticket ---- */
.ticket { position: relative; min-height: 0; border-left: 1px solid var(--linea); background: linear-gradient(180deg, #fffefb, #fbf8f3); border-radius: 0 0 20px 0; }
.ticket__paper { position: absolute; inset: 0; display: grid; }
.view {
  grid-area: 1 / 1; display: flex; flex-direction: column; min-height: 0;
  padding: clamp(10px, 2.2vh, 16px) clamp(12px, 1.8vw, 16px) clamp(10px, 2.2vh, 16px);
}
.view--pay { opacity: 0; visibility: hidden; }

.ticket__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: clamp(6px, 1.6vh, 12px); }
.ticket__title { font-size: 13px; font-weight: 650; letter-spacing: -0.005em; }
.ticket__count { font-size: 11.5px; color: var(--testo-3);  }

.lines { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; color: var(--testo-3); text-align: center; }
.line { overflow: hidden; }
.line__in {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: clamp(4px, 1.1vh, 7px) 0; border-bottom: 1px dashed rgba(36,28,22,0.1);
}
.line__qty {
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  min-width: 26px; height: 19px; padding: 0 5px; border-radius: 6px;
  background: var(--accento-tenue); color: var(--accento);
  font-size: 11px; font-weight: 650; 
}
.line__qty > span { display: block; }
.line__name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line__amt { font-size: 13px; font-weight: 550; }

.sum { display: flex; align-items: baseline; justify-content: space-between; padding-top: clamp(6px, 1.6vh, 12px); margin-top: 2px; border-top: 1px solid var(--linea); }
.sum__label { font-size: 12.5px; color: var(--testo-2); }
.sum__val { font-size: clamp(18px, 3.4vh, 24px); font-weight: 680; letter-spacing: -0.02em; }

.cta {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: clamp(32px, 7.4vh, 42px); margin-top: clamp(7px, 1.8vh, 12px); border-radius: 12px;
  font-size: 13.5px; font-weight: 650; color: #fff; touch-action: manipulation;
  transition: opacity .3s ease;
}
.cta__bg {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, #cf5f38 0%, var(--accento) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 0 0 1px rgba(120,40,15,0.2), 0 8px 16px -10px rgba(196,83,45,0.8);
}
.cta__label, .cta__amt { position: relative; }
.cta__label { transition: font-stretch .4s cubic-bezier(.3,1.6,.5,1); }
.cta:disabled { cursor: default; opacity: 0.38; }
.cta:focus-visible { outline: 2px solid var(--testo); outline-offset: 2px; }
@media (hover: hover) { .cta:not(:disabled):hover .cta__label { font-stretch: 112%; } }

/* ---- paying ---- */
.pay__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: clamp(6px, 1.6vh, 12px); }
.back { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--testo-2); transition: color .25s; }
.back svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pay__due { font-size: 12px; color: var(--testo-2);  }
.pay__due b { color: var(--testo); font-weight: 650; }

.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 11px; background: #f2ede5; box-shadow: inset 0 0 0 1px rgba(36,28,22,0.05); }
.seg__pill { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(36,28,22,0.08), 0 4px 10px -6px rgba(60,40,25,0.3), inset 0 0 0 1px rgba(36,28,22,0.05); opacity: 0; }
.seg__opt { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: clamp(26px, 6vh, 32px); font-size: 12.5px; font-weight: 600; color: var(--testo-2); transition: color .3s; }
.seg__opt[aria-checked="true"] { color: var(--testo); }
.seg__opt svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }

.bills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: clamp(7px, 1.8vh, 12px); transition: opacity .3s; }
.bills.is-off { opacity: 0.35; pointer-events: none; }
.bill { position: relative; display: block; aspect-ratio: 2.05 / 1; max-height: clamp(36px, 11vh, 68px); width: 100%; touch-action: manipulation; }
.bill__face {
  position: absolute; inset: 0; border-radius: 6px; overflow: hidden;
  background: var(--banconota);
  box-shadow: inset 0 0 0 1px rgba(36,28,22,0.08), 0 2px 5px -3px rgba(60,40,25,0.3);
  transition: transform .35s cubic-bezier(.3,1.6,.5,1), box-shadow .35s;
}
.bill__face::before { /* the thin inner frame */
  content: ""; position: absolute; inset: 3px; border-radius: 3.5px; border: 1px solid var(--banconota-2);
}
.bill__face::after { /* a fine engraved hatch on the right */
  content: ""; position: absolute; right: 9%; top: 50%; width: 34%; aspect-ratio: 1; transform: translateY(-50%); border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(36,28,22,0.12) 0 0.6px, rgba(0,0,0,0) 0.6px 2.6px);
  opacity: 0.8;
}
.bill__num { position: absolute; left: 9%; top: 50%; transform: translateY(-50%); font-size: clamp(14px, 3.2vh, 19px); font-weight: 700; letter-spacing: -0.03em;  font-stretch: 92%; }
.bill__num small { font-size: 0.6em; font-weight: 600; vertical-align: 0.45em; margin-right: 1px; color: var(--testo-2); }
.bill.is-given .bill__face { box-shadow: inset 0 0 0 1.5px var(--accento), 0 10px 20px -10px rgba(196,83,45,0.55); }
.bill.is-dim { opacity: 0.45; }
.bill { transition: opacity .3s; }
.bill:focus-visible { outline: 2px solid var(--testo); outline-offset: 2px; border-radius: 6px; }

.change { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; }
.change__label { font-size: 11.5px; font-weight: 550; letter-spacing: 0.04em; text-transform: uppercase; color: var(--testo-3); font-stretch: 112%; }
.change__val { font-size: clamp(26px, 7.4vh, 44px); font-weight: 700; letter-spacing: -0.035em; color: var(--accento); }
.change__sub { font-size: 12px; color: var(--testo-2);  white-space: nowrap; }

/* ---- the order closes ---- */
.closed {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 600; opacity: 0; visibility: hidden; pointer-events: none;
}
.closed svg { width: 30px; height: 30px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.closed circle { stroke: var(--accento); stroke-width: 1.2; opacity: 0.45; }
.closed path { stroke: var(--accento); stroke-width: 1.8; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* the +1 in flight */
.flyer {
  position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none;
  height: 20px; padding: 0 7px; display: inline-flex; align-items: center;
  border-radius: 999px; background: var(--accento); color: #fff;
  font-size: 11px; font-weight: 700; 
  box-shadow: 0 6px 14px -6px rgba(196,83,45,0.75), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ---- the rolling digits ---- */
.roll { display: inline-flex; align-items: flex-start; height: 1.15em; line-height: 1.15em; overflow: hidden;  }
.roll .s, .roll .d { display: block; height: 1.15em; }
.roll .d { overflow: hidden; width: 0.6em; }
.roll .d__col { display: block; }
.roll .d__col > span { display: block; height: 1.15em; text-align: center; white-space: nowrap; }
.roll .d__col { width: 100%; }

/* ---- phone: the grid on top, the ticket under it ---- */
@media (max-width: 600px) {
  .stage { padding: 8px; }
  .till { height: 100%; max-height: 520px; border-radius: 16px; }
  .bar { font-size: 11px; }
  .bar__mark { font-size: 12px; }
  .bar__till { display: none; }
  .body { display: flex; flex-direction: column; }
  .menu { flex: none; grid-auto-rows: clamp(40px, 11.5vh, 62px); gap: 5px; padding: 8px 8px 6px; }
  .tile { padding: 6px 8px; justify-content: flex-end; }
  .tile:nth-child(n+7) { display: none; }
  .tile__cat { display: none; }
  .tile__name { font-size: 12px; }
  .tile__price { font-size: 11px; margin-top: 1px; }
  .tile__qty { top: 4px; right: 4px; height: 16px; min-width: 20px; font-size: 10px; }
  .tile__bg, .tile__ring { border-radius: 10px; }
  .ticket { flex: 1; border-left: 0; border-top: 1px solid var(--linea); border-radius: 0 0 16px 16px; }
  .view { padding: 7px 10px 9px; }
  .ticket__head { margin-bottom: 2px; }
  .ticket__title { font-size: 12px; }
  .line__in { padding: 2px 0; }
  .line__name, .line__amt { font-size: 12px; }
  .line__qty { height: 16px; min-width: 22px; font-size: 10px; }
  .sum { padding-top: 4px; }
  .sum__val { font-size: 17px; }
  .cta { height: 30px; margin-top: 5px; font-size: 12.5px; border-radius: 10px; }
  .pay__head { margin-bottom: 4px; }
  .seg__opt { height: 24px; font-size: 12px; }
  .bills { margin-top: 5px; gap: 5px; }
  .bill { max-height: 34px; aspect-ratio: auto; height: 34px; }
  .bill__num { font-size: 14px; }
  .change__label { font-size: 10px; }
  .change__val { font-size: 26px; }
  .change__sub { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile__name, .cta__label, .bill__face { transition: none; }
}
