:root {
  --space: #C41414;
  --pos: #0F9F6E;
  --neg: #DC2626;
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --line: rgba(26, 31, 54, 0.08);
  --txt: #1A1F36;
  --muted: #6B7280;
  --soft: #EEF0F5;
  --display: "Bricolage Grotesque", "Noto Sans SC", sans-serif;
  --body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(26, 31, 54, 0.04), 0 10px 28px rgba(26, 31, 54, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  color: var(--txt);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  padding: 40px 24px 72px;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #0b1220 url("assets/bg-rocket.jpg") center / cover no-repeat;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(244,245,248,0.82), rgba(244,245,248,0.92));
}
.sheet { max-width: 1080px; margin: 0 auto; position: relative; }

.boot-error {
  max-width: 1080px; margin: 0 auto 20px;
  background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C;
  border-radius: 14px; padding: 14px 18px; font-weight: 700;
}

/* ---------- HEADER ---------- */
.site-header {
  display: flex; align-items: center; gap: 22px;
  padding-bottom: 28px; margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 72px; height: 72px; border-radius: 22px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--display); font-weight: 800; font-size: 26px; color: #fff;
  background: linear-gradient(145deg, #1A1F36, #4B5683);
  box-shadow: var(--shadow);
}
.brand-mark img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 8px; text-transform: uppercase;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--pos);
  box-shadow: 0 0 0 4px rgba(15, 159, 110, .16);
}
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(32px, 5vw, 48px); line-height: 1.05; letter-spacing: -.02em;
  color: var(--txt);
}
.meta {
  margin-top: 10px; color: var(--muted); font-size: 13.5px;
  display: flex; flex-wrap: wrap; gap: 6px 0; align-items: center;
}
.meta b { color: var(--txt); font-weight: 700; }
.meta .sep { margin: 0 8px; opacity: .45; }

/* ---------- KPI ---------- */
.kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent, #1A1F36);
}
.stat .k {
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.stat .v {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(22px, 2.6vw, 32px);
  margin-top: 8px; letter-spacing: -.02em;
  color: var(--vc, var(--txt));
}
.stat .ssub {
  font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px;
}

/* ---------- SECTIONS ---------- */
.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 0 0 14px;
}
.section-head h2 {
  font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em;
}
.section-head .hint,
.section-head .tag {
  font-size: 12px; color: var(--muted);
}
.section-head .tag {
  font-family: var(--mono); letter-spacing: .18em; text-transform: uppercase;
}
.hero-viz, .top-holdings, .sectors, .options { margin-bottom: 40px; }

/* ---------- TREEMAP ---------- */
.mapwrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
#treemap {
  width: 100%; height: auto; min-height: 280px;
  aspect-ratio: 1000 / 520; display: block; border-radius: 14px;
}
#treemap text { pointer-events: none; }
#treemap .leaf { cursor: default; }
.mapfallback {
  padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px;
}
.tm-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: rgba(26, 31, 54, .92); color: #fff;
  padding: 10px 12px; border-radius: 10px;
  font-size: 12px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-width: 240px;
  transform: translate(-50%, calc(-100% - 12px));
}
.tm-tip b { font-family: var(--mono); }
.tm-tip .muted { opacity: .72; }

.legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 14px;
}
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--txt);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
}
.chip i {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--c); flex-shrink: 0;
}
.chip b { font-family: var(--mono); font-weight: 700; }
.chip small { color: var(--muted); margin-left: 2px; }

/* ---------- TABLE ---------- */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.holdings-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.holdings-table th,
.holdings-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.holdings-table th {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  background: var(--soft);
}
.holdings-table tbody tr:last-child td { border-bottom: none; }
.holdings-table tbody tr:hover { background: rgba(26, 31, 54, .02); }
.holdings-table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.holdings-table .tk {
  font-family: var(--mono); font-weight: 700; font-size: 14px;
}
.holdings-table .sector-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, white);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  font-size: 12px; color: var(--txt);
}
.holdings-table .sector-pill i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--c);
}
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- SECTOR CARDS ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card .accent {
  height: 3px; background: linear-gradient(90deg, var(--c), transparent 90%);
}
.card .hd {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px 10px;
}
.card .ico {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  font-size: 17px;
}
.card .ti { flex: 1; min-width: 0; }
.card .ti .zh {
  font-family: var(--display); font-weight: 700; font-size: 17px; line-height: 1.15;
}
.card .ti .en {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase; margin-top: 3px;
}
.card .pc { text-align: right; flex-shrink: 0; }
.card .pc .big {
  font-family: var(--display); font-weight: 800; font-size: 24px;
  color: var(--c); line-height: 1;
}
.card .pc .sect-pnl {
  font-family: var(--mono); font-size: 12px; font-weight: 700; margin-top: 4px;
}
.card .wbar {
  height: 4px; background: rgba(0,0,0,.06); margin: 0 18px 12px; border-radius: 3px; overflow: hidden;
}
.card .wbar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }

.rows { padding: 0 14px 8px; }
.row {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--soft);
}
.row-top {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
}
.row .tk { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.row .nt { font-size: 12px; color: var(--muted); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pp {
  font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--c);
}
.row-keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.kv {
  min-width: 0;
}
.kv em {
  display: block; font-style: normal; font-size: 10.5px;
  color: var(--muted); letter-spacing: .04em; margin-bottom: 2px;
}
.kv b {
  display: block; font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kv b.pos { color: var(--pos); }
.kv b.neg { color: var(--neg); }

.row details {
  margin-top: 8px;
  border-top: 1px dashed rgba(26, 31, 54, .1);
  padding-top: 6px;
}
.row summary {
  cursor: pointer; list-style: none;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  user-select: none;
}
.row summary::-webkit-details-marker { display: none; }
.row summary::before { content: "▸ "; }
.row details[open] summary::before { content: "▾ "; }
.row .extra {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
}
.row .extra span b { color: var(--txt); font-weight: 700; }
.row .extra .pos { color: var(--pos); }
.row .extra .neg { color: var(--neg); }
.dlt { font-weight: 700; margin-left: 4px; }
.dlt.pos { color: var(--pos); }
.dlt.neg { color: var(--neg); }
.dlt.flat { color: var(--muted); font-weight: 500; }

/* ---------- OPTIONS ---------- */
.opt-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.opt-head, .opt-row {
  display: grid;
  grid-template-columns: 80px 110px 90px 120px auto;
  gap: 0 12px; padding: 11px 18px; align-items: center;
}
.opt-head {
  background: var(--soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase;
}
.opt-row { border-top: 1px solid var(--line); }
.opt-tk { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.opt-badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px;
  background: rgba(202,138,4,.1); border: 1px solid rgba(202,138,4,.28);
  font-family: var(--mono); font-size: 11px; color: #CA8A04; font-weight: 700;
}
.opt-badge.call {
  background: rgba(15,159,110,.1); border-color: rgba(15,159,110,.28); color: var(--pos);
}
.opt-strike { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.opt-exp { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.opt-c {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--neg); text-align: right;
}
.opt-empty {
  padding: 22px 18px; color: var(--muted); font-size: 13px;
}

/* ---------- FOOTER ---------- */
footer {
  margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); display: grid; gap: 6px;
}
footer .muted { opacity: .8; font-family: var(--mono); font-size: 11.5px; }

@media (max-width: 900px) {
  .kpi { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { padding: 24px 14px 48px; }
  .site-header { gap: 14px; }
  .brand-mark { width: 56px; height: 56px; font-size: 20px; border-radius: 16px; }
  .kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .row-keys { grid-template-columns: 1fr; }
  .holdings-table th, .holdings-table td { padding: 10px 12px; }
  .table-wrap { overflow-x: auto; }
  .opt-head, .opt-row { grid-template-columns: 64px 90px 70px 90px auto; padding: 10px 12px; }
}
