:root {
  --bg: #0a0a0a;
  --bg2: #121212;
  --card: #141414;
  --border: rgba(255, 255, 255, 0.13);
  --text: #f2f2f2;
  --muted: #8a8f98;
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.15);
  --orange: #fb923c;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: radial-gradient(
      ellipse 120% 80% at 50% -20%,
      rgba(34, 211, 238, 0.08),
      transparent 50%
    ),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* PC：左侧图表区自适应，右侧事件卡片固定比例宽度；窄屏单列堆叠 */
.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}

.top-bar > .okx-hero,
.top-bar > div {
  min-width: 0;
}

/* 右侧列与左侧图表区同高，卡片撑满该列 */
.top-bar > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top-bar > div > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 中间「隐含概率」块吃掉纵向余量，避免底部大块留白 */
.top-bar > div > .card > aside.price-vs-open + aside.odds-gauge-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

@media (max-width: 900px) {
  .top-bar {
    grid-template-columns: 1fr;
  }
}

.okx-hero {
  position: relative;
  border-radius: 14px;
  padding: 22px 22px 18px;
  /* background: linear-gradient(145deg, #151515 0%, #0c0c0c 100%); */
  border: 0.5px solid var(--border);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.45);
}

.okx-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 20% 20%,
    rgba(34, 211, 238, 0.12),
    transparent 45%
  );
  pointer-events: none;
}

.okx-label {
  position: relative;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.okx-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
}

.okx-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.price-vs-open {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0 0;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 0.5px solid var(--border);
  padding: 10px 12px;
  min-width: 148px;
} 

.pvo-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.pvo-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.pvo-delta {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--muted);
}

.pvo-delta.pvo-up {
  color: var(--green);
}

.pvo-delta.pvo-down {
  color: var(--red);
}

.pvo-delta.pvo-flat {
  color: var(--muted);
}

@media (max-width: 520px) {
  .price-vs-open {
    width: 100%;
    text-align: left;
  }

  .pvo-line {
    justify-content: space-between;
  }
}

.okx-price {
  font-size: clamp(2.2rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 0 28px rgba(34, 211, 238, 0.45),
    0 0 60px rgba(34, 211, 238, 0.15);
}

.okx-pair {
  font-size: 13px;
  color: var(--cyan);
  font-weight: 600;
}

.okx-tf-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tf-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tf-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.tf-btn.active {
  color: #0ecb81;
  border-color: rgba(14, 203, 129, 0.45);
  background: rgba(14, 203, 129, 0.12);
}

.okx-chart-wrap {
  position: relative;
  margin-top: 12px;
  width: 100%;
  height: min(42vh, 360px);
  min-height: 240px;
  border-radius: 10px;
  border: none;
  background: #0c0c0c;
  overflow: hidden;
}

.okx-chart {
  width: 100%;
  height: 100%;
  min-height: 240px;
  min-width: 200px;
  position: relative;
}

.chart-fallback {
  margin: 0;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.meta-strip {
  position: relative;
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.slug-pill {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-dot i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.live-dot.urgent i {
  background: var(--red);
  box-shadow: 0 0 14px var(--red);
  animation: pulse-fast 0.9s ease-in-out infinite;
}

.live-dot.closed i {
  background: var(--muted);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes pulse-fast {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.15);
  }
}

.grid-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .grid-main {
    grid-template-columns: 1fr;
  }
}

.card {
  border-radius: 14px;
  /* background: var(--card); */
  background: linear-gradient(145deg, #1b34566b 0%, #0c0c0c0a 100%);
  border: 0.5px solid var(--border);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.45);
}

.card-banner {
  text-align: center;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #1e3a5f99, #0f172a5e);
  color: var(--cyan);
  border-bottom: 1px solid var(--border);
}

.card-banner.warn {
  background: linear-gradient(90deg, #422006, #1c1006);
  color: var(--orange);
}

.card-banner--pm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 12px 14px;
}

.card-banner--pm .card-banner-pm-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-banner--pm .card-banner-pm-time {
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: none;
  line-height: 1.15;
}

.card-banner--pm .card-banner-pm-time.urgent {
  color: var(--red);
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.35);
}

.card-banner--pm .card-banner-pm-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  line-height: 1.35;
  max-width: 22em;
}

.card-banner--pm.warn .card-banner-pm-label,
.card-banner--pm.warn .card-banner-pm-sub {
  color: inherit;
  opacity: 0.95;
}

.card-banner--pm.warn .card-banner-pm-time {
  color: inherit;
  font-size: clamp(1rem, 3vw, 1.25rem);
}

.card-body {
  padding: 20px 20px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}
.odds-gauge-container{
  margin-top: 16px;
}
.event-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0f0f0f;
}

.event-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px 20px;
}

/* 事件标题移到 top-bar 后，主卡片仅余统计行时保留上内边距 */
.card > .stats-row:first-child {
  padding-top: 20px;
}

@media (max-width: 520px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

.stat {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.stat label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat strong {
  font-size: 1.05rem;
  font-weight: 700;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  padding: 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.odds-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.odds-gauge svg {
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.25));
}

.odds-labels {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.odds-labels span strong {
  color: var(--text);
  font-size: 1rem;
}

.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.countdown-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.error-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 13px;
}

.footer-note {
  margin-top: 24px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.badge.closed {
  background: rgba(138, 143, 152, 0.12);
  color: var(--muted);
  border-color: rgba(138, 143, 152, 0.35);
}

.mono {
  font-variant-numeric: tabular-nums;
}

/** Polymarket WSS 诊断块（snapshot.polymarketWs） */
.pm-ws-debug {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 42vh;
  overflow: auto;
}
