/* Shared compact controls; the native select remains the form value and focus target. */
:root {
  --yx-control-border: color-mix(in srgb, var(--ink) 20%, var(--panel));
  --yx-control-hover: color-mix(in srgb, var(--brand-primary) 7%, var(--panel));
  --yx-control-on: color-mix(in srgb, var(--brand-primary) 12%, var(--panel));
  --yx-control-accent: #394dc5;
  --yx-pop-shadow: 0 8px 30px rgb(20 30 64 / 14%), 0 2px 6px rgb(20 30 64 / 7%);
}
:root[data-theme="dark"] {
  --yx-control-accent: #bac2ff;
  --yx-pop-shadow: 0 10px 34px rgb(0 0 0 / 38%);
}
:root body select:not([multiple]):where(:not([size]),[size="0"],[size="1"]) {
  appearance: none; -webkit-appearance: none;
  box-sizing: border-box; min-width: 0; max-width: 100%; min-height: var(--control-compact,30px);
  border: 1px solid var(--yx-control-border); border-radius: var(--radius-field,5px);
  background: var(--ui-field,var(--panel));
  color: var(--ink); padding: 3px 9px;
  font-family: var(--brand-font); font-weight: 550; line-height: 1.2;
  text-overflow: ellipsis; cursor: pointer;
  transition: background-color 120ms, border-color 120ms;
}
:root body select:is(:hover,[aria-expanded="true"]):enabled {border-color: var(--brand-focus); background-color: var(--yx-control-hover);}
:root body select:is(:disabled,[aria-disabled="true"]) {cursor: not-allowed; opacity: .55;}
:root body select[aria-busy="true"] {cursor: progress;}
:root body select[aria-invalid="true"] {border-color: var(--color-error);}
/* The wallet has the primary action; language is a quieter utility. */
:root {
  --yx-wallet-fill: #263e98;
  --yx-wallet-hover: #1e3180;
  --yx-wallet-text: #fff;
  --yx-pill-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2354627b' stroke-width='1.55'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cellipse cx='12' cy='12' rx='3.8' ry='8.5'/%3E%3Cpath d='M4 9h16M4 15h16'/%3E%3C/svg%3E");
  --yx-pill-wallet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8.5 14 5l1 3H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h14V8H6m14 4h-4a1.5 1.5 0 0 0 0 3h4'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  --yx-wallet-fill:#3d56bf;
  --yx-wallet-hover:#485fca;
  --yx-pill-globe:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9c4db' stroke-width='1.55'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cellipse cx='12' cy='12' rx='3.8' ry='8.5'/%3E%3Cpath d='M4 9h16M4 15h16'/%3E%3C/svg%3E");
}
:root body :is(header,nav) :is(select[id$="-language"],[data-wallet]) {
  --pill-height:var(--control-normal,38px); --pill-icon:18px; --pill-inset:10px; --pill-pad:12px;
  --pill-text-space:calc(var(--pill-inset) + var(--pill-icon) + 6px);
  position:relative; box-sizing:border-box; min-width:0; max-width:100%;
  height:var(--pill-height); min-height:var(--pill-height); border:1px solid var(--yx-control-border);
  border-radius:var(--radius-action,7px); box-shadow:none;
  padding:0 var(--pill-pad) 0 var(--pill-text-space);
  font:600 var(--font-control,13px)/1.15 var(--brand-font);
  text-align:start; white-space:nowrap; text-overflow:ellipsis;
}
:root body :is(header,nav) select[id$="-language"] {
  appearance:none; color:var(--ink);
  background:var(--yx-pill-globe) left var(--pill-inset) center / var(--pill-icon) var(--pill-icon) no-repeat var(--ui-field,var(--panel));
}
:root body :is(header,nav) [data-wallet] {
  color:var(--yx-wallet-text); background:var(--yx-wallet-fill); border-color:transparent;
}
:root body :is(header,nav) [data-wallet]:is(:hover,:focus-visible) {background:var(--yx-wallet-hover);}
:root body :is(header,nav) [data-wallet]::before {
  content:""; position:absolute; inset-inline-start:var(--pill-inset); top:50%; transform:translateY(-50%);
  width:var(--pill-icon); height:var(--pill-icon); border-radius:50%;
  background:var(--yx-wallet-mark,var(--yx-pill-wallet)) center / contain no-repeat;
}
:root body :is(header,nav) [data-wallet]:not([data-connected="true"])::after {content:none;}
:root body :is(header,nav) [data-wallet][data-connected="true"]::after {
  content:""; position:absolute; inset-inline-start:calc(var(--pill-inset) + var(--pill-icon) - 5px);
  top:calc(50% + var(--pill-icon) / 2 - 7px); width:6px; height:6px; box-sizing:content-box;
  border:1.5px solid var(--yx-wallet-fill); border-radius:50%; background:#a4ee6b;
}
[data-wallet-brand="trust"] {--yx-wallet-mark:url("/assets/wallets/trust.png?v=a945d0b3a8f0db8c");}
[data-wallet-brand="metamask"] {--yx-wallet-mark:url("/assets/wallets/metamask.png?v=00915223b885bd94");}
[data-wallet-brand="phantom"] {--yx-wallet-mark:url("/assets/wallets/phantom.png?v=705800517eca82a8");}
[data-wallet-brand="coinbase"] {--yx-wallet-mark:url("/assets/wallets/coinbase.png?v=0b08f68a7682953d");}
[data-wallet-brand="okx"] {--yx-wallet-mark:url("/assets/wallets/okx.png?v=92f8ec0e149b15e1");}
[data-wallet-brand="rabby"] {--yx-wallet-mark:url("/assets/wallets/rabby.png?v=8191e807298b8b67");}
[data-wallet-brand="walletconnect"] {--yx-wallet-mark:url("/assets/wallets/walletconnect.png?v=8890646fed545c76");}
:root body :is(header,nav) select[id$="-language"]:is(:hover,[aria-expanded="true"]) {
  background-color:var(--yx-control-hover); border-color:var(--brand-focus);
}
:root body :is(header,nav) :is(select[id$="-language"],[data-wallet]):focus-visible {
  outline:2px solid var(--brand-focus); outline-offset:2px;
}
.yx-select-menu {
  position: fixed; inset: auto; z-index: var(--layer-dialog,100); box-sizing: border-box;
  width: max-content; height: auto; margin: 0; padding: 4px;
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  border: 1px solid var(--yx-control-border); border-radius: 10px;
  color: var(--ink); background: var(--panel); box-shadow: var(--yx-pop-shadow);
  font: 500 13px/1.3 var(--brand-font); text-align: start; font-variant-numeric: tabular-nums;
}
.yx-menu-option {
  position: relative; display: flex; align-items: center; min-height: 33px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere;
}
.yx-menu-option:is(:hover,[data-active]) {background: var(--yx-control-hover);}
.yx-menu-option[aria-selected="true"] {color: var(--yx-control-accent); font-weight: 650;}
.yx-menu-option[aria-disabled="true"] {color: var(--muted); opacity: .55; cursor: not-allowed;}
.yx-menu-group {padding: 7px 10px 3px; color: var(--muted); font-size: 11px; font-weight: 600;}
:root body .terminal :is(.chart-controls,.book-controls,.market-sort) select {
  min-height: var(--control-compact,30px); padding-block: 2px; font-size: 11px;
}
:root body .terminal :is(.chart-controls [data-interval],.venue-filters button,.drawing-toolbar [data-draw-tool]) {
  border-radius: 6px; border: 1px solid transparent;
}
:root body .terminal :is(.chart-controls [data-interval],.venue-filters button,.drawing-toolbar [data-draw-tool])[aria-pressed="true"] {
  color: var(--yx-control-accent); background: var(--yx-control-on);
}
.terminal .market-select-button {border: 1px solid transparent; border-radius: 8px; padding: 4px 7px;}
.terminal .market-select-button:hover,.terminal .venue-market-row:has(.venue-choice:hover) {background: var(--yx-control-hover);}
.terminal .venue-market-row:has(.venue-choice[aria-pressed="true"]) {background: var(--yx-control-on);}
.terminal .venue-choice[aria-pressed="true"] {color: var(--yx-control-accent);}
#venue-market-list[aria-busy="true"] p {color: var(--muted);}
#venue-market-list[data-state="error"] p {color: var(--color-error);}
#ticket-leverage-field summary {padding-block: 5px; border-radius: 5px; cursor: pointer;}
#ticket-leverage-field[open] summary {color: var(--yx-control-accent);}
:root body .terminal input:is([type="radio"],[type="checkbox"]) {accent-color: var(--brand-primary);}
@media (max-width: 800px) {
  .yx-menu-option {min-height: var(--control-touch,44px);}
  :root body .terminal :is(.chart-controls,.book-controls,.market-sort) select {min-height: 32px;}
  :root body .terminal-nav-actions select, :root body .terminal-nav-actions [data-wallet] {font-size: 11px;}
  :root body :is(header,nav) :is(select[id$="-language"],[data-wallet]) {
    --pill-height:36px; --pill-icon:17px; --pill-inset:6px; --pill-pad:8px;
    --pill-text-space:calc(var(--pill-inset) + var(--pill-icon) + 5px); font-size:12px;
  }
}
@media(prefers-reduced-motion: reduce) {
  :root body select,:root body header [data-wallet] {transition: none;}
}
@media(forced-colors: active) {
  :root body select:not([multiple]):where(:not([size]),[size="0"],[size="1"]) {appearance: none; background-image: none; border:1px solid ButtonText; color:ButtonText;}
  .yx-menu-option[data-active] {outline: 1px solid Highlight; outline-offset: -1px;}
}

@media(max-width:380px) {
  .overview .masthead {gap:6px;padding-inline:10px;}
  .overview .home-utilities {gap:4px;}
  :root body :is(header,nav) :is(select[id$="-language"],[data-wallet]) {
    --pill-icon:16px; --pill-inset:5px; --pill-pad:6px; font-size:11px;
  }
}

/* One navigational type scale; keep terminal labels compact. */
:is(.product-nav,.fund-nav,.masthead,.site-nav) nav a {
  font-family:var(--brand-font);
  font-weight:var(--weight-label);
  text-underline-offset:.28em;
}
:is(.product-nav,.fund-nav) nav a {white-space:nowrap;}
:is(.product-nav,.fund-nav) nav a:is(:hover,:focus-visible) {color:var(--ui-link);}
:is(.product-nav,.fund-nav) nav a[aria-current="page"] {
  color:var(--ui-link); text-decoration:underline; text-decoration-thickness:2px;
}
body header .yx-theme-button {
  position:relative; display:inline-grid; place-items:center; flex:none;
  box-sizing:border-box; height:32px; width:32px; min-height:32px;
  padding:0; border:1px solid transparent; border-radius:50%;
  color:var(--ink); background:transparent; cursor:pointer;
}
body header .yx-theme-button::before {
  content:""; width:17px; height:17px; background:currentColor;
  mask:var(--theme-icon) center/contain no-repeat;
  -webkit-mask:var(--theme-icon) center/contain no-repeat;
  --theme-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.2 14.7a8.6 8.6 0 0 1-10.9-11 8.7 8.7 0 1 0 10.9 11Z'/%3E%3C/svg%3E");
}
[data-theme="dark"] body header .yx-theme-button::before {
  --theme-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='3.7'/%3E%3Cpath d='M12 2v3m0 14v3M2 12h3m14 0h3M4.9 4.9l2.2 2.2m9.8 9.8 2.2 2.2m0-14.2-2.2 2.2m-9.8 9.8-2.2 2.2'/%3E%3C/svg%3E");
}
body header .yx-theme-button:is(:hover,:focus-visible) {background:var(--yx-control-hover);border-color:var(--yx-control-border);}
.yx-select-menu {padding:5px; scrollbar-color:var(--yx-control-border) transparent;}
.yx-menu-option {gap:8px;}
.yx-menu-option[data-active] {box-shadow:inset 2px 0 var(--brand-primary);}
.yx-menu-option[aria-selected="true"] {background:var(--yx-control-on);}
.yx-menu-option[aria-disabled="true"] {box-shadow:none;background:transparent;}
@media (pointer:coarse) {body header .yx-theme-button {min-width:42px; min-height:42px;}}
@media (max-width:699px) {
  .overview .mobile-menu .yx-theme-button {justify-self:start;width:auto;gap:9px;grid-auto-flow:column;padding:0 4px;font:inherit;}
  .overview .mobile-menu .yx-theme-button::after {content:attr(aria-label);}
}


@media (pointer:coarse) {
  :root body :is(header,nav) :is(select[id$="-language"],[data-wallet]) {--pill-height:var(--control-touch,44px);}
  :root body select:not([multiple]):where(:not([size]),[size="0"],[size="1"]) {min-height:var(--control-touch,44px);}
}
@media (forced-colors:active) {
  :root body :is(header,nav) :is(select[id$="-language"],[data-wallet]) {border:1px solid ButtonText;}
}
