/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f4f5f7;
  color: #333;
  min-width: 1180px;
}

/* ===== 顶部 ===== */
.site-header {
  background: linear-gradient(135deg, #3498db, #5dade2);
  color: #fff;
  padding: 16px 0;
}
.header-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-header h1 { font-size: 24px; letter-spacing: 2px; }
.tip-badge {
  font-size: 13px; background: rgba(255,255,255,.18);
  padding: 6px 14px; border-radius: 20px;
}

/* ===== 最新开奖条 ===== */
.latest-bar {
  max-width: 1440px; margin: 14px auto 0; padding: 14px 24px;
  background: #fff; border-radius: 10px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  font-size: 15px;
}
.latest-bar .loading { color: #999; }
.latest-bar .lb-code { font-weight: bold; color: #2980b9; font-size: 16px; }
.latest-bar .lb-date { color: #888; }
.latest-bar .lb-next { margin-left: auto; color: #2c7be5; font-size: 13px; }

/* ===== 球 ===== */
.ball {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  font-weight: bold; font-size: 15px; margin: 0 3px;
}
.ball.red { background: #e74c3c; color: #fff; box-shadow: inset -3px -3px 6px rgba(0,0,0,.2); }
.ball.blue { background: #2c7be5; color: #fff; box-shadow: inset -3px -3px 6px rgba(0,0,0,.2); }
.ball.small { width: 26px; height: 26px; font-size: 13px; margin: 0 2px; }
.ball.hit { outline: 3px solid #f1c40f; outline-offset: 1px; }

/* ===== 导航 ===== */
.tab-nav {
  max-width: 1440px; margin: 14px auto 0; padding: 0 24px;
  display: flex; gap: 8px;
}
.tab-btn {
  border: none; background: #e8eaed; color: #555;
  padding: 12px 28px; font-size: 15px; cursor: pointer;
  border-radius: 8px 8px 0 0; font-family: inherit;
}
.tab-btn:hover { background: #dde1e6; }
.tab-btn.active { background: #fff; color: #2980b9; font-weight: bold; }
.badge {
  background: #e74c3c; color: #fff; border-radius: 10px;
  font-size: 12px; padding: 1px 7px; margin-left: 4px;
}

/* ===== 主区域 ===== */
.main-content { max-width: 1440px; margin: 0 auto; padding: 0 24px 30px; }
.tab-page { display: none; background: #fff; border-radius: 0 8px 8px 8px; padding: 22px; }
.tab-page.active { display: block; }
.section-title {
  font-size: 17px; color: #2980b9; margin: 22px 0 12px;
  padding-left: 10px; border-left: 4px solid #3498db;
}
.section-title:first-child { margin-top: 0; }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; background: #fafbfc; border-radius: 8px; margin-bottom: 8px;
}
.toolbar-label { font-size: 14px; color: #555; }
.toolbar-note { font-size: 13px; color: #999; }
.btn-group { display: flex; gap: 6px; }
.range-btn {
  border: 1px solid #ddd; background: #fff; padding: 6px 16px;
  border-radius: 6px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.range-btn.active { background: #3498db; color: #fff; border-color: #3498db; }

/* ===== 按钮 ===== */
.btn {
  border: none; padding: 9px 20px; border-radius: 6px;
  font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #3498db; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2980b9; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover:not(:disabled) { background: #1e9648; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c0392b; }
.btn-mini {
  border: 1px solid #ddd; background: #fff; padding: 3px 10px;
  border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.btn-mini:hover { background: #f0f0f0; }
.btn-mini.danger { color: #e74c3c; border-color: #e74c3c; }

/* ===== 走势表格 ===== */
.table-scroll { overflow-x: auto; }
.trend-table {
  border-collapse: collapse; font-size: 12px; margin: 0 auto;
  min-width: 100%;
}
.trend-table th, .trend-table td {
  border: 1px solid #e3e6ea; text-align: center;
  width: 30px; min-width: 30px; height: 26px; padding: 0;
}
.trend-table th { background: #f6f7f9; color: #666; font-weight: normal; }
.trend-table th.head-red { background: #fdecea; color: #c0392b; }
.trend-table th.head-blue { background: #e8f1fd; color: #2c7be5; }
.trend-table td.cell-code {
  background: #f6f7f9; color: #888; font-size: 11px;
  min-width: 66px; width: 66px;
}
.trend-table td.omit { color: #b8bec7; }
.trend-table td.hit-red {
  background: #e74c3c; color: #fff; font-weight: bold;
  border-radius: 0; font-size: 13px;
}
.trend-table td.hit-blue { background: #2c7be5; color: #fff; font-weight: bold; font-size: 13px; }
.trend-table tr.stat-row td { background: #fffbe8; color: #8a6d1a; font-weight: bold; }
.trend-table tr.stat-row td.cell-code { background: #fdf3d7; color: #8a6d1a; font-size: 12px; }

/* ===== 折线图 ===== */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-card { border: 1px solid #eee; border-radius: 8px; padding: 14px; }
.chart-card h3 { font-size: 14px; color: #555; margin-bottom: 10px; font-weight: normal; }
.chart-card canvas { display: block; width: 100%; }

/* ===== 算法卡片 ===== */
.algo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-top: 14px;
}
.algo-card {
  border: 1px solid #e8eaed; border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .15s;
}
.algo-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.algo-card .algo-name { font-size: 15px; font-weight: bold; color: #333; }
.algo-card .algo-tag {
  font-size: 11px; color: #fff; background: #95a5a6;
  border-radius: 3px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.rank-badge {
  font-size: 11px; border-radius: 3px; padding: 1px 7px; margin-left: 6px;
  vertical-align: 2px; color: #fff;
}
.rank-badge.rank-1 { background: #f1c40f; color: #333; font-weight: bold; }
.rank-badge.rank-top { background: #e67e22; }
.rank-badge.rank-profit { background: #27ae60; font-weight: bold; }
.rank-badge.rank-normal { background: #7f8c8d; }
.info-bar { background: #eaf4fb; border: 1px solid #aed6f1; border-left: 4px solid #3498db; color: #2c3e50; font-size: 13px; line-height: 1.7; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
#pool-coverage .cov-panel { background: #f8fbfd; border: 1px solid #e3eef5; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
#pool-coverage .cov-title { font-size: 13px; color: #2c3e50; margin-bottom: 8px; }
#pool-coverage .cov-uncover { color: #e67e22; }
#pool-coverage .cov-grid { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; }
#pool-coverage .cov-cell { width: 24px; height: 24px; line-height: 24px; text-align: center; font-size: 11px; border-radius: 4px; background: #f0f2f5; color: #b5bcc4; }
#pool-coverage .cov-cell.cov-red.cov-lv1 { background: #fadbd8; color: #c0392b; }
#pool-coverage .cov-cell.cov-red.cov-lv2 { background: #f1948a; color: #fff; }
#pool-coverage .cov-cell.cov-red.cov-lv3 { background: #e74c3c; color: #fff; font-weight: bold; }
#pool-coverage .cov-cell.cov-blue.cov-lv1 { background: #d6eaf8; color: #2471a3; }
#pool-coverage .cov-cell.cov-blue.cov-lv2 { background: #85c1e9; color: #fff; }
#pool-coverage .cov-cell.cov-blue.cov-lv3 { background: #3498db; color: #fff; font-weight: bold; }
#pool-coverage .cov-note { font-size: 11.5px; color: #98a4ae; margin-top: 4px; }
.algo-card .algo-desc { font-size: 12.5px; color: #999; line-height: 1.5; min-height: 38px; }
.algo-card .algo-result {
  min-height: 40px; display: flex; align-items: center; flex-wrap: wrap;
  background: #fafbfc; border-radius: 6px; padding: 4px 8px;
}
.algo-card .algo-result .placeholder { color: #ccc; font-size: 13px; padding: 6px 0; }
.algo-card .algo-reason {
  font-size: 12px; color: #8a6d1a; background: #fffbe8;
  border-radius: 6px; padding: 7px 10px; line-height: 1.5; display: none;
}
.algo-card .algo-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.count-select {
  border: 1px solid #ddd; border-radius: 4px; padding: 4px 6px;
  font-size: 13px; font-family: inherit; background: #fff;
}

/* ===== 号池表格 ===== */
.data-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.data-table th, .data-table td {
  border: 1px solid #e8eaed; padding: 9px 8px; text-align: center;
}
.data-table th { background: #f6f7f9; color: #666; font-weight: normal; }
.data-table tr:hover td { background: #fafbfc; }
.prize-tag {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; background: #f0f0f0; color: #999;
}
.prize-tag.win { background: #fff3cd; color: #b8860b; font-weight: bold; }
.prize-tag.big { background: #ffe0e0; color: #c0392b; font-weight: bold; }
.empty-hint { text-align: center; color: #bbb; padding: 40px 0; font-size: 14px; }

/* ===== 数据管理页 ===== */
.status-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.status-card {
  border: 1px solid #e8eaed; border-radius: 10px; padding: 16px; text-align: center;
}
.status-card .num { font-size: 22px; font-weight: bold; color: #2980b9; }
.status-card .label { font-size: 13px; color: #999; margin-top: 6px; }
.panel {
  border: 1px solid #e8eaed; border-radius: 10px; padding: 18px;
  margin-bottom: 6px;
}
.panel-desc { font-size: 13px; color: #888; margin-bottom: 12px; line-height: 1.6; }
.update-status { margin-left: 12px; font-size: 13px; color: #666; }
.update-status.ok { color: #27ae60; }
.update-status.err { color: #e74c3c; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row label { font-size: 14px; color: #555; }
.form-row input {
  border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px;
  font-size: 14px; font-family: inherit;
}
.form-row input:focus { outline: none; border-color: #2c7be5; }

/* ===== 页脚 ===== */
.site-footer {
  max-width: 1440px; margin: 0 auto; padding: 18px 24px 30px;
  color: #aaa; font-size: 12px; text-align: center; line-height: 1.8;
}

/* ===== 打印区域（屏幕隐藏） ===== */
.print-area { display: none; }

@media print {
  body { min-width: auto; background: #fff; }
  .site-header, .latest-bar, .tab-nav, .main-content, .site-footer { display: none !important; }
  .print-area { display: block !important; font-family: "Microsoft YaHei", sans-serif; }
  .print-area .p-title { text-align: center; font-size: 22px; font-weight: bold; margin-bottom: 4px; }
  .print-area .p-sub { text-align: center; font-size: 12px; color: #555; margin-bottom: 14px; }
  .print-area table { width: 100%; border-collapse: collapse; }
  .print-area th, .print-area td {
    border: 1px solid #333; padding: 8px 6px; text-align: center; font-size: 15px;
  }
  .print-area th { background: #eee; }
  .print-area .p-red { color: #c0392b; font-weight: bold; font-size: 17px; letter-spacing: 3px; }
  .print-area .p-blue { color: #2c7be5; font-weight: bold; font-size: 17px; }
  .print-area .p-total { margin-top: 12px; font-size: 14px; display: flex; justify-content: space-between; }
  .print-area .p-note { margin-top: 14px; font-size: 11px; color: #777; text-align: center; }
  @page { size: A5 portrait; margin: 10mm; }
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px; width: 460px;
}
.modal-box h3 { font-size: 16px; margin-bottom: 16px; color: #2980b9; }
.modal-box .form-row input { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
