:root {
  --bg: #0C1C2A;        /* 与 banner (a.png) 背景统一 */
  --panel: #122434;
  --card: #16293c;
  --line: #24405a;
  --text: #dce6f0;
  --dim: #7e93a6;
  --gold: #ffd700;
  --red: #ff5050;
  --green: #50ff78;
  --blue: #64c8ff;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
}

.banner-fly {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  transform-origin: top left;
  transition: transform .9s cubic-bezier(.4, 0, .2, 1);
  border-radius: 3px;
  will-change: transform;
}

/* ---------- layout ---------- */
main {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px 26px;
  align-items: stretch;
  min-height: 0;
}

#left {
  flex: 0 0 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lrow {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

#datesel {
  width: 100%;
  padding: 9px 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 19px;
  margin-bottom: 10px;
}

#datesel:focus { outline: none; border-color: var(--gold); }

#daytabs { display: flex; gap: 8px; }

#daytabs button {
  flex: 1;
  padding: 8px 0;
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 19px;
  cursor: pointer;
}

#daytabs button.active {
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

#sectors {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #1a3348;
}

.sitem:hover { background: #18324a; }
.sitem.sel { background: #1d3d59; }

.sitem.conf { background: rgba(255, 215, 0, .05); border-bottom: 2px solid #2c4a66; }
.sitem.conf:hover { background: #18324a; }
.sitem.conf.sel { background: #1d3d59; }
.sitem.conf .rank { color: var(--gold); font-size: 18px; }
.sitem.conf .name { color: var(--gold); font-weight: 600; }
.sitem.conf .pct.n { color: var(--gold); font-size: 19px; }

.sitem .rank {
  flex: 0 0 28px;
  color: var(--dim);
  font-size: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sitem .name { flex: 1; font-size: 20px; }
.sitem .pct {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 700;
}
.sitem .cnt { color: var(--dim); font-size: 15px; width: 36px; text-align: right; }

.pct.hi { color: var(--red); }
.pct.lo { color: var(--green); }

/* ---------- main area ---------- */
#main {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  min-height: 0;
}

#main h1 {
  font-size: 30px;
  margin: 0 0 4px;
}

#main h1 .sub {
  color: var(--dim);
  font-size: 16px;
  font-weight: 400;
  margin-left: 10px;
}

#main h1 .wavg { color: var(--gold); font-size: 20px; margin-left: 10px; }

.searchbox {
  width: 100%;
  max-width: 420px;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 19px;
  margin: 12px 0;
}

.searchbox:focus { outline: none; border-color: var(--gold); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.cell {
  position: relative;
  border-radius: 8px;
  padding: 12px 6px;
  text-align: center;
  color: #fff;
  font-size: 17px;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  cursor: pointer;
  transition: transform .08s;
}

.cell:hover { transform: scale(1.04); }

.cell .tick { font-weight: 700; font-size: 18px; }
.cell .co { font-size: 14px; opacity: .92; }
.cell .pct { font-size: 21px; font-weight: 700; }

.cell .rtag {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 12px;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .25);
  font-weight: 700;
}
.cell .rtag.high { color: var(--gold); }
.cell .rtag.mid { color: #9fdcff; }

.loading { color: var(--dim); padding: 40px 0; text-align: center; }

/* ---------- modal ---------- */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 16, .72);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal.hidden { display: none; }

#modalbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 24px;
}

#modalbox h2 {
  margin: 0 0 4px;
  font-size: 28px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#modalbox h2 .code { color: var(--gold); font-variant-numeric: tabular-nums; }
#modalbox h2 .close-price { color: var(--dim); font-size: 17px; font-weight: 400; }

#modalbox .msec { margin-top: 18px; }
#modalbox .msec h3 {
  font-size: 17px;
  color: var(--dim);
  margin: 0 0 10px;
  font-weight: 600;
}

.prow {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pchip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 18px;
}

.pchip b { font-size: 21px; }
.pchip .d1 b { color: var(--gold); }

table.mtable {
  border-collapse: collapse;
  width: 100%;
  font-size: 17px;
}

table.mtable th, table.mtable td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid #1c3348;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.mtable th:first-child, table.mtable td:first-child { text-align: left; }
table.mtable th { color: var(--dim); font-weight: 600; }

.pos { color: var(--red); }
.neg { color: var(--green); }

#simchart {
  width: 100%;
  height: 280px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  margin-top: 12px;
}

.sims { list-style: none; margin: 12px 0 0; padding: 0; columns: 2; font-size: 17px; }
.sims li { padding: 3px 0; break-inside: avoid; color: var(--text); }
.sims li .dd { color: var(--dim); font-variant-numeric: tabular-nums; }

.mnote {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--dim);
  padding: 12px 16px;
  font-size: 17px;
}

/* ---------- 样本可靠性 ---------- */
.tdim { color: var(--dim); font-size: 14px; }

table.crel { font-size: 16px; }
table.crel th, table.crel td { padding: 6px 8px; }

.lv {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.lv-high { color: var(--gold); border-color: rgba(255, 215, 0, .45); background: rgba(255, 215, 0, .10); }
.lv-mid  { color: var(--blue); border-color: rgba(100, 200, 255, .45); background: rgba(100, 200, 255, .10); }
.lv-low  { color: #b9c7d6; border-color: rgba(185, 199, 214, .35); }
.lv-none { color: var(--dim); }
.lv-tiny { color: var(--dim); border-style: dashed; }

.msec h3 .lv { margin-left: 8px; }

.crel-note {
  color: var(--dim);
  font-size: 15.5px;
  line-height: 1.65;
  margin: 10px 0 0;
}


.crel-inline {
  color: var(--dim);
  font-size: 16px;
  margin: 10px 0 0;
}
.crel-inline .lv { margin: 0 2px; }

.mclose {
  float: right;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.mclose:hover { color: var(--text); }

/* ---------- footer ---------- */
footer {
  text-align: center;
  color: var(--dim);
  font-size: 15px;
  padding: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

footer .banner-mini {
  height: 26px;
  width: auto;
  flex: 0 0 auto;
  visibility: hidden;
}

body.banner-done footer .banner-mini { visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  .banner-fly { transition: none !important; }
}

/* ---------- mobile ---------- */
@media (max-width: 960px) {
  body { height: auto; }
  main { flex-direction: column; }
  #left { flex: none; max-height: 46vh; }
  #main { max-height: none; }
  .sims { columns: 1; }
}
