* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffd800;
  color: #1e293b;
  padding: 20px 16px 100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-user-select: none;
  user-select: none;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(145deg, #000000, #1e1e1e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 20px 0 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}
h1::before {
  content: "";
  display: inline-block;
  background-image: url('https://supervending.gaptex.com/Didid.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 3.8rem;
  height: 3.8rem;
  position: relative;
  top: -0.8rem;
  margin-right: 1px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 30px;
  max-width: 1200px;
  width: 92%;
  margin: 0 auto;
}

.card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px);
  transition: box-shadow 0.25s ease;
}
.card:hover {
  box-shadow: 0 20px 36px rgba(0, 20, 40, 0.08);
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 20px;
  padding: 8px;
  margin-bottom: 14px;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card .title {
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.4;
  color: #0f172a;
  margin-bottom: 4px;
}

.card .slot-info {
  font-size: 0.8rem;
  color: #64748b;
  background: #f1f5f9;
  display: inline-block;
  padding: 2px 12px;
  border-radius: 40px;
  margin-top: 2px;
  text-transform: uppercase;
}

.card .price {
  font-weight: 700;
  font-size: 1.3rem;
  color: #0b2b4e;
  letter-spacing: -0.3px;
  margin: 10px 0 12px;
}

.button-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.btn {
  background: #ff7303;
  border: none;
  border-radius: 60px;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 4px;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(23, 162, 184, 0.25);
  white-space: nowrap;
}
.btn-buy {
  flex: 2;
}
.btn-cart {
  background: #f1f5f9;
  color: #0b2b4e;
  box-shadow: none;
  border: 1px solid #cbd5e1;
  flex: 1;
  font-size: 1.1rem;
  position: relative;
  overflow: visible;
}
.btn-cart:hover {
  background: #e2e8f0;
}
.btn-cart.pop {
  animation: cartBtnPop 0.35s ease;
}
@keyframes cartBtnPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.85); background: #d1fae5; border-color: #10b981; }
  65%  { transform: scale(1.15); background: #d1fae5; border-color: #10b981; }
  100% { transform: scale(1); }
}
.btn:hover {
  opacity: 0.9;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Fly-to-cart flying image effect */
.fly-item {
  position: fixed;
  z-index: 1200;
  border-radius: 16px;
  object-fit: contain;
  background: white;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  pointer-events: none;
  will-change: transform, opacity;
  transition: transform 0.6s cubic-bezier(0.55, 0, 0.85, 0.35), opacity 0.6s ease;
}
.fly-item.flying {
  transform: var(--fly-transform);
  opacity: 0.3;
}

/* "+1" floating badge */
.fly-plus-one {
  position: fixed;
  z-index: 1200;
  font-weight: 700;
  font-size: 1rem;
  color: #10b981;
  pointer-events: none;
  opacity: 1;
  transition: transform 0.6s ease, opacity 0.6s ease;
}
.fly-plus-one.flying {
  transform: translateY(-40px);
  opacity: 0;
}

/* Cart bar bump when item lands */
.cart-bar.bump {
  animation: cartBarBump 0.4s ease;
}
@keyframes cartBarBump {
  0%   { transform: translateX(-50%) translateY(0) scale(1); }
  30%  { transform: translateX(-50%) translateY(0) scale(1.08); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

/* Spinner Loading Effect */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.btn-cart .spinner {
  border: 2px solid rgba(11, 43, 78, 0.2);
  border-top-color: #0b2b4e;
  width: 14px;
  height: 14px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Floating Cart Bar */
.cart-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e1e1e;
  color: white;
  padding: 12px 16px 12px 20px;
  border-radius: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(11, 43, 78, 0.4);
  z-index: 900;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 86%;
  max-width: 500px;
  justify-content: space-between;
}
.cart-bar.active {
  transform: translateX(-50%) translateY(0);
}
.cart-content-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cart-info {
  font-size: 0.95rem;
  font-weight: 500;
}
.btn-close-cart {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: 0.15s;
}
.btn-close-cart:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}
.cart-timer-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.cart-timer-badge.warning {
  background: rgba(220, 38, 38, 0.25);
  color: #fca5a5;
  animation: pulseWarning 0.8s infinite alternate;
}
@keyframes pulseWarning {
  from { opacity: 1; }
  to { opacity: 0.5; }
}
.btn-view-cart {
  background: #17a2b8;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
}
.btn-view-cart:hover {
  background: #138496;
}

/* Modal Cart List Styling */
.cart-items-container {
  max-height: 260px;
  overflow-y: auto;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  padding-right: 4px;
}
.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  gap: 10px;
}
.cart-item-thumb {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px;
  flex-shrink: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.cart-item-details {
  flex: 1;
}
.cart-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}
.cart-item-price {
  font-size: 0.85rem;
  color: #64748b;
}
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-qty {
  background: #e2e8f0;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b2b4e;
  transition: 0.15s;
}
.btn-qty:hover {
  background: #cbd5e1;
}
.cart-item-qty {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 20px;
  text-align: center;
}

/* Modal Styling */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal-overlay.locked {
  pointer-events: none;
}
.modal-overlay.locked .modal-content {
  pointer-events: none;
}
.modal-overlay.locked .modal-content .btn-close-x {
  display: none !important;
}

.modal-content {
  background: #ffffff;
  max-width: 420px;
  width: 100%;
  border-radius: 30px;
  padding: 32px 24px 36px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.3);
  position: relative;
  text-align: center;
  animation: modalFade 0.25s ease;
}
@keyframes modalFade {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.btn-close-x {
  position: absolute;
  top: 14px;
  right: 18px;
  background: #f1f5f9;
  border: none;
  font-size: 28px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1e293b;
  transition: 0.15s;
  z-index: 20;
}
.btn-close-x:hover {
  background: #e2e8f0;
  transform: rotate(90deg);
}

.qr-large {
  width: 200px;
  height: 200px;
  object-fit: contain;
  background: white;
  border-radius: 28px;
  margin: 16px auto 12px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.timer {
  font-size: 1rem;
  background: #f1f5f9;
  padding: 6px 18px;
  border-radius: 60px;
  display: inline-block;
  margin-top: 4px;
  color: #334155;
}
#countdown {
  font-weight: 700;
  color: #0b2b4e;
}

#paymentStatus {
  margin-top: 14px;
  font-weight: 600;
  color: #2563eb;
}

.success-container {
  padding: 8px 0 4px;
}
.success-icon {
  font-size: 64px;
  background: #d1fae5;
  width: 100px;
  height: 100px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #0b7e4b;
}
.success-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0b2b4e;
}
.success-subtitle {
  font-size: 1.1rem;
  color: #2d4a6b;
  margin: 8px 0 12px;
}
.loader-dots {
  font-size: 0.95rem;
  color: #475569;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 60px;
  display: inline-block;
  animation: pulseDots 1.4s infinite;
}
@keyframes pulseDots {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.confirm-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  border-radius: 30px;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.confirm-overlay.active {
  display: flex;
}
.confirm-box {
  background: white;
  padding: 28px 24px 24px;
  border-radius: 40px;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
.confirm-box p {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 20px;
  color: #0f172a;
}
.confirm-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
}
.btn-yes, .btn-no {
  border: none;
  padding: 10px 30px;
  border-radius: 60px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.15s;
  min-width: 80px;
}
.btn-yes {
  background: #dc2626;
  color: white;
}
.btn-no {
  background: #f1f5f9;
  color: #1e293b;
}

/* Custom Alert Modal Box */
.alert-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.alert-overlay.active {
  display: flex;
}
.alert-content {
  background: #ffffff;
  max-width: 340px;
  width: 100%;
  border-radius: 36px;
  padding: 28px 24px 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: modalFade 0.25s ease;
}
.alert-icon {
  font-size: 42px;
  margin-bottom: 12px;
}
.alert-message {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 24px;
  line-height: 1.5;
}
.btn-alert-ok {
  background: #0b2b4e;
  color: white;
  border: none;
  padding: 10px 30px;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.15s;
  width: 100%;
  box-shadow: 0 4px 12px rgba(11, 43, 78, 0.3);
}
.btn-alert-ok:hover {
  opacity: 0.9;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  color: #64748b;
}
.empty-state h3 {
  font-size: 1.6rem;
  font-weight: 500;
  color: #334155;
}