:root {
  --wa-green: #075e54;
  --wa-green-light: #128c7e;
  --wa-accent: #25d366;
  --text: #111;
  --muted: #666;
  --bg: #f5f5f5;
  --card: #fff;
  --price: #e53935;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  padding-bottom: 72px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Header */
.banner {
  background: linear-gradient(180deg, var(--wa-green) 0%, var(--wa-green-light) 100%);
  color: #fff;
  padding: 16px 12px 12px;
  text-align: center;
}

.banner-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.banner-logo {
  flex-shrink: 0;
}

/* Categories */
.categories {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-item {
  flex: 0 0 auto;
  min-width: 88px;
  max-width: 120px;
  padding: 10px 8px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
  margin: 0 2px;
  transition: background 0.2s;
}

.category-item.active {
  background: #fff;
  color: var(--wa-green);
}

.category-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.category-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.category-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.category-desc {
  display: block;
  font-size: 0.65rem;
  opacity: 0.85;
  margin-top: 4px;
  line-height: 1.2;
}

.category-item.active .category-desc {
  color: var(--muted);
}

/* Products */
.products-wrap {
  padding: 12px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card--clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.product-card--clickable:active {
  transform: scale(0.98);
}

.product-image-wrap {
  aspect-ratio: 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-name {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 8px 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.product-prices {
  padding: 0 8px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}

.price-current {
  color: var(--price);
  font-weight: 700;
  font-size: 0.95rem;
}

.price-original {
  color: #999;
  font-size: 0.75rem;
  text-decoration: line-through;
}

.price-discount {
  color: var(--price);
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-buy {
  display: block;
  margin: 0 8px 10px;
  padding: 8px;
  border-radius: 8px;
  background: var(--wa-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  pointer-events: none;
}

/* 登录弹窗 */
.login-modal {
  padding: 28px 20px 20px;
}

.login-modal-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.login-modal h2 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.login-modal-msg {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-text {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--text);
}

.loading,
.empty {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 50;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.bottom-nav-item.active {
  color: var(--wa-green-light);
  font-weight: 600;
}

.bottom-nav-icon {
  font-size: 1.25rem;
}

.fab-support {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: 80px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--wa-accent);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 40;
}

/* Modal */
.modal-overlay,
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay[hidden],
.panel-overlay[hidden] {
  display: none;
}

.lucky-modal,
.panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.lucky-modal h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.lucky-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.lucky-visual {
  font-size: 4rem;
  margin: 8px 0;
}

.lucky-limit {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.lucky-progress {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.lucky-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ffc107, #ff9800);
  border-radius: 4px;
  transition: width 0.3s;
}

.lucky-claimed {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 24px;
  background: var(--wa-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  margin-top: 16px;
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.modal-close {
  position: absolute;
  bottom: -44px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.panel {
  text-align: left;
}

.panel-hint {
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.panel code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

@media (min-width: 481px) {
  body {
    background: #e8e8e8;
  }
}
