/* Shared dropdown appearance: native selectors, app listboxes and player pickers. */
:root[data-theme="dark"] {
  --menu-surface: #181818;
  --menu-field: #121212;
  --menu-border: #454545;
  --menu-hover: #333333;
  --menu-selected: #3a3a3a;
  --menu-text: #e7e7e7;
  --menu-muted: #b1b1b1;
  --menu-accent: #b7b7b7;
}

html[data-theme="dark"] :is(select, .select-trigger, .player-picker) {
  min-height: 42px;
  color: var(--menu-text);
  background-color: var(--menu-field);
  border: 1px solid var(--menu-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}
html[data-theme="dark"] select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239eafc7' stroke-width='1.7' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
}
html[data-theme="dark"] :is(select, .select-trigger, .player-picker):hover:not(:disabled) { border-color: #7a7a7a; }
html[data-theme="dark"] :is(select:focus-visible, .select-trigger:focus-visible, .player-picker:focus-visible) {
  outline: 2px solid #aaaaaa;
  outline-offset: 2px;
  border-color: #aaaaaa;
  box-shadow: none;
}
html[data-theme="dark"] :is(select:open, .select-trigger.is-open, .player-picker[aria-expanded="true"]) {
  border-color: #aaaaaa;
  background-color: #202020;
}
html[data-theme="dark"] :is(select, .select-trigger, .player-picker):disabled { opacity: .5; cursor: not-allowed; }
html[data-theme="dark"] option { color: var(--menu-text); background: var(--menu-surface); }
html[data-theme="dark"] optgroup { color: var(--menu-muted); background: var(--menu-surface); font-size: 11px; font-weight: 600; }

/* Customizable native menus retain platform keyboard and form behavior. */
@supports (appearance: base-select) {
  html[data-theme="dark"] select:not([multiple]):not([size]),
  html[data-theme="dark"] select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
  html[data-theme="dark"] select:not([multiple]):not([size]) { display: flex; align-items: center; gap: 12px; background-image: none; padding-right: 12px; }
  html[data-theme="dark"] select::picker-icon { color: #adadad; margin-left: auto; transition: rotate .15s ease; }
  html[data-theme="dark"] select:open::picker-icon { rotate: 180deg; }
  html[data-theme="dark"] select::picker(select) {
    color: var(--menu-text);
    background: var(--menu-surface);
    border: 1px solid var(--menu-border);
    border-radius: 10px;
    padding: 6px;
    margin-top: 7px;
    box-shadow: 0 14px 36px #0006;
    max-height: min(320px, 60dvh);
    max-width: calc(100vw - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #6f6f6f var(--menu-surface);
  }
  html[data-theme="dark"] select option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 10px 12px;
    margin: 2px 0;
    border: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
  }
  html[data-theme="dark"] select option:is(:hover, :focus) { outline: none; background: var(--menu-hover); }
  html[data-theme="dark"] select option:checked { color: #d7d7d7; background: var(--menu-selected); font-weight: 600; }
  html[data-theme="dark"] select option::checkmark { order: 1; margin-left: auto; color: var(--menu-accent); }
  html[data-theme="dark"] select option:disabled { color: #888888; background: transparent; cursor: not-allowed; }
}

html[data-theme="dark"] :is(.select-menu, .player-picker-menu) {
  background: var(--menu-surface);
  border: 1px solid var(--menu-border);
  border-radius: 10px;
  box-shadow: 0 14px 36px #0006;
  color: var(--menu-text);
}
html[data-theme="dark"] .select-list { padding: 6px; }
html[data-theme="dark"] :is(.select-option, .player-picker-option) {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--menu-text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  background: transparent;
}
html[data-theme="dark"] :is(.select-option, .player-picker-option):is(:hover, :focus-visible) { background: var(--menu-hover); outline: none; }
html[data-theme="dark"] :is(.select-option, .player-picker-option).is-selected { background: var(--menu-selected); color: #d7d7d7; font-weight: 600; }
html[data-theme="dark"] :is(.select-option-check, .select-option-icon, .select-trigger-icon) { color: var(--menu-accent); }
html[data-theme="dark"] :is(.select-option-hint, .select-note, .select-trigger-chevron) { color: var(--menu-muted); }
html[data-theme="dark"] .select-option.is-muted { color: var(--menu-muted); }
html[data-theme="dark"] .select-menu.is-sheet { border-radius: 14px 14px 0 0; }
html[data-theme="dark"] .select-sheet-header { background: #1c1c1c; border-color: var(--menu-border); }
html[data-theme="dark"] .select-sheet-title { color: var(--menu-text); font-size: 15px; }
html[data-theme="dark"] .select-field.is-sm .select-trigger { min-height: 34px; padding: 6px 10px; font-size: 12px; }
@media (max-width: 640px) {
  html[data-theme="dark"] :is(select, .select-trigger, .player-picker) { min-height: 44px; font-size: 16px; }
  html[data-theme="dark"] .select-menu.is-sheet .select-option { min-height: 48px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] select::picker-icon { transition: none; }
}
