:root {
  --orange: #ff8c42;
  --orange-dark: #ff6b35;
  --yellow: #ffc947;
  --bg: #f5f5f7;
  --text: #333;
  --text-muted: #999;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e8e8e8;
  color: var(--text);
  min-height: 100vh;
}

.phone-wrap {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.12);
  position: relative;
  padding-bottom: calc(70px + var(--safe-bottom));
  animation: pageIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header gradient */
.hero {
  background: linear-gradient(180deg, #ff9f4a 0%, #ffc947 55%, #f5f5f7 100%);
  padding: 48px 20px 24px;
  position: relative;
}
.hero h1 { font-size: 28px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.hero .slogan { color: rgba(255,255,255,0.95); font-size: 14px; margin-top: 6px; }
.hero .stats { color: rgba(255,255,255,0.85); font-size: 12px; margin-top: 4px; }

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
  margin-top: -8px;
}
.feature-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s;
}
.feature-card:hover { transform: scale(1.02); }
.feature-card .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.feature-card.snack .icon { background: linear-gradient(135deg, #ffe0b2, #ffcc80); }
.feature-card.about .icon { background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.feature-card h3 { font-size: 15px; font-weight: 600; }
.feature-card p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.feature-card .arrow { margin-left: auto; color: #ccc; font-size: 18px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px;
  background: #fff;
  margin: 0 16px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.quick-item {
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.15s;
}
.quick-item:hover { background: #f9f9f9; }
.quick-item .qi-icon { font-size: 32px; line-height: 1; }
.quick-item span { display: block; font-size: 12px; margin-top: 6px; color: #555; }

.banner-promo {
  margin: 16px;
  padding: 16px 20px;
  background: linear-gradient(90deg, #7c5cff, #a78bfa);
  border-radius: var(--radius);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.banner-promo .btn-go {
  background: rgba(255,255,255,0.25);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  border: none;
  color: #fff;
  cursor: pointer;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 8px;
  font-size: 15px;
  font-weight: 600;
}
.section-title a { font-size: 13px; color: var(--orange-dark); text-decoration: none; }

.order-empty {
  margin: 0 16px 16px;
  background: #fff;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Mine page */
.mine-hero {
  background: linear-gradient(180deg, #ffc947 0%, #ffab40 40%, #f5f5f7 100%);
  padding: 56px 20px 80px;
}
.user-row { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.user-info h2 { font-size: 18px; font-weight: 700; }
.user-info .uid { font-size: 12px; color: rgba(0,0,0,0.5); margin-top: 4px; }
.school-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  font-size: 12px;
}
.stats-row {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  padding: 12px;
  background: rgba(255,255,255,0.35);
  border-radius: 12px;
}
.stats-row div { text-align: center; }
.stats-row strong { display: block; font-size: 18px; }
.stats-row span { font-size: 11px; color: rgba(0,0,0,0.55); }

.card-block {
  margin: 12px 16px;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card-block h3 { font-size: 15px; margin-bottom: 14px; }
.order-status-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
}
.order-status-grid .osi { font-size: 28px; }
.order-status-grid span { font-size: 11px; color: #666; display: block; margin-top: 4px; }

.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-icon { font-size: 22px; margin-right: 12px; }
.menu-item span { flex: 1; font-size: 15px; }
.menu-item .mi-arrow { color: #ccc; }

.service-banner {
  margin: 12px 16px;
  padding: 16px;
  background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
  border-radius: var(--radius);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Shop page */
.shop-header {
  background: #fff;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #eee;
}
.search-bar {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border-radius: 24px;
  padding: 10px 16px;
  gap: 8px;
}
.search-bar input { flex: 1; border: none; background: none; font-size: 14px; outline: none; }

.product-list { padding: 12px 16px; }
.product-card {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.product-card .thumb {
  width: 80px; height: 80px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}
.product-card .info { flex: 1; }
.product-card h4 { font-size: 15px; margin-bottom: 4px; }
.product-card .price { color: var(--orange-dark); font-size: 18px; font-weight: 700; }
.product-card .price small { font-size: 12px; }
.product-card .tax-tag {
  font-size: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.product-card .tax-tag.rate13 { background: #fff3e0; color: #e65100; }
.add-btn {
  margin-top: 8px;
  padding: 6px 20px;
  background: var(--orange-dark);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.add-btn:active { transform: scale(0.95); opacity: 0.9; }

/* Tab bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  display: flex;
  background: #fff;
  border-top: 1px solid #eee;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}
.tab-bar a {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  text-decoration: none;
  color: #999;
  font-size: 11px;
}
.tab-bar a.active { color: var(--orange-dark); }
.tab-bar .tab-icon { font-size: 24px; display: block; margin-bottom: 2px; }

    .demo-badge {
  position: fixed;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 8px;
  z-index: 200;
}

.cart-bar {
  position: fixed;
  bottom: calc(56px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 358px;
  background: #333;
  color: #fff;
  border-radius: 28px;
  padding: 10px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 99;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.cart-bar .cart-info { display: flex; align-items: center; gap: 10px; }
.cart-bar .cart-count {
  background: var(--orange-dark);
  width: 24px; height: 24px; border-radius: 50%;
  text-align: center; line-height: 24px; font-size: 12px; font-weight: 700;
}
.cart-bar .checkout-link {
  background: var(--orange-dark);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.toast-msg {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 14px; z-index: 999;
}

.shop-layout { display: flex; min-height: calc(100vh - 120px); }
.cat-sidebar {
  width: 88px; background: #f0f0f2; flex-shrink: 0;
  padding: 8px 0; overflow-y: auto;
}
.cat-sidebar button {
  display: block; width: 100%; border: none; background: none;
  padding: 14px 8px; font-size: 12px; color: #666; cursor: pointer;
  text-align: center; line-height: 1.3;
}
.cat-sidebar button.active {
  background: #fff; color: var(--orange-dark); font-weight: 600;
  border-left: 3px solid var(--orange-dark);
}
.shop-main { flex: 1; overflow-y: auto; padding-bottom: 100px; }

.coupon-card, .addr-card {
  margin: 12px 16px; background: #fff; border-radius: 12px; padding: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.coupon-card.selected { border: 2px solid var(--orange-dark); }
.coupon-card .off { font-size: 24px; font-weight: 700; color: var(--orange-dark); }
.coupon-card .cond { font-size: 12px; color: #999; }

.link-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid #f5f5f5; text-decoration: none; color: inherit;
}
.menu-item { cursor: pointer; }
.menu-item[href] { text-decoration: none; color: inherit; display: flex; }

.search-page input {
  width: calc(100% - 32px); margin: 12px 16px; padding: 12px 16px;
  border: 1px solid #eee; border-radius: 24px; font-size: 15px;
}

.order-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.order-actions a, .order-actions button {
  padding: 6px 14px; border-radius: 16px; font-size: 12px;
  border: 1px solid #ddd; background: #fff; text-decoration: none; color: #333; cursor: pointer;
}
.order-actions .primary { background: var(--orange-dark); color: #fff; border-color: var(--orange-dark); }

.detail-section { margin: 12px 16px; background: #fff; border-radius: 12px; padding: 16px; }
.status-banner {
  background: linear-gradient(135deg, #ff9f4a, #ff6b35);
  color: #fff; padding: 20px 16px; margin: 0;
}
.status-banner h2 { font-size: 18px; }
.status-banner p { font-size: 13px; opacity: 0.9; margin-top: 4px; }

.service-chat {
  margin: 16px; padding: 16px; background: #fff; border-radius: 12px;
  min-height: 200px; font-size: 14px; line-height: 1.8;
}
.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px;
  font-size: 13px; line-height: 1.5;
}
.chat-bubble.bot { background: #f5f5f5; }
.chat-bubble.user { background: #fff3e0; margin-left: auto; }
