:root {
  --game-bg: radial-gradient(circle at 50% 30%, #fff8e1 0%, #ffe0b2 55%, #ffcc80 100%);
  --wood-table: linear-gradient(180deg, #d7ccc8 0%, #bcaaa4 60%, #a1887f 100%);
  --crust-color: linear-gradient(135deg, #ffe082 0%, #ffd54f 50%, #ffca28 100%);
  --crust-border: #f57f17;
  --sauce-color: radial-gradient(circle, #e53935 0%, #d32f2f 70%, #c62828 100%);
}

/* ========================================================
   Main Field & Kitchen Setting
   ======================================================== */
.pizza-field {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 10px 12px 16px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ========================================================
   Top Order Ticket & Guest Customer
   ======================================================== */
.order-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
}

.guest-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 3px solid #ffb74d;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s ease;
  font: inherit;
}

.guest-card:hover {
  transform: scale(1.08);
}

.guest-card:focus-visible {
  outline: 3px solid #ff9800;
  outline-offset: 3px;
}

.guest-card.eating {
  animation: guest-eat 0.5s ease-in-out 2;
}

@keyframes guest-eat {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.18) translateY(-6px); }
  100% { transform: scale(1) translateY(0); }
}

.guest-avatar {
  font-size: 38px;
  line-height: 1;
  animation: guest-bob 2.6s ease-in-out infinite alternate;
}

@keyframes guest-bob {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-4px) rotate(3deg); }
}

.guest-speech {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff9800;
  color: #fff;
  font-size: 16px;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Recipe Ticket */
.recipe-ticket {
  background: #fffdf7;
  border: 2.5px dashed #ff9800;
  border-radius: 16px;
  padding: 6px 16px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  min-height: 48px;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.recipe-items {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recipe-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
  font-weight: 800;
  color: #4e342e;
  background: rgba(255, 152, 0, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.25s ease;
}

.recipe-item.fulfilled {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
  animation: item-complete 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes item-complete {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.item-icon {
  font-size: 22px;
  line-height: 1;
}

.item-check {
  font-size: 16px;
  margin-left: 2px;
}

/* ========================================================
   Kitchen Prep Stage & Pizza Board
   ======================================================== */
.kitchen-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(84vw, 42vh, 320px);
  height: min(84vw, 42vh, 320px);
  margin: auto 0;
  z-index: 10;
}

.pizza-board {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 45% 45%, #d7ccc8 0%, #bcaaa4 65%, #a1887f 100%);
  border: 8px solid #8d6e63;
  border-radius: 50%;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.6),
    inset 0 -6px 12px rgba(0, 0, 0, 0.25),
    0 14px 28px rgba(93, 64, 55, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.pizza-target {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82%;
  height: 82%;
}

.pizza-target:focus-visible {
  outline: 4px solid #ff9800;
  border-radius: 50%;
}

/* 1. Crust Layer */
.crust-layer {
  position: relative;
  background: var(--crust-color);
  border: 5px solid var(--crust-border);
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.7),
    inset 0 -6px 10px rgba(230, 81, 0, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.crust-layer.crust-ball {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  animation: dough-wobble 2s ease-in-out infinite alternate;
}

@keyframes dough-wobble {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.04); }
}

.crust-layer.crust-rolled {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: crust-expand 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes crust-expand {
  0% { transform: scale(0.4); }
  80% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.crust-layer.crust-eaten {
  transform: scale(0.08);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

/* 2. Sauce Layer */
.sauce-layer {
  position: absolute;
  inset: 12px;
  background: var(--sauce-color);
  border-radius: 50%;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: sauce-spread 0.4s ease-out;
  z-index: 2;
}

@keyframes sauce-spread {
  0% { transform: scale(0.2); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 3. Melted Cheese Glow Layer */
.cheese-layer {
  position: absolute;
  inset: 14px;
  background: radial-gradient(circle, #fff9c4 0%, #ffeb3b 40%, rgba(255, 213, 79, 0.85) 75%, transparent 100%);
  border-radius: 50%;
  z-index: 3;
  animation: cheese-melt 0.8s ease-in-out;
}

@keyframes cheese-melt {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* 4. Toppings Dropped on Pizza */
.toppings-layer {
  position: absolute;
  inset: 16px;
  z-index: 5;
  pointer-events: none;
}

.pizza-topping-item {
  position: absolute;
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.28));
  transform-origin: center center;
  animation: topping-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none;
}

@keyframes topping-pop {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ========================================================
   Wood Stone Oven View
   ======================================================== */
.oven-view {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle at 50% 60%, #3e2723 0%, #21120e 70%, #150906 100%);
  border: 10px solid #5d4037;
  border-radius: 40px;
  box-shadow:
    inset 0 10px 24px rgba(0, 0, 0, 0.8),
    0 16px 36px rgba(0, 0, 0, 0.4);
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: oven-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes oven-slide-in {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.oven-arch {
  position: relative;
  width: 90%;
  height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.oven-fire-glow {
  position: absolute;
  bottom: 10px;
  width: 80%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(255, 112, 67, 0.75) 0%, rgba(255, 87, 34, 0.3) 60%, transparent 100%);
  filter: blur(10px);
  animation: fire-pulse 1.2s ease-in-out infinite alternate;
}

.oven-fire-flames {
  position: absolute;
  bottom: 20px;
  font-size: 42px;
  animation: fire-wiggle 0.7s ease-in-out infinite alternate;
}

@keyframes fire-pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 1; }
}

@keyframes fire-wiggle {
  0% { transform: translateY(0) scaleX(1); }
  100% { transform: translateY(-6px) scaleX(1.15); }
}

/* ========================================================
   Pantry Selection Tray
   ======================================================== */
.pantry-tray {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.75);
  padding: 8px 12px;
  border-radius: 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: opacity 0.25s ease;
}

.pantry-tray.inactive {
  opacity: 0.7;
}

.pantry-item {
  background: #ffffff;
  border: 3px solid #ffcc80;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;
  outline: none;
  padding: 0;
}

.pantry-item:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.pantry-item:active {
  transform: scale(0.92);
}

.pantry-item:focus-visible {
  outline: 4px solid #ff9800;
}

.pantry-item.completed {
  opacity: 0.55;
  border-color: #81c784;
}

.pantry-icon {
  font-size: 30px;
  line-height: 1;
}

/* ========================================================
   Action Controls Bar
   ======================================================== */
.pizza-controls {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

.action-pill-btn {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  padding: 10px 28px;
  border: 3px solid #ffe082;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(245, 124, 0, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
  animation: btn-pulse 2.2s ease-in-out infinite alternate;
}

.action-pill-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 22px rgba(245, 124, 0, 0.55);
}

.action-pill-btn:active {
  transform: scale(0.96);
}

.action-pill-btn:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

.action-pill-btn.ready-to-bake {
  background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
  animation: btn-glow 1.2s ease-in-out infinite alternate;
}

@keyframes btn-glow {
  0% { transform: scale(1); box-shadow: 0 6px 18px rgba(230, 74, 25, 0.4); }
  100% { transform: scale(1.06); box-shadow: 0 8px 24px rgba(255, 87, 34, 0.7); }
}

@keyframes btn-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

/* ========================================================
   Wobble & Feedback Animations
   ======================================================== */
.wobble {
  animation: gentle-wobble 0.45s ease-in-out;
}

@keyframes gentle-wobble {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-4deg); }
  40% { transform: translateX(5px) rotate(3deg); }
  60% { transform: translateX(-4px) rotate(-2deg); }
  80% { transform: translateX(2px) rotate(1deg); }
}

/* ========================================================
   Sparkles & Steam
   ======================================================== */
.sparks-container,
.steam-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 35;
}

.sparkle-pop {
  position: absolute;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #ffffff 0%, #ffeb3b 60%, transparent 100%);
  border-radius: 50%;
  animation: spark-twinkle 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes spark-twinkle {
  0% { transform: translate(0, 0) scale(0.2); opacity: 1; }
  100% { transform: translate(var(--sx, 0), var(--sy, 0)) scale(1.4); opacity: 0; }
}

.steam-puff {
  position: absolute;
  font-size: 28px;
  animation: steam-rise 1.6s ease-out forwards;
}

@keyframes steam-rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0.8; }
  100% { transform: translateY(-80px) scale(1.4); opacity: 0; }
}

/* ========================================================
   Responsive Breakpoints
   ======================================================== */
@media (max-height: 600px) {
  .pizza-field {
    padding: 4px 8px 8px;
    gap: 4px;
  }
  .order-bar {
    max-width: 360px;
    gap: 8px;
  }
  .guest-card {
    width: 46px;
    height: 46px;
  }
  .guest-avatar {
    font-size: 28px;
  }
  .recipe-ticket {
    min-height: 38px;
    padding: 4px 10px;
  }
  .recipe-item {
    font-size: 14px;
    padding: 2px 8px;
  }
  .item-icon {
    font-size: 18px;
  }
  .kitchen-stage {
    width: min(76vw, 36vh, 220px);
    height: min(76vw, 36vh, 220px);
  }
  .pantry-tray {
    padding: 4px 8px;
    gap: 6px;
  }
  .pantry-item {
    width: 42px;
    height: 42px;
  }
  .pantry-icon {
    font-size: 24px;
  }
  .action-pill-btn {
    font-size: 15px;
    padding: 6px 18px;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .pizza-field {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 8px;
    padding: 4px 12px;
  }
  .order-bar {
    width: 45%;
    max-width: 280px;
  }
  .kitchen-stage {
    width: min(44vh, 180px);
    height: min(44vh, 180px);
  }
  .pantry-tray {
    width: 45%;
    max-width: 280px;
  }
  .pizza-controls {
    width: 100%;
    margin-top: 2px;
  }
}

/* ========================================================
   Reduced Motion
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
  .guest-avatar,
  .crust-layer.crust-ball,
  .action-pill-btn,
  .action-pill-btn.ready-to-bake,
  .oven-fire-glow,
  .oven-fire-flames {
    animation: none;
  }
}
