/* 五榜网格手机看板 —— 深蓝紫投资组合风，纯 CSS，适配微信（系统字体，无 WebGL / 无外链字体） */
:root {
  --bg: #0b0a16;
  --bg-2: #120e24;
  --card: #16122a;
  --card-2: #1c1834;
  --line: rgba(255, 255, 255, 0.07);
  --purple: #7c6cff;
  --purple-2: #c084fc;
  --cyan: #4ee8ff;
  --text: #f4f2ff;
  --muted: #9a93b8;
  --green: #2ee59d;
  --red: #ff4d6d;
  --amber: #ffb020;
  --ok: #2ee59d;
  --warn: #ffb020;
  --crit: #ff4d6d;
  --mono: ui-monospace, "SFMono-Regular", Menlo, "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --radius: 18px;
  --shadow: 0 10px 32px rgba(8, 4, 24, 0.45);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 48% at 50% -8%, #2c1b58 0%, transparent 58%),
    radial-gradient(ellipse 50% 36% at 92% 12%, rgba(50, 90, 180, 0.22), transparent 55%),
    radial-gradient(ellipse 40% 30% at 8% 70%, rgba(80, 40, 140, 0.16), transparent 60%),
    linear-gradient(180deg, #120e24 0%, #0b0a16 42%);
  background-attachment: fixed;
  min-height: 100%;
}
a { color: var(--cyan); text-decoration: none; }
#stale { display: none; }

/* —— 顶栏 —— */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: transparent;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand b {
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}
.tag {
  background: rgba(124, 108, 255, 0.22);
  color: #d4ccff;
  font-size: 11px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.live {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  line-height: 1.35;
  flex-shrink: 0;
}
.live .sep { opacity: 0.45; margin: 0 3px; }
.wd-extra { display: block; font-size: 10px; opacity: 0.85; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}
.lv-warn .dot, .lv-warning .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lv-critical .dot, .lv-crit .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.pill {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  background: rgba(46, 229, 157, 0.15);
  color: var(--green);
}
.pill.lv-warn, .pill.lv-warning { background: rgba(255, 176, 32, 0.18); color: var(--amber); }
.pill.lv-critical, .pill.lv-crit { background: rgba(255, 77, 109, 0.18); color: var(--red); }

/* —— 横幅 —— */
.banners { padding: 0 14px; }
.banner {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
}
.banner.crit {
  background: rgba(255, 77, 109, 0.14);
  border: 1px solid rgba(255, 77, 109, 0.45);
  color: #ffd0d8;
}
.banner.warn {
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.4);
  color: #ffe4b0;
}
.banner.pulse { animation: pulse-banner 1.6s ease-in-out infinite; }
@keyframes pulse-banner {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(255, 77, 109, 0); }
}

/* —— 布局（手机纵向：英雄 → 指标 → 雷达 → 持仓；宽屏两列） —— */
.layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 14px;
}
.col-main, .col-side { display: flex; flex-direction: column; gap: 12px; }
.below { padding: 12px 14px 0; display: flex; flex-direction: column; gap: 12px; }

/* —— 英雄：大白字账户权益 + 绿色已实现 + 青紫面积图 —— */
.hero {
  position: relative;
  background: linear-gradient(180deg, #1c1638 0%, #14102a 55%, #100d20 100%);
  border-radius: 22px;
  padding: 18px 18px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute;
  left: -10%; right: -10%; top: 36%; bottom: -30%;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(90, 220, 255, 0.22), transparent 55%),
    radial-gradient(ellipse at 70% 60%, rgba(124, 108, 255, 0.32), transparent 60%);
  pointer-events: none;
}
.hero-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.eq-block .k, .hero-unrl .k {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.eq-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 16px;
}
.eq-val {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: var(--sans);
}
.eq-delta {
  padding-bottom: 4px;
  min-width: 72px;
}
.eq-delta .amt {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.eq-delta .pct {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
  font-variant-numeric: tabular-nums;
}
.eq-delta .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.eq-delta.pos, .eq-delta.pos .amt, .eq-delta.pos .pct { color: var(--green); }
.eq-delta.neg, .eq-delta.neg .amt, .eq-delta.neg .pct { color: var(--red); }
.hero-unrl {
  text-align: right;
  padding-top: 2px;
  flex-shrink: 0;
}
.hero-unrl .v {
  display: block;
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.hero-unrl .v.pos { color: var(--green); }
.hero-unrl .v.neg { color: var(--red); }
.chart-wrap {
  position: relative;
  z-index: 1;
  margin: 6px -6px 0;
  height: 148px;
}
.eq-chart {
  display: block;
  width: 100%;
  height: 148px;
}
.eq-chart.ph { opacity: 0.85; }

/* —— 五指标卡 —— */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.metrics .metric.hold { grid-column: 1 / -1; }
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 11px;
  box-shadow: 0 6px 16px rgba(8, 4, 24, 0.28);
  min-width: 0;
}
.metric .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.metric .v {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  word-break: break-all;
}
.metric .v .n { font-size: 26px; }
.metric .v .den {
  font-size: 15px;
  font-weight: 600;
  color: #d8d2f0;
  margin-left: 1px;
}
.metric .s {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.metric.pos .v { color: var(--green); }
.metric.neg .v { color: var(--red); }
.metric.ok .v { color: #fff; }
.metric.ok .s { color: var(--green); }
.metric.warn {
  background: #2a2210;
  border-color: rgba(255, 176, 32, 0.45);
}
.metric.warn .s { color: var(--amber); }
.metric.alarm {
  background: #2a1220;
  border: 1px solid rgba(255, 77, 109, 0.7);
  animation: pulse-alarm 1.4s ease-in-out infinite;
}
.metric.alarm .v, .metric.alarm .s { color: #ff8ea3; }
.metric.muted .v { color: var(--muted); }
@keyframes pulse-alarm {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(255, 77, 109, 0); }
}

/* —— 卡片通用 —— */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  letter-spacing: 0;
}
.card h3 {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}
.hsub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.muted { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted) !important; font-weight: 400 !important; justify-content: center; }

/* —— 选池雷达 —— */
.radar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.tile {
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--card-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-variant-numeric: tabular-nums;
}
.tile .tsym { color: #fff; font-weight: 700; font-size: 12px; letter-spacing: 0.02em; }
.tile .tpnl { font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tile .tpnl.pos { color: var(--green); }
.tile .tpnl.neg { color: var(--red); }
.tile .tsub { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; max-width: 100%; }
.tile.on { box-shadow: 0 0 0 1.5px rgba(78, 232, 255, 0.5), 0 0 16px rgba(80, 160, 255, 0.22); }
.tile.up { background: linear-gradient(160deg, rgba(40, 220, 140, 0.20), var(--card-2) 70%); }
.tile.down { background: linear-gradient(160deg, rgba(255, 80, 110, 0.20), var(--card-2) 70%); }
.tile.skip { opacity: 0.38; }
.skip { list-style: none; margin: 0; padding: 0; }
.skip li {
  display: flex; gap: 8px; align-items: baseline;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.skip .sym { font-weight: 600; min-width: 5.5em; }
.skip .why { flex: 2; color: var(--muted); }
.skip .when { color: var(--muted); font-size: 11px; font-family: var(--mono); }

/* —— 持仓 / 平仓列表 —— */
.pos-list, .close-list { list-style: none; margin: 0; padding: 0; }
.pos-list li, .close-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.pos-list li:last-child, .close-list li:last-child { border-bottom: 0; }
.pos-list .badge, .close-list .badge {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: 0.02em;
}
.pos-list .mid, .close-list .mid {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.pos-list .sym, .close-list .sym {
  font-weight: 650;
  font-size: 14px;
  color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pos-list .meta, .close-list .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.pos-list .nt {
  font-family: var(--mono);
  font-size: 12px;
  color: #d8d2f0;
  white-space: nowrap;
}
.pos-list .pr {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
}
.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  margin-left: 1px;
  font-weight: 700;
}
.flag.ok { color: var(--green); }
.flag.warn { color: var(--amber); }
.flag.crit { color: var(--red); }
.flag.muted { color: var(--muted); font-size: 10px; }
.pos-list li.miss {
  background: rgba(255, 77, 109, 0.1);
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
  animation: pulse-miss 1.6s ease-in-out infinite;
  border-bottom-color: transparent;
}
@keyframes pulse-miss {
  0%, 100% { background: rgba(255, 77, 109, 0.1); }
  50% { background: rgba(255, 77, 109, 0.22); }
}
.pnl, .pnl-line { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pnl.pos, .pos, .pnl-line.pos { color: var(--green); }
.pnl.neg, .neg, .pnl-line.neg { color: var(--red); }
.pnl-line { margin-top: 10px; font-size: 16px; }
.pnl-line .lbl { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.pnl-line .muted { display: block; font-weight: 400; font-size: 11px; margin-top: 2px; color: var(--muted); }

.today-sum {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.today-sum .num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.today-sum .lbl, .lbl { font-size: 11px; color: var(--muted); }

/* —— 风控条 —— */
.bar-row {
  display: grid;
  grid-template-columns: 2.6em 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
}
.bar-row .k { color: var(--muted); }
.bar-row .v { font-family: var(--mono); font-size: 11px; color: #d8d2f0; }
.bar-row em { font-style: normal; color: var(--muted); font-size: 10px; }
.bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: visible;
}
.bar i {
  position: absolute;
  top: -3px;
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(78, 232, 255, 0.7);
}
.eq-foot { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* —— 对应率 / 系统 —— */
.metric-big { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.metric-big.pos { color: var(--green); }
.metric-big.neg { color: var(--red); }
.sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.err { font-size: 13px; color: var(--red); word-break: break-all; }
.sys-grid { display: grid; gap: 6px; font-size: 13px; }
.sys-grid .k { color: var(--muted); display: inline-block; min-width: 3.6em; font-size: 12px; }
.sys-grid .v { font-family: var(--mono); font-size: 12px; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 18px 16px 8px;
  line-height: 1.6;
}
footer a { color: var(--muted); border-bottom: 1px solid rgba(255, 255, 255, 0.15); }

/* —— 登录 —— */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 36%, #2c1b58 0%, transparent 65%),
    linear-gradient(180deg, #120e24, #0b0a16);
}
.login {
  width: 100%; max-width: 340px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px 22px;
  box-shadow: var(--shadow);
}
.login h1 {
  margin: 0;
  font-size: 22px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0;
}
.login .sub {
  text-align: center;
  color: var(--muted);
  margin: 4px 0 22px;
  font-size: 13px;
}
.login label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.login input[type=password] {
  width: 100%;
  font-size: 16px; /* 16px 避免 iOS/微信聚焦放大 */
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #100d20;
  color: #fff;
  outline: none;
  font-family: var(--sans);
}
.login input[type=password]:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.25);
}
.login button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(90deg, #6b5cff, #8b5cf6);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(124, 108, 255, 0.35);
}
.login .hint { font-size: 12px; color: var(--muted); margin: 16px 0 0; line-height: 1.55; }
.login .error {
  background: rgba(40, 10, 18, 0.95);
  color: #ffd0d6;
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 0 0 12px;
}
.login code {
  font-size: 11px;
  background: rgba(124, 108, 255, 0.14);
  padding: 1px 4px;
  border-radius: 4px;
  color: #d4ccff;
}

@media (max-width: 519px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .live { text-align: left; }
  /* 手机把「未实现」放在指标卡，给权益旁的绿色已实现让出位置 */
  .hero-unrl { display: none; }
  .eq-row { flex-wrap: nowrap; gap: 12px; }
  .eq-delta { flex-shrink: 0; }
}
@media (min-width: 520px) {
  .metrics { grid-template-columns: repeat(5, 1fr); }
  .metrics .metric.hold { grid-column: auto; }
  .eq-val { font-size: 54px; }
}
@media (min-width: 900px) {
  .layout {
    display: grid;
    grid-template-columns: 1.28fr 0.92fr;
    gap: 16px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 8px;
    align-items: start;
  }
  .below {
    max-width: 1080px;
    margin: 0 auto;
    padding: 8px 24px 0;
  }
  .top { max-width: 1080px; margin: 0 auto; padding-left: 24px; padding-right: 24px; width: 100%; }
  .banners { max-width: 1080px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
  .radar-grid { grid-template-columns: repeat(5, 1fr); gap: 10px; }
  .chart-wrap, .eq-chart { height: 168px; }
}
@media (prefers-reduced-motion: reduce) {
  .metric.alarm, .banner.pulse, .pos-list li.miss { animation: none; }
}
