* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.page {
  display: none;
  min-height: 100vh;
}
.page.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 首页 */
#home {
  justify-content: center;
  padding: 24px;
}
.hero {
  text-align: center;
  color: #fff;
}
.logo {
  font-size: 72px;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 40px;
  margin-bottom: 12px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.subtitle {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 40px;
}
.btn-primary {
  font-size: 24px;
  padding: 16px 64px;
  border: none;
  border-radius: 50px;
  background: #fff;
  color: #667eea;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  margin-top: 48px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  padding: 24px 40px;
  color: #fff;
}
.hint h3 {
  margin-bottom: 12px;
  font-size: 18px;
}
.hint ul {
  list-style: none;
  text-align: left;
}
.hint li {
  padding: 6px 0;
  font-size: 15px;
}
.hint b {
  color: #ffe08a;
}

/* loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  color: #fff;
  font-size: 16px;
}
.loading.hidden {
  display: none;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 结果页 */
#result {
  padding: 24px;
  background: #f5f6fa;
  min-height: 100vh;
  align-items: stretch;
}
.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.result-header h1 {
  font-size: 24px;
  color: #333;
}
.summary-bar {
  background: #fff;
  border-left: 4px solid #667eea;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tab {
  padding: 10px 24px;
  border: none;
  background: #fff;
  color: #666;
  font-size: 15px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
}
.tab:hover {
  color: #667eea;
}
.tab.active {
  color: #667eea;
  font-weight: 700;
  border-bottom: 3px solid #667eea;
}
.panel {
  width: 100%;
}

/* 分类标签 */
.cat-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  background: #eef1ff;
  color: #667eea;
  font-size: 12px;
  white-space: nowrap;
}
.buy-yes {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  background: #e6f7ee;
  color: #38a169;
  font-size: 12px;
  white-space: nowrap;
}
.buy-no {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  background: #fdecea;
  color: #e53e3e;
  font-size: 12px;
  white-space: nowrap;
}
.category-row td {
  background: #f7f8fc;
  font-weight: 700;
  color: #555;
  text-align: left;
  padding: 8px 16px;
  border-top: 1px solid #e0e4f0;
}
.btn-back {
  padding: 8px 20px;
  border: 1px solid #667eea;
  background: #fff;
  color: #667eea;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.btn-back:hover {
  background: #667eea;
  color: #fff;
}

.table-wrap {
  background: #fff;
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}
thead {
  background: #667eea;
  color: #fff;
}
th,
td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid #eee;
}
tbody tr:hover {
  background: #f0f3ff;
}
.rank {
  font-weight: 700;
  color: #667eea;
}
.up {
  color: #e53e3e;
}
.down {
  color: #38a169;
}
.name-cell {
  text-align: left;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#detailLoading {
  color: #667eea;
  margin-top: 24px;
}
