/* Preserve the owner-locked V3 composition while keeping the same controls
   reachable at desktop, tablet, and phone widths. */
.moneylab-v3 [data-v3-run-status] { margin-top: 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.moneylab-v3 [data-v3-run-status] p { margin: 8px 0; }
.moneylab-v3 [data-v3-run-status] .nfl-lab-readiness { display: block; }
.moneylab-v3 [data-v3-run-status] [hidden] { display: none !important; }
.moneylab-v3 [data-hardness-state="unavailable"] .dh-live-needle { opacity: 0 !important; }
.moneylab-v3-setup-editor[open] > div { position: static; width: auto; max-width: 100%; padding: 8px; }
.moneylab-v3 [data-v3-game-mount] select, .moneylab-v3 [data-v3-filter-mount] input { max-width: 100%; min-width: 0; }
.moneylab-v3 [data-v3-run-status] strong { white-space: normal; }
/* Long authenticated readiness messages must shrink the grid track, not make
   the Run button and its entire status block wider than the phone viewport. */
.moneylab-v3 .moneylab-v3-actions,
.moneylab-v3 .moneylab-v3-actions > div {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-inline-size: 0;
}
.moneylab-v3 :is([data-v3-run-mount], [data-v3-run-status], [data-v3-status-sport], #moneyLabReferenceRunMount, .nfl-readiness-mini, #nflRunNote, #nflReviewFixtureBanner) {
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  box-sizing: border-box;
}
.moneylab-v3 [data-v3-run-status] :is(p, small, span, strong) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  overflow: visible;
  text-overflow: clip;
}
.moneylab-v3 [data-v3-run-mount] button {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
@media (max-width: 1399px) {
  html, body.phase1-money-lab { min-width: 0; }
  .moneylab-v3 { grid-template-columns: 270px minmax(0, 1fr); }
  .moneylab-v3-workspace { min-width: 0; }
  .moneylab-v3-topbar { height: auto; flex-wrap: wrap; }
  .moneylab-v3-topbar nav { flex-wrap: wrap; gap: 8px; }
  .moneylab-v3-steps { width: auto; margin: 14px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); height: auto; }
  .moneylab-v3-steps li { width: auto; min-width: 0; min-height: 44px; white-space: normal; }
  .moneylab-v3-result-layout { display: grid; width: auto; margin: 14px; grid-template-columns: minmax(0,1fr); grid-template-rows: none; gap: 16px; }
  .moneylab-v3-result-layout > * { grid-column: auto; grid-row: auto; min-width: 0; max-width: 100%; margin: 0; }
  .moneylab-v3-result-card { width: auto; height: auto; min-height: 236px; padding: 24px 18px; }
  .moneylab-v3-result-head { grid-template-columns: minmax(0,1fr) auto; }
  .moneylab-v3-result-head h1 { font-size: clamp(30px,4.5vw,62px); overflow-wrap: anywhere; white-space: normal; }
  .moneylab-v3-result-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .moneylab-v3-result-summary strong { font-size: 28px; white-space: normal; overflow-wrap: anywhere; }
  .moneylab-v3-character { width: 400px; max-width: 100%; height: 260px; justify-self: center; }
  .moneylab-v3-probability { width: auto; height: auto; min-height: 90px; grid-template-columns: 130px minmax(0,1fr); padding: 12px; }
  .moneylab-v3-comparison { width: auto; height: auto; min-height: 180px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: auto; }
  .moneylab-v3-comparison > div { grid-row: auto; grid-column: auto; min-width: 0; width: auto; padding: 10px; }
  .moneylab-v3-comparison > div:nth-child(-n+2) { display: block; }
  .moneylab-v3-comparison .moneylab-v3-branch-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .moneylab-v3-bottom-row { width: auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; height: auto; }
  .moneylab-v3-bottom-panel { width: auto; min-width: 0; height: auto; min-height: 260px; }
  .moneylab-v3-bottom-panel dd { overflow-wrap: anywhere; white-space: normal; }
  .moneylab-v3 .moneylab-v3-hardness { width: min(430px,100%); min-width: 0; height: auto; aspect-ratio: 440 / 233; justify-self: center; }
  .moneylab-v3 .moneylab-v3-hardness > .dick-hardness-instrument { width: 100% !important; height: 100% !important; }
  .moneylab-v3 .dick-hardness-machine { width: 100%; height: 100%; }
  .moneylab-v3-advanced-assumptions[open] { position: fixed; inset: 12px; width: auto; max-height: calc(100dvh - 24px); overflow: auto; z-index: 150; }
  .moneylab-v3-advanced-assumptions[open] > div { max-height: none; grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .moneylab-v3 { display: flex; flex-direction: column; }
  .moneylab-v3-sidebar { position: static; width: 100%; height: auto; min-height: 0; overflow: visible; padding: 0 12px 16px; }
  .moneylab-v3-wordmark { width: auto; }
  .moneylab-v3-wordmark strong { width: auto; font-size: 27px; transform: none; }
  .moneylab-v3-workspace { width: 100%; }
  .moneylab-v3-topbar { padding: 0 12px; }
  .moneylab-v3-topbar nav { display: flex; flex-wrap: wrap; }
  .moneylab-v3-topbar a { min-height: 44px; font-size: 13px; }
  .moneylab-v3-result-layout { margin: 12px; }
  .moneylab-v3-result-card { padding: 22px 12px; }
  .moneylab-v3-result-head { gap: 8px; }
  .moneylab-v3-result-head > strong { font-size: 22px; }
  .moneylab-v3-result-head h1 { font-size: 32px; }
  .moneylab-v3-result-summary { gap: 12px; }
  .moneylab-v3-result-summary strong { font-size: 24px; }
  .moneylab-v3-probability { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .moneylab-v3-bottom-row { grid-template-columns: minmax(0,1fr); }
  .moneylab-v3-bottom-panel { min-height: 220px; }
  .moneylab-v3-advanced-assumptions[open] > div { grid-template-columns: minmax(0,1fr); }
  .moneylab-v3-disclosure { padding: 14px; font-size: 12px; white-space: normal; }
  .moneylab-v3-steps { margin: 12px; }
  .moneylab-v3-steps li { font-size: 12px; padding: 8px; }
  .moneylab-v3-steps li::after { display: none; }
}

/* Keep game selection in the rail; an open details element is not a modal. */
.moneylab-v3-setup-editor[open] { position: static; inset: auto; margin: 8px; box-shadow: none; }
.moneylab-v3-setup-editor[open] > div { grid-template-columns: minmax(0,1fr); }
.moneylab-v3-game-setup, .moneylab-v3-assumptions { height: auto; overflow: visible; }
.moneylab-v3-sidebar { height: auto; overflow: visible; }
body.phase1-money-lab > main > :not(.moneylab-v3) { display: none !important; }
.moneylab-v3-game-field > strong { position: static; display: block; padding: 6px 0; font-size: 12px; }
.moneylab-v3-game-field select { min-height: 44px; font-size: 14px; }
.moneylab-v3-assumptions > header { height: auto; min-height: 72px; flex-wrap: wrap; gap: 8px; }
.moneylab-v3-assumptions h2 { width: auto; white-space: normal; }
.moneylab-v3-wordmark { max-width: 100%; box-sizing: border-box; }
.moneylab-v3 .simulation-progress-card { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 1399px) {
  .moneylab-v3-character { position: relative; inset: auto; height: 383px; width: 464px; }
  .moneylab-v3-character::before { left: auto; right: 0; }
}
/* Expanded controls remain in the rail, so Reset and sport selection stay usable. */
.moneylab-v3 .moneylab-v3-advanced-assumptions[open] { position: static; inset: auto; width: auto; max-height: none; margin: 8px; box-shadow: none; }
.moneylab-v3 .moneylab-v3-advanced-assumptions[open] > div { grid-template-columns: minmax(0,1fr); max-height: none; overflow: visible; }
.moneylab-v3 .moneylab-v3-sport-picker > div { position: absolute; inset: 100% 0 auto auto; max-width: calc(100vw - 30px); }
.moneylab-v3 #nflGameFilters { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.moneylab-v3 #nflGameFilters label { min-width: 0; }
.moneylab-v3 #nflGameFilters input, .moneylab-v3 #nflGameFilters select { width: 100%; min-height: 44px; font-size: 14px; }
.moneylab-v3 #nflGameFilters button { min-height: 44px; }
.moneylab-v3 #nflGameFilters, .moneylab-v3 .moneylab-reference-filters-static { grid-template-columns: minmax(0,1fr) !important; }

/* Expanded controls must contribute their full height to the sidebar. */
.moneylab-v3 .moneylab-v3-assumptions { max-height: none; }
.moneylab-v3 [data-v3-account-mount] .auth-nav { display: flex; flex-wrap: wrap; }
.moneylab-v3 [data-v3-account-mount] [hidden] { display: none !important; }
.moneylab-v3-style { padding: 10px; }
.moneylab-v3-style label { font-size: 13px; }
.moneylab-v3-style select { width: 100%; min-height: 44px; font-size: 14px; }
.moneylab-v3 [data-v3-mode-mount] { margin: 12px; }
.moneylab-v3 [data-v3-context-mount] > :not([hidden]) { margin: 12px; }
.moneylab-v3-breakdown { margin: 16px; border: 1px solid var(--v3-line); padding: 12px; }
.moneylab-v3-breakdown > summary { cursor: pointer; min-height: 44px; padding: 12px; }
.moneylab-v3 [data-v3-breakdown-mount] > * { max-width: 100%; min-width: 0; }
.moneylab-v3 [data-v3-breakdown-mount] .moneylab-confidence-stack { position: static; display: flex; flex-wrap: wrap; }
.moneylab-v3 [data-v3-breakdown-mount] .moneylab-reference-principles { display: grid; }
@media (max-width: 700px) {
  .moneylab-v3-sidebar, .moneylab-v3-workspace { flex: 0 0 auto; }
  .moneylab-v3 [data-v3-breakdown-mount] .moneylab-reference-principles { grid-template-columns: minmax(0, 1fr); }
}
/* NCAA cards use the same single-column rail as NFL; targets cannot overlap. */
.moneylab-v3 [data-v3-advanced-assumptions] > #weightGrid {
  grid-template-columns: minmax(0, 1fr) !important;
}
.moneylab-v3 .team-scope {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  width: 100%;
}
.moneylab-v3 .team-scope > span, .moneylab-v3 .team-scope > .slider-target-prompt {
  grid-column: 1 / -1;
  white-space: normal;
}
.moneylab-v3 .team-scope > [data-scope] {
  position: relative;
  min-width: 0 !important;
  width: 100%;
  max-width: 100%;
  min-height: 44px !important;
  white-space: normal;
  overflow-wrap: anywhere;
}


/* Rail content must fit without clipping names or concealing data provenance. */
.moneylab-v3-wordmark { padding-left:12px; padding-right:12px; }
.moneylab-v3-wordmark strong { width:auto; max-width:100%; font-size:24px; letter-spacing:.035em; transform:none; }
.moneylab-v3-game-setup > header { padding-right:12px; height:auto; min-height:48px; }
.moneylab-v3-game-setup .moneylab-v3-field:has([data-v3-market]) { height:auto; min-height:78px; padding-right:12px; }
.moneylab-v3-game-setup .moneylab-v3-field:has([data-v3-market]) > strong { white-space:normal; overflow-wrap:anywhere; }
.moneylab-v3-game-setup .moneylab-v3-field > span { white-space:normal; overflow:visible; font-size:11px; line-height:1.4; }

/* Native selects must shrink with their grid track, including Safari's intrinsic
   option sizing. Bound the controls and each mount rather than hiding overflow. */
body.phase1-money-lab .moneylab-v3 :is(
  .moneylab-v3-game-field,
  .moneylab-v3-filter-field,
  [data-v3-game-mount],
  [data-v3-filter-mount],
  #moneyLabReferenceGameMount,
  #moneyLabReferenceFiltersMount,
  #nflGameFilters,
  .moneylab-schedule-selector
) {
  box-sizing: border-box;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
}
body.phase1-money-lab .moneylab-v3 :is(#nflGameFilters,.moneylab-schedule-selector) > label {
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  grid-template-columns: minmax(0,1fr);
}
body.phase1-money-lab .moneylab-v3 :is([data-v3-game-mount],[data-v3-filter-mount]) :is(select,input) {
  display: block;
  box-sizing: border-box;
  width: 100%;
  inline-size: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
}
