:root {
  --bg: #090b11;
  --card: #12161f;
  --card-2: #171c27;
  --line: rgba(255, 255, 255, 0.075);
  --text: #e9edf6;
  --muted: #8a93a8;
  --yes: #4c8dff;
  --yes-soft: rgba(76, 141, 255, 0.14);
  --no: #ff7a59;
  --no-soft: rgba(255, 122, 89, 0.13);
  --profit: #38d39f;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
button, input { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 650; }
.hidden { display: none !important; }

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-a { width: 560px; height: 560px; top: -260px; left: -120px; background: rgba(60, 110, 255, 0.14); }
.glow-b { width: 500px; height: 500px; top: 220px; right: -220px; background: rgba(255, 110, 80, 0.09); }

.topbar {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 9px; letter-spacing: 0.06em; }
.brand-mark { color: var(--yes); font-size: 22px; }
.brand-name { font-size: 19px; font-weight: 750; letter-spacing: 0.1em; }
.brand-sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #cfd7e8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.net { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.net i { width: 7px; height: 7px; border-radius: 50%; background: #e8b339; box-shadow: 0 0 0 3px rgba(232, 179, 57, 0.14); }
.net.ok i { background: var(--profit); box-shadow: 0 0 0 3px rgba(56, 211, 159, 0.14); }
.net.bad i { background: #ff6b6b; box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.14); }

.demo-banner {
  position: relative;
  z-index: 2;
  max-width: 1192px;
  margin: 6px auto 0;
  padding: 10px 16px;
  border: 1px solid rgba(232, 179, 57, 0.28);
  background: rgba(232, 179, 57, 0.08);
  border-radius: 10px;
  color: #e8c979;
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
}
.demo-banner > span { font-weight: 600; white-space: nowrap; }
.demo-banner .api-setup { display: flex; gap: 6px; flex: 1 1 320px; max-width: 540px; min-width: 0; }
.demo-banner input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(232, 179, 57, 0.32);
  background: rgba(0, 0, 0, 0.25);
  color: #f3dda5;
  font-size: 12px;
  outline: none;
}
.demo-banner input::placeholder { color: #a9976a; }
.demo-banner input:focus { border-color: rgba(232, 179, 57, 0.7); }
.demo-banner button {
  padding: 7px 15px;
  border-radius: 8px;
  border: 1px solid rgba(232, 179, 57, 0.42);
  background: rgba(232, 179, 57, 0.16);
  color: #f3dda5;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.demo-banner button:hover { background: rgba(232, 179, 57, 0.3); }
.demo-banner small { flex-basis: 100%; text-align: center; color: #b4a06c; font-size: 11px; line-height: 1.5; }

.layout {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 20px;
  align-items: start;
}
.col-main, .col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) , var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}
.sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.sec-title h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.sec-note { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.muted.small { font-size: 11.5px; line-height: 1.5; }
.muted b { color: var(--text); }

/* ---------- 市场卡片 ---------- */
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tag-row { display: flex; gap: 8px; }
.tag {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag-round { color: #a9c4ff; border-color: rgba(76, 141, 255, 0.3); background: var(--yes-soft); }
.tag-open { color: #7fe0b6; border-color: rgba(56, 211, 159, 0.28); background: rgba(56, 211, 159, 0.08); }
.tag-closed { color: #e8c979; border-color: rgba(232, 179, 57, 0.3); background: rgba(232, 179, 57, 0.08); }
.tag-settled { color: #b9c0cf; background: rgba(255, 255, 255, 0.05); }
.countdown { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.question {
  margin: 18px 0 8px;
  font-size: clamp(22px, 2.6vw, 31px);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.desc { margin: 0 0 26px; color: var(--muted); font-size: 12.5px; line-height: 1.7; max-width: 680px; }

.prob-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.prob-side { display: flex; flex-direction: column; line-height: 1.25; min-width: 120px; }
.prob-side > span { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.prob-side strong { font-size: 38px; font-weight: 750; letter-spacing: -0.02em; }
.prob-side small { font-size: 11px; color: var(--muted); }
.prob-yes { color: #7fb0ff; }
.prob-yes strong { color: #a9c8ff; }
.prob-no { text-align: right; align-items: flex-end; color: #ff9d82; }
.prob-no strong { color: #ffb49e; }
.prob-mid { color: #4d5567; font-size: 12px; font-weight: 700; letter-spacing: 0.2em; }
.prob-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: visible;
  background: linear-gradient(90deg, #d95f42, #ff8a66);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.prob-fill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f6fe0, #63a6ff);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.prob-marker {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
  transform: translateX(-50%);
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.market-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.market-stats div { display: flex; flex-direction: column; gap: 3px; }
.market-stats span { color: var(--muted); font-size: 11.5px; }
.market-stats b { font-size: 17px; font-weight: 700; }
.settle-result {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--yes-soft);
  border: 1px solid rgba(76, 141, 255, 0.28);
  color: #b9d2ff;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- 下注 ---------- */
.side-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.side-btn:hover { transform: translateY(-1px); }
.side-label { font-size: 14px; font-weight: 700; }
.side-price { font-size: 13px; color: var(--muted); font-weight: 650; }
.side-btn.yes.active { border-color: rgba(76, 141, 255, 0.65); background: var(--yes-soft); box-shadow: inset 0 0 0 1px rgba(76, 141, 255, 0.16); }
.side-btn.yes.active .side-price { color: #9cc1ff; }
.side-btn.no.active { border-color: rgba(255, 122, 89, 0.65); background: var(--no-soft); box-shadow: inset 0 0 0 1px rgba(255, 122, 89, 0.16); }
.side-btn.no.active .side-price { color: #ffab91; }

.amount-label { display: block; margin: 22px 0 9px; font-size: 12.5px; color: #c7cedd; font-weight: 600; }
.amount-label span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.amount-row { display: flex; gap: 12px; }
.amount-row > input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0d1119;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  outline: none;
}
.amount-row > input:focus { border-color: rgba(76, 141, 255, 0.6); }
.quick { display: flex; gap: 6px; }
.quick button {
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #c3cbdb;
  font-size: 12.5px;
  font-weight: 650;
}
.quick button:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }

.quote {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0d1119;
  border: 1px solid var(--line);
}
.quote > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quote span { color: var(--muted); font-size: 11px; }
.quote b { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote small { color: var(--muted); font-size: 10.5px; }
.quote .profit { color: var(--profit); }

.submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(100deg, #2f6fe0, #5b9bff);
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 26px rgba(47, 111, 224, 0.28);
  transition: filter 0.15s, transform 0.15s;
}
.submit:hover { filter: brightness(1.1); transform: translateY(-1px); }
.submit.no-mode { background: linear-gradient(100deg, #d95f42, #ff8a66); box-shadow: 0 10px 26px rgba(217, 95, 66, 0.28); }
.submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.trade-tip { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; text-align: center; }

/* ---------- 图表 ---------- */
.chart-wrap { position: relative; display: flex; gap: 10px; align-items: stretch; }
#chartSvg { flex: 1; width: 100%; height: 190px; display: block; }
.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 34px;
  padding: 2px 0;
  color: #5e677a;
  font-size: 10px;
  text-align: right;
}

/* ---------- 成交 ---------- */
.feed-list { display: flex; flex-direction: column; max-height: 290px; overflow-y: auto; }
.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 12.5px;
}
.feed-item:last-child { border-bottom: none; }
.feed-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.feed-badge { padding: 2px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; }
.feed-badge.YES { color: #9cc1ff; background: var(--yes-soft); }
.feed-badge.NO { color: #ffab91; background: var(--no-soft); }
.feed-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.feed-detail { color: var(--muted); white-space: nowrap; }
.feed-right { color: var(--muted); font-size: 11px; white-space: nowrap; }
.empty { padding: 22px 0; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 侧栏 ---------- */
.hello { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.hello b { color: var(--text); }
.balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(110deg, rgba(76, 141, 255, 0.16), rgba(76, 141, 255, 0.04));
  border: 1px solid rgba(76, 141, 255, 0.2);
}
.balance span { font-size: 12px; color: #b9c8e4; }
.balance strong { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.equity { display: flex; justify-content: space-between; padding: 10px 2px 14px; font-size: 12px; color: var(--muted); }
.equity b { color: var(--text); font-size: 13px; }
.positions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pos { padding: 12px 13px; border-radius: 11px; background: #0d1119; border: 1px solid var(--line); }
.pos > div { display: flex; flex-direction: column; }
.pos span { font-size: 11px; color: var(--muted); }
.pos b { font-size: 20px; font-weight: 700; }
.pos small { display: block; margin-top: 4px; color: #5f6879; font-size: 10.5px; }
.pos.yes b { color: #9cc1ff; }
.pos.no b { color: #ffab91; }
.text-btn { margin-top: 14px; padding: 0; border: none; background: none; color: var(--muted); font-size: 11.5px; text-decoration: underline; }
.text-btn:hover { color: var(--text); }
.name-row { display: flex; gap: 8px; margin-top: 12px; }
.name-row input, .admin-body input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0d1119;
  color: var(--text);
  outline: none;
}
.name-row input:focus, .admin-body input:focus { border-color: rgba(76, 141, 255, 0.6); }
.mini-btn {
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.14); }
.yes-mini { color: #a9c8ff; border-color: rgba(76, 141, 255, 0.35); }
.no-mini { color: #ffb49e; border-color: rgba(255, 122, 89, 0.35); }

.board-list { display: flex; flex-direction: column; gap: 9px; }
.board-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.board-rank { width: 20px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.board-rank.top { color: #e8c979; }
.board-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.board-val { font-weight: 700; }
.board-bar { height: 3px; border-radius: 2px; background: linear-gradient(90deg, #2f6fe0, #63a6ff); margin-top: 4px; }

.admin summary { cursor: pointer; font-size: 13px; font-weight: 650; color: #c7cedd; list-style: none; }
.admin summary::-webkit-details-marker { display: none; }
.admin summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); }
.admin[open] summary::before { content: "▾"; }
.admin-body { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.settle-row { display: flex; gap: 8px; }
.settle-row > button { flex: 1; }
.settle-row > input { max-width: 90px; flex: 0 0 90px; }

.info ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.info li b { color: #c9d3e5; }

.footer { position: relative; z-index: 1; padding: 8px 24px 34px; text-align: center; color: #4e5768; font-size: 11.5px; }
.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  max-width: min(90vw, 480px);
  padding: 12px 20px;
  border-radius: 11px;
  background: #1c2230;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 107, 107, 0.45); color: #ffb3b3; }
.toast.ok { border-color: rgba(56, 211, 159, 0.4); color: #a8ecd0; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .col-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .admin, .info { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .topbar, .layout { padding-left: 16px; padding-right: 16px; }
  .card { padding: 18px 16px; }
  .col-side { display: flex; }
  .question { font-size: 22px; }
  .prob-side strong { font-size: 30px; }
  .prob-side { min-width: 90px; }
  .market-stats { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .quote { grid-template-columns: repeat(2, 1fr); }
  .amount-row { flex-direction: column; }
  .quick button { flex: 1; padding: 9px 0; }
  .side-btn { padding: 12px; }
  .feed-detail { display: none; }
}
