@import url("https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&family=Noto+Sans+SC:wght@500;700;900&display=swap");

:root {
  --ink: #2a1810;
  --paper: #f7e6c4;
  --chili: #e23a2b;
  --oil: #c45a2a;
  --gold: #f4c430;
  --yolk: #ffe36a;
  --night: #1b2430;
  --moss: #1e4d4a;
  --steam: #ffb14a;
  --shadow: #14110d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #0c0a09;
  color: var(--paper);
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  user-select: none;
  touch-action: none;
}
button, input { font-family: inherit; }
button { cursor: pointer; }

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}

#stage {
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  position: relative;
  overflow: hidden;
  background: #1b2430;
  box-shadow: 0 30px 80px #000a;
}

.hud {
  position: absolute;
  z-index: 8;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.chip, .day-chip {
  pointer-events: auto;
  background: #f7e6c4ee;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 6px 10px;
  font-weight: 900;
  font-size: 13px;
  transform: rotate(-1.5deg);
}
.day-chip { transform: rotate(2deg); background: var(--gold); }
.chip b { color: var(--chili); }

.scene {
  position: absolute;
  inset: 0 0 40% 0;
  background:
    linear-gradient(180deg, #0c0a0988 0%, #0c0a0900 18%, #1a1008aa 78%, #1a1008ee 100%),
    url("assets/raster/bg-stall.jpg") center top / cover no-repeat;
}
.scene.neon {
  filter: saturate(1.18) contrast(1.05);
}
.scene.neon .sign {
  background: #1e4d4a;
  color: #ffe36a;
  box-shadow: 6px 6px 0 #f4c430, 0 0 24px #ffe36a88;
}
.scene.luxury {
  filter: saturate(1.28) contrast(1.08);
}
.scene.luxury .sign {
  background: #2a1810;
  color: #ffe36a;
  box-shadow: 6px 6px 0 #e23a2b, 0 0 28px #ffb14aaa;
}
.helpers {
  position: absolute;
  right: 12px;
  bottom: 248px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
.helper {
  width: 72px;
  background: #f7e6c4ee;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  text-align: center;
  font-size: 10px;
  font-weight: 900;
  transform: rotate(3deg);
}
.helper img {
  width: 100%;
  height: 58px;
  object-fit: contain;
  display: block;
}
.sign {
  position: absolute;
  left: 18px;
  top: 58px;
  width: 168px;
  padding: 10px 12px 12px;
  background: var(--chili);
  color: var(--yolk);
  border: 4px solid var(--ink);
  transform: rotate(-7deg);
  box-shadow: 6px 6px 0 var(--ink);
}
.sign h1 {
  margin: 0;
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 28px;
  letter-spacing: 1px;
  line-height: 1.05;
}
.sign small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--paper);
}
.heat-bar {
  position: absolute;
  right: 14px;
  top: 62px;
  width: 18px;
  height: 120px;
  border: 3px solid var(--ink);
  background: #2a1810aa;
  overflow: hidden;
  transform: rotate(3deg);
}
.heat-bar span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(#ffe36a, #e23a2b);
  height: 20%;
}
.heat-bar em {
  position: absolute;
  top: -22px;
  left: -8px;
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
  font-weight: 900;
}

.queue {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 92px;
  height: 150px;
}
.customer {
  position: absolute;
  bottom: 0;
  width: 108px;
  transition: transform .25s ease, left .4s ease, filter .2s;
}
.customer img {
  width: 100%;
  height: 132px;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 6px 0 #0006);
}
.customer.rage img { filter: saturate(1.4) contrast(1.2) hue-rotate(-20deg); animation: shake .18s linear 4; }
.bubble {
  position: absolute;
  left: 50%;
  bottom: 92%;
  transform: translateX(-50%) rotate(-2deg);
  min-width: 92px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--ink);
}
.bubble::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -10px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.patience {
  height: 6px;
  margin-top: 5px;
  background: #2a181033;
  overflow: hidden;
}
.patience i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--moss);
}

.grill-stage {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 78%;
  transform: translateX(-50%);
}
.grill-stage img { width: 100%; display: block; }
.slots {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 18%;
  bottom: 22%;
  display: flex;
  gap: 8px;
}
.slot {
  flex: 1;
  border: 2px dashed #ffe36a88;
  border-radius: 10px;
  position: relative;
}
.slot.hot { box-shadow: inset 0 0 18px #ff6a1a88; }
.slot .cook-item {
  position: absolute;
  inset: 4px;
  display: grid;
  place-items: center;
}
.slot .cook-item img { width: 78%; }
.slot .cook-item.raw { filter: grayscale(.35) brightness(1.15); }
.slot .cook-item.cooked { filter: saturate(1.3) contrast(1.05); }
.slot .cook-item.burnt { filter: grayscale(.2) brightness(.45) sepia(.6); }
.meter {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4px;
  height: 7px;
  background: #1a1410;
  border: 2px solid var(--ink);
}
.meter i { display: block; height: 100%; width: 0; background: #3ae0a0; }
.meter.cooked i { background: var(--gold); }
.meter.burnt i { background: var(--chili); }

.combo-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) rotate(-8deg);
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 42px;
  color: var(--gold);
  text-shadow: 4px 4px 0 var(--ink);
  opacity: 0;
  pointer-events: none;
}
.combo-pop.show { animation: pop 700ms ease; }

.desk {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background:
    repeating-linear-gradient(90deg, #6b3a22 0 14px, #5a301c 14px 28px);
  border-top: 6px solid var(--ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 8px 10px calc(10px + var(--safe-bottom));
  gap: 6px;
}
.orders {
  display: flex;
  gap: 6px;
  overflow: hidden;
}
.order-card {
  flex: 1;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
  min-height: 42px;
  transform: rotate(-1deg);
}
.order-card.active { background: var(--gold); }

.bench {
  display: grid;
  grid-template-columns: 1.4fr .9fr .8fr;
  gap: 8px;
  min-height: 0;
}
.tray, .sauces, .pack {
  background: #f7e6c4dd;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 #14110d;
  padding: 6px;
  min-height: 0;
}
.tray h3, .sauces h3, .pack h3 {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 1px;
}
.foods {
  display: flex;
  gap: 4px;
  height: calc(100% - 18px);
}
.food {
  flex: 1;
  background: #fff6e4;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  padding: 2px;
}
.food img {
  width: 100%;
  max-height: 54px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 0 #0003);
}
.grill-stage img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px #0008);
}
.slot .cook-item img {
  width: 86%;
  max-height: 58px;
  object-fit: contain;
}
.food.locked { opacity: .35; filter: grayscale(1); }
.food.dragging, .cook-item.dragging { opacity: .35; }

.sauces { display: flex; flex-direction: column; }
.sauce-row { display: flex; flex-wrap: wrap; gap: 4px; }
.sauce {
  border: 2px solid var(--ink);
  background: #fff6e4;
  font-weight: 900;
  font-size: 12px;
  padding: 6px 8px;
}
.sauce.on { background: var(--chili); color: var(--yolk); }
.pack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pack .hint { margin: 0; font-size: 11px; line-height: 1.35; }
.pack-drop {
  min-height: 48px;
  border: 2px dashed var(--ink);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  background: #fff6e4;
}
.pack-drop.ready { background: var(--gold); }

.toast {
  position: absolute;
  left: 50%;
  bottom: 42%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--yolk);
  border: 3px solid var(--gold);
  padding: 8px 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  z-index: 9;
}
.toast.show { animation: toast 1.4s ease; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #0c0a09d0;
  display: grid;
  place-items: end center;
  padding: 18px;
}
.overlay.hidden { display: none; }
.panel {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--chili);
  padding: 18px 16px 16px;
  transform: rotate(-1deg);
}
.panel h2 {
  font-family: "ZCOOL KuaiLe", cursive;
  margin: 4px 0 8px;
  font-size: 30px;
}
.kicker { margin: 0; font-size: 12px; font-weight: 900; color: var(--chili); letter-spacing: 1px; }
.copy { margin: 0 0 12px; line-height: 1.5; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 12px; }
.stats b { display: block; font-size: 20px; }
.btn-row { display: flex; flex-direction: column; gap: 8px; }
.btn {
  border: 3px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  font-weight: 900;
  padding: 12px;
  box-shadow: 4px 4px 0 var(--ink);
}
.btn.ghost { background: #fff6e4; }
.btn.danger { background: var(--chili); color: var(--yolk); }
.btn:disabled { opacity: .5; }

.qte-hit {
  width: 100%;
  height: 54px;
  border: 3px solid var(--ink);
  background: #fff6e4;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}
.qte-hit i {
  position: absolute;
  top: 0; bottom: 0;
  width: 22%;
  left: 54%;
  background: #3ae0a0aa;
}
.qte-hit b {
  position: absolute;
  top: 0; bottom: 0;
  width: 8px;
  background: var(--chili);
  left: 0;
  animation: sweep 1.1s linear infinite;
}

.ad-panel { transform: rotate(1deg); }
.ad-screen {
  background: var(--night);
  color: var(--yolk);
  border: 3px solid var(--ink);
  padding: 16px;
  margin-bottom: 12px;
  min-height: 120px;
}
.ad-bar { height: 8px; background: #2a1810; margin-bottom: 12px; overflow: hidden; }
.ad-bar i { display: block; height: 100%; width: 0; background: var(--gold); animation: load 3s linear forwards; }
.ad-brand { font-family: "ZCOOL KuaiLe", cursive; font-size: 28px; margin: 0; }
.ad-sub { margin: 6px 0 0; opacity: .8; }

.drag-ghost {
  position: absolute;
  width: 72px;
  pointer-events: none;
  z-index: 30;
  transform: translate(-50%, -70%);
  filter: drop-shadow(0 8px 0 #0006);
}

@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.6) rotate(-8deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1) rotate(-8deg); }
}
@keyframes toast {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes shake {
  from { transform: translateX(-3px); }
  to { transform: translateX(3px); }
}
@keyframes sweep { from { left: 0; } to { left: 96%; } }
@keyframes load { from { width: 0; } to { width: 100%; } }

@media (min-width: 720px) {
  #stage { border-radius: 18px; }
}
