/* =============================================================
 * OST · Live Watch + Bet
 * Modal + featured Polymarket card styling.
 * Loaded with live-watch.js. Self-contained.
 * ============================================================= */

.live-bet-section {
  padding: 56px 16px;
  background: linear-gradient(180deg, rgba(5, 8, 14, 0.92), rgba(8, 12, 22, 0.96));
  border-top: 1px solid rgba(109, 159, 255, 0.08);
  border-bottom: 1px solid rgba(109, 159, 255, 0.08);
}
.live-bet-shell {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}
.live-bet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.live-bet-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  letter-spacing: -.01em;
}
.live-bet-head p {
  margin: 4px 0 0;
  color: var(--text-muted, #94a3b8);
  font-size: .95rem;
}
.live-bet-card {
  background: linear-gradient(135deg, rgba(109, 159, 255, 0.08), rgba(167, 139, 250, 0.06));
  border: 1px solid rgba(109, 159, 255, 0.22);
  border-radius: 18px;
  padding: 22px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 22px;
  align-items: center;
  box-shadow: 0 16px 40px -28px rgba(109, 159, 255, .55);
}
.live-bet-meta {
  display: grid;
  gap: 12px;
}
.live-bet-pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.live-bet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 51, 51, 0.18);
  border: 1px solid rgba(255, 51, 51, 0.55);
  color: #ffb4b4;
  font-weight: 700;
  font-size: .8rem;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.live-bet-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3333;
  box-shadow: 0 0 0 0 rgba(255, 51, 51, .8);
  animation: livePulse 1.6s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 51, 51, .8); }
  100% { box-shadow: 0 0 0 10px rgba(255, 51, 51, 0); }
}
.live-bet-pill.is-quiet {
  background: rgba(109, 159, 255, .12);
  border-color: rgba(109, 159, 255, .35);
  color: #d6e4ff;
}
.live-bet-pill.is-quiet::before {
  background: #6d9fff;
  animation: none;
}
.live-bet-title {
  margin: 0;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.2;
}
.live-bet-sub {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-size: .92rem;
  line-height: 1.45;
}
.live-bet-prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.live-bet-price {
  background: rgba(15, 20, 30, .7);
  border: 1px solid rgba(109, 159, 255, .15);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}
.live-bet-price span {
  display: block;
  font-size: .68rem;
  color: #94a3b8;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.live-bet-price strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}
.live-bet-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.live-bet-watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #00d4ff, #6d9fff);
  color: #07111e;
  font-weight: 800;
  border: none;
  padding: 12px 22px;
  border-radius: 30px;
  cursor: pointer;
  font-size: .95rem;
  box-shadow: 0 12px 28px -14px rgba(0, 212, 255, .65);
  transition: transform .15s ease;
}
.live-bet-watch-btn:hover { transform: translateY(-1px); }
.live-bet-poly-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 20, 30, .7);
  color: #d6e4ff;
  border: 1px solid rgba(109, 159, 255, .35);
  padding: 11px 18px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
}
.live-bet-poster {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #050810;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(109, 159, 255, .18);
}
.live-bet-poster::before {
  content: '▶';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.4rem;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 6px 18px rgba(0, 0, 0, .55);
  background: radial-gradient(circle at center, rgba(109, 159, 255, .25), transparent 65%);
  pointer-events: none;
}
.live-bet-poster-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 2.4rem;
  font-weight: 800;
  color: rgba(248, 250, 252, .78);
  background:
    linear-gradient(135deg, rgba(109, 159, 255, .18), rgba(167, 139, 250, .14)),
    radial-gradient(circle at 20% 30%, rgba(109, 159, 255, .35), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(167, 139, 250, .3), transparent 55%);
}
.live-bet-poster-grid > span {
  display: grid;
  place-items: center;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ===== Modal ===== */
.live-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.live-modal.is-open { display: flex; }
.live-modal-shell {
  width: min(96vw, 1200px);
  background: #0a0a0a;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
  border: 1px solid rgba(0, 212, 255, .15);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
}
.live-modal-top {
  background: #111;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #222;
  flex-wrap: wrap;
}
.live-modal-title {
  color: #fff;
  font-size: 1.2em;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.live-modal-live-pill {
  background: #ff3333;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75em;
  font-weight: 700;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live-modal-live-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .8);
  animation: livePulse 1.6s ease-out infinite;
}
.live-modal-close {
  background: #ff4444;
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 30px;
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
}
.live-modal-video-wrap {
  padding: 14px;
  background: #000;
  min-height: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid rgba(255,255,255,0.08);
  contain: layout paint;
}
.live-modal-video-wrap::after {
  content: 'Stream stays live while you trade';
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 3;
  color: rgba(248,250,252,0.82);
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(109,159,255,0.25);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
}
.live-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #05070c;
}
.live-modal-video-wrap .video-js {
  width: 100% !important;
  height: min(58vh, calc(96vh - 154px)) !important;
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  flex: 1 1 auto;
}

/* Embedded live market panel inside the modal */
.live-modal-market {
  margin: 0;
  background: linear-gradient(135deg, rgba(109,159,255,0.09), rgba(167,139,250,0.07));
  border: 0;
  border-left: 1px solid rgba(109,159,255,0.22);
  border-radius: 0;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.live-market-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.live-market-head h4 {
  margin: 4px 0 0;
  font-size: 1.05rem;
  color: #f8fafc;
}
.live-market-source {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
}
.live-market-meta {
  font-size: .8rem;
  color: #94a3b8;
  text-align: right;
}
.live-market-outcomes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.live-market-outcome {
  display: grid;
  gap: 4px;
  background: rgba(15, 20, 30, 0.7);
  border: 1px solid rgba(109,159,255,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  color: #f8fafc;
  transition: border-color .12s ease, transform .1s ease;
  position: relative;
}
.live-market-outcome:hover {
  border-color: rgba(0, 212, 255, 0.55);
  transform: translateY(-1px);
}
.live-market-outcome.is-selected {
  border-color: rgba(0, 212, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.22), 0 14px 28px -24px rgba(0, 212, 255, 0.8);
  background: rgba(0, 212, 255, 0.12);
}
.live-market-outcome-label {
  font-size: .82rem;
  font-weight: 600;
  color: #d6e4ff;
}
.live-market-outcome-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.live-market-outcome-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(109,159,255,0.15);
  overflow: hidden;
  margin-top: 2px;
}
.live-market-outcome-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #6d9fff);
  border-radius: 999px;
}
.live-market-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.live-market-trade-btn {
  background: linear-gradient(135deg, #00d4ff, #6d9fff);
  color: #07111e;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  font-size: .85rem;
}
.live-market-poly-link {
  color: #d6e4ff;
  text-decoration: none;
  font-size: .85rem;
  border: 1px solid rgba(109,159,255,0.35);
  padding: 8px 14px;
  border-radius: 999px;
}
.live-market-chart {
  background: rgba(3, 7, 18, 0.72);
  border: 1px solid rgba(109,159,255,0.16);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.live-market-chart-head,
.live-market-positions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.live-market-chart-head h5,
.live-market-positions-head h5 {
  margin: 0;
  color: #f8fafc;
  font-size: .86rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.live-market-chart-head span,
.live-market-positions-head span {
  color: #94a3b8;
  font-size: .76rem;
  text-align: right;
}
.live-market-chart canvas {
  display: block;
  width: 100%;
  height: 210px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01));
}
.live-market-trade {
  display: grid;
  grid-template-columns: 1.1fr minmax(140px, .55fr) 1fr auto;
  gap: 10px;
  align-items: stretch;
  background: rgba(15, 20, 30, 0.74);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 12px;
  padding: 12px;
}
.live-market-selected,
.live-market-stake,
.live-market-projection {
  background: rgba(2, 6, 23, 0.58);
  border: 1px solid rgba(109,159,255,0.14);
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
}
.live-market-selected span,
.live-market-stake {
  color: #94a3b8;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
}
.live-market-selected strong {
  display: block;
  color: #f8fafc;
  font-size: .98rem;
  margin-top: 4px;
}
.live-market-selected em {
  display: block;
  color: #00d4ff;
  font-style: normal;
  font-size: .8rem;
  margin-top: 2px;
}
.live-market-stake input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: none;
  outline: none;
  border-radius: 8px;
  padding: 9px 10px;
  color: #f8fafc;
  background: rgba(255,255,255,0.08);
  font-size: 1rem;
  font-weight: 800;
}
.live-market-projection {
  display: flex;
  align-items: center;
  color: #d6e4ff;
  font-size: .88rem;
  line-height: 1.35;
}
.live-market-submit {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #00ff9f, #00d4ff);
  color: #03111d;
  font-weight: 900;
  padding: 0 18px;
  cursor: pointer;
  min-height: 52px;
  white-space: nowrap;
}
.live-market-submit:disabled,
.live-position-row button:disabled {
  opacity: .6;
  cursor: wait;
}
.live-market-positions {
  background: rgba(3, 7, 18, 0.56);
  border: 1px solid rgba(109,159,255,0.14);
  border-radius: 12px;
  padding: 12px;
}
.live-market-positions-list {
  display: grid;
  gap: 8px;
}
.live-market-empty {
  color: #94a3b8;
  font-size: .84rem;
  padding: 4px 0;
}
.live-position-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, .9fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.live-position-row:first-child { border-top: none; }
.live-position-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.live-position-row strong {
  color: #f8fafc;
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-position-row span {
  color: #94a3b8;
  font-size: .76rem;
}
.live-position-pnl {
  font-weight: 800;
  font-size: .82rem;
}
.live-position-pnl.is-up { color: #00ff9f; }
.live-position-pnl.is-down { color: #ff7c8a; }
.live-position-row button {
  border: none;
  border-radius: 999px;
  background: #22c55e;
  color: #03110a;
  font-weight: 800;
  padding: 7px 13px;
  cursor: pointer;
}
.live-modal-fallback {
  display: none;
  color: #ffb4b4;
  background: rgba(255, 51, 51, .12);
  border: 1px solid rgba(255, 51, 51, .3);
  border-radius: 10px;
  padding: 14px;
  margin: 0 28px 24px;
  font-size: .9rem;
  text-align: center;
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: center;
  z-index: 4;
  max-width: calc(100% - 56px);
}
.live-modal-fallback.is-shown { display: block; }
.live-modal-bet-bar {
  background: #111;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid #222;
}
.live-modal-bet-bar > .live-bet-bar-label {
  color: #94a3b8;
  font-size: .95rem;
  margin-right: 4px;
}
.live-modal-bet-btn {
  background: linear-gradient(135deg, #00d4ff, #6d9fff);
  color: #07111e;
  padding: 10px 22px;
  border: none;
  border-radius: 30px;
  font-weight: 800;
  cursor: pointer;
  font-size: .9rem;
  letter-spacing: .02em;
}
.live-modal-bet-btn:hover { filter: brightness(1.05); }
.live-modal-bet-status {
  margin-left: auto;
  color: #00ff9f;
  font-size: .85rem;
  font-weight: 600;
}
.live-modal-toast {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 159, .15);
  border: 1px solid rgba(0, 255, 159, .35);
  color: #c8ffe6;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 5;
}
.live-modal-toast.is-shown { opacity: 1; }
.live-modal-toast.is-error {
  background: rgba(255, 51, 51, .16);
  border-color: rgba(255, 51, 51, .38);
  color: #ffd4d4;
}

/* ---- Mobile ---- */
@media (max-width: 720px) {
  .live-modal {
    align-items: stretch;
    padding: 8px;
  }
  .live-bet-card {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .live-bet-poster { order: -1; }
  .live-modal-shell {
    width: 100%;
    max-height: calc(100vh - 16px);
    border-radius: 14px;
  }
  .live-modal-top { padding: 12px 14px; }
  .live-modal-bet-bar { padding: 12px 14px; gap: 8px; }
  .live-modal-bet-btn { flex: 1 1 30%; padding: 12px 8px; font-size: .85rem; }
  .live-modal-bet-status {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
  .live-modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .live-modal-video-wrap {
    position: sticky;
    top: 0;
    z-index: 4;
    flex: 0 0 clamp(210px, 34vh, 280px);
    height: clamp(210px, 34vh, 280px);
    min-height: 210px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 10px;
    background: #000;
  }
  .live-modal-video-wrap::after {
    left: 16px;
    bottom: 16px;
    font-size: .66rem;
  }
  .live-modal-video-wrap .video-js {
    height: 100% !important;
    min-height: 0;
  }
  .live-modal-fallback {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
    justify-self: auto;
    max-width: none;
    margin: 10px;
  }
  .live-market-outcomes {
    grid-template-columns: 1fr;
  }
  .live-modal-market {
    margin: 0;
    border-left: 0;
    border-top: 1px solid rgba(109,159,255,0.22);
    max-height: none;
    overflow: visible;
    padding: 12px;
  }
  .live-market-chart canvas {
    height: 170px;
  }
  .live-market-trade {
    grid-template-columns: 1fr;
  }
  .live-market-submit {
    min-height: 48px;
  }
  .live-position-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .live-position-row button {
    width: 100%;
    padding: 10px 13px;
  }
}
