@media (max-width: 640px) {
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    font-size: 14px;
  }

  .container-fluid.px-4 {
    padding: 12px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
  }

  input:not([type="checkbox"]), select, textarea {
    font-size: 16px !important;
    min-height: 44px;
    max-width: 100%;
  }

  button, .btn, .page-link {
    min-height: 44px;
    touch-action: manipulation;
  }

  .header-tabs, .header-tabs-right {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .mobile-filter-panel {
    width: 100%;
    margin: 0 0 12px;
    border: 1px solid #2a3542;
    border-radius: 10px;
    background: #10171f;
    color: #d5dfeb;
  }

  .mobile-filter-panel[hidden] {
    display: none !important;
  }

  .mobile-filter-panel summary {
    text-align: left;
    min-height: 44px;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    touch-action: manipulation;
  }

  .mobile-filter-panel[open] summary {
    border-bottom: 1px solid #2a3542;
  }

  .mobile-filter-panel .exchange-filters,
  .mobile-filter-panel #opportunityControls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    width: 100%;
    margin: 0;
  }

  .mobile-filter-panel .form-check {
    display: flex;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 0;
    margin: 0;
    min-width: 0;
  }

  .mobile-filter-panel .form-check-input {
    float: none;
    margin: 0;
    flex: 0 0 20px;
  }

  .mobile-filter-panel .form-check-label,
  .header-tabs-right .exchange-filters .form-check-label {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 13px;
    white-space: normal;
  }

  #opportunityControls > :last-child {
    grid-column: 1 / -1;
  }

  #dataTable_wrapper .dataTables_filter,
  #opportunityTable_wrapper .dataTables_filter {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    float: none;
    width: 100%;
    gap: 8px;
    margin: 0 0 12px;
    text-align: left;
  }

  .dataTables_filter > label:not(.symbol-exact-toggle) {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    width: 100%;
    order: 1;
  }

  .dataTables_filter input[type="search"] {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    border-radius: 8px;
  }

  .dataTables_filter .symbol-exact-toggle {
    min-height: 44px;
    width: fit-content;
    margin: 0;
    font-size: 13px;
    order: 2;
  }

  .dataTables_filter > .mobile-filter-panel {
    order: 3;
    margin-bottom: 0;
  }

  .dataTables_length {
    display: none;
  }

  .mobile-table-sort {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    font-size: 14px;
  }

  .mobile-table-sort select {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: 1px solid #354353;
    border-radius: 8px;
    color: #e3edf7;
    background: #10171f;
  }

  .table-responsive {
    overflow: visible;
  }

  #dataTable, #opportunityTable {
    display: block;
    width: 100% !important;
    margin: 0 !important;
    border: 0;
    background: transparent;
  }

  #dataTable thead, #opportunityTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  #dataTable tbody, #opportunityTable tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  #dataTable tbody tr, #opportunityTable tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
    gap: 12px 16px;
    border: 1px solid #2c3948;
    border-radius: 12px;
    background: #10171f !important;
    color: #e4ebf4 !important;
  }

  #dataTable tbody td, #opportunityTable tbody td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit;
    font-size: 15px;
    line-height: 1.5;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    overflow: visible;
    max-width: none;
  }

  td[data-mobile-label]::before {
    content: attr(data-mobile-label);
    display: block;
    margin-bottom: 4px;
    color: #a8b8cb;
    font-size: 12px;
    font-weight: 400;
  }

  #dataTable td[data-mobile-column="0"],
  #dataTable td[data-mobile-column="1"] {
    padding-bottom: 10px;
    border-bottom: 1px solid #2c3948;
    font-weight: 650;
    font-size: 17px;
  }

  #dataTable td[data-mobile-column="9"],
  #opportunityTable td[data-mobile-column="0"],
  #opportunityTable td[data-mobile-column="10"],
  .table .dataTables_empty {
    grid-column: 1 / -1;
  }

  #opportunityTable td[data-mobile-column="5"],
  #opportunityTable td[data-mobile-column="6"],
  #opportunityTable td[data-mobile-column="7"] {
    display: none;
  }

  #opportunityTable td[data-mobile-column="0"]::before {
    display: none;
  }

  #opportunityTable .opportunity-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2c3948;
    color: #c2e3ff;
    font-size: 18px;
    font-weight: 650;
    text-decoration: none;
  }

  #opportunityTable .opportunity-link::after {
    content: '查看详情 →';
    flex-shrink: 0;
    margin-left: 12px;
    font-size: 13px;
    font-weight: 500;
  }

  #opportunityTable .diff-detail {
    display: block;
    font-size: 12px;
    color: #a8b8cb;
    margin-top: 4px;
    white-space: normal;
  }

  #opportunityTable .diff-value {
    color: #e4ebf4;
    font-size: 15px;
  }

  .dataTables_wrapper .dataTables_info {
    float: none;
    text-align: center;
    padding: 16px 0 8px;
  }

  .dataTables_wrapper .dataTables_paginate {
    float: none;
    padding: 0 0 16px;
    width: 100%;
  }

  .pagination {
    justify-content: center !important;
    flex-wrap: wrap;
    gap: 4px;
  }

  .page-link {
    min-width: 40px;
    display: grid;
    place-items: center;
    padding: 8px;
  }

  .opportunity-detail {
    padding: 14px;
    scroll-margin-top: 12px;
  }

  .opportunity-detail-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  #opportunityDetailBack {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }

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

  .detail-row {
    grid-template-columns: minmax(74px, 0.8fr) minmax(0, 1.5fr);
    font-size: 14px;
  }

  .detail-row-value, .detail-action-line, .fr-history-value, .opportunity-orderbook-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .detail-action-line {
    flex-wrap: wrap;
    gap: 4px;
  }

  .orderbook-detail-controls, .fr-history-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .cex-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
    gap: 16px 12px;
  }

  .cex-control, .cex-control input:not([type="checkbox"]) {
    min-width: 0;
    width: 100%;
  }

  .cex-controls > :last-child {
    grid-column: 1 / -1;
  }

  .cex-control label {
    font-size: 12px;
  }

  .cex-control .form-check {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    flex: 1;
    min-width: 0;
  }

  .cex-control .form-check-input {
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    border-color: #738599;
  }

  .cex-control .form-check-label {
    min-height: 44px;
    display: grid;
    place-items: center;
  }

  #cex-refresh,
  .cex-exchange-title .cex-exchange-label,
  .cex-meta-label {
    font-size: 12px;
  }

  .cex-table-head {
    display: none !important;
  }

  .cex-table, .cex-table.asset-mode .cex-table-body {
    background: transparent;
    border: 0;
    padding: 0;
  }

  .cex-table-body {
    display: grid;
    gap: 12px;
  }

  .cex-table-row, .cex-exchange-group {
    background: #10171f;
    border: 1px solid #2c3948;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    animation: none;
  }

  .cex-table-row > span:nth-child(4), .cex-table-row > span:nth-child(5) {
    grid-column: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cex-table-row > span:nth-child(3)::before { content: '网络 · '; color: #a8b8cb; }
  .cex-table-row > span:nth-child(4)::before { content: '充值'; }
  .cex-table-row > span:nth-child(5)::before { content: '提现'; }
  .cex-exchange-row > span:nth-child(2)::before { content: '充值'; margin-right: 4px; }
  .cex-exchange-row > span:nth-child(3)::before { content: '提现'; margin-right: 4px; }

  .cex-chain-pill, .cex-asset-meta {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .cex-badge {
    font-size: 12px;
  }

  :is(a, button, input, select, summary):focus-visible {
    outline: 2px solid #9ed4ff !important;
    outline-offset: 3px;
  }
}
