:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --bg-page: #080c14;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-blue: #0ea5e9;
  --accent-red: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  padding: 16px;
  line-height: 1.5;
}

.app-layout {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ================= 顶部导航栏 ================= */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111827;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b0f19;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 15px;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-text h1 span {
  color: var(--accent-gold);
}

.brand-domain {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
}

.dot-live {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.status-txt {
  font-size: 11px;
  color: #a7f3d0;
  font-weight: 600;
}

.refresh-time {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  background: #0b0f19;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #1f2937;
}

.btn-refresh {
  background: #0b0f19;
  border: 1px solid #374151;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-refresh:hover {
  color: #fff;
  border-color: var(--accent-gold);
}

.btn-refresh.loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ================= 顶部概览指标 ================= */
.metric-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.overview-box {
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
}

.ov-title {
  font-size: 12px;
  font-weight: 600;
}

.ov-num {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-mono);
  margin: 3px 0;
}

.ov-desc {
  font-size: 11px;
  opacity: 0.8;
}

.tier1-box {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.45), rgba(4, 47, 46, 0.7));
  border-color: #059669;
  color: #a7f3d0;
}
.tier1-box .ov-num { color: #34d399; }

.tier2-box {
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.45), rgba(8, 47, 73, 0.7));
  border-color: #0284c7;
  color: #bae6fd;
}
.tier2-box .ov-num { color: #38bdf8; }

.tier3-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.7));
  border-color: #475569;
  color: #cbd5e1;
}
.tier3-box .ov-num { color: #94a3b8; }

/* ================= 三级异色容器 ================= */
.containers-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tier-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid transparent;
}

/* Tier 1 翡翠墨绿 */
.container-tier1 {
  background: linear-gradient(180deg, #042f2e 0%, #064e3b 35%, #022c22 100%);
  border-color: #10b981;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.15);
}
.container-tier1 .tier-header {
  background: linear-gradient(90deg, #065f46, #044e3d);
  border-bottom: 1px solid #10b981;
}
.container-tier1 .tier-title { color: #6ee7b7; }
.container-tier1 .tier-badge {
  background: rgba(16, 185, 129, 0.25);
  color: #a7f3d0;
  border: 1px solid #10b981;
}

/* Tier 2 深海靛蓝 */
.container-tier2 {
  background: linear-gradient(180deg, #082f49 0%, #0c4a6e 35%, #032036 100%);
  border-color: #0284c7;
  box-shadow: 0 0 18px rgba(2, 132, 199, 0.15);
}
.container-tier2 .tier-header {
  background: linear-gradient(90deg, #0369a1, #075985);
  border-bottom: 1px solid #0284c7;
}
.container-tier2 .tier-title { color: #7dd3fc; }
.container-tier2 .tier-badge {
  background: rgba(2, 132, 199, 0.25);
  color: #bae6fd;
  border: 1px solid #0284c7;
}

/* Tier 3 冷灰石板 */
.container-tier3 {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 45%, #090e17 100%);
  border-color: #475569;
}
.container-tier3 .tier-header {
  background: linear-gradient(90deg, #334155, #1e293b);
  border-bottom: 1px solid #475569;
}
.container-tier3 .tier-title { color: #cbd5e1; }
.container-tier3 .tier-badge {
  background: rgba(71, 85, 105, 0.35);
  color: #e2e8f0;
  border: 1px solid #64748b;
}

.tier-header {
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tier-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tier-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ================= 桌面端表格视图 ================= */
.desktop-table-wrap {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.custom-table th {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.mono-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.name-col {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stock-name {
  font-weight: 700;
  color: #fff;
  font-size: 14px;
}

.stock-code {
  font-family: var(--font-mono);
  color: #94a3b8;
  font-size: 12px;
}

.stock-sec {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.35);
  color: #cbd5e1;
  padding: 1px 6px;
  border-radius: 4px;
}

.potential-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}

.chip-tier1 {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid #10b981;
}

.chip-tier2 {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
  border: 1px solid #0284c7;
}

.chip-tier3 {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid #475569;
}

.chip-negative {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef4444;
}

.growth-up {
  color: #34d399;
  font-family: var(--font-mono);
  font-weight: 600;
}

.growth-down {
  color: #f87171;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ================= 移动端手机专享卡片流 (Mobile Card Flow) ================= */
.mobile-cards-wrap {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.m-stock-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.m-stock-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.m-stock-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.m-stock-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-blue);
}

.m-stock-sec {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 1px 5px;
  border-radius: 3px;
}

.m-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.m-grid-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-item-label {
  font-size: 11px;
  color: var(--text-dim);
}

.m-item-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.m-card-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.m-organ-tag {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ================= 底部说明 ================= */
.footer-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #111827;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-cert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #a7f3d0;
  line-height: 1.6;
}

.cert-icon { font-size: 16px; }

.footer-rule {
  color: var(--text-dim);
  font-size: 11px;
}

/* ================= 手机端媒体查询断点 (@media <= 768px) ================= */
@media (max-width: 768px) {
  body {
    padding: 10px 8px;
  }

  .header-bar {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .metric-overview {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .overview-box {
    padding: 10px 8px;
    align-items: center;
    text-align: center;
  }

  .ov-title {
    font-size: 10px;
    white-space: nowrap;
  }

  .ov-num {
    font-size: 20px;
  }

  .ov-desc {
    display: none; /* 移动端隐藏冗余小字，保持紧凑 */
  }

  /* 核心切换：在手机端隐藏横向宽表格，展示结构化卡片流！ */
  .desktop-table-wrap {
    display: none;
  }

  .mobile-cards-wrap {
    display: flex;
  }

  .tier-header {
    padding: 10px 14px;
  }

  .tier-title {
    font-size: 13px;
  }
}
