:root {
  --ink: #2b1d14;
  --muted: #6d5c4d;
  --wall: #eef5f1;
  --green: #1f6f5c;
  --green-dark: #164f42;
  --steel: #dfe4e8;
  --steel-dark: #8e979e;
  --red: #c8321f;
  --yellow: #f2c14e;
  --cream: #fff8ec;
  --wood: #6b4a33;
  --font: 'Baloo Bhaijaan 2', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #123d33;
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
svg { display: block; }

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--wall);
  overflow: hidden;
}

/* top bar */
#hud {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: var(--green);
  color: #fff;
  z-index: 2;
}
.pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .2);
  font-weight: 800;
  font-size: 18px;
  line-height: 30px;
  direction: ltr;
}
.pill i svg, #bin i svg { width: 22px; height: 22px; }
.spacer { flex: 1; }
.iconbtn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, .2);
  color: #fff;
  display: grid;
  place-items: center;
}
.iconbtn svg { width: 20px; height: 20px; }

/* the street side of the counter: the wall, the sign and the customers */
#street {
  flex: 1;
  min-height: 230px;
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--wall);
  background-image:
    linear-gradient(90deg, rgba(31, 111, 92, .11) 1.5px, transparent 1.5px),
    linear-gradient(rgba(31, 111, 92, .11) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
}
.sign {
  align-self: center;
  margin-top: 8px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  line-height: 32px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.slots {
  flex: 1;
  display: flex;
  direction: ltr;            /* A S D serve left to right in both languages */
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 4px;
}
.slot {
  width: 32%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.slot.empty { visibility: hidden; }
.slot.in { animation: walkin .45s ease-out; }
.slot.out .ticket, .slot.out .bar { opacity: 0; transition: opacity .2s; }
.slot.out .figure { animation: walkout 1.2s ease-in forwards; }
@keyframes walkin { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes walkout { 0%, 45% { transform: none; opacity: 1; } 100% { transform: translateY(50px); opacity: 0; } }

.ticket {
  position: relative;
  width: 100%;
  max-width: 134px;
  min-height: 66px;
  padding: 4px 4px 6px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
  margin-bottom: 8px;
}
.ticket::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: #fff;
}
.ticket .size {
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  line-height: 20px;
  background: #ebe4d6;
}
.ticket .size.big { background: var(--yellow); }
.ticket .items { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px 2px; margin-top: 3px; }
.ticket .plain { font-weight: 700; font-size: 13px; color: var(--muted); }
.it { position: relative; width: 32px; height: 32px; }
.it svg { width: 100%; height: 100%; }
.it b {
  position: absolute;
  right: -5px;
  bottom: -3px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 15px;
  direction: ltr;
}
.it.no::after {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: var(--ink);
  border-radius: 2px;
  transform: rotate(-40deg);
}
.figure svg { width: 104px; height: 124px; }
.bar { width: 66%; height: 8px; margin: 2px 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 4px; background: #3bb273; }

/* what a customer says, and the coins they pay */
.say {
  position: absolute;
  bottom: calc(100% - 26px);
  left: 50%;
  z-index: 3;
  width: max-content;
  max-width: 160px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  unicode-bidi: plaintext;   /* the customers' row is left to right; the words follow the language */
  transform: translateX(-50%);
  transform-origin: center bottom;
  animation: pop .18s ease-out;
}
.say.good { background: var(--green); }
/* the outer customers' bubbles open inwards, so they stay on screen */
.slot:first-child .say { left: 0; transform: none; transform-origin: left bottom; }
.slot:last-child .say { left: auto; right: 0; transform: none; transform-origin: right bottom; }
.float {
  position: absolute;
  top: 40%;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 800;
  font-size: 22px;
  color: #b47c0e;
  text-shadow: 0 2px 0 #fff;
  transform: translateX(-50%);
  animation: rise 1.2s ease-out forwards;
}
.float svg { width: 22px; height: 22px; }
@keyframes pop { from { scale: .6; } to { scale: 1; } }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }

/* the steel counter top, and the kitchen side */
#counterTop {
  height: 16px;
  background: linear-gradient(#f4f6f8, #aab3ba);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .15);
  z-index: 1;
}
#kitchen {
  position: relative;
  height: 172px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  background: #e8dfcf;
}
#bowl svg { width: 178px; height: 142px; transition: transform .15s; }
#bowl .bowl-small { transform: scale(.82); }
#bowl .bowl-big { transform: scale(1.04); }
#bowl.bump svg { animation: bump .18s; }
@keyframes bump { 50% { transform: scale(1.1); } }
#bin {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  width: 62px;
  min-height: 62px !important;
  font-size: 13px;
}
#bin i svg { width: 30px; height: 30px; }
#hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  padding: 0 12px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--green-dark);
}
#hint.warn { color: var(--red); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* the buttons: two bowls, then the pots in layer order */
#counter {
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: var(--wood);
}
#bowls { display: flex; gap: 8px; margin-bottom: 8px; }
#bowls .btn { flex: 1; flex-direction: row; gap: 8px; min-height: 54px; font-size: 16px; }
#bowls .btn svg { width: 38px; height: 38px; }
#pots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#pots .btn { flex: 0 0 calc(33.333% - 6px); }
.btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: 4px 2px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(#ffffff, var(--steel));
  box-shadow: 0 4px 0 var(--steel-dark);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--steel-dark); }
.btn svg { width: 44px; height: 44px; margin-bottom: 2px; }
.btn .n {
  position: absolute;
  top: -5px;
  inset-inline-end: -4px;
  min-width: 24px;
  padding: 0 5px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  line-height: 24px;
  direction: ltr;
}
.btn .n:empty { display: none; }
.btn.no { animation: shake .3s; }
.btn kbd { display: none; }
@media (hover: hover) and (pointer: fine) {
  .btn kbd {
    display: block;
    position: absolute;
    top: 4px;
    inset-inline-start: 6px;
    font: 700 11px var(--font);
    color: var(--steel-dark);
  }
}

/* banners and screens */
#banner {
  position: absolute;
  top: 34%;
  left: 50%;
  z-index: 4;
  padding: 6px 24px;
  border-radius: 16px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  white-space: nowrap;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
  transform: translateX(-50%) scale(0);
  pointer-events: none;
}
#banner.show { animation: banner 2s ease-out forwards; }
@keyframes banner {
  0% { transform: translateX(-50%) scale(0); }
  12% { transform: translateX(-50%) scale(1.1); }
  20%, 80% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 0; }
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(18, 61, 51, .9);
  overflow-y: auto;
}
.screen.hidden { display: none; }
.card {
  width: 100%;
  max-width: 400px;
  padding: 18px 20px 20px;
  border-radius: 24px;
  background: var(--cream);
  text-align: center;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .25);
}
.hero svg { width: 190px; height: 150px; margin: -6px auto 0; }
h1 { margin: 0; font-size: 40px; line-height: 1.1; color: var(--red); }
h2 { margin: 4px 0 8px; font-size: 30px; line-height: 1.2; color: var(--green-dark); }
.tagline { margin: 4px 0 10px; font-size: 18px; color: var(--muted); }
.card ol { margin: 0 0 16px; padding-inline-start: 22px; text-align: start; font-size: 16px; line-height: 1.45; }
.card li { margin-bottom: 4px; }
.big {
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 4px 0 #8f2213;
}
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #8f2213; }
.link { margin-top: 12px; border: 0; background: none; font-weight: 700; font-size: 17px; color: var(--green); text-decoration: underline; }
.keys { display: none; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .keys { display: block; } }
.stars { display: flex; justify-content: center; gap: 6px; margin: 2px 0 6px; }
.stars svg { width: 54px; height: 54px; }
.stars svg.on { animation: pop2 .35s ease-out backwards; }
.stars svg:nth-child(2) { animation-delay: .25s; }
.stars svg:nth-child(3) { animation-delay: .5s; }
@keyframes pop2 { from { transform: scale(0); } to { transform: scale(1); } }
.best { min-height: 24px; font-weight: 800; color: var(--red); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 6px 0 16px; font-size: 18px; text-align: start; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 800; direction: ltr; text-align: end; }

/* shorter phones */
@media (max-height: 740px) {
  #street { min-height: 200px; }
  .figure svg { width: 80px; height: 96px; }
  #kitchen { height: 132px; }
  #bowl svg { width: 135px; height: 108px; }
  .ticket { min-height: 58px; }
  .it { width: 27px; height: 27px; }
  #bin { width: 54px; min-height: 54px !important; }
  #bowls .btn { min-height: 46px; }
  #pots .btn { min-height: 66px; }
  .btn svg { width: 36px; height: 36px; }
  .hero svg { width: 150px; height: 118px; }
  h1 { font-size: 34px; }
}
