* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.app-header {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-search {
  font-size: 20px;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.header-search:active {
  opacity: 0.6;
}

.search-bar {
  background: white;
  padding: 8px 16px 10px;
  display: none;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 48px;
  z-index: 99;
}

.search-bar.show {
  display: block;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 20px;
  padding: 8px 14px;
  gap: 8px;
}

.search-icon {
  font-size: 16px;
  opacity: 0.5;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  padding: 2px 6px;
}

.search-clear.show {
  display: block;
}

.main-content {
  padding-bottom: calc(70px + var(--safe-bottom));
  min-height: calc(100vh - 48px);
}

.page {
  display: none;
  padding: 12px 14px;
}

.page.active {
  display: block;
}

.banner-swiper {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}

.banner-track {
  display: flex;
  transition: transform 0.4s ease;
}

.banner-slide {
  min-width: 100%;
}

.banner-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 18px;
  color: white;
  min-height: 120px;
}

.banner-text h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.banner-text p {
  font-size: 12px;
  opacity: 0.9;
}

.banner-icon {
  font-size: 48px;
  opacity: 0.9;
}

.banner-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
}

.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.5);
  transition: all 0.3s;
}

.banner-dot.active {
  width: 18px;
  background: white;
}

.section {
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.section-more {
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.category-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.category-card:active {
  transform: scale(0.96);
}

.category-card-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.category-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.category-card-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.hot-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.hot-list::-webkit-scrollbar {
  display: none;
}

.hot-card {
  min-width: 150px;
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  scroll-snap-align: start;
  flex-shrink: 0;
}

.hot-card-cover {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.hot-card-info {
  padding: 10px;
}

.hot-card-title {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.hot-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hot-card-price {
  font-size: 15px;
  font-weight: 700;
  color: #ef4444;
}

.hot-card-sales {
  font-size: 11px;
  color: var(--text-muted);
}

.product-card {
  display: flex;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  cursor: pointer;
  gap: 12px;
  transition: transform 0.15s;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card-cover {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}

.product-card-info {
  flex: 1;
  min-width: 0;
}

.product-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.product-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.product-card-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.product-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.product-tag.hot {
  background: #fef2f2;
  color: #ef4444;
}

.product-tag.new {
  background: #ecfdf5;
  color: #10b981;
}

.product-tag.type {
  background: #eff6ff;
  color: #3b82f6;
}

.product-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-card-price {
  font-size: 16px;
  font-weight: 700;
  color: #ef4444;
}

.product-card-price .symbol {
  font-size: 12px;
}

.product-card-original {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 4px;
}

.product-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
  white-space: nowrap;
}

.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.page-category .product-list {
  margin-top: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: none;
}

.empty-state.show {
  display: block;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.mine-header {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
  margin-bottom: 16px;
}

.mine-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.mine-info {
  flex: 1;
}

.mine-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.mine-phone {
  font-size: 12px;
  opacity: 0.8;
}

.mine-edit {
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  cursor: pointer;
}

.mine-stats {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.stat-item {
  text-align: center;
  cursor: pointer;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.mine-menu {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:active {
  background: var(--bg);
}

.menu-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.menu-icon {
  font-size: 18px;
}

.menu-arrow {
  font-size: 20px;
  color: var(--text-muted);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.page-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.back-btn {
  font-size: 15px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 16px;
  transition: color 0.2s;
  color: var(--text-muted);
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 20px;
}

.tab-label {
  font-size: 11px;
  font-weight: 500;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.show {
  transform: translateX(-50%) translateY(0);
}

.modal-detail-header {
  position: relative;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.detail-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
}

.modal-detail-body {
  padding: 16px 18px 24px;
  overflow-y: auto;
  flex: 1;
}

.detail-tag-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.detail-category-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #eff6ff;
  color: #3b82f6;
  font-weight: 500;
}

.detail-tag-item {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fef2f2;
  color: #ef4444;
  font-weight: 500;
}

.detail-new-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #10b981;
  font-weight: 500;
  display: none;
}

.detail-new-tag.show {
  display: inline;
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.detail-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
}

.detail-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-feature-item {
  font-size: 12px;
  padding: 5px 10px;
  background: #f0f9ff;
  color: #2563eb;
  border-radius: 14px;
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-price {
  color: #ef4444;
}

.price-symbol {
  font-size: 14px;
  font-weight: 600;
}

.price-value {
  font-size: 24px;
  font-weight: 700;
}

.detail-original-price {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.detail-download-tip {
  font-size: 12px;
  color: #f59e0b;
  background: #fffbeb;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.detail-actions {
  display: flex;
  gap: 12px;
}

.btn-buy {
  flex: 1;
  padding: 12px 0;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-buy:active {
  opacity: 0.8;
}

.btn-cart {
  width: 100px;
  padding: 12px 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cart:active {
  background: var(--border);
}

.modal-pay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-pay-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-pay-header .modal-close {
  position: static;
  background: var(--bg);
  color: var(--text);
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.modal-pay-body {
  padding: 16px 18px 24px;
  overflow-y: auto;
}

.pay-product-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.pay-product-cover {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 8px;
}

.pay-product-name {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-amount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 15px;
}

.pay-price {
  font-size: 22px;
  font-weight: 700;
  color: #ef4444;
}

.pay-methods {
  margin-bottom: 20px;
}

.pay-method {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.pay-method-icon {
  font-size: 20px;
}

.pay-method span:nth-child(2) {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.pay-check {
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
}

.btn-primary {
  width: 100%;
  padding: 12px 0;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:active {
  opacity: 0.8;
}

.btn-go-shop {
  width: auto;
  padding: 10px 32px;
  display: inline-block;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
}

.content-info {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.content-product-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.content-download-tip {
  font-size: 13px;
  color: #f59e0b;
  background: #fffbeb;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.content-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px;
}

.content-link-icon {
  font-size: 16px;
}

.content-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.content-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 10px;
  color: var(--text);
}

.content-link-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.content-link-note {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.content-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.content-link-url {
  font-size: 12px;
  color: #2563eb;
  word-break: break-all;
  text-decoration: none;
}

.content-link-url:active {
  opacity: 0.7;
}

.content-link-code {
  font-size: 13px;
  color: var(--text);
}

.content-link-code strong {
  color: #f59e0b;
  font-size: 15px;
  letter-spacing: 2px;
  background: #fffbeb;
  padding: 2px 8px;
  border-radius: 4px;
}

.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #1f2937;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #10b981;
}

.purchased-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #d1fae5;
  color: #059669;
  font-weight: 500;
}

.orders-product-card {
  position: relative;
}

.orders-product-card .product-card-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.btn-view-content {
  padding: 6px 14px;
  background: #eff6ff;
  color: var(--primary);
  border: none;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.btn-view-content:active {
  background: #dbeafe;
}