:root {
  --bg1: #1a1412;
  --panel: #332017;
  --panel2: #45281b;
  --wood: #6d3f23;
  --cream: #f7ead0;
  --ink: #22130b;
  --red: #d93829;
  --red2: #b82b1d;
  --green: #2b9348;
  --gold: #f4a261;
  --gold2: #e76f51;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: "Baloo 2", "Trebuchet MS", Verdana, sans-serif;
  background: radial-gradient(1400px 700px at 50% -180px, #362217, transparent), var(--bg1);
  color: var(--cream);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px 14px;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: 100%;
  max-width: 1720px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hidden { display: none !important; }

/* Custom scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #00000030; border-radius: 99px; }
::-webkit-scrollbar-thumb { background: #6d3f23aa; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #f4a261cc; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px;
  flex-shrink: 0;
}
.logo {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 0 #00000088;
}
.chips {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.chip {
  background: #00000055;
  border: 1px solid #ffffff18;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 700;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 16px;
}
.btn-icon {
  background: #00000055;
  border: 1px solid #ffffff22;
  color: var(--cream);
  font-size: 16px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
}
.btn-icon:hover { background: #00000085; transform: translateY(-1px); }
.btn-icon:active { transform: translateY(0); }

/* ---------- Awning ---------- */
.awning {
  position: relative;
  height: 26px;
  border-radius: 12px 12px 0 0;
  background: repeating-linear-gradient(90deg, var(--red) 0 48px, var(--cream) 48px 96px);
  box-shadow: 0 4px 12px #00000066;
  flex-shrink: 0;
}
.awning::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 100%; height: 18px;
  background:
    radial-gradient(circle at 24px 0, var(--red2) 17px, transparent 18px),
    radial-gradient(circle at 72px 0, #e6d6b4 17px, transparent 18px);
  background-size: 96px 18px;
  background-repeat: repeat-x;
}

/* ---------- Customer Strip ---------- */
.strip {
  margin-top: 16px;
  background: var(--panel);
  border: 3px solid var(--wood);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  position: relative;
  min-height: 96px;
  flex-shrink: 0;
}
.avatar {
  width: 74px; height: 74px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #00000035;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s ease, opacity 0.45s ease;
  position: relative;
  z-index: 2;
}
.avatar.enterL { transform: translateX(-120px); opacity: 0; }
.avatar.exitL { transform: translateX(-120px) scale(0.8); opacity: 0; }
.avatar.exitR { transform: translateX(120px) scale(0.8); opacity: 0; }
.avatar.shake { animation: shake 0.4s; }
#face { font-size: 38px; line-height: 1; animation: bob 2.6s ease-in-out infinite; }
#cname { font-size: 12px; font-weight: 800; opacity: 0.9; margin-top: 2px; }

.bubble {
  position: relative;
  flex: 1;
  background: var(--cream);
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 16px;
}
.bubble::before {
  content: '';
  position: absolute;
  left: -10px; top: 24px;
  border: 10px solid transparent;
  border-right-color: var(--cream);
  border-left: 0;
}
#ordTitle { font-weight: 800; font-size: 16px; }
#ordBase { font-size: 14px; margin: 3px 0 5px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ord-tag { background: #00000015; padding: 2px 10px; border-radius: 8px; color: #402414; font-size: 13px; font-weight: 800; }
#ordItems { display: flex; flex-wrap: wrap; gap: 4px; }

.mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #00000014;
  border-radius: 8px;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
}
.mini b { font-size: 14px; color: #5b3a1e; font-weight: 800; }

.patwrap {
  height: 9px;
  background: #00000022;
  border-radius: 99px;
  margin-top: 6px;
  overflow: hidden;
}
#patFill {
  display: block;
  height: 100%; width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #3f9d4f, #f5b83d 62%, #e04b3a);
  transition: width 0.1s linear;
}
#patFill.urgent { animation: blink 0.5s steps(2) infinite; }

.float {
  position: absolute;
  left: 55%; top: -8px;
  font-weight: 800; font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 6px #000;
  pointer-events: none;
  z-index: 5;
  animation: rise 1.2s forwards;
}

/* ---------- Kitchen Grid ---------- */
.kitchen {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1.2fr minmax(420px, 520px);
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.shelf {
  background: var(--panel);
  border: 3px solid var(--wood);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.shelf h3 {
  font-size: 15px;
  letter-spacing: 2px;
  opacity: 0.85;
  text-align: center;
  text-transform: uppercase;
  flex-shrink: 0;
}
.bins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
  align-content: start;
}
.bin {
  background: var(--panel2);
  border: 2px solid #ffffff18;
  border-radius: 12px;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: grab;
  color: var(--cream);
  font-family: inherit;
  touch-action: none;
  transition: transform 0.08s, border-color 0.15s;
  min-width: 0;
  overflow: hidden;
}
.bin:hover { transform: translateY(-2px); border-color: var(--gold); }
.bin:active { cursor: grabbing; }
.bin.locked { opacity: 0.45; cursor: pointer; filter: grayscale(0.7); }
.bin .sample {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  background: #00000030;
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}
.ghost-sample {
  width: 36px; height: 36px;
  border-radius: 50%;
  position: fixed;
  z-index: 200;
  pointer-events: none;
}
.blabel {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.15;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ---------- Prep Controls ---------- */
.prep {
  background: linear-gradient(#4d2e1c, #391f12);
  border: 3px solid var(--wood);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  height: 100%;
  min-height: 0;
  position: relative;
}
.hint {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.9;
  min-height: 20px;
  text-align: center;
  flex-shrink: 0;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}
.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  border: 0;
  border-radius: 12px;
  padding: 11px 24px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.b-dough { background: #2f9e44; }
.b-trash { background: #e03131; }
.b-bake { background: #f08c00; }
.b-serve { background: #1971c2; }
.b-takeout { background: #d9480f; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.modal-card {
  background: var(--panel);
  border: 3px solid var(--wood);
  border-radius: 18px;
  padding: 24px;
  width: min(560px, 100%);
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}
.modal-card h2 { font-size: 28px; margin-bottom: 10px; }
.modal-card p { opacity: 0.9; margin: 8px 0 16px; line-height: 1.45; font-size: 15px; }

/* ---------- Toasts & Banner ---------- */
#toasts {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast {
  background: #110905ee;
  border: 1px solid var(--wood);
  color: var(--cream);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 99px;
  box-shadow: 0 4px 14px #000;
  animation: tin 0.2s ease, tout 0.3s ease 2.2s forwards;
}
#banner { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 90; }
#bannerTxt { font-weight: 800; font-size: 46px; color: var(--cream); text-shadow: 0 4px 14px #000; animation: bannerPop 1.6s forwards; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  html, body { overflow: auto; height: auto; min-height: 100%; }
  #app { height: auto; max-height: none; }
  .kitchen {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    flex: none;
  }
  .shelf { max-height: 240px; }
  .bins { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .prep { min-height: 440px; }
}
