/* v17 native select contrast. Load after the v16 surfaces and v17 button paint.
   Keep the browser picker, arrow, keyboard/touch behavior and control geometry.
   An OS-managed picker may override author colors; verify its actual popup too. */
body select,
body #detail-dialog select,
body.game-interface .field select {
  color-scheme:dark;
  color:#fff4dc;
  background-color:#132630;
  border-color:#adc4c7;
  -webkit-text-fill-color:currentColor;
}

/* Option backgrounds are independent of the decorated collapsed select face.
   Never pair the inherited pale label with an unspecified native light surface. */
body select option,
body select optgroup {
  color-scheme:dark;
  color:#fff4dc;
  background:#132630;
  -webkit-text-fill-color:currentColor;
  text-shadow:none;
  opacity:1;
}

body select option:checked {
  color:#fff4dc;
  background:#325c66;
}

body select:disabled,
body #detail-dialog select:disabled,
body.game-interface .field select:disabled {
  /* The v16 field selector gains specificity from its text-input exclusions. */
  color:#b9c9d5!important;
  opacity:1;
}
body select option:disabled,
body select optgroup:disabled,
body select optgroup:disabled option,
body select:disabled option {
  color:#b9c9d5;
  background:#182a34;
}

body select:focus-visible,
body #detail-dialog select:focus-visible,
body.game-interface .field select:focus-visible {
  outline:3px solid #f5d99e;
  outline-offset:2px;
}

/* Respect the user's system high-contrast palette instead of forcing game ink. */
@media (forced-colors:active) {
  body select,
  body #detail-dialog select,
  body.game-interface .field select,
  body select option,
  body select optgroup {
    color-scheme:light dark;
    /* Override the existing v16 field paint while retaining native UA mapping. */
    color:CanvasText!important;
    background:Canvas!important;
    border-color:CanvasText!important;
    forced-color-adjust:auto;
    -webkit-text-fill-color:currentColor;
  }
  body select option:checked {
    color:HighlightText!important;
    background:Highlight!important;
  }
  body select:disabled,
  body #detail-dialog select:disabled,
  body.game-interface .field select:disabled,
  body select option:disabled,
  body select optgroup:disabled,
  body select optgroup:disabled option,
  body select:disabled option {
    color:GrayText!important;
    background:Canvas!important;
  }
  body select:focus-visible,
  body #detail-dialog select:focus-visible,
  body.game-interface .field select:focus-visible {
    outline-color:Highlight;
  }
}
