* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #fff3e0 0%, #ffe4c4 100%);
  color: #4a2f1d; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; overflow: hidden;
}
#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* header */
#hdr {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
}
#hdr .pill {
  background: #fffdf8; border: 2px solid #eccfa8; border-radius: 999px;
  padding: 7px 12px; font-weight: 800; font-size: 15px; min-height: 44px;
  display: flex; align-items: center; gap: 5px;
}
button.pill, button.big, .chip, .shelfItem, .tierCard { cursor: pointer; font-family: inherit; }
#hdrHome { border: none; background: #e35336; color: #fff; font-size: 19px; }
#hdrSpacer { flex: 1; }

/* screens */
.scr { flex: 1; display: none; flex-direction: column; overflow-y: auto; padding: 6px 14px 20px; }
.scr.on { display: flex; }

/* menu */
#scr-menu { align-items: center; text-align: center; gap: 12px; justify-content: center; }
#scr-menu h1 { font-size: clamp(34px, 10vw, 46px); }
#scr-menu .sub { color: #8a6a4a; font-weight: 600; margin-bottom: 4px; }
#tierRow { display: flex; gap: 8px; width: 100%; }
.tierCard {
  flex: 1; background: #fffdf8; border: 3px solid #eccfa8; border-radius: 16px;
  padding: 10px 4px; font-weight: 800; font-size: 14px; line-height: 1.35;
}
.tierCard small { display: block; color: #8a6a4a; font-weight: 700; }
.tierCard .te { font-size: 26px; display: block; }
.tierCard.sel { border-color: #e35336; background: #ffe9d2; box-shadow: 0 3px 0 #e3533644; }
button.big {
  width: 100%; border: none; border-radius: 18px; min-height: 58px;
  font-size: 20px; font-weight: 800; background: #fffdf8; color: #4a2f1d;
  border: 3px solid #eccfa8; box-shadow: 0 4px 0 #d9b98c;
}
button.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9b98c; }
button.big.primary { background: #e35336; border-color: #b23a22; color: #fff; box-shadow: 0 4px 0 #b23a22; }
#freePick { display: none; gap: 8px; width: 100%; }
#freePick.on { display: flex; }
#freePick button { flex: 1; font-size: 28px; min-height: 58px; border-radius: 16px; border: 3px solid #eccfa8; background: #fffdf8; box-shadow: 0 4px 0 #d9b98c; cursor: pointer; }
#statsLine { color: #8a6a4a; font-weight: 700; }

/* order card */
.orderCard {
  background: #fffdf8; border: 3px solid #eccfa8; border-radius: 16px;
  padding: 10px 12px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.orderCard .cust { font-size: 38px; }
.orderCard .wants { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wantChip {
  background: #fff1dd; border: 2px solid #eccfa8; border-radius: 10px;
  padding: 4px 8px; font-weight: 800; font-size: 15px;
}
.wantChip.done { background: #d9f2d9; border-color: #7fc07f; }
.orderCard .recipeBig { font-size: 30px; }
.famName { width: 100%; font-size: 13px; color: #8a6a4a; font-weight: 800; }

/* shop — basket model: pick things up (free), see them in the basket,
   pay once at checkout. The shelf scrolls; the basket + checkout stay pinned. */
#walletLine { font-weight: 800; margin-bottom: 6px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
#walletLine .tot { color: #b23a22; }
#shopShelf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; overflow-y: auto; align-content: start; }
.shelfItem {
  background: #fffdf8; border: 3px solid #eccfa8; border-radius: 14px;
  padding: 8px 2px 6px; text-align: center; font-weight: 800; font-size: 12px;
  color: #8a6a4a; min-height: 64px; position: relative;
}
.shelfItem .ie { font-size: 30px; display: block; line-height: 1.15; }
.shelfItem .qty {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px;
  background: #4a9e57; color: #fff; border-radius: 999px; font-size: 13px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.shelfItem.glow { border-color: #f0a832; background: #fff3c9; box-shadow: 0 0 0 3px #f0a83255; }
.shelfItem.have { border-color: #4a9e57; }

/* basket tray — reserved height so adding the first item never shifts layout */
#basketWrap { margin-top: 10px; }
#basketWrap .lbl { font-weight: 800; font-size: 14px; color: #8a6a4a; margin-bottom: 4px; }
#shopBasket {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 46px; align-content: flex-start;
  background: #fff8ee; border: 2px dashed #eccfa8; border-radius: 12px; padding: 6px;
}
#shopBasket:empty::after { content: 'Tap shelf items to fill your basket…'; color: #b79b76; font-weight: 700; font-size: 13px; padding: 6px; }
.basketItem {
  background: #fffdf8; border: 2px solid #eccfa8; border-radius: 10px;
  padding: 4px 8px; font-weight: 800; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; gap: 3px;
}
.basketItem.extra { background: #ffe9d2; border-color: #e0b070; }
.basketItem .x { color: #b23a22; font-size: 13px; }
#shopMsg { min-height: 20px; font-weight: 700; color: #4a9e57; margin-top: 6px; text-align: center; font-size: 14px; }
.bottomBtn { margin-top: 10px; }

/* kitchen */
/* one line, always — hint changes must never shift the food area */
#kHint {
  text-align: center; font-weight: 800; font-size: 16px; height: 26px; margin: 6px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#foodArea { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 250px; position: relative; }
#chipRow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 0; }
.chip {
  background: #fffdf8; border: 3px solid #eccfa8; border-radius: 14px;
  padding: 8px 10px; font-weight: 800; font-size: 15px; min-height: 52px; min-width: 62px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.chip .ie { font-size: 26px; line-height: 1.1; }
.chip.dim { opacity: 0.4; }

.pizzaBase {
  width: min(66vw, 280px); height: min(66vw, 280px); border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #f2cd8b, #daa958 92%);
  border: 10px solid #c98d3f; position: relative;
}
.sauceLayer, .cheeseLayer { position: absolute; inset: 9%; border-radius: 50%; }
.sauceLayer { background: radial-gradient(circle at 50% 45%, #e35336, #c23a22); }
.cheeseLayer { background: repeating-radial-gradient(circle at 48% 44%, #ffd97a 0 14px, #f7c94f 14px 22px); inset: 13%; opacity: 0.95; }
.topping { position: absolute; font-size: 26px; transform: translate(-50%, -50%); }

.bowl {
  width: 230px; height: 140px; background: linear-gradient(#f7ecd9, #e8d3b4);
  border: 6px solid #c98d3f; border-top: 10px solid #c98d3f;
  border-radius: 18px 18px 115px 115px; position: relative;
}
.bowl .topping { font-size: 24px; }
.tray { width: 250px; background: #d8dde3; border: 5px solid #9aa4af; border-radius: 14px; padding: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot { height: 56px; border: 3px dashed #9aa4af; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; background: #eef1f4; cursor: pointer; }
.slot.filled { border-style: solid; border-color: #c98d3f; background: #f7ecd9; }

/* burger/sandwich cross-section: CSS-drawn layers so the stack reads as a
   real sandwich, not a tower of grocery emoji (loaf + whole onion + meat). */
.stackWrap { display: flex; flex-direction: column-reverse; align-items: center; min-height: 240px; justify-content: flex-start; }
.blayer {
  width: 168px; height: 16px; margin-top: -3px; border-radius: 5px;
  box-shadow: inset 0 -3px rgba(0,0,0,0.08); position: relative; z-index: 1;
}
.blayer.pop { animation: pop 0.3s ease; }
/* buns */
.l-bunbot { height: 26px; border-radius: 6px 6px 16px 16px; background: linear-gradient(#eaa863, #d98f42); }
.l-buntop { height: 34px; border-radius: 90px 90px 8px 8px; background: linear-gradient(#f2b96e, #e09a44); box-shadow: inset 0 4px rgba(255,255,255,0.35); }
.l-buntop::after { content: '· · ·'; position: absolute; top: 7px; left: 0; right: 0; text-align: center; color: #f6e6c8; font-size: 12px; letter-spacing: 4px; }
/* bread (square-ish, lighter) */
.l-bread { height: 24px; width: 172px; border-radius: 6px; background: linear-gradient(#f4dcae, #e6c583); border: 1px solid #d8b57a; }
/* fillings */
.l-patty { height: 20px; border-radius: 8px; background: linear-gradient(#7c4a29, #59331d); }
.l-cheese { height: 12px; border-radius: 3px; background: linear-gradient(#f7c948, #f0b429); }
.l-cheese::after, .l-cheese::before { content: ''; position: absolute; bottom: -5px; width: 10px; height: 8px; background: #f0b429; border-radius: 0 0 3px 3px; }
.l-cheese::after { left: 22px; } .l-cheese::before { right: 30px; }
.l-lettuce { height: 13px; border-radius: 8px; background: #74c24a; box-shadow: 0 2px #63ab3d; }
.l-tomato { height: 12px; background: linear-gradient(#e2503b, #cf3f2c); border-radius: 4px; }
.l-onion { height: 9px; background: #f6ede4; border: 1px solid #e6d3c2; border-radius: 6px; }
.l-pickle { height: 9px; background: repeating-linear-gradient(90deg,#6fae3a 0 12px,#5c9930 12px 16px); border-radius: 4px; }
.l-bacon { height: 10px; background: repeating-linear-gradient(90deg,#b5452e 0 9px,#e5b8a2 9px 14px); border-radius: 4px; }
.l-egg { height: 15px; background: radial-gradient(circle at 50% 55%, #f6c343 0 9px, #fff 9px); border-radius: 8px; }
.l-ham { height: 12px; background: linear-gradient(#f2a3b0, #e88394); border-radius: 4px; }
.l-turkey { height: 13px; background: linear-gradient(#e9cfa6, #dcb987); border-radius: 5px; }
.l-mushroom { height: 10px; background: #d8c5a8; border-radius: 5px; }

.blender {
  width: 130px; height: 180px; border: 5px solid #8a6a4a; border-radius: 12px 12px 20px 20px;
  background: linear-gradient(#ffffffcc, #e8f4ff); position: relative; overflow: hidden;
}
.blender .topping { font-size: 24px; }
.blender.whirl { animation: whirl 0.18s linear infinite; }
@keyframes whirl { 0%{transform:translateX(-2px) rotate(-1.5deg)} 50%{transform:translateX(2px) rotate(1.5deg)} 100%{transform:translateX(-2px) rotate(-1.5deg)} }
.smoothieFill { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: linear-gradient(#f791b8, #e35390); transition: height 0.15s; }

/* timing overlay */
#timeOv {
  position: fixed; inset: 0; background: #4a2f1dd9; display: none;
  align-items: center; justify-content: center; z-index: 30; padding: 20px;
}
#timeOv.on { display: flex; }
#timeCard { background: #fffdf8; border-radius: 20px; padding: 22px 18px; width: 100%; max-width: 420px; text-align: center; }
#timeLabel { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
#timeBar { position: relative; height: 34px; background: #f1e2cb; border-radius: 999px; overflow: hidden; border: 3px solid #d9b98c; }
#timeZone { position: absolute; top: 0; bottom: 0; background: #7fc07f; }
#timeNeedle { position: absolute; top: -2px; bottom: -2px; width: 6px; background: #b23a22; border-radius: 3px; }
#timeMeter { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: #f791b8; }
#timeMsg { min-height: 28px; font-weight: 800; font-size: 19px; margin: 12px 0 6px; }
#timeBtn { margin-top: 6px; }

/* serve */
#scr-serve { align-items: center; text-align: center; gap: 10px; justify-content: center; }
#serveCust { font-size: 64px; }
#serveSpeech { font-size: 20px; font-weight: 800; }
#servePlate { transform: scale(0.85); transform-origin: top center; min-height: 150px; display: flex; align-items: center; justify-content: center; }
#serveStars { font-size: 42px; letter-spacing: 6px; min-height: 52px; }
#serveCoins { font-weight: 800; font-size: 18px; color: #8a6a4a; min-height: 24px; }

/* how to */
#scr-how .card { background: #fffdf8; border: 3px solid #eccfa8; border-radius: 16px; padding: 14px; margin-bottom: 10px; font-size: 16px; line-height: 1.55; font-weight: 600; }
#scr-how h2 { margin-bottom: 8px; }

.wiggle { animation: wig 0.35s ease; }
@keyframes wig { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
.pop { animation: pop 0.3s ease; }
@keyframes pop { 0%{transform:scale(0.4)} 70%{transform:scale(1.15)} 100%{transform:scale(1)} }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #4a2f1d; color: #fff; font-weight: 800; padding: 10px 18px;
  border-radius: 999px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 40;
  max-width: 88vw; text-align: center;
}
#toast.on { opacity: 1; }
