* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2333;
  --bg-hover: #252d3f;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-green: #3fb950;
  --accent-red: #f85149;
  --accent-gold: #d29922;
  --border: #30363d;
  --border-radius: 8px;
  --header-height: 64px;
  --nav-height: 44px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 600; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }

header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between;
  height: 100%; padding: 0 16px;
}
.logo { cursor: pointer; display: flex; align-items: center; }
.logo h1 { font-size: 1.3rem; display: flex; align-items: center; gap: 8px; }
.cn-badge {
  font-size: 0.7rem; background: #1f6feb; color: #fff;
  padding: 2px 8px; border-radius: 12px; font-weight: 500;
}
.header-controls { display: flex; align-items: center; gap: 12px; }
.dc-selector { display: flex; align-items: center; gap: 8px; }
.dc-selector label { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }
.select-group { display: flex; gap: 6px; }
.select-group select {
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 0.85rem; cursor: pointer;
  max-width: 140px;
}
.select-group select:focus { outline: none; border-color: var(--accent); }

.nav-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 0; height: 100%;
}
.nav-link {
  display: flex; align-items: center; padding: 0 20px;
  color: var(--text-secondary); font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--text-primary); text-decoration: none; }
.nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }

main {
  max-width: 1200px; margin: 0 auto; padding: 24px 16px;
}
.page { display: none; }
.page.active { display: block; }

.hero {
  text-align: center; padding: 60px 20px 40px;
}
.hero h2 { font-size: 2rem; margin-bottom: 8px; }
.hero p { color: var(--text-secondary); margin-bottom: 24px; font-size: 1rem; }

.search-box {
  display: flex; max-width: 600px; margin: 0 auto; gap: 0;
  border-radius: var(--border-radius); overflow: hidden;
  border: 1px solid var(--border);
}
.search-box input {
  flex: 1; padding: 12px 16px; font-size: 1rem;
  border: none; background: var(--bg-secondary);
  color: var(--text-primary); outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box button {
  padding: 12px 24px; background: #1f6feb; color: #fff;
  border: none; cursor: pointer; font-size: 1rem;
  font-weight: 500; transition: background 0.2s;
}
.search-box button:hover { background: #388bfd; }

.quick-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin: 32px 0;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--border-radius); padding: 20px;
  text-align: center;
}
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.section-title {
  font-size: 1.2rem; font-weight: 600; margin: 28px 0 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.dc-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; margin-bottom: 32px;
}
.dc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--border-radius); padding: 16px;
}
.dc-card h3 { font-size: 1rem; margin-bottom: 8px; }
.dc-worlds { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-world-tag {
  font-size: 0.75rem; background: var(--bg-primary);
  padding: 2px 8px; border-radius: 4px;
  color: var(--text-secondary);
}

.search-page-box { margin-bottom: 24px; }

.item-result {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--border-radius);
  border: 1px solid var(--border); margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
}
.item-result:hover { background: var(--bg-hover); border-color: var(--accent); }
.item-icon { width: 40px; height: 40px; border-radius: 4px; background: var(--bg-primary); flex-shrink: 0; }
.item-result-info { flex: 1; }
.item-result-name { font-weight: 500; }
.item-result-category { font-size: 0.8rem; color: var(--text-secondary); }

.search-history { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 0; }
.search-history:empty { display: none; }
.history-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 4px 12px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s;
}
.history-tag:hover { background: var(--bg-hover); border-color: var(--accent); }
.history-tag .remove {
  font-size: 1rem; line-height: 1; color: var(--text-secondary);
  margin-left: 2px;
}
.history-tag .remove:hover { color: var(--accent-red); }
.history-clear {
  font-size: 0.75rem; color: var(--text-secondary);
  cursor: pointer; background: none; border: none; padding: 4px 8px;
}
.history-clear:hover { color: var(--accent-red); text-decoration: underline; }
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-bottom: 4px;
}
.history-header span { font-size: 0.75rem; color: var(--text-secondary); }

.item-detail { margin-top: 16px; }
.item-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 24px;
}
.item-header-icon { width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0; }
.item-header-info { flex: 1; }
.item-header-name { font-size: 1.5rem; font-weight: 600; }
.item-header-category { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }
.fav-btn {
  margin-top: 8px; padding: 4px 14px; border: 1px solid var(--border);
  border-radius: 16px; background: var(--bg-card); color: var(--text-primary);
  cursor: pointer; font-size: 0.8rem; transition: all 0.15s;
}
.fav-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.fav-btn.active { border-color: var(--accent-gold); color: var(--accent-gold); background: rgba(210,153,34,0.1); }

.price-summary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; margin-bottom: 24px;
}
.price-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--border-radius); padding: 12px; text-align: center;
}
.price-box .label { font-size: 0.75rem; color: var(--text-secondary); }
.price-box .value { font-size: 1.1rem; font-weight: 600; margin-top: 4px; }
.price-box .value.green { color: var(--accent-green); }
.price-box .value.red { color: var(--accent-red); }
.price-box .value.gold { color: var(--accent-gold); }

.data-section-title {
  font-size: 1rem; font-weight: 600; margin: 20px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.data-section-title .count-badge {
  font-size: 0.75rem; background: var(--bg-hover);
  padding: 2px 8px; border-radius: 12px; color: var(--text-secondary);
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
th {
  background: var(--bg-secondary); padding: 10px 12px;
  text-align: left; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
tr:hover td { background: var(--bg-hover); }
.hq-badge {
  font-size: 0.7rem; background: var(--accent-gold);
  color: #000; padding: 1px 6px; border-radius: 4px;
  font-weight: 600;
}

.back-btn {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); padding: 8px 16px;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
  margin-bottom: 16px;
}
.back-btn:hover { background: var(--bg-hover); }

.loading {
  text-align: center; padding: 60px; color: var(--text-secondary);
  font-size: 1.1rem;
}

.about-content { max-width: 700px; line-height: 1.8; }
.about-content p { margin-bottom: 12px; }
.about-content ul { margin-left: 20px; margin-bottom: 12px; }
.footer-note { margin-top: 40px; color: var(--text-secondary); font-size: 0.8rem; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--border-radius); padding: 12px 24px;
  font-size: 0.9rem; z-index: 999;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

.more-btn {
  padding: 6px 20px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card); color: var(--accent); cursor: pointer;
  font-size: 0.85rem; transition: all 0.15s;
}
.more-btn:hover { background: var(--bg-hover); border-color: var(--accent); }

.filter-bar { display: flex; gap: 6px; margin-bottom: 12px; }
.filter-btn {
  padding: 4px 16px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  font-size: 0.8rem; transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(88,166,255,0.1); }

@media (max-width: 768px) {
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .header-inner { flex-direction: column; height: auto; padding: 8px 16px; gap: 8px; }
  header { height: auto; }
  .dc-selector { width: 100%; }
  .select-group { flex: 1; }
  .select-group select { flex: 1; max-width: none; }
  .hero h2 { font-size: 1.5rem; }
  .hero { padding: 32px 16px 24px; }
  .price-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
}
