/* Universe Live — Dream444 table UI parity (markets/cards/results).
   Header / chips / modal chrome: universe-baccarat-game.css (.ub-*).
   Mobile nav: reserved via --ub-nav-space (Dream footer stays visible). */

#lion-universe-live-root {
  --ub-nav-space: max(74px, calc(13.33333vw + env(safe-area-inset-bottom, 0px)));
  --d4-page: #ededed;
  --d4-header: #223545;
  --d4-row: #fff;
  --d4-row-border: #dce1e6;
  --d4-odds: #92c9f7;
  --d4-odds-text: #111;
  --d4-suspend: #d0021b;
  --d4-label: #212529;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--ub-nav-space);
  height: auto;
  max-height: calc(100vh - var(--ub-nav-space));
  max-height: calc(100dvh - var(--ub-nav-space));
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: var(--d4-page);
  color: #212529;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
#lion-universe-live-root[hidden] { display: none !important; }
#lion-universe-live-root * { box-sizing: border-box; }

@media (min-width: 801px) {
  #lion-universe-live-root {
    --ub-nav-space: 0px;
    bottom: 0;
    max-height: 100vh;
    max-height: 100dvh;
  }
}

.ul-main,
#lion-universe-live-root .ub-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

/* —— Video + overlays (Dream444 live table) —— */
.ul-video {
  position: relative;
  background: #000;
  min-height: 200px;
  aspect-ratio: 16 / 10;
  max-height: 38vh;
  flex: 0 0 auto;
}
.ul-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.ul-video-ph, .ul-offline {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: 16px;
  z-index: 1;
}
.ul-offline[hidden], .ul-video-ph[hidden] { display: none !important; }
.ub-reconnect-btn {
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: #243049;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.ul-round {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Baccarat SVG countdown host (styles from universe-baccarat-game.css) */
#lion-universe-live-root #ub-timer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.ul-hands {
  position: absolute;
  left: 8px;
  top: 36px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  max-width: 46%;
}
.ul-hand {
  background: rgba(10,16,28,.72);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  padding: 4px 6px;
  min-width: 72px;
  text-align: left;
}
.ul-hand h3 {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: .04em;
  color: #fff;
  font-weight: 700;
}
.ul-cards {
  display: flex;
  justify-content: flex-start;
  gap: 3px;
  min-height: 40px;
}
.ul-cards img {
  width: 30px;
  height: 42px;
  object-fit: contain;
  border-radius: 2px;
  background: #fff1;
  border: 1px solid #000;
}

#lion-universe-live-root[data-family="multi-hand"] .ul-hands,
#lion-universe-live-root[data-family="lucky-7"] .ul-hands,
#lion-universe-live-root[data-family="character-result"] .ul-hands,
#lion-universe-live-root[data-family="dragon-tiger"] .ul-hands,
#lion-universe-live-root[data-family="teen-patti"] .ul-hands,
#lion-universe-live-root[data-family="andar-bahar"] .ul-hands {
  flex-direction: row;
  flex-wrap: wrap;
  left: 8px;
  right: auto;
  top: auto;
  bottom: 8px;
  max-width: calc(100% - 16px);
}
#lion-universe-live-root[data-family="multi-hand"] .ul-hand,
#lion-universe-live-root[data-family="lucky-7"] .ul-hand {
  text-align: center;
}
#lion-universe-live-root[data-family="multi-hand"] .ul-cards,
#lion-universe-live-root[data-family="lucky-7"] .ul-cards {
  justify-content: center;
}

/* —— Dream444 exchange-list markets —— */
.ul-bet-pane,
#lion-universe-live-root .ub-bet-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--d4-page);
  color: var(--d4-label);
  overflow: hidden;
}

.d4-markets-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--d4-page);
  padding-bottom: 2px;
}

.d4-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: #6b7280;
}

.d4-market {
  margin: 0 0 6px;
  background: var(--d4-row);
}

.d4-market-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--d4-header);
  color: #fff;
  min-height: 34px;
}

.d4-market-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d4-info {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #1285e2;
  font-size: 12px;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 18px;
  padding: 0;
  cursor: default;
}

.d4-market-body {
  background: var(--d4-row);
}

.d4-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--d4-row-border);
  background: var(--d4-row);
}

.d4-row:last-child {
  border-bottom: 0;
}

.d4-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--d4-label);
  line-height: 1.25;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.d4-label-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

/* Baccarat-matching P/L book line on Dream444 exchange rows */
#lion-universe-live-root .d4-pl.ub-pl {
  margin-top: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-shadow: none;
}
#lion-universe-live-root .d4-pl.plus-book {
  color: #0a7a2f;
}
#lion-universe-live-root .d4-pl.minus-book {
  color: #d0021b;
}

.d4-rank {
  font-weight: 800;
  min-width: 1.2em;
}

.d4-suits {
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
}
.d4-suits.red,
.d4-suits .red { color: #c62828; }
.d4-suits.black,
.d4-suits .black { color: #111; }

.d4-odds {
  flex: 0 0 auto;
  width: 92px;
  min-height: 40px;
  border: 1px solid #6eb0e0;
  border-radius: 2px;
  background: var(--d4-odds);
  color: var(--d4-odds-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  cursor: pointer;
}

.d4-odds:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.d4-odds.is-selected {
  outline: 2px solid #fd8f3b;
  outline-offset: 1px;
}

.d4-odds.is-suspended {
  background: #fff;
  border: 2px solid var(--d4-suspend);
}

.d4-price {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
}

.d4-size {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.1;
  opacity: .92;
}

.d4-suspended {
  color: var(--d4-suspend);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
}

/* Recent result letter colors (Dream444 per-game, not Baccarat P/B/T) */
#lion-universe-live-root .ub-recent li[data-w="D"],
#lion-universe-live-root .ub-recent li.D { background: #1285e2; }
#lion-universe-live-root .ub-recent li[data-w="A"],
#lion-universe-live-root .ub-recent li.A { background: #1285e2; }
#lion-universe-live-root .ub-recent li[data-w="H"],
#lion-universe-live-root .ub-recent li.H { background: #1285e2; }

#lion-universe-live-root[data-family="dragon-tiger"] .ub-recent li[data-w="T"],
#lion-universe-live-root[data-family="dragon-tiger"] .ub-recent li.T,
#lion-universe-live-root[data-family="andar-bahar"] .ub-recent li[data-w="B"],
#lion-universe-live-root[data-family="andar-bahar"] .ub-recent li.B,
#lion-universe-live-root[data-family="teen-patti"] .ub-recent li[data-w="B"],
#lion-universe-live-root[data-family="teen-patti"] .ub-recent li.B,
#lion-universe-live-root[data-family="lucky-7"] .ub-recent li[data-w="L"],
#lion-universe-live-root[data-family="lucky-7"] .ub-recent li.L {
  background: #ee6aa7;
}

#lion-universe-live-root[data-family="lucky-7"] .ub-recent li[data-w="T"],
#lion-universe-live-root[data-family="lucky-7"] .ub-recent li.T {
  background: #f0c419;
  color: #111;
}

#lion-universe-live-root .ub-recent li[data-w="E"],
#lion-universe-live-root .ub-recent li.E,
#lion-universe-live-root .ub-recent li[data-w="S"],
#lion-universe-live-root .ub-recent li.S { background: #11b24b; }

#lion-universe-live-root .ub-recent li[data-w="?"],
#lion-universe-live-root .ub-recent li.\? { background: #6b7280; }
