@font-face {
  font-family: "BitLadder Web Rubik Dirt";
  src: url("../assets/release/rubik-dirt-regular.ttf") format("truetype");
  font-display: block;
}

.swap-settings-feedback {
  min-height: 18px;
  margin: 0;
  color: #9cb2d4;
  font-size: 11px;
  line-height: 1.45;
}

.history-share-modal [hidden] {
  display: none !important;
}

html,
body {
  max-width: 100%;
}

input,
select,
textarea {
  font: inherit;
}

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* Browser focus must stay inside the canonical Desktop amount card instead of
   clipping its top edge or crossing the fiat-value row. */
.swap-pro-amount-card input:focus-visible {
  outline: 0;
}

.swap-pro-amount-card:focus-within {
  border-color: rgba(105, 225, 170, 0.42);
  box-shadow: inset 0 0 0 1px rgba(105, 225, 170, 0.12);
}

.swap-token-dropdown .swap-modal-search input:focus-visible {
  outline: 0;
}

.swap-direction-button svg {
  transform-origin: center;
}

.swap-direction-button.swap-direction-flipping svg {
  animation: swap-direction-flip 320ms ease;
}

@keyframes swap-direction-flip {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

.desktop-update-button {
  display: none !important;
}

.history-table-scroll,
.manage-table-wrap,
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

#view-pool-search .toolbar-main {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}

/* Keep Desktop's single-row Min/Max controls while giving long browser price
   strings enough room to remain fully visible beside the percentage field. */
#view-create .range-input-grid {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

/* Browser widths must keep the complete Desktop price string and its action
   in normal flow; the Desktop absolute placement can overlap longer values. */
.range-center-price-line {
  padding-inline: 0;
}

.range-center-card .range-center-price-line .price-refresh-button {
  position: static;
  flex: 0 0 30px;
}

.status-card:nth-child(4) strong {
  white-space: nowrap;
}

@media (min-width: 1161px) and (max-width: 1399px) {
  .app-header > div:first-child { flex: 1 1 auto; min-width: 0; }
  .header-status-bar { flex: 0 0 614px; flex-wrap: nowrap; }
  .status-card,
  .status-card-updated,
  .status-card-license { flex: 0 0 118px; }
}

/* The browser shell reserves more horizontal space for its outer navigation
   than Desktop. Wrap the canonical Manage batch controls before they can sit
   underneath the 320px Local Keystore sidebar and intercept network clicks. */
@media (min-width: 1161px) and (max-width: 1750px) {
  .manage-card-head-compact {
    flex-wrap: wrap;
  }

  .manage-batch-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    margin-left: 0;
    order: 3;
  }
}

@media (max-width: 1160px) {
  body {
    min-width: 0;
    padding: 0;
  }

  .app-shell {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    margin: 0;
    padding: 12px 10px calc(78px + env(safe-area-inset-bottom));
  }

  .app-sidebar {
    position: fixed;
    z-index: 1000;
    inset: auto 0 0;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-width: 1px 0 0;
    border-radius: 0;
    background: rgba(12, 16, 21, 0.98);
  }

  .brand-block {
    display: none;
  }

  .app-nav {
    display: contents;
  }

  .app-nav-footer {
    margin-top: 0;
  }

  .nav-link {
    min-width: 0;
    min-height: 52px;
    padding: 6px 2px;
    border-radius: 9px;
    font-size: clamp(9px, 2.7vw, 11px);
    text-align: center;
    overflow-wrap: anywhere;
  }

  .app-main {
    min-width: 0;
  }

  .search-box {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-box #pool-query {
    grid-column: 1 / -1;
  }

  .search-box > button {
    width: auto;
    min-width: 0;
  }

  .toolbar-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .toolbar-main .field,
  .toolbar-main .field select,
  #sort-select,
  #fee-tvl-interval,
  #dex-filter,
  #quote-token-filter,
  #pool-chain-select,
  .pool-chain-selector,
  .pool-chain-selector .network-select {
    width: 100%;
    min-width: 0;
  }

  .toolbar-main .pool-type-filter-field,
  .toolbar-main fieldset.field.pool-type-filter-field {
    grid-column: 1 / -1;
    width: 100%;
  }

  #view-pool-search .toolbar-main select,
  #view-pool-search #pool-chain-select,
  #view-pool-search #save-filter-preset-button {
    min-height: 44px;
  }

  .history-top-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-panel,
  .history-profit-head,
  .history-controls,
  .history-period-stats,
  .history-chart-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .view-section,
  .create-workspace,
  .create-shell,
  .create-builder,
  .search-panel,
  .settings-card,
  .history-panel,
  .manage-table-card,
  .manage-main,
  .manage-card,
  #view-manage .sidebar,
  #view-manage .side-card {
    min-width: 0;
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea,
  a.settings-external-link,
  a.settings-social-link {
    min-height: 44px;
  }

  .updated-refresh-button {
    min-width: 44px;
  }

  .settings-wallet-submit,
  .settings-node-reset {
    min-height: 44px;
  }

  .settings-modal,
  .modal-shell,
  .history-share-modal {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .settings-modal-dialog,
  .modal-dialog,
  .history-share-dialog {
    width: min(100%, 680px);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }
}

@media (min-width: 621px) and (max-width: 1160px) {
  .app-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }

  .app-header > div:first-child {
    flex: 0 1 220px;
    min-width: 0;
  }

  .app-header p {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-status-bar {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
  }

  .status-card,
  .status-card-updated,
  .status-card-license {
    flex: 1 1 118px;
    min-width: 118px;
    padding: 8px 10px;
  }

  .status-card-updated {
    padding-right: 42px;
  }

}

@media (min-width: 621px) and (max-width: 900px) {
  .app-header > div:first-child {
    flex: 0 0 118px;
  }

  .app-header p {
    display: none;
  }

  .header-status-bar {
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .status-card,
  .status-card-updated,
  .status-card-license {
    flex: 0 0 118px;
  }

  .status-card-updated,
  .status-card:nth-child(4),
  .status-card-license {
    flex-basis: 150px;
  }
}

@media (max-width: 620px) {
  .app-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }

  .app-header > div:first-child {
    flex: 0 0 118px;
    min-width: 0;
  }

  .app-header h1 {
    margin-bottom: 0;
    overflow: hidden;
    font-size: 22px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-header p {
    display: none;
  }

  .header-status-bar {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .status-card,
  .status-card-updated,
  .status-card-license {
    flex: 0 0 118px;
    min-width: 118px;
    padding: 8px 10px;
  }

  .status-card-updated,
  .status-card:nth-child(4),
  .status-card-license {
    flex-basis: 150px;
  }

  .status-card-updated {
    padding-right: 42px;
  }

  .history-table-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .history-repair-controls {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 860px) {
  #view-swap button {
    min-height: 44px;
  }

  #swap-network-switch button,
  #swap-direction-button {
    min-width: 44px;
  }
}

.settings-wallet-loss-warning {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  color: #f3c562;
  font-size: 11px;
  line-height: 1.45;
}

.settings-wallet-loss-warning input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

@media (max-width: 430px) {
  .history-page-controls {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 4px !important;
    width: 100%;
    min-width: 0;
  }

  .history-page-controls button {
    width: 100%;
    min-width: 0;
    padding-right: 5px;
    padding-left: 5px;
    gap: 3px;
  }

  .history-page-controls #history-page-number {
    min-width: 32px;
  }
}

@media (max-width: 320px) {
  .app-shell {
    padding-right: 8px;
    padding-left: 8px;
  }

  .header-status-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .status-card-license {
    grid-column: auto;
  }

  .nav-link {
    padding-right: 0;
    padding-left: 0;
    font-size: 8px;
  }

  .settings-wallet-ledger-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .settings-wallet-row-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    width: 100%;
    min-width: 0;
  }

  .settings-wallet-row-actions button {
    min-width: 0;
    padding-right: 7px;
    padding-left: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 1320px) {
  .settings-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.history-repair-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.toast-item.multihop-accent {
  border-color: rgba(155, 207, 255, 0.5);
}

.toast-item.multihop-accent strong {
  color: #9bcfff;
}

.history-repair-button {
  flex: 0 0 auto;
}

#history-repair-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
