/* Same control for public documents and SPA shells. The native picker is
   available on script-free pages and browsers without the Popover API. */
.ht-choice-trigger,
select:not([multiple], [size]:not([size="1"]):not([size="0"])) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
  min-block-size: 36px;
  border: 0;
  border-radius: 8px;
  background-color: var(--terminal-control, #131e1c);
  color: var(--terminal-text, #f1f5f9);
  color-scheme: dark;
  font: 14px var(--tide-font-sans, "Inter", sans-serif);
}
select.ht-choice-enhanced {
  position: absolute !important;
  inset-inline-start: 0 !important;
  clip-path: inset(50%) !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  min-inline-size: 0 !important;
  min-block-size: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.ht-choice-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 0 10px;
  text-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ht-choice-trigger[hidden] { display: none; }
.ht-choice-trigger::after {
  content: "";
  flex: 0 0 auto;
  inline-size: 6px;
  block-size: 6px;
  margin: -3px 2px 0 3px;
  border: solid var(--terminal-label, #94a3b8);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.ht-choice-trigger[aria-expanded="true"]::after { transform: translateY(3px) rotate(225deg); }
.ht-choice-trigger:disabled { opacity: .48; cursor: not-allowed; }
.ht-choice-trigger:hover:not(:disabled), .ht-choice-trigger[aria-expanded="true"] {
  background-color: var(--terminal-control-hover, #182523);
}
.ht-choice-trigger:focus-visible, .ht-choice-option:focus-visible {
  outline: 2px solid var(--terminal-accent, #34d399);
  outline-offset: 2px;
}
select:focus-visible { outline: 2px solid var(--terminal-accent, #34d399); outline-offset: 2px; }
.ht-choice-caption { flex: 0 0 auto; color: var(--terminal-label, #94a3b8); }
.ht-choice-caption:empty { display: none; }
.ht-choice-value { min-inline-size: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-choice-panel {
  box-sizing: border-box;
  inline-size: max-content;
  max-inline-size: min(360px, calc(100vw - 16px));
  max-block-size: min(320px, 65vh);
  padding: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 12px;
  background: var(--terminal-surface, #0f1716);
  color: var(--terminal-text, #f1f5f9);
  color-scheme: dark;
  box-shadow: 0 14px 36px rgb(0 0 0 / 52%), var(--terminal-highlight, inset 0 1px 0 rgb(255 255 255 / 3%));
  font: 14px var(--tide-font-sans, "Inter", sans-serif);
}
.ht-choice-panel[popover] { position: fixed; inset: auto; margin: 0; }
.ht-choice-option {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-block-size: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: 1.3;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.ht-choice-option:is([aria-selected="true"], [aria-pressed="true"]) {
  color: var(--terminal-accent, #34d399);
  background: var(--terminal-control-hover, #182523);
}
.ht-choice-option[role="option"]::after {
  content: "";
  flex: 0 0 auto;
  inline-size: 6px;
  block-size: 10px;
  margin: -2px 4px 0 0;
  border: solid currentColor;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
  visibility: hidden;
}
.ht-choice-option[aria-selected="true"]::after { visibility: visible; }
.ht-choice-option[data-active] { background: var(--terminal-control-hover, #182523); box-shadow: inset 2px 0 var(--terminal-accent, #34d399); }
.ht-choice-option:hover:not([aria-disabled="true"], [aria-selected="true"], [aria-pressed="true"]) { background: var(--terminal-control-hover, #182523); }
.ht-choice-option[aria-disabled="true"] { opacity: .52; cursor: not-allowed; }
.ht-choice-group { padding: 7px 10px 4px; color: var(--terminal-label, #94a3b8); font-size: .82em; }
.ht-choice-invalid { display: block; color: var(--negative, #ff9196); font-size: .85em; }
.ht-choice-trigger[aria-invalid="true"] { box-shadow: inset 0 -2px var(--negative, #ff9196); }
@media (pointer: coarse) {
  .ht-choice-option { min-block-size: 44px; }
}
@media (forced-colors: active) {
  .ht-choice-option[data-active] { outline: 2px solid Highlight; outline-offset: -2px; }
  .ht-choice-option:is([aria-selected="true"], [aria-pressed="true"]) { text-decoration: underline; }
}
