:root {
  --bg: #0d1117;
  --panel: #161b22;
  --card: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --primary: #1f6feb;
  --primary-hover: #388bfd;
  --success: #3fb950;
  --danger: #f85149;
  --box: #58a6ff;
  --channel: #a371f7;
  --triangle: #3fb950;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ========== 左侧面板 ========== */
.panel {
  width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.panel-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-group select,
.form-group textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.box { background: var(--box); }
.dot.channel { background: var(--channel); }
.dot.triangle { background: var(--triangle); }

.panel-footer {
  margin-top: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ========== 右侧结果 ========== */
.results {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

#resultCount {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--card);
  padding: 4px 12px;
  border-radius: 20px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state .hint {
  font-size: 0.85rem;
  margin-top: 8px;
  opacity: 0.7;
}

/* ========== 结果卡片 ========== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s, transform 0.15s;
}

.card:hover {
  border-color: #484f58;
  transform: translateY(-1px);
}

.card-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.symbol {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  width: fit-content;
}

.badge.box {
  background: rgba(88, 166, 255, 0.15);
  color: var(--box);
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.badge.channel {
  background: rgba(163, 113, 247, 0.15);
  color: var(--channel);
  border: 1px solid rgba(163, 113, 247, 0.3);
}

.badge.triangle {
  background: rgba(63, 185, 80, 0.15);
  color: var(--triangle);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge.up {
  background: rgba(63, 185, 80, 0.15);
  color: var(--success);
}

.badge.down {
  background: rgba(248, 81, 73, 0.15);
  color: var(--danger);
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card-right {
  text-align: right;
}

.price {
  font-size: 1.2rem;
  font-weight: 600;
}

.change {
  font-size: 0.85rem;
  margin-top: 2px;
}

.change.positive { color: var(--success); }
.change.negative { color: var(--danger); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }
  .panel {
    width: 100%;
    height: auto;
    position: relative;
  }
  .results {
    padding: 16px;
  }
}

/* ========== 新增：复选框 & 量价标签 ========== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.vol-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(63, 185, 80, 0.15);
  color: var(--success);
  margin-left: 6px;
}

.vol-tag.weak {
  background: rgba(139, 148, 158, 0.15);
  color: var(--text-muted);
}

/* ========== 卡片可点击 ========== */
.card {
  cursor: pointer;
}

.card:active {
  transform: scale(0.99);
}

/* ========== 图表弹窗 ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 12px 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.modal-metrics .metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-metrics .metric strong {
  color: var(--text);
  font-size: 0.95rem;
}

.chart-container {
  width: 100%;
  height: 420px;
  min-height: 320px;
}

.modal-footer {
  padding: 10px 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .modal-content {
    max-height: 95vh;
  }
  .chart-container {
    height: 300px;
  }
}
