/* Phone reading layout. Market values and execution gates stay in the
   canonical terminal; browsing uses the browser's document scroll. */
@media (max-width: 760px) {
  html:has(body.hg-markets.hg-predict-market-page) {
    height: auto !important;
    overflow-y: auto !important;
    scroll-snap-type: none !important;
    scroll-behavior: auto;
    scroll-padding-block: 16px 180px;
  }
  body.hg-markets.hg-predict-market-page {
    height: auto !important;
    min-height: 100svh !important;
    max-height: none !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
    font-size: 15px;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body.hg-markets.hg-predict-market-page .pm-root {
    height: auto !important;
    min-height: 100svh !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
  }
  html:has(body.hg-markets.hg-predict-market-page.pm-mobile-ticket-open),
  html:has(body.hg-markets.hg-predict-market-page.pm-portfolio-drawer-open),
  html:has(body.hg-markets.hg-predict-market-page #signInModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page #walletSelectionModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page #builderApprovalModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page #onboardingModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page #depositModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page #safetyCenterModal:not([hidden])),
  html:has(body.hg-markets.hg-predict-market-page dialog[open]) {
    overflow-y: hidden !important;
    overscroll-behavior-y: contain;
  }
  body.hg-markets.hg-predict-market-page #signInModal,
  body.hg-markets.hg-predict-market-page #orderTicket { overscroll-behavior: contain; }
  body.hg-markets.hg-predict-market-page #mobileMarketFeed { display: none !important; }
  body.hg-markets.hg-predict-market-page .pm-list-view:not([hidden]),
  body.hg-markets.hg-predict-market-page .pm-list-layout,
  body.hg-markets.hg-predict-market-page .pm-list-main {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    flex: none !important;
    overscroll-behavior: auto !important;
  }
  body.hg-markets.hg-predict-market-page #pmMarketGrid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: 14px !important;
    padding: 12px 0 20px !important;
    scroll-snap-type: none !important;
  }
  body.hg-markets.hg-predict-market-page .pm-category-chip,
  body.hg-markets.hg-predict-market-page .pm-top-signin {
    min-height: 44px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
  }
  body.hg-markets.hg-predict-market-page #openSignInButton { min-height: 44px !important; font-size: 14px !important; }
  body.hg-markets.hg-predict-market-page .pm-search-inline input {
    min-height: 44px !important;
    font-size: 16px !important;
  }
  body.hg-markets.hg-predict-market-page .pm-live-chip { font-size: 13px !important; min-height: 32px !important; height: auto !important; }
  body.hg-markets.hg-predict-market-page:not(.pm-detail-open) .pm-market-card {
    height: auto !important;
    min-height: 0 !important;
    padding: 18px !important;
    gap: 14px !important;
    border-radius: 18px !important;
  }
  body.hg-markets.hg-predict-market-page .pm-card-head h2 { font-size: 18px !important; line-height: 1.4 !important; letter-spacing: -.02em !important; }
  body.hg-markets.hg-predict-market-page .pm-card-head__condition,
  body.hg-markets.hg-predict-market-page .pm-market-footer,
  body.hg-markets.hg-predict-market-page .pm-card-side__label { font-size: 13px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page .pm-card-outcome-row,
  body.hg-markets.hg-predict-market-page .pm-card-binary-side {
    height: auto !important;
    min-height: 48px !important;
    max-height: none !important;
    padding: 10px 12px !important;
  }
  body.hg-markets.hg-predict-market-page .pm-card-outcome-row__label,
  body.hg-markets.hg-predict-market-page .pm-card-binary-side__direction { font-size: 14px !important; line-height: 1.4 !important; }
  body.hg-markets.hg-predict-market-page .pm-card-outcome-row__pct,
  body.hg-markets.hg-predict-market-page .pm-card-binary-side__multiplier { font-size: 20px !important; font-variant-numeric: tabular-nums; }
  body.hg-markets.hg-predict-market-page .pm-card-outcome-row__pct {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 74px !important;
    max-width: none !important;
    height: auto !important;
    min-height: 36px !important;
    padding: 6px 10px !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
    font-size: 18px !important;
    line-height: 1.3 !important;
    box-shadow: none !important;
    white-space: nowrap !important;
  }
  body.hg-markets.hg-predict-market-page .pm-card-spark {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
  }
  body.hg-markets.hg-predict-market-page .pm-collection-toggle {
    min-height: 44px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
  }
  body.hg-markets.hg-predict-market-page .pm-collection-legs-scroll {
    max-height: none !important;
    overflow-y: visible !important;
  }
  body.hg-markets.hg-predict-market-page .pm-market-footer span,
  body.hg-markets.hg-predict-market-page .pm-match-card-state,
  body.hg-markets.hg-predict-market-page .pm-match-card-date,
  body.hg-markets.hg-predict-market-page .pm-match-card-volume { font-size: 13px !important; line-height: 1.5 !important; }

  /* One detail page, no sideways peek pages or inner viewport traps. */
  body.hg-markets.hg-predict-market-page.pm-detail-open .pm-detail-view:not([hidden]),
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-pager,
  body.hg-markets.hg-predict-market-page .pm-detail-view [data-pager-slot="current"] {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    flex: none !important;
    scroll-snap-type: none !important;
    scroll-snap-align: none !important;
    transform: none !important;
  }
  body.hg-markets.hg-predict-market-page .pm-detail-view [data-pager-slot="prev"],
  body.hg-markets.hg-predict-market-page .pm-detail-view [data-pager-slot="next"] { display: none !important; }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-shell[data-experience="v2"],
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-detail-workspace {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
    gap: 16px !important;
    --pm-title-size: clamp(20px, 5.5vw, 24px);
  }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-chart-panel,
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-book-panel,
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-outcomes-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    overflow: visible !important;
  }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-chart-wrap { touch-action: pan-y pinch-zoom !important; }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-chart-toolbar {
    height: auto !important;
    max-height: none !important;
    padding: 0 0 16px !important;
    gap: 16px !important;
  }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-chart-toolbar__identity { gap: 16px !important; min-width: 0; }
  body.hg-markets.hg-predict-market-page .pm-detail-view .pm-chart-toolbar__title-block { align-items: start !important; gap: 12px !important; }
  body.hg-markets.hg-predict-market-page .pm-detail-view #detailTitle {
    font-size: clamp(20px, 5.5vw, 24px) !important;
    font-weight: 650 !important;
    line-height: 1.3 !important;
    letter-spacing: -.035em !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-height: none !important;
    -webkit-line-clamp: unset !important;
  }
  body.hg-markets.hg-predict-market-page .pm-back-button,
  body.hg-markets.hg-predict-market-page .pm-chart-rules-button,
  body.hg-markets.hg-predict-market-page .hg-sports-book-toggle,
  body.hg-markets.hg-predict-market-page .hg-chart-presentation__scale {
    min-height: 44px !important;
    height: auto !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    transform: none !important;
  }
  body.hg-markets.hg-predict-market-page .pm-chart-toolbar__delta,
  body.hg-markets.hg-predict-market-page #chartOutcomeLabel,
  body.hg-markets.hg-predict-market-page .pm-chart-range button,
  body.hg-markets.hg-predict-market-page .pm-book-head,
  body.hg-markets.hg-predict-market-page .pm-book-row,
  body.hg-markets.hg-predict-market-page .pm-book-mid,
  body.hg-markets.hg-predict-market-page .pm-panel-tabs button { font-size: 13px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page .pm-panel-tabs button { min-height: 44px !important; padding: 10px 12px !important; }
  body.hg-markets.hg-predict-market-page .pm-account-empty p,
  body.hg-markets.hg-predict-market-page .pm-order-disclaimer,
  body.hg-markets.hg-predict-market-page .pm-ticket-block-reason,
  body.hg-markets.hg-predict-market-page .pm-order-field label { font-size: 14px !important; line-height: 1.6 !important; }
  body.hg-markets.hg-predict-market-page .pm-detail-view input:not([type="radio"]):not([type="checkbox"]) { font-size: 16px !important; }
  body.hg-markets.hg-predict-market-page #marketDetailView .pm-outcomes-panel h2 { font-size: 14px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page #marketDetailView .pm-outcome-row__price,
  body.hg-markets.hg-predict-market-page #marketExpiryCountdown span,
  body.hg-markets.hg-predict-market-page #personalDockSummary { font-size: 13px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page .hg-chart-presentation__status {
    font-size: 13px !important;
    line-height: 1.45 !important;
    white-space: normal !important;
  }
  body.hg-markets.hg-predict-market-page #chartRulesButton {
    min-height: 44px !important;
    height: 44px !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  /* Keep source state and game facts readable, including unavailable data. */
  body.hg-markets.hg-predict-market-page .hg-sports-presentation { padding: 16px !important; gap: 12px !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-presentation h3,
  body.hg-markets.hg-predict-market-page .hg-sports-presentation h4 { font-size: 14px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-scoreline__team strong { font-size: 14px !important; line-height: 1.4 !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-scoreline__caption { font-size: 12px !important; letter-spacing: .08em !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-source-badge,
  body.hg-markets.hg-predict-market-page .hg-sports-scheduled-start,
  body.hg-markets.hg-predict-market-page .hg-sports-market-context,
  body.hg-markets.hg-predict-market-page .hg-sports-market-context small,
  body.hg-markets.hg-predict-market-page .hg-sports-feed-times dt,
  body.hg-markets.hg-predict-market-page .hg-sports-feed-times dd,
  body.hg-markets.hg-predict-market-page .hg-sports-state-grid dt,
  body.hg-markets.hg-predict-market-page .hg-sports-stats__leaders li,
  body.hg-markets.hg-predict-market-page .hg-sports-stats__teams span,
  body.hg-markets.hg-predict-market-page .hg-sports-cache-provenance { font-size: 13px !important; line-height: 1.5 !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-cache-provenance summary { display: flex; align-items: center; min-height: 44px; }
  body.hg-markets.hg-predict-market-page .hg-sports-instrument-tabs > label { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 14px; font-size: 14px; }
  body.hg-markets.hg-predict-market-page .hg-sports-market-context strong { font-size: 22px !important; }
  body.hg-markets.hg-predict-market-page .hg-sports-context-status p { font-size: 14px; }

  /* The fixed action dock remains a compact, reachable control, never a
     scrolling market selector. Reserve enough document space beneath it. */
  body.hg-markets.hg-predict-market-page.pm-detail-open .pm-detail-view:not([hidden]) { padding-bottom: calc(200px + env(safe-area-inset-bottom)) !important; }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeDock:not(.is-ticket-open) {
    grid-template-columns: minmax(0, 1fr) minmax(136px, .9fr) !important;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) !important;
    gap: 10px 12px !important;
    border-radius: 16px !important;
  }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeSummary strong { font-size: 16px !important; line-height: 1.4 !important; }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeSummary span,
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeStats span,
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeStats strong { font-size: 13px !important; line-height: 1.4 !important; }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeStats > div {
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 3px !important;
  }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileOutcomePair button {
    min-height: 52px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: var(--compact-outcome-ink) !important;
    background: var(--compact-outcome-surface) !important;
  }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileOutcomePair button.is-active {
    color: var(--compact-outcome-selected-ink) !important;
    background: var(--compact-outcome-selected-surface) !important;
  }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileOutcomePair button > span,
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileOutcomePair button > strong { font-size: 14px !important; line-height: 1.4 !important; color: inherit !important; }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileOutcomePair::before { display: none !important; }
  body.hg-markets.hg-predict-market-page.pm-detail-open #mobileTradeButton { min-height: 52px !important; padding: 10px 12px !important; font-size: 14px !important; line-height: 1.4 !important; }
  body.hg-markets.hg-predict-market-page:not(.pm-detail-open) #pmLegalChrome {
    position: static !important;
    width: auto !important;
    max-width: none !important;
    margin: 8px 16px 80px !important;
    flex-wrap: wrap;
    gap: 6px 16px !important;
    pointer-events: auto;
    font-size: 13px !important;
  }
  body.hg-markets.hg-predict-market-page:not(.pm-detail-open) #pmLegalChrome a { min-width: 44px; min-height: 44px; display: inline-flex !important; align-items: center; }
  body.hg-markets.hg-predict-market-page #pmLocaleTrigger { min-height: 44px !important; font-size: 13px !important; }
  body.hg-markets.hg-predict-market-page #pmThemePicker .pm-theme-swatch { min-width: 44px !important; min-height: 44px !important; width: 44px !important; height: 44px !important; }
  body.hg-markets.hg-predict-market-page .pm-glass-dock { font-size: 13px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html:has(body.hg-markets.hg-predict-market-page) { scroll-behavior: auto !important; }
}
