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

html,
body {
  height: 100%;
  background: #160d08;
  overflow: hidden;
  font-family: ui-rounded, 'Hiragino Maru Gothic ProN', 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif;
  touch-action: manipulation;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 390px;
  height: 844px;
  transform: translate(-50%, -50%);
  overflow: clip;
  background: #2b1a10;
}

#game {
  position: absolute;
  left: 0;
  top: 0;
  width: 390px;
  height: 844px;
}

.hidden {
  display: none !important;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 10px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.chip {
  background: rgba(38, 20, 12, 0.82);
  color: #ffe9c7;
  border: 2px solid #ffb24d;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.chip.gold {
  background: rgba(73, 45, 8, 0.92);
  color: #ffd763;
}

#hud-stars {
  color: #ffd763;
  letter-spacing: 1px;
}

/* ---------- order bubbles ---------- */
#bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.bubble {
  position: absolute;
  width: 104px;
  padding: 7px 6px 6px;
  background: #fffaf0;
  border: 3px solid #3a2418;
  border-radius: 14px;
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease-out;
  animation: bubblepop 0.25s ease-out;
}

.bubble:active {
  transform: scale(0.93);
}

.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -12px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-top: 10px solid #3a2418;
}

.bubble .bfood {
  display: block;
  width: 64px;
  height: 48px;
  margin: 0 auto;
}

.bubble .bname {
  font-size: 10px;
  font-weight: 800;
  color: #5a3a22;
  margin-bottom: 4px;
}

.bubble .pbar {
  height: 7px;
  background: #e7d9c5;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid #3a2418;
}

.bubble .pfill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: #4caf50;
}

.bubble.urgent {
  animation: urgentshake 0.45s ease-in-out infinite;
}

@keyframes bubblepop {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes urgentshake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

/* ---------- cooking panel ---------- */
#cookpanel {
  position: absolute;
  inset: 0;
  overflow: clip;
  z-index: 10;
  background: rgba(20, 10, 6, 0);
  pointer-events: none;
  transition: background 0.25s;
}

#cookpanel.open {
  background: rgba(20, 10, 6, 0.45);
  pointer-events: auto;
}

#cp-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 566px;
  background: linear-gradient(#fff6e6, #ffe9cb);
  border-top: 4px solid #3a2418;
  border-radius: 26px 26px 0 0;
  padding: 14px 16px;
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.22, 1.2, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#cookpanel.open #cp-card {
  transform: translateY(0);
}

#cp-card.shake {
  animation: panelshake 0.3s;
}

@keyframes panelshake {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(0) translateX(-9px); }
  75% { transform: translateY(0) translateX(9px); }
}

#cp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#cp-name {
  font-size: 22px;
  font-weight: 900;
  color: #b03028;
}

#cp-patience {
  flex: 1;
  height: 12px;
  margin: 0 12px;
  background: #e7d9c5;
  border: 2px solid #3a2418;
  border-radius: 99px;
  overflow: hidden;
}

#cp-pfill {
  height: 100%;
  width: 100%;
  background: #4caf50;
}

#cp-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 3px solid #3a2418;
  background: #fffaf0;
  font-size: 18px;
  font-weight: 900;
  color: #3a2418;
  cursor: pointer;
}

#cp-order {
  display: flex;
  gap: 10px;
  justify-content: center;
  min-height: 64px;
}

.oslot {
  width: 60px;
  height: 60px;
  border: 3px dashed #c8a987;
  border-radius: 14px;
  background: #fffdf8;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8c3a8;
}

.oslot.filled {
  border-style: solid;
  border-color: #3a2418;
  background: #fff3d9;
  animation: bubblepop 0.22s ease-out;
}

#cp-ings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ing {
  border: 3px solid #3a2418;
  border-radius: 16px;
  background: #fffaf0;
  padding: 9px 4px 6px;
  font-size: 36px;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(58, 36, 24, 0.45);
  transition: transform 0.08s;
  font-family: inherit;
}

.ing:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 1px 0 rgba(58, 36, 24, 0.45);
}

.ing .ilabel {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #5a3a22;
  margin-top: 2px;
}

.ing.used {
  opacity: 0.35;
  pointer-events: none;
}

#cp-cook,
#cp-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cp-hint {
  font-size: 13px;
  font-weight: 800;
  color: #8a6a48;
}

#cp-bar {
  border: 3px solid #3a2418;
  border-radius: 16px;
  background: #2b2b33;
}

#cp-dish {
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.25));
}

#cp-result {
  font-size: 20px;
  font-weight: 900;
  color: #b03028;
  min-height: 24px;
}

.bigbtn {
  border: 3px solid #3a2418;
  border-radius: 18px;
  background: linear-gradient(#ff6b5e, #e03a3e);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  font-family: inherit;
  padding: 12px 42px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7c1d1f;
  transition: transform 0.08s;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.bigbtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7c1d1f;
}

.bigbtn.teal {
  background: linear-gradient(#3ecfc6, #1f9e96);
  box-shadow: 0 4px 0 #0d5b56;
}

/* ---------- overlay screens ---------- */
#overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

#overlay:empty {
  pointer-events: none;
}

.screen {
  width: 320px;
  background: linear-gradient(#fff8ea, #ffeed2);
  border: 4px solid #3a2418;
  border-radius: 26px;
  padding: 26px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: bubblepop 0.3s ease-out;
}

.screen.dim-bg {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 2000px rgba(22, 10, 5, 0.55);
}

.screen h1 {
  font-size: 44px;
  font-weight: 900;
  color: #e03a3e;
  line-height: 1;
  text-shadow: 0 3px 0 #f7c87f;
}

.screen h2 {
  font-size: 30px;
  font-weight: 900;
  color: #b03028;
}

.screen .sub {
  font-size: 15px;
  font-weight: 700;
  color: #6a4a2e;
}

.screen .statrow {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 800;
  color: #4a2f1c;
  padding: 3px 10px;
}

.screen .statrow b {
  color: #b03028;
}

.screen .menu-emoji {
  font-size: 34px;
  letter-spacing: 6px;
}

/* ---------- toast ---------- */
#toast {
  position: absolute;
  left: 50%;
  top: 130px;
  transform: translateX(-50%);
  background: rgba(38, 20, 12, 0.92);
  color: #ffe9c7;
  border: 2px solid #ffb24d;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 800;
  z-index: 30;
  pointer-events: none;
  animation: toastin 0.25s ease-out;
}

@keyframes toastin {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
