:root {
  --primary: #ff6b35;
  --primary-light: #ff8c5a;
  --primary-dark: #e55a2b;
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-light: #aeaeb2;
  --border: #e5e5ea;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --meituan: #ffc300;
  --taobao: #ff5000;
  --jd: #e4393c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* Header */
.header {
  position: relative;
  padding: 40px 20px 30px;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 0 0 30px 30px;
}

.header-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
}

.title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 400;
}

/* Tip Bar */
.tip-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 16px 0;
  padding: 12px 16px;
  background: #fff8f0;
  border: 1px solid #ffe0c0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary-dark);
}

.tip-icon { font-size: 16px; }

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.error {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 28px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.retry-btn:hover { background: var(--primary-dark); }

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 10px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.category-tab:active { transform: scale(0.95); }

.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

.category-tab .tab-icon { font-size: 18px; }

/* Coupon List */
.coupon-list {
  padding: 0 16px 20px;
}

.category-section {
  margin-bottom: 28px;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 4px;
}

.category-title .cat-icon { font-size: 22px; }

/* Coupon Card */
.coupon-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.coupon-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: 4px 0 0 4px;
}

.coupon-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-hover);
}

.coupon-card.type-code::before { background: #5856d6; }

.coupon-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.coupon-text {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.coupon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.coupon-badge.link {
  background: #fff3ed;
  color: var(--primary);
}

.coupon-badge.code {
  background: #f0edff;
  color: #5856d6;
}

.coupon-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Empty */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 30px 20px 40px;
  font-size: 12px;
  color: var(--text-light);
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Responsive */
@media (min-width: 768px) {
  .app { max-width: 600px; }
  .title { font-size: 32px; }
}

@media (min-width: 1024px) {
  .app { max-width: 720px; }
}
