/* ==========================================================================
   1. 基础重置与全局变量
   ========================================================================== */
:root {
  --bg: #0f141c;
  --card-bg: #1a222f;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --yes: #22c55e;
  --no: #ef4444;
  --border: #334155;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-top: 70px;
}

/* ==========================================================================
   0. 导航栏
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  backdrop-filter: blur(10px);
  background-color: rgba(26, 34, 47, 0.95);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.nav-logo a {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav-logo a:hover {
  color: var(--primary);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 30px;
  flex: 1;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
  border-radius: 1px;
}

.nav-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background-color: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.balance-label {
  font-size: 12px;
  color: var(--text-muted);
}

.balance-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* ==========================================================================
   2. 布局与容器
   ========================================================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 25px;
}

header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

/* ==========================================================================
   3. 统计行
   ========================================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
}

/* ==========================================================================
   4. 筛选
   ========================================================================== */
.filter-section {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 25px;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #000;
}

/* ==========================================================================
   5. 市场列表 - 改进为多列布局
   ========================================================================== */
.market-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.market-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.market-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  margin-right: 6px;
}

.status-badge.active {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--yes);
  border-color: var(--yes);
}

.status-badge.locked {
  background-color: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border-color: #fbbf24;
}

.status-badge.resolved {
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border-color: var(--text-muted);
}

.category-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  background-color: var(--bg);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.time-left {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.market-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ==========================================================================
   6. 选项列表 - 紧凑卡片版
   ========================================================================== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.option-item {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  transition: all 0.2s;
}

.option-item:hover {
  border-color: var(--primary);
}

.option-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.option-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.option-odds {
  font-size: 12px;
  font-weight: 600;
}

.option-percentage {
  font-size: 11px;
  color: var(--text-muted);
  background-color: var(--card-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ==========================================================================
   7. 持仓分布
   ========================================================================== */
.pool-distribution {
  margin-bottom: 12px;
}

.dist-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #475569;
}

.dist-segment {
  height: 100%;
  transition: all 0.2s;
  cursor: pointer;
}

.dist-segment:hover {
  opacity: 0.8;
}

/* ==========================================================================
   8. 结果横幅
   ========================================================================== */
.result-banner {
  background-color: var(--bg);
  border-left: 4px solid var(--yes);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text);
}

.result-banner strong {
  color: var(--yes);
  font-weight: 700;
}

/* ==========================================================================
   9. 按钮
   ========================================================================== */
.market-link {
  text-decoration: none;
  color: inherit;
  margin-top: auto;
}

.btn-participate {
  width: 100%;
  padding: 10px;
  background-color: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-participate:hover {
  opacity: 0.9;
  background-color: #0ea5e9;
}

/* ==========================================================================
   10. 详情页布局
   ========================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 25px;
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.card h3 {
  font-size: 16px;
  margin-bottom: 15px;
  color: var(--text);
}

/* ==========================================================================
   11. 响应式
   ========================================================================== */
@media (max-width: 1024px) {
  .nav-menu {
    gap: 20px;
  }

  .nav-container {
    gap: 20px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .market-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .navbar {
    height: auto;
    padding: 10px 0;
  }

  .nav-container {
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 20px;
  }

  .nav-menu {
    order: 3;
    width: 100%;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
  }

  .nav-balance {
    order: 2;
  }

  body {
    padding-top: auto;
  }

  .container {
    max-width: 100%;
    padding: 0 15px;
  }

  header {
    flex-direction: column;
    gap: 15px;
  }

  .market-list {
    grid-template-columns: 1fr;
  }

  .options-list {
    gap: 6px;
  }

  .market-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .time-left {
    margin-left: 0;
    margin-top: 8px;
  }
}

@media (max-width: 600px) {
  header h1 {
    font-size: 24px;
  }

  .market-title {
    font-size: 14px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 12px;
  }

  .option-item {
    padding: 8px;
  }

  .nav-logo a {
    font-size: 18px;
  }

  .nav-link {
    font-size: 13px;
  }
}