:root {
  --bg: #0b1017;
  --bg-2: #0e141d;
  --panel: #131a24;
  --panel-2: #17202c;
  --line: #1f2937;
  --line-2: #2a3646;
  --txt: #e8eef7;
  --txt-2: #8b98ab;
  --txt-3: #5f6b7d;
  --up: #3ddc97;
  --down: #ff6b6b;
  --brand: #5b8def;
  --warn: #f5a524;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  padding: 28px 18px 80px;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(91, 141, 239, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
@media (min-width: 900px) {
  .page { padding: 40px 32px 100px; }
}

.wrap { max-width: 1120px; margin: 0 auto; }

/* ── 页头 ── */
.head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.title-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -0.01em; }
@media (min-width: 900px) { h1 { font-size: 34px; } }
.sub { font-family: var(--mono); font-size: 12.5px; color: var(--txt-2); letter-spacing: 0.06em; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt-2); }
.live i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--up);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.13);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.caption { margin: 0; font-size: 13px; line-height: 1.7; color: var(--txt-2); }

/* ── 汇总条 ── */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--line);
}
.summary > div { padding: 16px 18px; background: var(--panel); }
.summary .k { font-size: 11.5px; color: var(--txt-3); margin-bottom: 6px; }
.summary .v { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
@media (min-width: 900px) { .summary .v { font-size: 26px; } }

/* ── 规则卡片 ── */
.group { margin-bottom: 26px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; padding-left: 10px;
  font-size: 13px; color: var(--txt-2);
}
.group-head::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--brand);
}
.group-meta { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--txt-3); }

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--panel);
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  border-radius: 16px 0 0 16px; background: var(--brand); opacity: 0.9;
}
.card.break::before { background: var(--warn); }
.card.follow::before { background: #38bdf8; }
.card.chain::before { background: #a78bfa; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.name { font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; word-break: break-all; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--txt-2); white-space: nowrap; }
.state i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.state.idle i { background: var(--txt-3); }
.params { font-size: 11.5px; color: var(--txt-3); font-family: var(--mono); }

.figures { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pnl { font-family: var(--mono); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.roi { font-size: 12px; color: var(--txt-3); font-family: var(--mono); white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { display: flex; flex-direction: column; gap: 3px; }
.metric b { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.metric span { font-size: 11px; color: var(--txt-3); }

.cum {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--txt-2);
}
.cum b { font-family: var(--mono); font-size: 14px; }

/* ── 战报 ── */
.active-card {
  padding: 18px;
  margin-bottom: 26px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(91, 141, 239, 0.1), transparent), var(--panel);
}
.active-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tag {
  font-size: 11px; color: var(--brand);
  border: 1px solid rgba(91, 141, 239, 0.4); border-radius: 999px; padding: 2px 9px;
}
.active-head .name { font-size: 17px; }
.active-foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--txt-3);
}

.section-title { margin: 0 0 12px; padding-left: 10px; font-size: 13px; color: var(--txt-2); position: relative; }
.section-title::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 3px; height: 14px;
  border-radius: 2px; background: var(--brand);
}

.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; flex-direction: column; }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; padding: 14px 16px;
  text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: inherit;
  font: inherit;
  transition: border-color 0.16s ease;
}
.row:hover { border-color: var(--line-2); }
.row.is-open {
  border-color: var(--brand);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-title .name { font-size: 15px; }
.badge { font-size: 11px; color: var(--up); }
.badge.idle { color: var(--txt-3); }
.row-meta { font-size: 11.5px; color: var(--txt-3); font-family: var(--mono); }
.row-figures { display: flex; align-items: center; gap: 16px; font-size: 12.5px; color: var(--txt-2); white-space: nowrap; }
.row-figures b { font-family: var(--mono); font-size: 15px; }
@media (max-width: 640px) {
  .row { flex-direction: column; align-items: flex-start; }
  .row-figures { width: 100%; justify-content: space-between; gap: 8px; }
}

.detail {
  margin-top: -1px;
  padding: 6px 16px 14px;
  border: 1px solid var(--brand); border-top: none;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.bets { display: flex; flex-direction: column; }
.bet {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.7fr 0.9fr 1fr 0.9fr;
  gap: 8px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px;
}
.bet:first-child { border-top: none; }
.bet .issue { color: var(--txt-2); }
.bet .dir { color: var(--txt); }
.bet .stake { color: var(--txt-2); text-align: right; }
.bet .result { text-align: center; }
.bet .pnl { text-align: right; }
.bet .at { color: var(--txt-3); text-align: right; }
@media (max-width: 560px) {
  .bet { grid-template-columns: 1.2fr 0.8fr 0.6fr 0.8fr 0.9fr; font-size: 11.5px; }
  .bet .at { display: none; }
}

/* ── 通用 ── */
.is-up { color: var(--up); }
.is-down { color: var(--down); }
.is-muted { color: var(--txt-3); }
.hint { padding: 40px 0; text-align: center; color: var(--txt-2); font-size: 13px; }
.hint--tight { padding: 16px 0; }
.hint--error { color: var(--down); }
.loading { padding: 80px 0; text-align: center; color: var(--txt-2); font-size: 13px; }
.foot { margin-top: 30px; font-size: 11.5px; line-height: 1.8; color: var(--txt-3); }
.foot .mono { font-family: var(--mono); }
/* 卡片可点：整张卡是链接 */
a.card { color: inherit; text-decoration: none; cursor: pointer; }

/* 表格 */
.table {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--panel); margin-bottom: 22px;
}
.thead, .trow {
  display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr 1fr 1fr 0.8fr;
  gap: 10px; align-items: center; padding: 11px 16px;
}
.thead {
  font-size: 11.5px; color: var(--txt-3); background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.trow { font-size: 12.5px; border-top: 1px solid var(--line); }
.trow:first-of-type { border-top: none; }
.table--sessions .thead, .table--sessions .trow { grid-template-columns: 1.4fr 1fr 0.7fr 1fr; }
@media (max-width: 560px) {
  .thead, .trow { grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr; padding: 10px 12px; }
  .thead span:nth-child(3), .trow span:nth-child(3),
  .thead span:nth-child(6), .trow span:nth-child(6) { display: none; }
}

.link { color: var(--brand); text-decoration: none; }
.link:hover { text-decoration: underline; }

.empty {
  padding: 36px 20px; text-align: center; color: var(--txt-2); font-size: 13px;
  border: 1px dashed var(--line-2); border-radius: 14px;
}
