@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700;800&family=Orbitron:wght@800;900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  font-family: 'Fredoka', 'Segoe UI', cursive, sans-serif;
  touch-action: none;
}

body, html {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #2e1d52 0%, #110924 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 420px;
  height: 650px;
  max-width: 100vw;
  max-height: 100vh;
  background: radial-gradient(circle at 50% 30%, #3a2861 0%, #1d1238 100%);
  border-radius: 36px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 0 6px #533b8a,
    0 0 0 10px #241642,
    inset 0 2px 8px rgba(255, 255, 255, 0.3);
  overflow: hidden;
  transform-origin: center center;
}

/* Glass Jar Rim & Highlight */
#game-container::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 18px;
  right: 18px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  filter: blur(1px);
  pointer-events: none;
  z-index: 5;
}

#game-container::after {
  content: '';
  position: absolute;
  top: 30px;
  left: 25px;
  width: 12px;
  height: 80%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), rgba(255,255,255,0.02));
  border-radius: 10px;
  pointer-events: none;
  z-index: 5;
}

/* 0. 3-SECOND SPLASH SCREEN */
.splash-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #3a2861 0%, #120924 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-layer.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 82%;
}

.splash-logo {
  font-size: 3.8rem;
  filter: drop-shadow(0 4px 14px rgba(244, 63, 94, 0.6));
  animation: bouncePudding 1.6s infinite ease-in-out;
}

@keyframes bouncePudding {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.08, 0.94); }
}

.splash-title {
  font-family: 'Orbitron', 'Fredoka', sans-serif;
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #f43f5e 0%, #fb7185 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(244, 63, 94, 0.5));
  margin-top: 6px;
}

.splash-subtitle {
  color: #fbcfe8;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: -2px;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  margin-top: 24px;
  overflow: hidden;
  border: 1.5px solid rgba(251, 113, 133, 0.4);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f43f5e, #fb7185, #facc15);
  box-shadow: 0 0 12px #f43f5e;
  border-radius: 12px;
  transition: width 0.1s linear;
}

.splash-loading-text {
  font-size: 0.78rem;
  color: #cbd5e1;
  font-weight: 700;
  margin-top: 10px;
}

/* Top UI Bar */
#ui-layer {
  position: absolute;
  top: 14px;
  left: 0;
  width: 100%;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

#stats-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#score-box, #coin-box {
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 14px;
  color: #3b206b;
  font-weight: 800;
  font-size: 0.8rem;
  box-shadow: 0 4px 0 #cfc3ea, 0 6px 12px rgba(0,0,0,0.3);
}

#coin-box {
  background: #fef08a;
  color: #854d0e;
  box-shadow: 0 3px 0 #eab308;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ui-svg-coin {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.ui-svg-coin-sm {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  display: inline-block;
}

#order-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #ffe4e6 0%, #fecdd3 100%);
  padding: 5px 8px;
  border-radius: 16px;
  box-shadow: 0 4px 0 #fb7185, 0 8px 16px rgba(0, 0, 0, 0.25);
  border: 2px solid #fff;
}

#customer-avatar {
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

#order-target {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #9f1239;
}

#target-preview {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #4ade80;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

#top-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

#next-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  padding: 3px 5px;
  border-radius: 10px;
  box-shadow: 0 3px 0 #cfc3ea;
  color: #583394;
  font-size: 0.62rem;
  font-weight: 800;
}

#next-preview {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  margin-top: 1px;
}

.icon-btn {
  background: #ffffff;
  border: none;
  border-radius: 12px;
  color: #3b206b;
  width: 32px;
  height: 32px;
  cursor: pointer;
  box-shadow: 0 3px 0 #cfc3ea, 0 4px 8px rgba(0,0,0,0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.icon-btn:active {
  transform: translateY(2px) scale(0.95);
  box-shadow: 0 1px 0 #cfc3ea;
}

.ui-svg-icon {
  width: 18px;
  height: 18px;
}

/* Bottom Bar */
#bottom-bar {
  position: absolute;
  bottom: 14px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  z-index: 10;
}

.action-btn {
  background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
  color: white;
  border: 2px solid #a5b4fc;
  padding: 7px 9px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 0.74rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #4338ca, 0 6px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #4338ca;
}

.action-btn.active {
  background: linear-gradient(180deg, #f87171 0%, #ef4444 100%) !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 4px 0 #b91c1c !important;
}

.rainbow-btn {
  background: linear-gradient(180deg, #f472b6 0%, #d946ef 100%);
  border-color: #fbcfe8;
  box-shadow: 0 4px 0 #a21caf, 0 6px 12px rgba(0, 0, 0, 0.3);
}

.coin-ad-btn {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #fef08a;
  color: #78350f;
  text-shadow: none;
  box-shadow: 0 4px 0 #b45309, 0 6px 12px rgba(0, 0, 0, 0.3);
}

.ad-btn {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  border-color: #a7f3d0;
  box-shadow: 0 4px 0 #047857, 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Modal Windows & Transitions */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 9, 36, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #3b206b;
  z-index: 30;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-box {
  background: #ffffff;
  border: 4px solid #fbcfe8;
  padding: 22px;
  border-radius: 28px;
  width: 88%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 6px 0 #f472b6;
  transform: scale(1) translateY(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.hidden .modal-box {
  transform: scale(0.85) translateY(20px);
}

/* Mode Selection Cards */
#modes-carousel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 4px 0;
}

.mode-card {
  background: #f8fafc;
  border: 2.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  position: relative;
}

.mode-card:hover {
  transform: translateY(-2px);
}

.mode-card.active {
  background: #faf5ff;
  border-color: #a855f7;
  box-shadow: 0 4px 0 #c084fc;
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-icon {
  font-size: 1.2rem;
}

.mode-header h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1e1b4b;
}

.mode-desc {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
  padding-right: 70px;
}

.mode-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 800;
}

.unlocked-badge {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.locked-badge {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.timer-badge {
  background: #fef08a;
  color: #854d0e;
  border: 1px solid #fde047;
}

/* Shop Modal Styling */
.shop-modal-box {
  max-height: 82%;
  padding-bottom: 12px;
}

#skins-scroll-container {
  overflow-y: auto;
  max-height: 320px;
  padding-right: 4px;
}

#skins-scroll-container::-webkit-scrollbar {
  width: 6px;
}

#skins-scroll-container::-webkit-scrollbar-thumb {
  background: #cfc3ea;
  border-radius: 10px;
}

#skins-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 16px;
  box-shadow: 0 3px 0 #cbd5e1;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.skin-card.active {
  border-color: #a855f7;
  background: #faf5ff;
  box-shadow: 0 3px 0 #c084fc;
}

.skin-preview {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.skin-info {
  flex: 1;
  text-align: left;
  margin-left: 8px;
}

.skin-info h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: #334155;
}

.skin-info p {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
}

.skin-action-btn {
  border: none;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.74rem;
  cursor: pointer;
  transition: transform 0.08s;
}

.skin-action-btn:active {
  transform: scale(0.95);
}

.equip-btn {
  background: #cbd5e1;
  color: #475569;
}

.skin-card.active .equip-btn {
  background: #a855f7;
  color: white;
}

.buy-btn {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 3px 0 #92400e;
}

.ad-unlock-btn {
  background: linear-gradient(180deg, #06b6d4, #0891b2);
  color: white;
  box-shadow: 0 3px 0 #0e7490;
}

.shop-coin-badge {
  background: #fef08a;
  color: #854d0e;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 12px;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 5px;
}

.modal-subtext {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
}

.text-center {
  text-align: center;
  align-items: center;
}

.game-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: #7c3aed;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: -6px;
}

.menu-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
}

.menu-badge {
  background: #f1f5f9;
  padding: 5px 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.82rem;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.primary-btn {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: white;
  border: 2px solid #bbf7d0;
  padding: 12px 30px;
  border-radius: 20px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #15803d, 0 10px 20px rgba(34, 197, 94, 0.35);
  transition: transform 0.08s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #15803d;
}

.secondary-btn {
  background: #cbd5e1;
  color: #334155;
  border: none;
  padding: 10px 24px;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #94a3b8;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #f1f5f9;
  padding-bottom: 6px;
  width: 100%;
}

.modal-header h3 {
  font-weight: 800;
  color: #3b206b;
}

.close-btn {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 800;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
}

.setting-item input[type="range"] {
  width: 120px;
  accent-color: #ec4899;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #ec4899;
}

.setting-item select {
  background: #f8fafc;
  color: #334155;
  border: 2px solid #e2e8f0;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 700;
  outline: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}