*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark:  #5b21b6;
  --accent:        #f59e0b;
  --sale-color:    #f43f5e;
  --bg:            #0f0f1a;
  --bg-card:       #1a1a2e;
  --bg-card2:      #16213e;
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --border:        #2d2d4a;
  --success:       #10b981;
  --danger:        #ef4444;
  --hkd-color:     #f59e0b;
  --twd-color:     #60a5fa;
  --radius:        12px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* HEADER */
.site-header {
  background: rgba(15,15,26,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.2rem; font-weight: 700; color: var(--primary-light); }
.header-nav { display: flex; align-items: center; gap: 12px; }
.badge-online {
  font-size: 0.8rem; color: var(--success);
  background: rgba(16,185,129,0.15);
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid rgba(16,185,129,0.3);
}

/* CART BUTTON */
.cart-btn {
  position: relative;
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 14px; border-radius: 10px;
  font-family: inherit; font-size: 0.9rem; cursor: pointer;
  transition: border-color 0.2s; display: flex; align-items: center; gap: 6px;
}
.cart-btn:hover { border-color: var(--primary-light); }
.cart-count {
  background: var(--sale-color); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

/* HERO */
.hero {
  text-align: center; padding: 60px 24px 40px;
  background: linear-gradient(160deg, #1a0a3a 0%, #0f0f1a 60%);
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 10px;
}
.hero p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 24px; }
.currency-toggle {
  display: inline-flex; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
}
.currency-btn {
  padding: 8px 22px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
}
.currency-btn.active { background: var(--primary); color: #fff; }

/* SHOP */
.shop-section { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }
.filter-bar { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.search-input, .category-select {
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); font-family: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s;
}
.search-input { flex: 1; min-width: 200px; }
.search-input:focus, .category-select:focus { border-color: var(--primary-light); }
.category-select option { background: var(--bg-card); }

/* GRID */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.item-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer; position: relative;
}
.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(124,58,237,0.3);
  border-color: var(--primary-light);
}
.item-grade-bar { height: 3px; width: 100%; }
.item-badges {
  position: absolute; top: 14px; left: 8px;
  display: flex; gap: 4px; z-index: 1;
}
.badge-featured {
  background: var(--primary); color: #fff;
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.badge-sale {
  background: var(--sale-color); color: #fff;
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.sold-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--danger); color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.item-img-wrap {
  width: 100%; aspect-ratio: 1/1;
  background: linear-gradient(135deg, #1a1a3e, #0d0d1f);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-bottom: 1px solid var(--border);
}
.item-img-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.item-img-placeholder { font-size: 3rem; opacity: 0.3; }
.item-info { padding: 12px; }
.item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tag-grade, .tag-slot {
  font-size: 0.68rem; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.tag-slot {
  color: var(--text-muted); border-color: var(--border);
  background: rgba(255,255,255,0.04);
}
.item-name {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-prices { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.price-hkd { font-size: 1rem; font-weight: 700; color: var(--hkd-color); }
.price-twd { font-size: 0.8rem; color: var(--twd-color); }
.price-orig { font-size: 0.8rem; color: #ffffff; text-decoration: line-through; opacity: 0.78; }
.price-sale { color: var(--sale-color) !important; }
.item-actions {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  align-items: center;
}
.btn-buy {
  width: 100%; padding: 9px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-family: inherit;
  font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-buy:hover { background: var(--primary-dark); }
.btn-card-cart {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(167,139,250,0.35);
  background: rgba(124,58,237,0.14);
  color: var(--primary-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-card-cart:hover {
  background: rgba(124,58,237,0.28);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center;
  justify-content: center; padding: 16px;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  position: relative; padding: 28px; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 0.9rem; display: flex;
  align-items: center; justify-content: center; transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-header { margin-bottom: 24px; padding-right: 40px; }
.modal-header h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.modal-price { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.modal-price .price-hkd { font-size: 1.3rem; }
.modal-steps h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--primary-light); }

/* Payment tabs */
.payment-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.pay-tab {
  flex: 1; min-width: 80px; padding: 9px;
  border: 1px solid var(--border); background: var(--bg-card2);
  color: var(--text-muted); border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 0.88rem; font-weight: 500; transition: all 0.2s;
}
.pay-tab.active {
  border-color: var(--primary-light);
  background: rgba(124,58,237,0.2); color: var(--primary-light);
}

/* QR */
.qr-display { display: flex; justify-content: center; margin-bottom: 20px; }
.qr-mock {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center; width: 220px;
}
.qr-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.qr-image-container { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.qr-image-container img { width: 160px; height: 160px; object-fit: contain; border-radius: 8px; }
.qr-fallback {
  width: 160px; height: 160px; border: 2px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.8rem;
}

/* Buttons */
.btn-next, .btn-submit {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 10px; font-family: inherit;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-next:hover, .btn-submit:hover { background: var(--primary-dark); }
.btn-submit:disabled { background: #4a4a6a; cursor: not-allowed; }
.btn-back {
  padding: 12px 20px; background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
}
.btn-back:hover { color: var(--text); border-color: var(--text-muted); }

.modal-cart-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn-cart-add {
  flex: 1; padding: 12px; background: transparent;
  border: 1px solid var(--primary-light); color: var(--primary-light);
  border-radius: 10px; font-family: inherit; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-cart-add:hover { background: rgba(124,58,237,0.15); }
.btn-next { flex: 1.5; width: auto; }

/* Form groups */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.form-group input[type="text"] {
  width: 100%; padding: 10px 14px; background: var(--bg-card2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-family: inherit; font-size: 0.9rem; outline: none; transition: border-color 0.2s;
}
.form-group input[type="text"]:focus { border-color: var(--primary-light); }
.upload-area {
  position: relative; border: 2px dashed var(--border); border-radius: 10px;
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; transition: border-color 0.2s;
}
.upload-area:hover { border-color: var(--primary-light); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.85rem; }
.upload-icon { font-size: 1.8rem; }
.preview-img { width: 100%; max-height: 160px; object-fit: contain; border-radius: 8px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions .btn-submit { flex: 1; }

/* Success */
.success-screen { text-align: center; padding: 20px 0; }
.success-icon { font-size: 3rem; margin-bottom: 16px; }
.success-screen h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; color: var(--success); }
.success-screen p { color: var(--text-muted); margin-bottom: 4px; }
.success-note { font-size: 0.82rem; margin-top: 8px; }
.btn-close-success {
  margin-top: 24px; padding: 10px 32px; background: var(--success); color: #fff;
  border: none; border-radius: 10px; font-family: inherit;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
}

/* CART DRAWER */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300;
}
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 360px; max-width: 100vw;
  background: var(--bg-card); border-left: 1px solid var(--border);
  z-index: 301; display: flex; flex-direction: column;
  box-shadow: -4px 0 32px rgba(0,0,0,0.5);
}
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
  font-size: 1.05rem; font-weight: 700;
}
.cart-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 1.2rem; cursor: pointer; transition: color 0.2s;
}
.cart-close:hover { color: var(--text); }
.cart-body { flex: 1; overflow-y: auto; padding: 16px; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 40px 0; }
.cart-seller-group { margin-bottom: 16px; }
.cart-seller-label {
  font-size: 0.75rem; font-weight: 700; color: var(--primary-light);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.cart-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.cart-row:last-child { border-bottom: none; }
.cart-thumb {
  width: 44px; height: 44px; border-radius: 6px; object-fit: contain;
  background: var(--bg-card2); border: 1px solid var(--border); padding: 3px; flex-shrink: 0;
}
.cart-thumb-placeholder {
  width: 44px; height: 44px; border-radius: 6px; background: var(--bg-card2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.cart-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-meta { font-size: 0.75rem; color: var(--text-muted); }
.cart-remove {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.9rem; padding: 4px 6px; border-radius: 4px;
  transition: color 0.2s; flex-shrink: 0;
}
.cart-remove:hover { color: var(--danger); }
.cart-grand-total {
  text-align: right; font-size: 1rem; font-weight: 700;
  color: var(--hkd-color); padding: 12px 0 4px;
  border-top: 1px solid var(--border); margin-top: 8px;
}
.cart-footer { padding: 16px; border-top: 1px solid var(--border); }
.btn-checkout {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 10px; font-family: inherit;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: background 0.2s;
}
.btn-checkout:hover { background: var(--primary-dark); }

/* CHECKOUT MODAL */
.checkout-items { margin-bottom: 16px; }
.checkout-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.checkout-item-name { flex: 1; font-size: 0.88rem; }
.checkout-item-price { font-size: 0.88rem; font-weight: 700; color: var(--hkd-color); flex-shrink: 0; }
.checkout-total {
  text-align: right; font-weight: 700; color: var(--hkd-color);
  padding-top: 10px; font-size: 1rem;
}

/* FOOTER */
.site-footer {
  text-align: center; padding: 24px; color: var(--text-muted);
  font-size: 0.85rem; border-top: 1px solid var(--border);
}
.site-footer strong { color: var(--primary-light); }

/* RESPONSIVE */
@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; }
  .logo-text { font-size: 1rem; }
  .hero { padding: 40px 16px 28px; }
  .shop-section { padding: 20px 16px 40px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .modal-box { padding: 20px 16px; }
  .cart-drawer { width: 100vw; }
  .filter-bar { flex-direction: column; }
}