/* 500w 双色球追踪系统 - 暗色主题 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #0f1923;
  color: #e0e0e0;
  min-height: 100vh;
}

/* 登录遮罩 */
.login-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #0f1923;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-box {
  text-align: center;
  padding: 40px;
  border: 1px solid #1e3044;
  border-radius: 12px;
  background: #162230;
  width: 320px;
}
.login-box .logo {
  font-size: 48px; font-weight: 900; color: #f39c12;
  letter-spacing: -2px;
}
.login-box .subtitle { color: #8899aa; font-size: 14px; }
.login-input {
  width: 100%; padding: 12px 16px;
  background: #0f1923; border: 1px solid #1e3044;
  border-radius: 8px; color: #fff; font-size: 16px;
  outline: none; text-align: center;
}
.login-input:focus { border-color: #f39c12; }
.login-error { color: #e74c3c; margin-top: 12px; font-size: 14px; }
.btn-large { padding: 12px 24px; font-size: 16px; }

/* 退出按钮 */
.btn-logout {
  position: absolute; top: 16px; right: 16px;
  background: none; border: 1px solid #334455;
  color: #8899aa; padding: 6px 12px;
  border-radius: 6px; cursor: pointer;
  font-size: 12px;
}
.btn-logout:hover { color: #e74c3c; border-color: #e74c3c; }
.btn-logout::after { content: '退出'; }

/* 已收录期号 */
.stored-issues {
  background: #162230; border-radius: 8px;
  padding: 16px; margin: 16px 0;
}
.stored-issues h3 { font-size: 14px; color: #8899aa; margin-bottom: 12px; }
.stored-issues .hint { color: #f39c12; }
.issue-tags-wrapper {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
}
.issue-tags { }
.year-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.year-tag {
  background: #1e3044;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #aabbcc;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.year-tag:hover {
  background: #2980b9;
  color: #fff;
}
.year-tag.active {
  background: #e74c3c;
  color: #fff;
  border-color: #c0392b;
}
.year-tag small {
  font-weight: 400;
  color: inherit;
  opacity: 0.7;
  font-size: 11px;
}
.year-detail-list {
  max-height: 350px;
  overflow-y: auto;
  border-top: 1px solid #1e3044;
  padding-top: 8px;
  margin-top: 4px;
}
.issue-tag {
  background: #1e3044; padding: 4px 10px;
  border-radius: 4px; font-size: 12px;
  color: #aabbcc; font-family: Consolas, monospace;
}
.issue-tag.latest { background: #2980b9; color: #fff; }
.issue-tag.missing { background: #3a1a1a; color: #e74c3c; }

#app { max-width: 900px; margin: 0 auto; padding: 16px; }

/* Header */
header {
  text-align: center;
  padding: 24px 0 16px;
  border-bottom: 1px solid #1e3044;
  margin-bottom: 16px;
}
.logo {
  font-size: 42px;
  font-weight: 900;
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}
.subtitle { color: #7f8c8d; font-size: 14px; margin-top: 4px; }
.stats-bar {
  display: flex; justify-content: center; gap: 24px;
  margin-top: 12px; font-size: 13px; color: #95a5a6;
}
.stats-bar span { color: #f39c12; font-weight: 600; }

/* Tabs */
.tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 2px solid #1e3044;
}
.tab {
  flex: 1; padding: 12px 8px; text-align: center;
  background: none; border: none; color: #7f8c8d;
  font-size: 15px; cursor: pointer; transition: all 0.2s;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: #bdc3c7; }
.tab.active { color: #e74c3c; border-bottom-color: #e74c3c; font-weight: 600; }

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Ball picker */
.ball-picker { margin-bottom: 20px; }
.ball-picker h3 { font-size: 15px; margin-bottom: 10px; color: #bdc3c7; }
.hint { font-size: 12px; color: #7f8c8d; font-weight: 400; }

.ball-grid {
  display: grid; gap: 6px;
}
.red-grid { grid-template-columns: repeat(11, 1fr); }
.blue-grid { grid-template-columns: repeat(8, 1fr); }

.ball-btn {
  aspect-ratio: 1; border-radius: 50%; border: 2px solid #2c3e50;
  background: #1a2a3a; color: #bdc3c7; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.ball-btn:hover { border-color: #e74c3c; transform: scale(1.08); }
.ball-btn.selected-red {
  background: #e74c3c; border-color: #e74c3c; color: #fff;
  box-shadow: 0 0 12px rgba(231,76,60,0.5);
}
.ball-btn.selected-blue {
  background: #2980b9; border-color: #2980b9; color: #fff;
  box-shadow: 0 0 12px rgba(41,128,185,0.5);
}

.selected-balls {
  display: flex; gap: 8px; margin-top: 12px; min-height: 40px;
  align-items: center; justify-content: center;
}
.mini-ball {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.mini-ball.red { background: #e74c3c; }
.mini-ball.blue { background: #2980b9; }

/* Form */
.entry-form {
  background: #1a2a3a; border-radius: 12px; padding: 20px;
  margin-top: 16px;
}
.form-row {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.form-row label { font-size: 13px; color: #95a5a6; white-space: nowrap; }
.form-row input {
  background: #0f1923; border: 1px solid #2c3e50; color: #e0e0e0;
  padding: 8px 12px; border-radius: 6px; font-size: 14px;
}
.form-row input:focus { outline: none; border-color: #e74c3c; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn {
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #e74c3c; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #c0392b; }
.btn-secondary { background: #2c3e50; color: #bdc3c7; }
.btn-secondary:hover { background: #34495e; }
.btn-accent { background: #f39c12; color: #1a1a2e; }
.btn-accent:hover { background: #e67e22; }
.btn-large { padding: 14px 32px; font-size: 16px; }
.input-sm {
  background: #0f1923; border: 1px solid #2c3e50; color: #e0e0e0;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; width: 120px;
}

/* History */
.history-actions {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.entry-card {
  background: #1a2a3a; border-radius: 10px; padding: 16px;
  margin-bottom: 10px; border-left: 4px solid #2c3e50;
  transition: all 0.2s;
}
.entry-card:hover { background: #1e3044; }
.entry-card.won { border-left-color: #f39c12; }
.entry-card.won-1 { border-left-color: #e74c3c; box-shadow: 0 0 20px rgba(231,76,60,0.2); }
.entry-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 13px; color: #7f8c8d;
}
.entry-balls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.entry-balls .mini-ball { width: 30px; height: 30px; font-size: 12px; }
.entry-balls .separator { color: #7f8c8d; margin: 0 4px; font-size: 18px; }
.entry-result {
  margin-top: 8px; font-size: 13px; padding: 6px 10px;
  border-radius: 6px; display: inline-block;
}
.entry-result.no-win { background: #1a2a3a; color: #7f8c8d; }
.entry-result.win { background: rgba(243,156,18,0.15); color: #f39c12; font-weight: 600; }
.entry-result.jackpot { background: rgba(231,76,60,0.15); color: #e74c3c; font-weight: 700; }
.entry-delete {
  background: none; border: none; color: #7f8c8d; cursor: pointer;
  font-size: 12px; padding: 4px 8px;
}
.entry-delete:hover { color: #e74c3c; }

/* Frequency chart */
.freq-section { margin-bottom: 24px; }
.freq-section h3 { font-size: 15px; margin-bottom: 10px; color: #bdc3c7; }
.freq-chart {
  display: grid; gap: 4px;
}
.freq-chart.red-chart { grid-template-columns: repeat(11, 1fr); }
.freq-chart.blue-chart { grid-template-columns: repeat(8, 1fr); }
.freq-bar {
  background: #1a2a3a; border-radius: 6px; padding: 6px 4px;
  text-align: center; font-size: 11px; transition: all 0.2s;
  cursor: default; position: relative;
}
.freq-bar:hover { background: #1e3044; transform: translateY(-2px); }
.freq-bar .num { font-weight: 700; font-size: 13px; display: block; }
.freq-bar .count { color: #7f8c8d; font-size: 10px; }
.freq-bar .bar-fill {
  height: 3px; border-radius: 2px; margin-top: 4px;
  background: #e74c3c; transition: width 0.3s;
}
.freq-bar.hot .bar-fill { background: #e74c3c; }
.freq-bar.cold .bar-fill { background: #2980b9; }
.freq-bar.missing-high { border: 1px solid #f39c12; }

/* AI */
.strategy-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.strategy-card {
  background: #1a2a3a; border: 2px solid #2c3e50; border-radius: 10px;
  padding: 16px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.strategy-card:hover { border-color: #34495e; }
.strategy-card.active { border-color: #e74c3c; background: #1e2a3a; }
.strategy-icon { font-size: 28px; margin-bottom: 6px; }
.strategy-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.strategy-desc { font-size: 11px; color: #7f8c8d; line-height: 1.4; }

.ai-result {
  background: #1a2a3a; border-radius: 12px; padding: 24px;
  text-align: center; margin-bottom: 16px; min-height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.ai-hint { color: #7f8c8d; font-size: 14px; }
.ai-balls { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ai-balls .mini-ball { width: 42px; height: 42px; font-size: 16px; }
.ai-balls .separator { color: #7f8c8d; font-size: 22px; margin: 0 4px; }

.ai-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

.ai-multi { display: grid; gap: 8px; }
.ai-multi-row {
  background: #1a2a3a; border-radius: 8px; padding: 10px 16px;
  display: flex; align-items: center; gap: 6px; font-size: 13px;
}
.ai-multi-row .mini-ball { width: 28px; height: 28px; font-size: 11px; }

/* 打票格式 */
.ticket-row {
  padding: 12px 16px;
  border-left: 3px solid #e67e22;
}
.ticket-num {
  color: #e67e22;
  font-weight: bold;
  font-size: 15px;
  min-width: 28px;
  margin-right: 4px;
}
.ticket-ball {
  width: 36px !important;
  height: 36px !important;
  font-size: 15px !important;
}

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #2c3e50; color: #fff; padding: 12px 24px; border-radius: 8px;
  font-size: 14px; z-index: 999; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }

/* AI range bar */
.ai-range-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding: 12px 16px;
  background: rgba(255,255,255,0.05); border-radius: 8px;
}
.ai-range-bar label { color: #7f8c8d; font-size: 14px; white-space: nowrap; }
.ai-range-select {
  background: #1a2632; color: #e0e0e0; border: 1px solid #2c3e50;
  border-radius: 4px; padding: 6px 12px; font-size: 14px; outline: none;
}
.ai-range-select:focus { border-color: #3498db; }
.ai-range-label { color: #7f8c8d; font-size: 13px; margin-bottom: 8px; }

/* 补偿强度滑块 */
.ai-gamma-bar {
  background: rgba(255,255,255,0.05); border-radius: 8px;
  padding: 12px 16px; margin-bottom: 16px;
}
.gamma-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.gamma-head label { color: #7f8c8d; font-size: 14px; white-space: nowrap; }
.gamma-val {
  color: #3498db; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ai-gamma-bar input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px; outline: none;
  background: linear-gradient(to right, #2c3e50, #3498db);
}
.ai-gamma-bar input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #3498db; cursor: pointer;
  border: 2px solid #1a2632;
  box-shadow: 0 0 0 1px rgba(52,152,219,0.5);
}
.ai-gamma-bar input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #3498db; cursor: pointer; border: 2px solid #1a2632;
}
.gamma-scale {
  display: flex; justify-content: space-between;
  margin-top: 6px; font-size: 11px; color: #5d6d7e;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.collapse-icon {
  font-size: 12px;
  color: #7f8c8d;
  transition: transform 0.2s;
}
.collapsible-header.open .collapse-icon {
  transform: rotate(90deg);
}
.issue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}
.issue-item .issue-num {
  color: #e0e0e0;
  font-size: 13px;
  min-width: 55px;
}
.issue-item .mini-ball {
  width: 20px;
  height: 20px;
  font-size: 10px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  display: inline-block;
}
.issue-item .mini-ball.red {
  background: #e74c3c;
  color: white;
}
.issue-item .mini-ball.blue {
  background: #3498db;
  color: white;
}

/* Responsive */
@media (max-width: 600px) {
  .red-grid { grid-template-columns: repeat(7, 1fr); }
  .blue-grid { grid-template-columns: repeat(8, 1fr); }
  .strategy-cards { grid-template-columns: 1fr; }
  .tabs { font-size: 13px; }
  .tab { padding: 10px 4px; font-size: 13px; }
  .freq-chart.red-chart { grid-template-columns: repeat(7, 1fr); }
}

/* 策略回测 */
.ai-backtest {
  margin-top: 26px; padding: 16px 18px;
  background: rgba(255,255,255,0.04); border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.backtest-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px;
}
.backtest-head h3 { font-size: 15px; margin: 0 0 4px; color: #e0e0e0; }
.backtest-desc { font-size: 12px; color: #7f8c8d; margin: 0; line-height: 1.5; }
.bt-meta { font-size: 12px; color: #7f8c8d; margin-bottom: 10px; }
.bt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bt-table th, .bt-table td {
  padding: 7px 8px; text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-variant-numeric: tabular-nums;
}
.bt-table th:first-child, .bt-table td:first-child { text-align: left; }
.bt-table th { color: #7f8c8d; font-weight: 500; font-size: 12px; }
.bt-table td { color: #c8d0d8; }
.bt-summary { margin-top: 12px; font-size: 13px; line-height: 1.9; color: #c8d0d8; }
.bt-note { font-size: 12px; color: #6b7c8d; line-height: 1.6; margin-top: 6px; }
.bt-verdict {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; margin-left: 6px;
}
.bt-verdict.neutral { background: rgba(127,140,141,0.22); color: #95a5a6; }
.bt-verdict.up { background: rgba(231,76,60,0.18); color: #e74c3c; }
.bt-verdict.down { background: rgba(46,204,113,0.18); color: #2ecc71; }

/* 蓝球覆盖说明 */
.blue-cover-note {
  margin-top: 10px; padding: 9px 12px;
  background: rgba(52,152,219,0.10);
  border-left: 3px solid #3498db; border-radius: 6px;
  font-size: 13px; color: #b8c4ce; line-height: 1.7;
}
.blue-cover-note b { color: #5dade2; }
.blue-cover-sub { display: block; font-size: 12px; color: #7f8c8d; margin-top: 2px; }

/* 分布自检 */
.ai-distcheck {
  margin-top: 18px; padding: 16px 18px;
  background: rgba(255,255,255,0.04); border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.dc-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 150px; margin: 14px 0 6px; padding: 0 2px;
}
.dc-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.dc-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.dc-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  background: rgba(149,165,166,0.45);
  transition: height .35s ease;
}
.dc-bar.hi { background: #e74c3c; }
.dc-bar.lo { background: #34495e; }
.dc-cnt {
  font-size: 11px; color: #c8d0d8; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.dc-num { font-size: 10px; color: #6b7c8d; margin-top: 1px; }
.dc-summary { margin-top: 10px; font-size: 13px; line-height: 1.9; color: #c8d0d8; }
.dc-verdict {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 12px; margin-bottom: 6px;
}
.dc-verdict.ok { background: rgba(231,76,60,0.18); color: #e74c3c; }
.dc-verdict.flat { background: rgba(127,140,141,0.22); color: #95a5a6; }
.dc-stats b { color: #e0e0e0; }

/* 期号预填与暂存找回 */
.issue-prefill {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 2px; flex-wrap: wrap;
}
.issue-prefill label { font-size: 13px; color: #7f8c8d; }
.prefill-input {
  width: 92px; padding: 5px 8px; text-align: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px; color: #e0e0e0; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.prefill-input:focus { outline: none; border-color: #3498db; }
.prefill-meta { font-size: 12px; color: #7f8c8d; }
.staged-restore {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  background: rgba(243,156,18,0.12); border-left: 3px solid #f39c12;
  border-radius: 6px; font-size: 13px; color: #e8d8b0;
}
.staged-actions { display: flex; gap: 8px; }
.btn-sm { padding: 4px 14px; font-size: 12px; }
