:root {
  --carta: #f4f2ed;          /* the warm paper of the page */
  --card: #ffffff;           /* the card */
  --inchiostro: #17171a;     /* the text and the flap tiles */
  --testo-2: #6b6862;        /* the secondary text */
  --testo-3: #aaa59c;        /* the small labels */
  --linea: #e7e3da;          /* hairlines and the wait track */
  --flap-luce: #2a2a2f;      /* the lit top of a flap tile */
  --cifre: #f6f3ec;          /* the digits on the tiles */
  --accento: #e0662a;        /* the one accent: amber, the wait bar and your turn */
}

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

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  /* everything inside is sized in em: it follows the width and the height of the window */
  font-size: clamp(11px, min(2.9vw, 2.75vh), 20px);
}

.card {
  position: relative;
  width: min(26em, 94vw);
  padding: 1.35em 1.4em 1.2em;
  background: var(--card);
  border-radius: 1.4em;
  box-shadow:
    0 0 0 1px rgba(23, 23, 26, .06),
    0 1px 2px rgba(23, 23, 26, .05),
    0 .6em 1.4em -.4em rgba(23, 23, 26, .12),
    0 2.4em 4em -1.6em rgba(23, 23, 26, .16);
  outline: none;
  cursor: default;
}
.card:focus-visible { box-shadow: 0 0 0 2px var(--carta), 0 0 0 4px var(--inchiostro), 0 2.4em 4em -1.6em rgba(23, 23, 26, .16); }
.card__ring {
  position: absolute; inset: -1px;
  border-radius: inherit;
  border: 1.5px solid var(--accento);
  box-shadow: 0 0 0 .35em rgba(224, 102, 42, .12);
  opacity: 0;
  pointer-events: none;
}
.card__sheen {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0) 30%);
  pointer-events: none;
}

.head { position: relative; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: .4em; font-weight: 640; font-stretch: 108%; font-size: .95em; letter-spacing: -.01em; }
.brand__mark { width: 1.25em; height: 1.25em; }
.head__where { font-size: .72em; color: var(--testo-3); font-weight: 520; letter-spacing: .02em; }

.label {
  position: relative;
  margin-top: 1.1em;
  font-size: .68em;
  font-weight: 620;
  font-stretch: 115%;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--testo-2);
}

/* ---- the split-flap board ---- */
.row { position: relative; margin-top: .55em; display: flex; align-items: flex-end; justify-content: space-between; gap: 1em; }
.next { display: grid; gap: .2em; justify-items: end; padding-bottom: .2em; }
.next__k { font-size: .62em; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-3); margin-bottom: .15em; }
.roll--next { font-size: 1.05em; font-weight: 620; font-variant-numeric: tabular-nums; color: var(--testo-3); text-align: right; }
.roll--next .roll__row.is-you { color: var(--accento); }
.board {
  position: relative;
  display: flex;
  gap: .32em;
}
.flap {
  position: relative;
  width: 3.5em;
  height: 4.6em;
  perspective: 18em;
  border-radius: .5em;
  box-shadow: 0 .12em .2em rgba(0,0,0,.18), 0 .5em 1em -.4em rgba(0,0,0,.35);
  font-weight: 640;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 1em;
}
.flap__half {
  position: absolute; left: 0; right: 0;
  height: 50%;
  overflow: hidden;
  background: var(--inchiostro);
  color: var(--cifre);
  backface-visibility: hidden;
}
.flap__half--top { top: 0; border-radius: .5em .5em 0 0; background: linear-gradient(180deg, var(--flap-luce), var(--inchiostro)); transform-origin: 50% 100%; }
.flap__half--bottom { bottom: 0; border-radius: 0 0 .5em .5em; transform-origin: 50% 0; }
.flap__glyph {
  display: block;
  height: 4.6em;
  line-height: 4.6em;
  text-align: center;
  font-size: 1em;
}
.flap__glyph > span { font-size: 3.2em; line-height: 1.4375; display: block; letter-spacing: -.02em; }
.flap__half--bottom .flap__glyph { transform: translateY(-50%); }
/* the hinge: a hairline gap across the middle */
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - .5px); height: 1px;
  background: rgba(0,0,0,.55); z-index: 5; pointer-events: none;
}
.flap__shade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.flap--letter .flap__glyph > span { color: var(--accento); }

/* ---- your number ---- */
.you {
  position: relative;
  margin-top: 1.1em;
  display: flex;
  align-items: center;
  gap: .9em;
}
.you__ticket {
  display: grid;
  gap: .1em;
  padding: .55em .8em .6em;
  border-radius: .8em;
  background: var(--carta);
  box-shadow: inset 0 0 0 1px var(--linea);
}
.you__small { font-size: .62em; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .55; }
.you__num { font-size: 1.35em; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.you__state { flex: 1; display: grid; gap: .15em; min-width: 0; }
.roll { display: block; overflow: hidden; height: 1.3em; line-height: 1.3em; }
.roll__row { display: block; white-space: nowrap; }
[data-state] { font-size: 1em; font-weight: 600; }
.roll--small { font-size: .78em; color: var(--testo-2); font-variant-numeric: tabular-nums; }
.bell { width: 1.6em; height: 1.6em; color: var(--testo-3); flex: none; overflow: visible; }

/* ---- the wait bar ---- */
.wait { position: relative; margin-top: 1em; height: .3em; }
.wait__track { position: absolute; inset: 0; border-radius: 1em; background: var(--linea); overflow: hidden; }
.wait__fill { position: absolute; inset: 0; background: var(--accento); border-radius: 1em; transform-origin: 0 50%; transform: scaleX(0); }
.wait__ticks { position: absolute; inset: 0; }
.wait__tick { position: absolute; top: -.15em; width: 1.5px; height: .6em; margin-left: -.75px; background: var(--card); border-radius: 1px; }

/* ---- the order drawer, opened by hover or tap ---- */
.drawer { position: relative; height: 0; overflow: hidden; }
.drawer__inner { display: grid; gap: .35em; padding-top: 1em; }
.drawer__line { display: flex; gap: .8em; font-size: .78em; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer__k { width: 4.6em; flex: none; color: var(--testo-3); font-weight: 560; }

@media (max-width: 420px) {
  .head__where { display: none; }
}
