/*
 * Decision-first detail refinements.
 *
 * This file deliberately covers only the live detail shell. It keeps the
 * existing multi-outcome navigation model: exactly three outcomes are shown
 * together; four or more retain the horizontal, scrollable rail.
 */

html[data-hg-theme="brand"] body.hg-markets.hg-predict-market-page,
body.hg-markets.hg-predict-market-page[data-hg-theme="brand"] {
  --compact-outcome-surface: #f3ead8;
  --compact-outcome-ink: #16120e;
  --compact-outcome-selected-surface: #16120e;
  --compact-outcome-selected-ink: #fdf8ed;
  --compact-outcome-selected-accent: #d7b07a;
  --compact-book-ink: #16120e;
  --compact-book-muted: #614a33;
  --compact-book-bid: #0f766e;
  --compact-book-ask: #8f2f2f;
}

html[data-hg-theme="light"] body.hg-markets.hg-predict-market-page,
body.hg-markets.hg-predict-market-page[data-hg-theme="light"] {
  --compact-outcome-surface: #f8fafc;
  --compact-outcome-ink: #0f172a;
  --compact-outcome-selected-surface: #0f766e;
  --compact-outcome-selected-ink: #ffffff;
  --compact-outcome-selected-accent: #99f6e4;
  --compact-book-ink: #0f172a;
  --compact-book-muted: #475569;
  --compact-book-bid: #0f766e;
  --compact-book-ask: #9f1239;
}

html[data-hg-theme="hyperliquid"] body.hg-markets.hg-predict-market-page,
body.hg-markets.hg-predict-market-page[data-hg-theme="hyperliquid"] {
  --compact-outcome-surface: #17191c;
  --compact-outcome-ink: #eceff4;
  --compact-outcome-selected-surface: #174a47;
  --compact-outcome-selected-ink: #f4fffd;
  --compact-outcome-selected-accent: #97fce4;
  --compact-book-ink: #eceff4;
  --compact-book-muted: #b8c1cc;
  --compact-book-bid: #97fce4;
  --compact-book-ask: #f3b2bb;
}

/* Exactly three outcomes are compact, equal choices. Larger sets keep their
 * existing horizontal rail so every outcome remains reachable. */
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) {
  grid-auto-flow: row !important;
  grid-auto-columns: initial !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  overflow-x: hidden !important;
  scroll-snap-type: none !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row {
  min-width: 0;
  min-height: 64px !important;
  height: 64px !important;
  max-height: 64px !important;
  padding: 7px 10px !important;
  overflow: hidden;
  scroll-snap-align: none;
  background: var(--compact-outcome-surface) !important;
  background-image: none !important;
  border-color: color-mix(in srgb, var(--compact-outcome-ink) 16%, transparent) !important;
  color: var(--compact-outcome-ink) !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row.is-active {
  background: var(--compact-outcome-selected-surface) !important;
  background-image: none !important;
  border-color: var(--compact-outcome-selected-accent) !important;
  box-shadow: inset 3px 0 0 var(--compact-outcome-selected-accent) !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__label,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__metrics,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__pct,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__price {
  min-width: 0;
  color: var(--compact-outcome-ink) !important;
  text-shadow: none !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row.is-active .pm-outcome-row__label,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row.is-active .pm-outcome-row__metrics,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row.is-active .pm-outcome-row__pct,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row.is-active .pm-outcome-row__price {
  color: var(--compact-outcome-selected-ink) !important;
}

/* The light-backed themes previously inherited white book totals. Keep each
 * displayed column legible without changing order-book values or semantics. */
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-head {
  color: var(--compact-book-muted) !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-row span,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-row strong,
body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-mid {
  color: var(--compact-book-ink) !important;
  text-shadow: none !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-row--bid span:first-child {
  color: var(--compact-book-bid) !important;
}

body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"] .pm-book-panel .pm-book-row--ask span:first-child {
  color: var(--compact-book-ask) !important;
}

@media (min-width: 768px) {
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-panel:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) {
    height: 104px;
    min-height: 104px;
    max-height: 104px;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) {
    height: 64px;
    min-height: 64px;
  }
}

@media (max-width: 767px) {
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-panel:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 6px 10px 8px;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) {
    height: 64px;
    min-height: 64px;
  }
}

@media (max-width: 399px) {
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row {
    padding: 7px 6px !important;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__label {
    font-size: 11px;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__metrics {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
    gap: 3px;
    font-size: 11px;
    white-space: nowrap;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__pct {
    font-size: 14px !important;
    line-height: 1.1;
  }

  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"].has-outcomes-rail .pm-outcomes-list:has(.pm-outcome-row:nth-child(3)):not(:has(.pm-outcome-row:nth-child(4))) .pm-outcome-row__price {
    font-size: 10px !important;
    line-height: 1.1;
  }
}

/* Author display rules must not override the semantic market visibility gate. */
body.hg-markets.hg-predict-market-page .pm-market-card[hidden] {
  display: none !important;
}
