* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #ff5722;
  --bg: #f5f5f5;
  --white: #fff;
  --text: #333;
  --muted: #888;
  --border: #eee;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { border: none; cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* Layout */
.container { max-width: 480px; margin: 0 auto; }

/* Header */
.header { position: sticky; top: 0; z-index: 100; background: var(--white); padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.header-back { font-size: 20px; color: var(--text); background: none; padding: 4px; }
.header-title { font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-location { font-size: 13px; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-location i { color: var(--primary); margin-right: 4px; }

/* Tab Bar */
.tab-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); display: flex; justify-content: space-around; padding: 8px 0 env(safe-area-inset-bottom, 8px); box-shadow: 0 -2px 8px rgba(0,0,0,.08); z-index: 100; }
.tab-item { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--muted); gap: 2px; padding: 4px 12px; }
.tab-item i { font-size: 20px; }
.tab-item.active { color: var(--primary); }
.tab-item .badge { position: absolute; top: -4px; right: -4px; background: var(--primary); color: #fff; font-size: 9px; padding: 1px 4px; border-radius: 8px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.card-img { width: 100%; height: 140px; object-fit: cover; }
.card-body { padding: 12px; }

/* Store Card */
.store-card { display: flex; gap: 12px; padding: 12px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; align-items: center; }
.store-card-img { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.store-card-info { flex: 1; min-width: 0; }
.store-card-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.store-card-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-card-meta { display: flex; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.store-card-meta span { display: flex; align-items: center; gap: 3px; }
.store-card-badge { display: inline-block; background: #fff3e0; color: #e65100; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; margin-top: 4px; }
.store-closed { opacity: .5; }

/* Item Card */
.item-card { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.item-card:last-child { border-bottom: none; }
.item-card-info { flex: 1; }
.item-card-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.item-card-desc { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card-price { font-weight: 700; font-size: 14px; }
.item-card-old-price { text-decoration: line-through; color: var(--muted); font-size: 12px; margin-left: 6px; font-weight: 400; }
.item-card-img { width: 90px; height: 90px; border-radius: 10px; object-fit: cover; flex-shrink: 0; position: relative; }
.btn-add { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--white); color: var(--primary); border: 1.5px solid var(--primary); font-size: 14px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.btn-add i { pointer-events: none; }
.btn-add:active { background: var(--primary); color: #fff; }
.btn-add-no-img { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--white); color: var(--primary); border: 1.5px solid var(--primary); font-size: 14px; border-radius: 8px; margin-top: 8px; }
.btn-add-no-img i { pointer-events: none; }
.btn-add-no-img:active { background: var(--primary); color: #fff; }

/* Category tabs */
.cat-tabs { display: flex; overflow-x: auto; gap: 0; background: var(--white); position: sticky; top: 52px; z-index: 50; border-bottom: 1px solid var(--border); }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { padding: 10px 16px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; flex-shrink: 0; }
.cat-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Slider */
.slider { display: flex; overflow-x: auto; gap: 10px; padding: 12px 16px; scroll-snap-type: x mandatory; }
.slider::-webkit-scrollbar { display: none; }
.slider-item { flex-shrink: 0; scroll-snap-align: start; border-radius: var(--radius); overflow: hidden; width: 260px; height: 130px; }
.slider-item img { width: 100%; height: 100%; object-fit: cover; }

/* Search / Location */
.search-box { background: var(--white); border-radius: 25px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); margin: 12px 16px; }
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; background: transparent; }
.search-box i { color: var(--muted); }

.gps-btn { display: flex; align-items: center; gap: 10px; background: var(--primary); color: #fff; padding: 14px 16px; border-radius: var(--radius); margin: 12px 16px; font-size: 14px; font-weight: 500; }
.gps-btn i { font-size: 18px; }

.location-item { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.location-item i { color: var(--primary); font-size: 18px; }
.location-item-text { font-size: 14px; }

/* Cart */
.cart-float { position: fixed; bottom: 70px; left: 16px; right: 16px; background: var(--primary); color: #fff; padding: 14px 20px; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; box-shadow: 0 4px 12px rgba(255,87,34,.3); z-index: 90; }
.page { min-height: 100vh; padding-bottom: 130px; }
.cart-float-text { font-size: 13px; }
.cart-float-total { font-weight: 700; font-size: 15px; }

.cart-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 500; }
.cart-item-price { font-size: 13px; color: var(--muted); }
.qty-control { display: flex; align-items: center; gap: 0; border: 1px solid var(--primary); border-radius: 6px; overflow: hidden; }
.qty-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--primary); background: var(--white); }
.qty-btn i { pointer-events: none; }
.qty-btn:active { background: #fff3e0; }
.qty-val { width: 30px; text-align: center; font-size: 14px; font-weight: 600; }

/* Delivery toggle */
.delivery-toggle { display: flex; background: #eee; border-radius: 25px; padding: 3px; margin: 12px 16px; }
.delivery-toggle button { flex: 1; padding: 8px; border-radius: 22px; font-size: 13px; font-weight: 500; background: transparent; color: var(--muted); transition: all .2s; }
.delivery-toggle button.active { background: var(--white); color: var(--text); box-shadow: var(--shadow); }

/* Section */
.section-title { font-size: 14px; font-weight: 600; padding: 12px 16px 8px; color: var(--text); }

/* Bill */
.bill { background: var(--white); border-radius: var(--radius); padding: 16px; margin: 12px 16px; }
.bill-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.bill-row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }

/* Buttons */
.btn-primary { background: var(--primary); color: #fff; width: 100%; padding: 14px; border-radius: var(--radius); font-size: 15px; font-weight: 600; text-align: center; }
.btn-primary:active { opacity: .9; }

/* Loading */
.loading { display: flex; justify-content: center; padding: 40px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: #ddd; margin-bottom: 16px; }
.empty-state p { color: var(--muted); font-size: 14px; }

/* Store detail header */
.store-hero { position: relative; }
.store-hero-img { width: 100%; height: 180px; object-fit: cover; }
.store-hero-info { padding: 16px; background: var(--white); }
.store-hero-name { font-size: 18px; font-weight: 700; }
.store-hero-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.store-hero-meta { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* Popup/Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: flex-end; }
.modal-content { background: var(--white); width: 100%; max-height: 70vh; border-radius: 16px 16px 0 0; padding: 20px; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* Coupon */
.coupon-input { display: flex; gap: 8px; padding: 12px 16px; }
.coupon-input input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.coupon-input button { background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; }

@media (min-width: 481px) {
  .container { padding: 0 16px; }
  .page { max-width: 480px; margin: 0 auto; }
  .tab-bar { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .cart-float { max-width: 448px; left: 50%; transform: translateX(-50%); }
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #121212;
  --white: #1e1e1e;
  --text: #e0e0e0;
  --muted: #999;
  --border: #333;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
}
[data-theme="dark"] body { background: #121212; color: #e0e0e0; }
[data-theme="dark"] .header { background: #1e1e1e; }
[data-theme="dark"] .tab-bar { background: #1e1e1e; }
[data-theme="dark"] .search-box { background: #1e1e1e; }
[data-theme="dark"] .search-box input { color: #e0e0e0; }
[data-theme="dark"] .delivery-toggle { background: #333; }
[data-theme="dark"] .delivery-toggle button.active { background: #1e1e1e; color: #e0e0e0; }
[data-theme="dark"] .cat-tabs { background: #1e1e1e; border-color: #333; }
[data-theme="dark"] .qty-btn { background: #1e1e1e; }
[data-theme="dark"] .modal-content { background: #1e1e1e; }
[data-theme="dark"] .coupon-input input { background: #1e1e1e; color: #e0e0e0; border-color: #333; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #2a2a2a; color: #e0e0e0; border-color: #444; }
[data-theme="dark"] .btn-add { background: #1e1e1e; }
[data-theme="dark"] .btn-add-no-img { background: #1e1e1e; }
[data-theme="dark"] .store-card-badge { background: #3e2723; }
[data-theme="dark"] .cart-float { box-shadow: 0 4px 12px rgba(0,0,0,.5); }
[data-theme="dark"] .empty-state i { color: #444; }
[data-theme="dark"] .bill { background: #1e1e1e; }
[data-theme="dark"] .bill-row.total { border-color: #333; }
[data-theme="dark"] .card { background: #1e1e1e; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
[data-theme="dark"] .item-card { border-color: #333; }
[data-theme="dark"] .store-hero-info { background: #1e1e1e; }
[data-theme="dark"] .location-item { border-color: #333; }
[data-theme="dark"] .gps-btn { box-shadow: none; }
[data-theme="dark"] .slider-item { background: #2a2a2a; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.7); }
