:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e3eaf3;
  --text: #101827;
  --text-2: #40516a;
  --text-3: #7688a0;
  --up: #e5484d;
  --down: #0f9d68;
  --blue: #2f6bfe;
  --blue-soft: #eaf1ff;
  --shadow: 0 10px 30px rgba(23, 43, 77, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 15% -10%, #eaf1ff 0%, rgba(234, 241, 255, 0) 55%),
              radial-gradient(900px 500px at 100% 0%, #f0fbf6 0%, rgba(240, 251, 246, 0) 50%),
              var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 22px 20px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f6bfe, #1d4ed8); color: #fff;
  font-size: 19px; font-weight: 700; box-shadow: 0 6px 16px rgba(47, 107, 254, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--text-3); letter-spacing: .4px; }
.toolbar { display: flex; align-items: center; gap: 12px; }
.status { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #b6c2d3; display: inline-block;
}
.status.ok .dot { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .14); }
.status.err .dot { background: #e5484d; }
.status.loading .dot { background: #f5a623; animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.refresh {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 12.5px; padding: 7px 15px; border-radius: 9px; cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.refresh:hover { border-color: #b9cdf6; color: var(--blue); box-shadow: 0 3px 10px rgba(47, 107, 254, .1); }
.refresh:disabled { opacity: .55; cursor: default; }

main { max-width: 1120px; margin: 0 auto; padding: 4px 20px 28px; }

.market {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.market-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 13px; box-shadow: var(--shadow); min-width: 0;
}
.market-tile .name { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-tile .price {
  margin-top: 5px; font-size: 19px; font-weight: 650; letter-spacing: -.3px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.market-tile .change { margin-top: 2px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.market-summary {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 9px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; font-size: 11.5px; color: var(--text-3);
}
.market-summary b { color: var(--text); font-weight: 600; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--text-3); }

.global-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px; padding: 13px 20px 20px;
}
.global-tile {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 12px; min-width: 0;
}
.global-tile .head { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.global-tile .name { font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-tile .tag {
  flex: none; font-size: 9.5px; line-height: 16px; padding: 0 5px; border-radius: 5px;
  background: var(--blue-soft); color: var(--blue); font-weight: 600;
}
.global-tile .price { margin-top: 6px; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-tile .change { margin-top: 2px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.global-tile .time { margin-top: 4px; font-size: 10px; color: var(--text-3); }

.futures-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr; gap: 9px 11px; padding: 13px 20px 20px;
}
.futures-tile {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px;
}
.futures-tile .name { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.futures-tile .price { margin-top: 5px; font-size: 21px; font-weight: 650; letter-spacing: -.3px; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.futures-tile .change { margin-top: 1px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.futures-tile .change span { font-size: 11px; }
.futures-tile .extra {
  margin-top: auto; padding-top: 6px; font-size: 10px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.futures-tile .extra b { font-weight: 600; }
.futures-tile .tag {
  display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 5px;
  font-size: 9.5px; line-height: 16px; font-weight: 600;
  background: #eef2f8; color: var(--text-3);
}
.futures-tile .tag.premium { background: #fdecec; color: #c0353a; }
.futures-tile .tag.discount { background: #e8f7f0; color: #0f8f5e; }

.empty .price, .empty .change { color: var(--text-3); }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-3); }

/* 恐慌指数 */
.fear-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 13px 20px 20px; }
.fear-panel {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; min-width: 0;
}
.fear-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fear-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fear-badge {
  font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: 600;
  background: #eef2f8; color: #5b6b82;
}
.fear-badge.calm { background: #e8f7f0; color: #0f8f5e; }
.fear-badge.watch { background: #fff3e2; color: #b26a00; }
.fear-badge.fear { background: #fdecec; color: #c0353a; }
.fear-badge.panic { background: #f9dcdc; color: #9b1c1c; }
.fear-value {
  margin-top: 8px; font-size: 32px; font-weight: 680; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.fear-value .unit { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.fear-change { margin-top: 2px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fear-gauge { margin-top: 10px; }
.fear-track {
  position: relative; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #0f9d68, #8bc34a 35%, #f5a623 60%, #e5484d);
}
.fear-marker {
  position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px;
  transform: translateY(-50%); border-radius: 50%; background: #fff;
  border: 2px solid #1f2d3d; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.fear-scale {
  display: flex; justify-content: space-between; margin-top: 4px;
  font-size: 9px; color: var(--text-3);
}
.fear-split { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fear-chip {
  font-size: 10px; color: var(--text-3); background: #fff;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px;
}
.fear-chip b { color: var(--text-2); font-weight: 600; margin-left: 3px; }
.fear-structure { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fear-structure .fear-chip { background: transparent; }
.fear-meta { margin-top: 9px; font-size: 10.5px; color: var(--text-3); line-height: 1.6; }
@media (max-width: 900px) {
  .fear-grid { grid-template-columns: 1fr; }
}

/* 短线情绪 */
.sentiment-body {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px;
  padding: 13px 20px 8px;
}
.phase-box {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 13px 15px;
}
.phase-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.phase-badge {
  padding: 3px 10px; border-radius: 7px; font-size: 13px; font-weight: 650;
  background: #eef2f8; color: #5b6b82;
}
.phase-badge.hot { background: #fdecec; color: #c0353a; }
.phase-badge.warm { background: #fff3e2; color: #b26a00; }
.phase-badge.cold { background: #e8f7f0; color: #0f8f5e; }
.phase-badge.neutral { background: #eef2f8; color: #5b6b82; }
.phase-meta { font-size: 10.5px; color: var(--text-3); }
.phase-advice { margin: 0; font-size: 12px; line-height: 1.7; color: var(--text-2); }

.sentiment-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.st-metric {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; min-width: 0;
}
.st-metric span { display: block; font-size: 10.5px; color: var(--text-3); }
.st-metric b {
  display: block; margin-top: 3px; font-size: 16px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.st-metric small {
  display: block; margin-top: 2px; font-size: 9.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sentiment-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 8px 20px 20px; }
.list-panel { min-width: 0; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.list-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.list-head span { font-size: 10px; color: var(--text-3); }
.ladder-list, .sector-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ladder-group + .ladder-group { border-top: 1px solid var(--border); }
.ladder-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--surface-2); font-size: 10.5px; color: var(--text-3);
}
.ladder-group-head b { font-size: 11px; color: var(--text-2); }
.ladder-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 11px; }
.ladder-row + .ladder-row { border-top: 1px dashed var(--border); }
.ladder-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder-name strong { font-weight: 600; color: var(--text-2); }
.ladder-name em { font-style: normal; margin-left: 6px; font-size: 9.5px; color: var(--text-3); }
.ladder-tag {
  flex: none; font-size: 9.5px; color: var(--text-3); background: var(--surface-2);
  border-radius: 5px; padding: 1px 5px;
}
.ladder-tag.warn { color: #c0353a; background: #fdecec; }
.sector-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.sector-row + .sector-row { border-top: 1px dashed var(--border); }
.sector-rank { flex: none; font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sector-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sector-name { font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sector-leaders { font-size: 9.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sector-count { flex: none; text-align: right; }
.sector-count b { font-size: 13px; color: var(--up); }
.sector-count small { display: block; font-size: 9px; color: var(--text-3); }
.list-empty { padding: 14px; text-align: center; font-size: 11px; color: var(--text-3); }

@media (max-width: 900px) {
  .sentiment-body { grid-template-columns: 1fr; }
  .sentiment-lists { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sentiment-body { padding: 10px 14px 4px; }
  .sentiment-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sentiment-lists { padding: 6px 14px 16px; }
}

footer {
  max-width: 1120px; margin: 0 auto; padding: 6px 20px 30px;
  font-size: 11px; color: var(--text-3); line-height: 1.7;
}
footer p { margin: 2px 0; }
footer .copyright { color: #a3b0c2; }

@media (max-width: 1000px) {
  .market { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .global-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar { padding: 16px 14px 10px; }
  main { padding: 0 14px 20px; }
  .market { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .global-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 14px 16px; }
  .futures-grid { gap: 6px; padding: 10px 14px 16px; }
  .futures-tile { padding: 9px 10px; }
  .futures-tile .name { font-size: 11px; }
  .futures-tile .price { font-size: 18px; }
  .futures-tile .change { font-size: 10.5px; }
  .futures-tile .change span { font-size: 10px; }
  .futures-tile .extra { font-size: 9px; }
  .card-head { padding: 14px 14px 0; }
  footer { padding: 4px 14px 24px; }
}
