/* Cake Sort 3D - Color Puzzle Game Styling */
:root {
  --bg-floor-1: #5c3e34;
  --bg-floor-2: #482f27;
  --bg-floor-line: #38241e;
  
  --table-top: #a89ce8;
  --table-side: #8878d6;
  --table-border: #7565c4;
  --table-slot-bg: #8c7ecf;
  --table-slot-shadow: rgba(62, 45, 117, 0.4);
  
  --plate-base: #f7f9fd;
  --plate-rim: #e2e8f5;
  --plate-shadow: rgba(30, 20, 70, 0.25);
  
  --hud-bg: rgba(255, 255, 255, 0.95);
  --hud-border: #ffd180;
  --hud-shadow: rgba(0, 0, 0, 0.18);
  
  --font-main: 'Fredoka', 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background-color: #4a332a;
}

/* App Container */
#game-app {
  width: 100vw;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  
  /* Wooden plank floor texture */
  background: repeating-linear-gradient(
    90deg,
    #5f4137 0px,
    #5f4137 90px,
    #4a3128 92px,
    #583b32 94px,
    #583b32 180px,
    #442b22 182px
  );
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

/* Floor plank horizontal joints */
#game-app::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 140px,
      rgba(30, 15, 10, 0.35) 140px,
      rgba(30, 15, 10, 0.35) 143px
    );
  pointer-events: none;
  z-index: 1;
}

/* =========================================================
   CLEAN UNIFIED TOP BAR
   ========================================================= */
.clean-top-bar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 3px 10px;
  gap: 6px;
}

/* Spin Button in Top Bar */
.top-spin-btn {
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  border: 2px solid #ffffff;
  border-radius: 20px;
  padding: 3px 10px 3px 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  font-family: var(--font-main);
  font-weight: 900;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(255, 71, 87, 0.45);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.top-spin-btn:active {
  transform: scale(0.92);
}

.top-spin-btn .wheel-mini-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: conic-gradient(
    #ff4757 0deg 45deg,
    #ffa502 45deg 90deg,
    #2ed573 90deg 135deg,
    #1e90ff 135deg 180deg,
    #9c88ff 180deg 225deg,
    #ff6b81 225deg 270deg,
    #3742fa 270deg 315deg,
    #70a1ff 315deg 360deg
  );
  border: 2px solid white;
  animation: spin-slow 6s linear infinite;
  flex-shrink: 0;
}

.spin-btn-text {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* Center: Prominent Level Info & Strikes */
.top-level-info {
  flex: 1;
  background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 50%, #6c5ce7 100%);
  border: 1.5px solid #ffffff;
  border-radius: 14px;
  padding: 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
  min-width: 140px;
}

.top-level-info:active {
  transform: scale(0.97);
}

.top-level-badge {
  background: #ffffff;
  color: #d63031;
  font-size: 9px;
  font-weight: 900;
  padding: 0 6px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.top-level-title {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  line-height: 1.2;
}

.top-strikes-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}

.strikes-label-mini {
  font-size: 9px;
  font-weight: 800;
  color: #ffffff;
  opacity: 0.9;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.strike-dot {
  font-size: 11px;
  opacity: 0.35;
  filter: grayscale(1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
  line-height: 1;
}

.strike-dot.active {
  opacity: 1;
  filter: none;
  transform: scale(1.2);
  animation: strike-pop 0.35s ease;
}

.strike-dot.active.pulse {
  animation: strike-pulse-fast 0.6s infinite alternate;
}

/* Right: Coins & Mini Buttons */
.top-right-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.top-coin-pill {
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  border-radius: 14px;
  padding: 2px 7px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 900;
  font-size: 12px;
  color: #2d3436;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.top-mini-btn {
  background: white;
  border: 1.5px solid #e0e4f0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

.top-mini-btn:active {
  transform: scale(0.9);
}

/* =========================================================
   SIDE ACTION BUTTONS & BOOSTERS
   ========================================================= */
.side-actions-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Boosters Stack */
.boosters-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.booster-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4a5568, #2d3748);
  border: 2px solid #cbd5e0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}

.booster-btn:active {
  transform: scale(0.92);
}

.booster-btn.active {
  border-color: #ffd32a;
  box-shadow: 0 0 14px #ffd32a, 0 3px 8px rgba(0, 0, 0, 0.5);
  animation: booster-glow 1s infinite alternate;
}

@keyframes booster-glow {
  from { transform: scale(1.04); }
  to { transform: scale(1.12); }
}

.booster-icon {
  font-size: 17px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.booster-count {
  position: absolute;
  bottom: -3px;
  right: -3px;
  background: #ff4757;
  color: white;
  font-size: 9px;
  font-weight: 900;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.booster-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* =========================================================
   PROMINENT ACTIVE LEVEL BANNER
   ========================================================= */
.active-level-banner {
  margin: 0 12px 2px 12px;
  background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 50%, #74b9ff 100%);
  border: 1.5px solid #ffffff;
  border-radius: 12px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 20;
  position: relative;
  animation: banner-shimmer 3s infinite linear;
}

.level-badge-tag {
  background: #ffffff;
  color: #d63031;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  letter-spacing: 0.5px;
}

.level-name-tag {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   MAIN GAME STAGE & 3D TABLE
   ========================================================= */
.game-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  z-index: 10;
  padding: 2px 0;
}

.table-3d-wrapper {
  position: relative;
  width: min(300px, 82vw);
  height: min(285px, 37vh);
  transform: rotateX(18deg) translateY(0);
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

/* Table Surface (Lavender Purple) */
.table-surface {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #b8abf8 0%, #9e8ee4 100%);
  border-radius: 32px;
  border: 4px solid #c8bdfc;
  box-shadow: 
    0 10px 0 #7b6ac4,
    0 18px 24px rgba(25, 15, 50, 0.55),
    inset 0 4px 8px rgba(255, 255, 255, 0.4);
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Table Legs */
.table-leg {
  position: absolute;
  bottom: -30px;
  width: 20px;
  height: 36px;
  background: linear-gradient(180deg, #3d2f52 0%, #1f182b 100%);
  border-radius: 6px;
  z-index: -1;
  box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

.leg-left { left: 28px; }
.leg-right { right: 28px; }

/* 4x4 Grid Container - perfectly contained inside table surface */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 5px 5px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* Circular Plate Slots (Wells in Table) */
.grid-slot {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle, #8372cc 60%, #7262b8 100%);
  border-radius: 50%;
  box-shadow: 
    inset 0 3px 5px rgba(45, 30, 85, 0.6),
    0 1px 2px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  overflow: hidden;
}

.grid-slot.highlight-valid {
  background: radial-gradient(circle, #55efc4 60%, #00b894 100%);
  box-shadow: 0 0 14px #55efc4, inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: scale(1.03);
}

.grid-slot.highlight-smash {
  background: radial-gradient(circle, #ff7675 60%, #d63031 100%);
  box-shadow: 0 0 16px #ff7675;
  animation: pulse-smash 0.6s infinite alternate;
}

@keyframes pulse-smash {
  from { transform: scale(0.98); }
  to { transform: scale(1.08); }
}

/* Canvas FX Layer (Particles, Flying Slices, Celebrations) */
#fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* =========================================================
   BOTTOM DOCK CONTAINER (CONVEYOR TRAY)
   ========================================================= */
.bottom-dock-container {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  padding: 4px 12px 10px 12px;
}

.dock-shelf {
  background: linear-gradient(180deg, #c79e8c 0%, #b38875 100%);
  border-radius: 22px;
  border-top: 3px solid #e0baa8;
  box-shadow: 
    0 -3px 10px rgba(0, 0, 0, 0.3),
    0 5px 0 #8c6756,
    inset 0 2px 5px rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: 74px;
}

.dock-slot {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, #9d7564 60%, #876252 100%);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-slot.selected {
  transform: translateY(-6px) scale(1.08);
}

.dock-slot.selected::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px dashed #ffd32a;
  animation: spin-slow 4s linear infinite;
}

.dock-slot.dragging-source {
  opacity: 0.35;
  transform: scale(0.92);
}

/* Floating Drag & Drop Plate Avatar */
.drag-floating-plate {
  position: fixed;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%) scale(1.18) rotate(4deg);
  filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.5));
  will-change: transform, left, top;
}

.drag-floating-plate .plate-dish {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff 50%, #e6edf8 90%, #ced7e7 100%);
  border: 2.5px solid #ffffff;
  box-shadow: inset 0 -2px 4px rgba(180, 195, 220, 0.5);
}

.drag-floating-plate .cake-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* =========================================================
   PLATE & CAKE RENDERING (DOM + SVG / CANVAS HYBRID)
   ========================================================= */
.plate-view {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.plate-dish {
  position: absolute;
  width: 92%;
  height: 92%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff 50%, #e6edf8 90%, #ced7e7 100%);
  border: 2px solid #ffffff;
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.25),
    inset 0 -2px 4px rgba(180, 195, 220, 0.5);
  pointer-events: none;
}

.cake-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

/* =========================================================
   BOOSTER MODE BANNER
   ========================================================= */
.booster-banner {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2d3436, #1e272e);
  color: #ffd32a;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid #ffd32a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  animation: slide-down 0.3s ease;
}

.btn-cancel {
  background: #ff4757;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

@keyframes slide-down {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* =========================================================
   MODALS & OVERLAYS
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 25, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s ease;
}

.modal-backdrop.hidden {
  display: none !important;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #ffffff;
  border-radius: 28px;
  border: 4px solid #e0e6ed;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  position: relative;
  text-align: center;
  animation: pop-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-up {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f1f2f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 900;
  color: #747d8c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  color: #2f3542;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: #747d8c;
  font-weight: 600;
  margin-bottom: 18px;
}

/* Action Buttons */
.action-btn {
  background: linear-gradient(180deg, #2ed573 0%, #26af5f 100%);
  color: white;
  border: none;
  border-radius: 22px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 0 #1b7a42, 0 10px 16px rgba(46, 213, 115, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  margin-top: 14px;
}

.action-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1b7a42, 0 4px 8px rgba(46, 213, 115, 0.4);
}

.btn-secondary {
  background: #f1f2f6;
  color: #2f3542;
  border: 2px solid #dfe4ea;
  border-radius: 18px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
}

.btn-secondary:active {
  background: #dfe4ea;
}

/* Settings Modal */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  border-bottom: 1px solid #f1f2f6;
  font-weight: 700;
  font-size: 15px;
  color: #2f3542;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: #2ed573; }
input:checked + .slider:before { transform: translateX(20px); }

/* Spin Wheel Modal */
.wheel-stage {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  color: #ff4757;
  z-index: 10;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}

.reward-banner {
  margin-top: 12px;
  padding: 8px 14px;
  background: #fff9db;
  border: 2px solid #ffd43b;
  border-radius: 14px;
  font-weight: 800;
  color: #f59f00;
  font-size: 14px;
  animation: pop-up 0.3s ease;
}

/* How to play */
.how-to-content {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}

.how-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #57606f;
  line-height: 1.4;
}

.how-step-num {
  background: #3742fa;
  color: white;
  font-weight: 900;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
}

/* Win Modal */
.win-trophy-anim {
  font-size: 54px;
  margin-bottom: 8px;
  animation: bounce-trophy 1.2s infinite ease-in-out;
}

@keyframes bounce-trophy {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
}

.win-title {
  color: #ff9f43;
  font-size: 26px;
  font-weight: 900;
}

.win-level-sub {
  color: #747d8c;
  font-weight: 700;
  margin-bottom: 14px;
}

.win-rewards {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.reward-pill {
  background: #f1f2f6;
  border-radius: 20px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 14px;
  color: #2f3542;
  border: 2px solid #e4e7eb;
}

/* Game Over */
.game-over-icon {
  font-size: 48px;
  margin-bottom: 6px;
}

.game-over-title {
  color: #ff4757;
  font-size: 24px;
  font-weight: 900;
}

.game-over-sub {
  color: #747d8c;
  font-size: 13px;
  margin-bottom: 14px;
}

.booster-revive-btn {
  background: linear-gradient(180deg, #ffa502 0%, #e67e22 100%);
  box-shadow: 0 6px 0 #b35914, 0 10px 16px rgba(255, 165, 2, 0.4);
}

/* Toast Notification */
.toast-popup {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 39, 46, 0.95);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  z-index: 120;
  box-shadow: 0 6px 14px rgba(0,0,0,0.3);
  pointer-events: none;
  animation: toast-anim 2s forwards ease;
}

@keyframes toast-anim {
  0% { transform: translate(-50%, -10px); opacity: 0; }
  15% { transform: translate(-50%, 0); opacity: 1; }
  80% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -20px); opacity: 0; }
}

/* =========================================================
   START / MAIN MENU SCREEN OVERLAY
   ========================================================= */
.start-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.start-menu-overlay.menu-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.08);
}

.start-menu-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, rgba(68, 43, 34, 0.94) 0%, rgba(35, 20, 15, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.start-menu-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: menu-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes menu-enter {
  0% { transform: translateY(30px) scale(0.92); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Floating Bakery Decorations */
.floating-cake {
  position: absolute;
  font-size: 32px;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
  opacity: 0.85;
}

.cake-1 { top: -20px; left: -10px; animation: float-slow 3.2s infinite ease-in-out; }
.cake-2 { top: -10px; right: -10px; animation: float-slow 3.8s infinite ease-in-out 0.5s; font-size: 36px; }
.cake-3 { bottom: 120px; left: -25px; animation: float-slow 4.2s infinite ease-in-out 1s; }
.cake-4 { bottom: 130px; right: -25px; animation: float-slow 3.5s infinite ease-in-out 1.5s; }
.cake-5 { top: 120px; right: -30px; animation: float-slow 4s infinite ease-in-out 0.8s; font-size: 26px; }

@keyframes float-slow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* Logo & Hero Header */
.game-logo-wrapper {
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-cake-hero {
  position: relative;
  width: 130px;
  height: 130px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sparkle-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 234, 167, 0.4) 0%, rgba(255, 121, 63, 0.15) 60%, transparent 80%);
  animation: pulse-glow 2.4s infinite ease-in-out;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.95; }
}

#menu-hero-cake {
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  animation: cake-wobble 4s infinite ease-in-out;
}

@keyframes cake-wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-3deg) scale(1.03); }
  75% { transform: rotate(3deg) scale(1.03); }
}

.game-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
  text-shadow: 
    0 4px 0 #d35400,
    0 8px 16px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 121, 63, 0.6);
  line-height: 1.1;
  margin-bottom: 4px;
}

.title-3d {
  background: linear-gradient(180deg, #ffeaa7 0%, #fab1a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-left: 6px;
  filter: drop-shadow(0 3px 0 #b33939);
}

.game-tagline {
  font-size: 13px;
  color: #f1f2f6;
  font-weight: 700;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

/* Player Stats Card in Menu */
.menu-stats-card {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 12px 18px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  margin-bottom: 24px;
}

.menu-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 22px;
}

.stat-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.stat-label {
  font-size: 10px;
  font-weight: 900;
  color: #ffbe76;
  letter-spacing: 0.8px;
}

.stat-value {
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
}

.menu-stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
}

/* Actions in Start Menu */
.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Play Now Big Button */
.play-btn-pulse {
  background: linear-gradient(180deg, #2ed573 0%, #20bf6b 60%, #10ac84 100%);
  color: #ffffff;
  border: none;
  border-radius: 28px;
  padding: 16px 36px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 
    0 8px 0 #0b7056,
    0 14px 25px rgba(46, 213, 115, 0.55),
    inset 0 2px 3px rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: play-pulse-anim 2s infinite ease-in-out;
}

.play-btn-pulse:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 10px 0 #0b7056,
    0 18px 30px rgba(46, 213, 115, 0.65),
    inset 0 2px 3px rgba(255, 255, 255, 0.5);
}

.play-btn-pulse:active {
  transform: translateY(6px);
  box-shadow: 
    0 2px 0 #0b7056,
    0 6px 12px rgba(46, 213, 115, 0.4);
}

@keyframes play-pulse-anim {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.play-icon {
  font-size: 20px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

.play-text {
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Secondary Menu Buttons Row */
.menu-secondary-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.menu-sub-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 10px 6px;
  color: #ffffff;
  font-family: var(--font-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: background 0.18s ease, transform 0.15s ease;
}

.menu-sub-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.menu-sub-btn:active {
  transform: translateY(2px);
  background: rgba(255, 255, 255, 0.3);
}

.sub-icon {
  font-size: 20px;
}

.sub-text {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

/* Exit Modal Styling */
.exit-modal-card {
  border-top: 6px solid #ff7675;
}

.exit-modal-icon {
  font-size: 46px;
  margin-bottom: 6px;
}

.exit-confirm-btn {
  background: linear-gradient(180deg, #ff6b6b 0%, #ee5253 100%);
  box-shadow: 0 6px 0 #b33939, 0 10px 16px rgba(238, 82, 83, 0.4);
}

.btn-exit-highlight {
  background: #ffeaa7;
  color: #d63031;
  border-color: #ffd180;
}

.btn-exit-highlight:hover {
  background: #fed330;
}

/* =========================================================
   HUD SUBBAR: LIVES & OUT SYSTEM STATUS
   ========================================================= */
.hud-subbar {
  position: relative;
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 6px 12px;
  gap: 8px;
}

.lives-status-pill {
  flex: 1;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid #ffd180;
  border-radius: 18px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  min-height: 32px;
  transition: all 0.3s ease;
}

.lives-label {
  font-size: 11px;
  font-weight: 800;
  color: #4a332a;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.lives-hearts-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
}

.heart-icon {
  font-size: 14px;
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: heart-pop 0.3s ease;
}

.heart-icon.lost {
  opacity: 0.3;
  filter: grayscale(1);
  transform: scale(0.8);
}

@keyframes heart-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

.quick-level-btn {
  background: linear-gradient(180deg, #ffeaa7 0%, #fed330 100%);
  border: 2px solid #ffffff;
  border-radius: 16px;
  padding: 4px 10px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 800;
  color: #5c3e34;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.18);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.quick-level-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #fff2cc 0%, #ffeaa7 100%);
}

.quick-level-btn:active {
  transform: translateY(1px);
}

.level-pill {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.level-pill:hover {
  transform: scale(1.04);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.level-select-caret {
  font-size: 10px;
  color: #888;
  margin-left: -2px;
}

/* =========================================================
   START MENU: CHOOSE LEVEL BUTTON
   ========================================================= */
.menu-choose-level-btn {
  width: 100%;
  background: linear-gradient(180deg, #a29bfe 0%, #6c5ce7 100%);
  border: 3px solid #ffffff;
  border-radius: 20px;
  padding: 12px 14px;
  color: white;
  font-family: var(--font-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 0 #4834d4, 0 12px 20px rgba(108, 92, 231, 0.45);
  margin-top: 10px;
  margin-bottom: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-choose-level-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #4834d4, 0 16px 24px rgba(108, 92, 231, 0.55);
}

.menu-choose-level-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #4834d4, 0 6px 10px rgba(108, 92, 231, 0.3);
}

.menu-level-icon {
  font-size: 22px;
}

.menu-level-text {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.menu-level-sub {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

/* =========================================================
   LEVEL SELECT MODAL & CARDS
   ========================================================= */
.level-select-modal-card {
  max-width: 440px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: #ffffff;
  border-radius: 24px;
}

.level-modal-header {
  text-align: center;
  margin-bottom: 12px;
}

.level-rules-pill {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.rule-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
}

.rule-safe {
  background: #e3fcef;
  color: #10ac84;
  border: 1px solid #1dd1a1;
}

.rule-out {
  background: #ffeaa7;
  color: #d63031;
  border: 1px solid #ff7675;
}

.rule-easy {
  background: #ede7f6;
  color: #6c5ce7;
  border: 1px solid #a29bfe;
}

.level-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 6px 4px 12px 4px;
  max-height: 52vh;
}

/* Custom scrollbar for level grid */
.level-select-grid::-webkit-scrollbar {
  width: 6px;
}
.level-select-grid::-webkit-scrollbar-thumb {
  background: #dcdde1;
  border-radius: 4px;
}

.level-card-item {
  background: #f8f9fa;
  border: 2px solid #e1e8f0;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.level-card-item:hover {
  transform: translateY(-3px);
  border-color: #6c5ce7;
  box-shadow: 0 8px 16px rgba(108, 92, 231, 0.2);
}

.level-card-item.current-active {
  background: #f0f3ff;
  border-color: #4834d4;
  box-shadow: 0 0 0 2px #6c5ce7;
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-card-badge {
  background: #2d3436;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
}

.level-card-item.current-active .level-card-badge {
  background: #6c5ce7;
}

.level-diff-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.diff-safe {
  background: #2ed573;
  color: white;
}

.diff-hard {
  background: #ff4757;
  color: white;
}

.diff-medium {
  background: #ffa502;
  color: white;
}

.diff-easy {
  background: #2ed573;
  color: white;
}

.diff-supereasy {
  background: #9b59b6;
  color: white;
}

.diff-megaeasy {
  background: #ffd32a;
  color: #333;
}

.level-card-name {
  font-size: 13px;
  font-weight: 800;
  color: #2f3542;
}

.level-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #57606f;
  font-weight: 700;
}

.level-card-lives {
  color: #eb4d4b;
  font-weight: 800;
}

.level-card-preview-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.flavor-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.level-card-play-btn {
  width: 100%;
  background: #2ed573;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 6px 0;
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s ease;
}

.level-card-item:hover .level-card-play-btn {
  background: #26af5f;
}

.btn-level-highlight {
  background: linear-gradient(180deg, #a29bfe 0%, #6c5ce7 100%);
  color: white;
  border-color: #ffffff;
}

.btn-level-highlight:hover {
  background: #5a4ad1;
}

/* =========================================================
   OUT SYSTEM BADGES & ANIMATIONS
   ========================================================= */
.out-level-info {
  margin: 10px 0 14px 0;
}

.out-badge {
  background: #ffeaa7;
  color: #d63031;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px dashed #ff7675;
}

.angry-badge {
  background: #ffebee;
  color: #c62828;
  border: 1.5px solid #ef5350;
  font-weight: 900;
  animation: pulse-angry-badge 1.2s infinite alternate;
}

@keyframes pulse-angry-badge {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

/* Red Screen Flash & Shake when Out / Life Lost */
.screen-shake {
  animation: shake-anim 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake-anim {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* =========================================================
   HUD SUBBAR & ANGRY CUSTOMER STRIKES BAR
   ========================================================= */
.hud-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  gap: 8px;
  z-index: 20;
  position: relative;
}

.lives-status-pill {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #ffccd5;
  border-radius: 16px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.lives-label {
  font-size: 11px;
  font-weight: 800;
  color: #e84393;
  white-space: nowrap;
}

.lives-hearts-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.heart-icon {
  font-size: 13px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.heart-icon.lost {
  opacity: 0.35;
  filter: grayscale(1);
}

/* Angry Strikes Pill */
.angry-strikes-pill {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #ff7675;
  border-radius: 16px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(214, 48, 49, 0.25);
  transition: all 0.2s ease;
}

.angry-strikes-pill.danger {
  border-color: #d63031;
  background: #ffe6e6;
  animation: pulse-danger-pill 0.8s infinite alternate;
}

@keyframes pulse-danger-pill {
  from { box-shadow: 0 0 4px #d63031; }
  to { box-shadow: 0 0 12px #ff4757; }
}

.strikes-label {
  font-size: 11px;
  font-weight: 900;
  color: #d63031;
  white-space: nowrap;
}

.strikes-dots-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
}

.strike-dot {
  font-size: 13px;
  opacity: 0.25;
  filter: grayscale(1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
}

.strike-dot.active {
  opacity: 1;
  filter: none;
  transform: scale(1.2);
  animation: strike-pop 0.35s ease;
}

.strike-dot.active.pulse {
  animation: strike-pulse-fast 0.6s infinite alternate;
}

@keyframes strike-pop {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.4); }
  100% { transform: scale(1.2); }
}

@keyframes strike-pulse-fast {
  from { transform: scale(1.1); }
  to { transform: scale(1.35); }
}

.quick-level-btn {
  background: white;
  border: 1.5px solid #74b9ff;
  color: #0984e3;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.15s ease;
}

.quick-level-btn:active {
  transform: scale(0.92);
}

/* =========================================================
   BAKERY CUSTOMER ORDER COUNTER (QUEUE)
   ========================================================= */
.customer-counter-section {
  position: relative;
  z-index: 18;
  margin: 2px 10px 4px 10px;
  display: flex;
  flex-direction: column;
}

.bakery-canopy {
  position: relative;
  height: 18px;
  background: repeating-linear-gradient(
    90deg,
    #ff6b81 0px,
    #ff6b81 18px,
    #ffffff 18px,
    #ffffff 36px
  );
  border-radius: 8px 8px 0 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-bottom: none;
}

.canopy-scallop {
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: radial-gradient(circle at 9px 0, transparent 8px, #ff6b81 9px);
  background-size: 18px 6px;
  pointer-events: none;
}

.canopy-title {
  background: rgba(255, 255, 255, 0.94);
  color: #d63031;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.6px;
  padding: 1px 8px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: 1px solid #ffccd5;
}

.customers-queue-container {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border: 2px solid #fed7aa;
  border-radius: 0 0 14px 14px;
  padding: 6px 6px 4px 6px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  min-height: 74px;
  position: relative;
}

/* Customer Card */
.customer-card {
  flex: 1;
  max-width: 145px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease;
}

.customer-card.active-match {
  border-color: #ffd32a;
  box-shadow: 0 0 10px rgba(255, 211, 42, 0.6);
  animation: customer-highlight 1.2s infinite alternate;
}

@keyframes customer-highlight {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

/* Card Top: Avatar + Order Bubble */
.customer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.customer-avatar-box {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #fed7aa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
  overflow: visible;
}

.customer-avatar-svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.customer-sweat {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 11px;
  animation: sweat-drop 0.8s infinite alternate;
  z-index: 5;
}

@keyframes sweat-drop {
  from { transform: translateY(0); opacity: 0.7; }
  to { transform: translateY(3px); opacity: 1; }
}

.customer-mood-badge {
  position: absolute;
  bottom: -4px;
  left: -2px;
  font-size: 11px;
  line-height: 1;
  z-index: 5;
}

/* Order Bubble */
.customer-order-bubble {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  position: relative;
}

.order-flv-pill {
  display: flex;
  align-items: center;
  gap: 3px;
}

.order-cake-canvas {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.order-text {
  font-size: 10px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-name {
  font-size: 8px;
  font-weight: 700;
  color: #64748b;
  margin-top: 1px;
  text-align: left;
}

/* Patience Timer Bar */
.customer-timer-wrapper {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.customer-timer-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.customer-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ed573, #10ac84);
  border-radius: 4px;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.customer-timer-fill.warn {
  background: linear-gradient(90deg, #ffa502, #ff7f50);
}

.customer-timer-fill.danger {
  background: linear-gradient(90deg, #ff4757, #d63031);
  animation: timer-flash 0.5s infinite alternate;
}

@keyframes timer-flash {
  from { opacity: 1; }
  to { opacity: 0.6; }
}

.customer-timer-sec {
  font-size: 9px;
  font-weight: 900;
  color: #475569;
  min-width: 16px;
  text-align: right;
}

/* Individual Customer Treat / Wait Extension Button */
.customer-treat-btn {
  background: linear-gradient(135deg, #ff9f43 0%, #ee5253 100%);
  border: 1px solid #ffffff;
  color: #ffffff;
  font-size: 8px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 1.5px 4px rgba(238, 82, 83, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
  margin-left: 2px;
  line-height: 1.2;
}

.customer-treat-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.customer-treat-btn:active {
  transform: scale(0.95);
}

/* Coffee Booster Styling */
.booster-coffee-btn {
  background: linear-gradient(135deg, #a0522d 0%, #6f3717 100%) !important;
  box-shadow: 0 4px 10px rgba(111, 55, 23, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.4) !important;
}

.booster-coffee-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 14px rgba(111, 55, 23, 0.6) !important;
}

/* Calmed / Extra Wait Relief Glow */
.customer-card.customer-treat-glow {
  animation: treatGlow 0.8s ease forwards;
}

@keyframes treatGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(46, 213, 115, 0); }
  40% { transform: scale(1.08); box-shadow: 0 0 16px rgba(46, 213, 115, 0.85); border-color: #2ed573; }
  100% { transform: scale(1); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); }
}

.floating-patience-text {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff4757;
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 100;
  animation: floatUpFade 1.2s ease-out forwards;
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -16px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -24px) scale(0.9); }
}

/* Dynamic Animation States */
.customer-enter {
  animation: cust-bounce-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cust-bounce-in {
  0% { transform: scale(0.3) translateY(-20px); opacity: 0; }
  70% { transform: scale(1.1) translateY(2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}

.customer-served-happy {
  animation: cust-happy-jump 0.6s ease forwards;
}

@keyframes cust-happy-jump {
  0% { transform: scale(1); }
  30% { transform: scale(1.2) translateY(-12px); }
  60% { transform: scale(1.15) translateY(-6px); }
  100% { transform: scale(0) translateY(-24px); opacity: 0; }
}

.customer-angry-leave {
  animation: cust-angry-exit 0.65s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes cust-angry-exit {
  0% { transform: scale(1); }
  20% { transform: scale(1.25) rotate(-6deg); background: #ffebee; border-color: #ff4757; }
  40% { transform: scale(1.25) rotate(6deg); }
  60% { transform: scale(1.1) rotate(-4deg); }
  100% { transform: translateY(40px) scale(0.2); opacity: 0; }
}

.customer-sweating {
  animation: cust-wobble-anxious 0.6s infinite ease-in-out;
}

@keyframes cust-wobble-anxious {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

.hidden {
  display: none !important;
}


