:root {
  color-scheme: dark;
  --ui-page: #212429;
  --ui-panel: #191b1f;
  --ui-raised: #2c2f36;
  --ui-hover: #353841;
  --ui-border: #40444f;
  --ui-text: #ffffff;
  --ui-muted: #c3c5cb;
  --ui-subtle: #8f96ac;
  --ui-soft: #b2b9d2;
  --ui-icon: #565a69;
  --ui-accent: #f3b71e;
  --ui-chart: #000000;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ui-page: #f7f8fa;
  --ui-panel: #ffffff;
  --ui-raised: #edf0f5;
  --ui-hover: #e4e8ef;
  --ui-border: #d5dae3;
  --ui-text: #202531;
  --ui-muted: #51596a;
  --ui-subtle: #626c7e;
  --ui-soft: #626c7e;
  --ui-icon: #8c96a7;
  --ui-accent: #946600;
  --ui-chart: #ffffff;
}
.dmxuPu > img { width: 40px; height: 40px; object-fit: contain; display: block; }
#swap-page svg[stroke="#FFFFFF"] { stroke: var(--ui-text); }
@media (max-width: 720px) { .dmxuPu > img { width: 32px; height: 32px; } }
.fst-popups {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 1rem;
  width: min(355px, calc(100% - 2rem));
  display: grid;
  gap: 20px;
}
.fst-popups .bPPnFe { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .fst-popups { width: calc(100% - 2rem); display: flex; overflow-x: auto; scrollbar-width: none; }
  .fst-popups > .cCnyGV { flex: 0 0 min(300px, 100%); min-width: 0; margin-inline-end: 0; }
}
.fst-social-link { text-decoration: none; min-height: 42px; }
.fst-social-link > span { display: inline-flex; align-items: center; gap: 10px; }
.fst-social-link svg, .fst-theme-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }
.fst-social-link:focus-visible, .fst-theme-toggle:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; border-radius: 4px; }
.fst-market-status { padding: 8px 10px; font-size: 11px; line-height: 1.5; color: var(--ui-muted); }
.fst-chart-wrap { background: var(--ui-chart) !important; }
.fst-chart-wrap .hYtEsE span { color: var(--ui-muted); }
.fst-chart-wrap .hYtEsE .active { color: var(--ui-accent); }
.fst-chart-wrap .keaJxJ { color: var(--ui-text); background: var(--ui-chart); pointer-events: none; }
.fst-trades-scroll { max-height: 500px; width: 100%; overflow: auto; margin-bottom: 20px; }
.fst-trades-scroll table { width: 1020px; line-height: 35px; font-size: 0.8rem; border-collapse: collapse; }
.fst-trades-scroll tr { border-bottom: 1px solid var(--ui-border); }

/* Shared swap/liquidity picker: only the results scroll; header and footer stay visible. */
.fst-token-dialog[data-reach-dialog-content] {
  height: 80vh; height: 80dvh; min-height: 0; max-height: 80vh; max-height: 80dvh;
  overflow: hidden;
}
.fst-token-dialog > .hWZtKW { min-height: 0; overflow: hidden; }
.fst-token-dialog .kcbEdf, .fst-token-dialog .eDdLkf, .fst-token-dialog .jLNbCu { flex-shrink: 0; }
.fst-token-results { flex: 1 1 0%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.fst-token-results > div { padding-bottom: 8px; }
.fst-token-results [role="button"] { min-height: 56px; height: auto; }
.fst-token-results .css-8mokm4, .fst-token-results .css-165qfk5 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fst-token-results [role="button"] > .dkvoaW { min-width: 0; }
.fst-common-tokens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fst-common-token {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0;
  padding: 8px 5px; border: 1px solid var(--ui-border); border-radius: 12px;
  color: var(--ui-text); background: var(--ui-panel); cursor: pointer; font: inherit; font-size: 13px;
}
.fst-common-token > img, .fst-common-token > svg { width: 18px; height: 18px; flex-shrink: 0; }
.fst-common-token:disabled { opacity: .45; cursor: default; }
.fst-common-token:not(:disabled):hover { background: var(--ui-raised); }
.fst-common-token:focus-visible, .fst-token-results [role="button"]:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; }
.fst-pool-status { padding: 8px 16px; }
.fst-pool-status p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ui-subtle); }

/* Keep the existing panel design; give the desktop swap card 5% more width. */
@media (min-width: 961px) { .fst-swap-card { max-width: 504px; } }
.fst-balance-row { flex-wrap: wrap; gap: 4px 0; height: auto !important; min-height: 17px; }
.fst-balance-row .css-djrxae { overflow-wrap: anywhere; }
.fst-balance-row .cfnxzr { white-space: nowrap; }
.fst-balance-row .cfnxzr:disabled { opacity: 0.45; cursor: default; }
.fst-balance-row .cfnxzr:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }

/* Separate the amount fields from their balance and Max actions on the swap page. */
.fst-swap-card #swap-page > .dcfnNF { grid-template-columns: minmax(0, 1fr); }
.fst-swap-card #swap-page > .dcfnNF > * { min-width: 0; }
.fst-swap-card #swap-page :is(#swap-currency-input, #swap-currency-output),
.fst-swap-card #swap-page :is(#swap-currency-input, #swap-currency-output) > .jhmeqW {
  background: transparent;
  border: 0;
}
.fst-swap-card #swap-page .buISKp {
  min-width: 0;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--ui-raised);
  border-radius: 20px;
  background: var(--ui-page);
}
.fst-swap-card #swap-page .buISKp:focus-within { border-color: var(--ui-border); }
.fst-swap-card #swap-page .open-currency-select-button {
  flex-shrink: 0;
  max-width: 55%;
  margin-right: 0;
  font-size: 20px;
}
.fst-swap-card #swap-page .token-symbol-container { overflow: hidden; text-overflow: ellipsis; }
.fst-swap-card #swap-page .cFosER { min-width: 0; gap: 8px; }
.fst-swap-card #swap-page .cFosER > .iWJdVe { min-width: 0; }
.fst-swap-card #swap-page .SzIbk { flex-shrink: 0; }
.fst-swap-card #swap-page .token-amount-input { min-width: 0; font-variant-numeric: tabular-nums; }
.fst-swap-card #swap-page .fNKPVt { padding: 6px 4px 0; }
.fst-swap-card #swap-page .fst-balance-row { width: 100%; gap: 4px 12px; }
.fst-swap-card #swap-page .fst-balance-row .css-djrxae { flex: 1 1 0; min-width: 0; font-size: 12px; line-height: 20px; }
.fst-swap-card #swap-page .fst-balance-row .cfnxzr {
  flex: 0 0 auto;
  min-height: 28px;
  margin: 0 0 0 auto;
  padding: 4px 10px;
  background: var(--ui-raised);
  border-radius: 8px;
  font-size: 12px;
  line-height: 20px;
}
.fst-balance-row { display: flex; align-items: center; width: 100%; gap: 4px 8px; }
.fst-balance-row > .css-djrxae { flex: 1 1 120px; min-width: 0; font-size: 12px; line-height: 20px; }
.fst-balance-actions { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; margin-left: auto; white-space: nowrap; }
.fst-balance-actions .fst-balance-action,
.fst-swap-card #swap-page .fst-balance-row .fst-balance-actions .fst-balance-action {
  appearance: none;
  flex: 0 0 auto;
  min-height: 28px;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--ui-raised);
  color: var(--ui-accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  cursor: pointer;
}
.fst-balance-actions .fst-balance-action:enabled:hover { border-color: var(--ui-accent); }
.fst-balance-actions .fst-balance-action:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.fst-balance-actions .fst-balance-action:disabled { opacity: 0.45; cursor: default; }
.fst-swap-card #swap-page .hDVbXn { margin-top: 8px; margin-bottom: 8px; }
.fst-swap-card #swap-page .open-currency-select-button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }

/* The live block link sits above the mobile navigation, including its safe area. */
@media (max-width: 960px) {
  .kStqaV {
    display: flex;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--ui-page);
    z-index: 2;
  }
  .kStqaV .gXlyCc { opacity: 0.85; }
  .jkedYv { padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  .fIPKBG { margin-top: calc(7rem + env(safe-area-inset-bottom, 0px)); }
}

/* Wallet choices remain scrollable at short heights. */
.fst-wallet-dialog[data-reach-dialog-content]{max-height:calc(100dvh - 24px);overflow-y:auto}
.fst-wallet-dialog .fvKtIt[hidden]{display:none}
.fst-wallet-dialog button{min-height:56px}
.fst-wallet-status{margin:10px 0 0;font-size:13px;line-height:1.5;color:var(--ui-subtle)}
.fst-wallet-status:empty{display:none}
.fst-wallet-qr{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:12px;background:#fff;border-radius:12px;min-height:240px;color:#111}
.fst-wallet-qr canvas{max-width:100%;height:auto!important}
.fst-wallet-open-app{color:#725000;text-decoration:underline}
/* Use the visible viewport above a software keyboard, rather than layout vh. */
.fst-token-dialog.fst-keyboard-open[data-reach-dialog-content]{height:calc(var(--fst-visible-height) - 16px);max-height:calc(var(--fst-visible-height) - 16px);margin:0}
.fst-token-dialog.fst-keyboard-open .kcbEdf{padding:10px 14px;gap:8px}
.fst-token-dialog.fst-keyboard-open .kcbEdf > .jmNfaf{display:none}
.fst-token-dialog.fst-keyboard-open .fst-common-tokens{display:none}
.fst-token-dialog.fst-keyboard-open #token-search-input{padding:10px 12px;font-size:16px}
.fst-token-dialog.fst-keyboard-open .fst-token-results [role=button]{min-height:48px;padding-top:4px;padding-bottom:4px}
.fst-token-dialog.fst-keyboard-open .eDdLkf{padding:8px 14px}
.fst-token-dialog.fst-keyboard-open .fst-keyboard-dismiss{display:block}
.fst-keyboard-dismiss{display:none;border:0;background:none;color:var(--ui-accent);padding:4px 8px;cursor:pointer;font:inherit}

.fst-pool-management.fQDkfy { background: transparent; }
.dPzCpt:has(.fst-pool-management) > .ibtXyT > .boqFeG { background-color: var(--ui-page); }
.fst-pool-management #swap-page,
.fst-pool-management .bWHOHv,
.fst-pool-position {
  background: var(--ui-panel);
  border: 1px solid var(--ui-raised);
  border-radius: 16px;
}
.fst-pool-management .bWHOHv, .fst-pool-positions { margin-top: 12px; }
.fst-pool-positions { display: grid; gap: 12px; }
.fst-pool-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.fst-pool-management #swap-page > .fst-pool-actions { margin-top: 16px; }
.fst-pool-actions .bCtKAO {
  width: 100%;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: 12px;
  font-size: clamp(13px, 3.8vw, 16px);
  white-space: normal;
}
.fst-pool-position { padding: clamp(12px, 3.75vw, 18px); }
.fst-pool-position > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}
.fst-pool-position > summary::-webkit-details-marker { display: none; }
.fst-pool-position > summary:focus-visible,
.fst-pool-actions a:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }
.fst-pool-position-pair, .fst-pool-position-icon { display: inline-flex; align-items: center; flex: none; }
.fst-pool-position-pair > :is(img, svg) { width: 24px; height: 24px; }
.fst-pool-position-pair > :nth-child(2) { margin-left: -6px; }
.fst-pool-position-icon > :is(img, svg) { width: 19px; height: 19px; }
.fst-pool-position-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 18px; font-weight: 600; }
.fst-pool-position-chevron {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(243, 183, 30, 0.12);
  color: var(--ui-accent);
}
.fst-pool-position-chevron::after {
  content: "";
  width: 8px;
  height: 8px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}
.fst-pool-position[open] .fst-pool-position-chevron::after { transform: translateY(2px) rotate(225deg); }
.fst-pool-position dl { margin: 8px 0 12px; }
.fst-pool-position dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  font-size: 14px;
}
.fst-pool-position dl > div + div { border-top: 1px solid var(--ui-raised); }
.fst-pool-position dt { display: flex; align-items: center; gap: 7px; color: var(--ui-muted); overflow-wrap: anywhere; }
.fst-pool-position dd { max-width: min(32vw, 185px); margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }

/* Fit the existing cards and shared token picker to the phone viewport. */
@media (max-width: 720px) {
  :is(.fst-swap-card, .fst-liquidity-page).fQDkfy {
    width: calc(100% - 24px);
    margin-inline: 12px;
    margin-top: clamp(76px, 12vh, 112px);
  }
  .fst-swap-card #swap-page .buISKp {
    gap: clamp(6px, 2vw, 12px);
    padding: clamp(8px, 3vw, 16px);
  }
  .fst-swap-card #swap-page .open-currency-select-button {
    min-height: 44px;
    max-width: 51%;
    font-size: clamp(16px, 4.8vw, 20px);
  }
  .fst-swap-card #swap-page .cFosER { gap: 6px; }
  .fst-swap-card #swap-page .token-amount-input {
    font-size: clamp(18px, 5.6vw, 24px);
  }
  .fst-swap-card #swap-page .fst-balance-row { gap: 4px 6px; }
  .fst-swap-card #swap-page .fst-balance-row > .css-djrxae { flex-basis: 90px; }
  .fst-swap-card #swap-page .fst-balance-row .fst-balance-action {
    min-height: 32px;
    padding-inline: 5px;
  }
  .fst-swap-card #swap-page .hDVbXn { margin-block: 2px; }
  .fst-swap-card .cKJcLm > div { gap: 8px; }
  .fst-swap-card .cKJcLm .css-16sxy43 {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .fst-swap-card .cKJcLm .css-q0g5a7 { flex-wrap: wrap; justify-content: flex-end; }

  .fst-token-dialog[data-reach-dialog-content] { width: min(420px, calc(100% - 24px)); }
  .fst-token-dialog .kcbEdf { padding: clamp(12px, 3.8vw, 20px); gap: 10px; }
  .fst-token-dialog #token-search-input { min-height: 44px; padding: 10px 12px; font-size: 16px; }
  .fst-token-dialog .eDdLkf { padding: 8px clamp(12px, 3.8vw, 20px); }
  .fst-token-dialog .list-token-manage-button { min-height: 40px; }
  .fst-common-tokens { gap: 4px; }
  .fst-common-token { min-height: 38px; padding-inline: 3px; font-size: 12px; gap: 4px; }
  .fst-token-results :is(.hkWdsr, .hhKaCX, .LPcFh) {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 26%);
    gap: clamp(8px, 2.5vw, 16px);
    min-height: 50px;
    padding-inline: clamp(12px, 3.8vw, 20px);
  }
  .fst-token-results :is(.hkWdsr, .hhKaCX, .LPcFh) > span:empty { display: none; }
  .fst-token-results .hpHOqm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .fst-token-dialog.fst-keyboard-open .kcbEdf { padding-block: 6px; gap: 4px; }
  .fst-token-dialog.fst-keyboard-open .fst-token-results [role="button"] { min-height: 44px; }
  .fst-token-dialog.fst-keyboard-open .eDdLkf { padding-block: 4px; }
}

/* Center the original desktop navigation in the page viewport, even beside a wallet panel. */
@media (min-width: 961px) {
  .boqFeG, .gJyWFR {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .jkedYv { justify-self: center; }
}
/* Preserve balances and wallet controls when the desktop viewport narrows. */
@media (min-width: 961px) and (max-width: 1100px) {
  .hbURQO .APMAQ { padding-inline: 8px; margin-right: 6px; }
  .hbURQO .falNtq { padding-left: 8px; padding-right: 4px; }
  .hbURQO .fzBwMs { padding-inline: 6px; }
  .hbURQO .gmWIYM { margin-left: 2px; margin-right: 6px; }
}

/* Keep liquidity controls within the existing card on narrow screens. */
@media (max-width: 720px) {
  .fst-liquidity-page .dbEdQm {
    padding-inline: clamp(12px, 4vw, 20px);
  }
  .fst-liquidity-page .dbEdQm > :is(.dcfoEc, .dcfnNF) {
    grid-template-columns: minmax(0, 1fr);
  }

  .fst-liquidity-page .buISKp,
  .fst-liquidity-page .fNKPVt {
    padding-inline: clamp(8px, 3vw, 16px);
  }
  .fst-liquidity-page .open-currency-select-button {
    min-height: 44px;
    max-width: 56%;
    margin-right: 8px;
  }
  .fst-liquidity-page .open-currency-select-button.hZyjaL {
    max-width: 64%;
  }
  .fst-liquidity-page .open-currency-select-button .iWJdVe {
    min-width: 0;
  }
  .fst-liquidity-page .open-currency-select-button :is(img, svg) {
    flex-shrink: 0;
  }
  .fst-liquidity-page .token-symbol-container {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(14px, 4vw, 18px);
  }
  .fst-liquidity-page .token-amount-input {
    min-width: 0;
    font-size: clamp(20px, 5vw, 24px);
  }
  .fst-liquidity-page .fst-balance-actions {
    gap: 4px;
    max-width: 100%;
  }
  .fst-liquidity-page .fst-balance-actions .fst-balance-action {
    min-height: 32px;
    padding-inline: 5px;
  }
  .fst-liquidity-page .gplWWU .dmuRTh,
  .fst-liquidity-page .bTkpzO,
  .fst-liquidity-page .bWHOHv .css-1mkknq7 {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .fst-liquidity-page .gOauOq > .jmNfaf > div:first-child {
    min-width: 0;
  }
  .fst-liquidity-page .gOauOq :is(img, svg) {
    flex-shrink: 0;
  }
  .fst-liquidity-page .gOauOq .css-6dfm9t {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fst-liquidity-page .dDFCFi {
    margin-inline: 0;
  }
  .fst-liquidity-page .GhknT {
    min-height: 36px;
    margin-inline: 0;
  }
  .fst-liquidity-page .exvWjX .dcfoDv > .jmNfaf {
    gap: 8px;
  }
  .fst-liquidity-page .exvWjX .css-1kwqs79 {
    overflow-wrap: anywhere;
    font-size: clamp(18px, 5vw, 24px);
  }
  .fst-liquidity-page .exvWjX .dcfoDv .iWJdVe {
    width: auto;
    max-width: 55%;
    flex-shrink: 0;
  }
  .fst-liquidity-page .exvWjX .dcfoDv .iWJdVe :is(img, svg) {
    flex-shrink: 0;
  }
  .fst-liquidity-page .exvWjX .dcfoDv .iWJdVe .css-1kwqs79 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .fst-liquidity-page .fst-liquidity-rate .jmNfaf {
    gap: 8px;
  }
  .fst-liquidity-page .fst-liquidity-rate .jmNfaf > div:last-child {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .fst-liquidity-page .llqzho {
    min-width: 0;
    width: min(18.125rem, calc(100vw - 40px));
  }
  .fst-liquidity-page .llqzho .bPPnFe > .jmNfaf {
    gap: 4px;
  }
  .fst-liquidity-page .llqzho .bPPnFe > .jmNfaf > .bRgAhW:not([tabindex]) {
    min-width: 0;
    margin-right: 0;
  }
}
