* {
  -webkit-tap-highlight-color: transparent;
}

:root {
  --cream: #FFF8F0;
  --tomato: #E63946;
  --basil: #2A9D8F;
  --gold: #F4A261;
  --wood: #8B5E3C;
  --wood-dark: #5C3D26;
  --night: #1B2432;
}

body {
  background: #3d2314;
  color: #3d2314;
}

/* ——— Start screen ——— */
.start-screen-bg {
  background:
    linear-gradient(180deg, rgba(90, 30, 20, 0.55), rgba(40, 15, 10, 0.75)),
    url('../assets/restaurant-bg.png') center / cover no-repeat;
}

.start-screen-overlay {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 180, 60, 0.25), transparent 55%),
    linear-gradient(180deg, transparent 40%, rgba(40, 10, 5, 0.5));
  pointer-events: none;
}

/* ——— Restaurant scene ——— */
.restaurant-scene {
  position: relative;
  isolation: isolate;
}

.restaurant-bg {
  position: absolute;
  inset: 0;
  background:
    url('../assets/restaurant-bg.png') center / cover no-repeat;
  z-index: 0;
  transition: filter 2.5s ease, opacity 2.5s ease;
}

.restaurant-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, 0.15) 0%, rgba(90, 45, 20, 0.25) 45%, rgba(60, 30, 15, 0.45) 100%);
  transition: background 2.5s ease;
}

#game-container[data-time="night"] .restaurant-bg {
  filter: brightness(0.45) saturate(0.85) hue-rotate(-10deg);
}

#game-container[data-time="night"] .restaurant-tint {
  background:
    linear-gradient(180deg, rgba(20, 30, 60, 0.45) 0%, rgba(10, 15, 40, 0.55) 100%);
}

body[data-time="night"] {
  background: #121820;
}

/* String lights */
.lights-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  padding: 0 8% 0;
  pointer-events: none;
  height: 18px;
}

.lights-row span {
  width: 10px;
  height: 14px;
  border-radius: 50% 50% 40% 40%;
  background: radial-gradient(circle at 40% 30%, #fff7c2, #fbbf24 60%, #f59e0b);
  box-shadow: 0 0 12px 4px rgba(251, 191, 36, 0.55);
  animation: light-twinkle 2.4s ease-in-out infinite;
}

.lights-row span:nth-child(odd) {
  background: radial-gradient(circle at 40% 30%, #ffe4e6, #fb7185 60%, #e11d48);
  box-shadow: 0 0 12px 4px rgba(251, 113, 133, 0.5);
  animation-delay: 0.4s;
}

.lights-row span:nth-child(3n) {
  background: radial-gradient(circle at 40% 30%, #d1fae5, #34d399 60%, #059669);
  box-shadow: 0 0 12px 4px rgba(52, 211, 153, 0.45);
  animation-delay: 0.8s;
}

@keyframes light-twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.9); }
}

#game-container[data-time="night"] .lights-row span {
  box-shadow: 0 0 18px 6px rgba(251, 191, 36, 0.7);
}

/* ——— HUD ——— */
.hud-bar {
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.95), rgba(255, 236, 210, 0.92));
  border: 2px solid rgba(139, 94, 60, 0.35);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  box-shadow: 0 6px 20px rgba(60, 30, 10, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 600;
  border: 1.5px solid transparent;
}

.hud-chip-gold {
  background: linear-gradient(180deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
}

.hud-chip-sky {
  background: linear-gradient(180deg, #e0f2fe, #bae6fd);
  border-color: #38bdf8;
}

.hud-chip-purple {
  background: linear-gradient(180deg, #ede9fe, #ddd6fe);
  border-color: #a78bfa;
}

.hud-chip-purple.urgent,
#hud-timer-wrap.border-red-500\/60,
#hud-timer-wrap.bg-red-500\/20 {
  background: linear-gradient(180deg, #fee2e2, #fecaca) !important;
  border-color: #ef4444 !important;
}

.storefront-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #9f1239;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ——— Station panels ——— */
.station-panel {
  background:
    linear-gradient(165deg, rgba(255, 250, 243, 0.92), rgba(255, 236, 210, 0.88));
  border: 3px solid rgba(139, 94, 60, 0.4);
  border-radius: 1.25rem;
  padding: 0.6rem 0.75rem;
  box-shadow:
    0 10px 28px rgba(60, 25, 10, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
}

.dining-panel {
  background:
    linear-gradient(165deg, rgba(255, 245, 238, 0.94), rgba(254, 215, 170, 0.85));
  border-color: #e07a5f;
}

.prep-panel {
  background:
    linear-gradient(165deg, rgba(255, 252, 245, 0.95), rgba(253, 230, 180, 0.9));
  border-color: #c2410c;
}

.oven-panel {
  background:
    linear-gradient(165deg, rgba(255, 247, 237, 0.94), rgba(254, 215, 170, 0.88));
  border-color: #b45309;
}

.station-title {
  color: #7c2d12;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

@media (min-width: 768px) {
  .station-title { font-size: 0.85rem; }
}

/* ——— Cutting board / pizza ——— */
.cutting-board {
  background:
    linear-gradient(135deg, #c4a574 0%, #a67c52 40%, #8b5e3c 100%);
  border-radius: 1.5rem;
  padding: 1.25rem 1.5rem;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.25),
    inset 0 -4px 12px rgba(60, 30, 10, 0.35),
    0 8px 20px rgba(60, 30, 10, 0.3);
  border: 3px solid #6b4226;
  position: relative;
}

.cutting-board::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.pizza-plate {
  background:
    radial-gradient(circle at 40% 35%, #f5e6d3, #e8d4b8 55%, #c4a574);
  border: 5px solid #8b5e3c;
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.2);
}

.pizza-layer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transition: opacity 0.2s;
}

.pizza-layer-dough {
  background:
    radial-gradient(circle at 38% 32%, #f8e4bc, #e8c988 55%, #d4a574 85%, #b8874e);
  box-shadow: inset 0 -6px 14px rgba(139, 90, 40, 0.35);
}

.pizza-layer-sauce {
  background: radial-gradient(circle at 50% 50%, #ef5350 0%, #c62828 55%, transparent 82%);
  width: 86%;
  height: 86%;
  top: 7%;
  left: 7%;
  opacity: 0.95;
}

.pizza-layer-cheese {
  background:
    radial-gradient(circle at 42% 38%, rgba(255, 248, 180, 0.95) 0%, rgba(255, 213, 79, 0.85) 45%, transparent 78%),
    radial-gradient(circle at 62% 58%, rgba(255, 236, 140, 0.7) 0%, transparent 40%);
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
}

.pizza-layer-pepperoni {
  background-image:
    radial-gradient(circle at 28% 32%, #b71c1c 0%, #8b1515 42%, transparent 44%),
    radial-gradient(circle at 62% 48%, #c62828 0%, #8b1515 40%, transparent 42%),
    radial-gradient(circle at 44% 68%, #b71c1c 0%, #8b1515 38%, transparent 40%),
    radial-gradient(circle at 72% 28%, #d32f2f 0%, #8b1515 36%, transparent 38%),
    radial-gradient(circle at 38% 48%, #c62828 0%, #8b1515 34%, transparent 36%);
  width: 78%;
  height: 78%;
  top: 11%;
  left: 11%;
}

.pizza-layer-mushrooms {
  background-image:
    radial-gradient(ellipse 10px 7px at 32% 38%, #eceff1 0%, #90a4ae 55%, transparent 58%),
    radial-gradient(ellipse 10px 7px at 58% 32%, #eceff1 0%, #78909c 55%, transparent 58%),
    radial-gradient(ellipse 9px 6px at 48% 62%, #cfd8dc 0%, #78909c 55%, transparent 58%),
    radial-gradient(ellipse 9px 6px at 70% 55%, #eceff1 0%, #90a4ae 55%, transparent 58%);
  width: 78%;
  height: 78%;
  top: 11%;
  left: 11%;
}

.pizza-base[data-state="building"] {
  animation: subtle-pulse 2s ease-in-out infinite;
}

.pizza-base[data-state="baked"] {
  filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.7));
}

.pizza-base[data-state="baked"] .pizza-layer-dough {
  background: radial-gradient(circle at 40% 35%, #e8c070, #c9954a 65%, #a06a30);
}

@keyframes subtle-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.pizza-base.drop-target {
  outline: 3px dashed #f59e0b;
  outline-offset: 6px;
}

.held-pizza-tray {
  background: linear-gradient(180deg, #fff8e7, #fde68a);
  border: 2px dashed #d97706;
  border-radius: 1rem;
  padding: 0.25rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.serve-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #9a3412;
  background: #fff;
  border-radius: 999px;
  padding: 0 0.4rem;
  margin-top: -4px;
}

/* ——— Ingredient tray ——— */
.ingredient-bar {
  background:
    linear-gradient(180deg, rgba(120, 70, 35, 0.85), rgba(80, 45, 20, 0.92));
  border-top: 4px solid #5c3d26;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}

.ingredient-bar p {
  color: #fde68a !important;
}

.ingredient-chip {
  touch-action: none;
  user-select: none;
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  background: linear-gradient(180deg, #fffdf8, #fff1d6);
  border: 2.5px solid #c2410c;
  border-radius: 1rem;
  box-shadow:
    0 4px 0 #9a3412,
    0 8px 16px rgba(0, 0, 0, 0.2);
  min-width: 4.25rem;
  padding: 0.35rem 0.4rem 0.45rem;
}

.ingredient-chip:hover {
  transform: translateY(-3px);
}

.ingredient-chip:active,
.ingredient-chip.dragging {
  cursor: grabbing;
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 100;
}

.ingredient-chip .ing-sprite {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.ingredient-chip .ing-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #7c2d12;
  pointer-events: none;
  margin-top: 0.1rem;
}

.ingredient-chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  opacity: 0.95;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.drag-ghost img {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
}

/* ——— Customers ——— */
.customer-card {
  transition: transform 0.2s, opacity 0.3s, box-shadow 0.2s;
  background: linear-gradient(160deg, #fffdf9, #ffedd5);
  border: 2px solid #fdba74;
  border-radius: 1rem;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 4px 12px rgba(120, 50, 20, 0.15);
}

.customer-card.leaving {
  transform: translateX(-100%);
  opacity: 0;
}

.customer-card.angry-leaving {
  transform: translateX(100%) rotate(5deg);
  opacity: 0;
}

.customer-card.drop-target-serve {
  outline: 3px dashed #22c55e;
  outline-offset: 2px;
  transform: scale(1.03);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

.customer-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background: #fff7ed;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .customer-avatar {
    width: 3.5rem;
    height: 3.5rem;
  }
}

.order-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  background: #fff;
  border: 1.5px solid #fdba74;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.order-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patience-bar {
  transition: width 0.1s linear, background-color 0.3s;
}

.patience-bar.critical {
  animation: patience-flash 0.5s ease-in-out infinite;
}

@keyframes patience-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ——— Oven ——— */
.oven-sprite {
  animation: float 3.5s ease-in-out infinite;
}

.oven-door {
  background:
    linear-gradient(180deg, #5c4033 0%, #3d2918 40%, #2a1a10 100%);
  border: 3px solid #8b5e3c !important;
  border-radius: 1rem;
  min-height: 110px;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.oven-door::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 180, 80, 0.15);
  pointer-events: none;
}

.oven-door[data-state="baking"] {
  border-color: #f97316 !important;
  box-shadow:
    0 0 24px rgba(249, 115, 22, 0.55),
    inset 0 0 40px rgba(255, 100, 0, 0.25);
  animation: oven-glow 1s ease-in-out infinite alternate;
}

.oven-door[data-state="baking"] .oven-sprite-mini,
.oven-door[data-state="baking"] {
  animation: oven-glow 1s ease-in-out infinite alternate, sizzle 0.6s ease-in-out infinite;
}

.oven-door[data-state="done"] {
  border-color: #22c55e !important;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.5);
}

@keyframes oven-glow {
  from { box-shadow: 0 0 15px rgba(249, 115, 22, 0.35), inset 0 0 20px rgba(255, 100, 0, 0.15); }
  to { box-shadow: 0 0 32px rgba(249, 115, 22, 0.7), inset 0 0 50px rgba(255, 100, 0, 0.3); }
}

.oven-label {
  color: #fde68a !important;
  font-weight: 600;
}

/* ——— Buttons ——— */
.game-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 0.75rem;
  transition: transform 0.1s, box-shadow 0.1s;
  color: white;
}

.game-btn-danger {
  background: linear-gradient(180deg, #f87171, #dc2626);
  box-shadow: 0 4px 0 #991b1b;
}

.game-btn-danger:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #991b1b;
}

.game-btn-oven {
  background: linear-gradient(180deg, #fb923c, #ea580c);
  box-shadow: 0 4px 0 #9a3412;
}

.game-btn-oven:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #9a3412;
}

/* ——— Summary / shop ——— */
.summary-panel {
  background:
    linear-gradient(180deg, #fffaf3 0%, #ffecd2 100%);
  border: 3px solid #c2410c;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.stat-tile {
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid #fdba74;
}

.coin-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
}

.shop-item {
  transition: transform 0.15s, border-color 0.15s;
  background: rgba(255, 255, 255, 0.75) !important;
  border: 2px solid #fdba74 !important;
  border-radius: 0.85rem;
}

.shop-item:not(.maxed):hover {
  transform: translateY(-1px);
  border-color: #f59e0b !important;
}

.shop-item.maxed {
  opacity: 0.65;
}

.shop-item .text-white {
  color: #7c2d12 !important;
}

.shop-item .text-slate-400,
.shop-item .text-slate-500 {
  color: #92400e !important;
  opacity: 0.75;
}

.shake-screen {
  animation: shake 0.4s ease-in-out;
}

#customer-queue::-webkit-scrollbar {
  width: 4px;
}

#customer-queue::-webkit-scrollbar-thumb {
  background: rgba(194, 65, 12, 0.35);
  border-radius: 2px;
}

.empty-state {
  color: #9a3412 !important;
  opacity: 0.55;
}

@media (max-width: 768px) {
  .pizza-base {
    width: 8.5rem;
    height: 8.5rem;
  }

  .ingredient-chip {
    min-width: 3.6rem;
  }

  .ingredient-chip .ing-sprite {
    width: 2.25rem;
    height: 2.25rem;
  }

  .oven-hero img {
    width: 5.5rem;
  }

  .storefront-title {
    display: none;
  }
}
