:root {
  --bg: #04070c;
  --panel: #0b1018;
  --panel-alt: #0f1420;
  --line: #1a2130;
  --text: #d7dcea;
  --muted: #7a8397;
  --green: #00c087;
  --red: #ef4d62;
  --blue: #174a40;
}

* {
  box-sizing: border-box;
}

html {
  background: #000;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  background: #03070d;
}

.top-nav {
  height: 64px;
  border-bottom: 1px solid #131a26;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.left-nav,
.right-nav,
.brand,
.main-links {
  display: flex;
  align-items: center;
}

.left-nav {
  gap: 16px;
  min-width: 0;
}

.brand {
  gap: 9px;
  min-width: 0;
  flex: 0 0 auto;
  font-weight: 800;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: #05070b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 7px 18px rgba(0, 0, 0, 0.24);
}

.brand-word {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: #f5f8ff;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  transform: none;
}

.brand-main {
  color: #f6f8ff;
  font-weight: 900;
}

.brand-sub {
  color: #35a486;
  font-weight: 900;
}

.main-links {
  gap: 14px;
  color: #b2bbce;
  font-size: 14px;
  white-space: nowrap;
}

.main-links a:hover {
  color: #f1f5ff;
}

.gold-pill {
  margin-left: 4px;
  background: rgba(181, 133, 57, 0.38);
  border: 1px solid rgba(181, 133, 57, 0.65);
  color: #f9cd61;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 999px;
}

.right-nav {
  gap: 10px;
  flex-shrink: 0;
}

.search-box {
  width: 220px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid #1b2231;
  background: #090e17;
  color: #6b768d;
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-size: 14px;
}

.wallet-btn {
  height: 36px;
  min-width: 158px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #174a40;
  color: #edf3ff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.wallet-btn:hover {
  background: #1d5f52;
}

.wallet-btn:disabled {
  cursor: wait;
  opacity: 0.76;
}

.wallet-btn.connected {
  background: #102f2a;
  color: #d8fff4;
}

.wallet-btn-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #05070b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.market-strip {
  display: grid;
  grid-template-columns: 260px 230px minmax(520px, 1fr);
  gap: 0;
  border-bottom: 1px solid #131a26;
  min-height: 78px;
}

.market-strip > * {
  border-right: 1px solid #131a26;
  padding: 14px 14px 12px;
}

.market-strip > *:last-child {
  border-right: 0;
}

.pair-block {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pair-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #263040;
  background: linear-gradient(145deg, #2f3e56, #1a2435);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 13px;
  color: #f3f7ff;
}

.pair-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.pair-title {
  font-size: 31px;
  font-weight: 700;
  transform: scaleX(0.53);
  transform-origin: left center;
  line-height: 1;
  margin-bottom: 3px;
  letter-spacing: 0.05em;
}

.pair-sub {
  font-size: 14px;
  color: #74809a;
}

.last-price {
  font-size: 42px;
  line-height: 1;
  color: var(--green);
  font-weight: 700;
  transform: scaleX(0.53);
  transform-origin: left center;
  margin-bottom: 2px;
  letter-spacing: 0.05em;
}

.usd-price {
  color: #707a91;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-item span {
  color: #687489;
  font-size: 12px;
}

.stat-item strong {
  color: #d4dceb;
  font-size: 14px;
  font-weight: 600;
}

.trade-layout {
  display: grid;
  grid-template-columns: minmax(540px, 1.75fr) minmax(260px, 0.72fr) minmax(270px, 0.74fr);
  gap: 8px;
  padding: 8px;
}

.panel {
  background: var(--panel);
  border: 1px solid #131b29;
  border-radius: 4px;
}

.chart-panel,
.book-panel,
.ticket-panel {
  min-height: 640px;
}

.panel-tabs {
  height: 42px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  gap: 16px;
}

.mobile-tab {
  display: none;
}

.tab {
  border: 0;
  background: transparent;
  color: #79849b;
  font-size: 15px;
  height: 42px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: #e8edfb;
  border-bottom-color: #f1f4fb;
}

.timeframe-row {
  height: 38px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.time-tabs {
  display: flex;
  gap: 5px;
}

.time-tabs button {
  border: 0;
  background: transparent;
  color: #6d7890;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.time-tabs button.active {
  background: #151d2b;
  color: #d6deef;
}

.chart-tools {
  color: #6d7890;
  font-size: 13px;
}

.chart-meta {
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #7590c9;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.chart-wrap {
  height: calc(100% - 116px);
  min-height: 520px;
}

#chart-root {
  height: 100%;
  width: 100%;
}

.book-panel {
  display: flex;
  flex-direction: column;
}

.book-head,
.trades-head,
.book-row,
.trade-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
}

.book-head,
.trades-head {
  padding: 9px 12px;
  color: #6f7990;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.book-head span:nth-child(2),
.book-head span:nth-child(3),
.trades-head span:nth-child(2),
.trades-head span:nth-child(3) {
  text-align: right;
}

.book-view,
.trades-view {
  height: calc(100% - 84px);
  overflow: hidden;
}

.book-list {
  height: calc((100% - 32px) / 2);
  overflow: hidden;
  padding: 2px 0;
}

.book-row {
  position: relative;
  padding: 1px 12px;
  height: 26px;
  font-size: 12px;
}

.book-row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: var(--fill, 0%);
  opacity: 0.12;
  pointer-events: none;
}

.book-row[data-side="ask"]::before {
  background: #ff5870;
}

.book-row[data-side="bid"]::before {
  background: #12cf94;
}

.book-row[data-side="ask"] span:first-child {
  color: #fa6f86;
}

.book-row[data-side="bid"] span:first-child {
  color: #16cb90;
}

.book-row span:nth-child(2),
.book-row span:nth-child(3),
.trade-row span:nth-child(2),
.trade-row span:nth-child(3) {
  text-align: right;
}

.mid-price {
  height: 32px;
  border-top: 1px solid #161f2f;
  border-bottom: 1px solid #161f2f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #17c78f;
  letter-spacing: 0.01em;
}

.trades-list {
  height: calc(100% - 36px);
  overflow: auto;
}

.trade-row {
  padding: 0 12px;
  height: 25px;
  font-size: 12px;
  color: #a8b3c9;
}

.trade-row .side-up {
  color: #17c88f;
}

.trade-row .side-down {
  color: #f56379;
}

.ticket-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.spot-label {
  color: #e4e9f8;
  font-size: 18px;
  font-weight: 600;
}

.side-switch,
.order-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.order-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.side-switch button,
.order-tabs button,
.percent-row button,
.action-btn {
  border: 1px solid #1a2232;
  border-radius: 6px;
  cursor: pointer;
}

.side-switch button,
.order-tabs button,
.percent-row button {
  height: 34px;
  background: #101827;
  color: #8a96af;
}

.side-switch button.active[data-side="buy"] {
  background: rgba(6, 99, 74, 0.42);
  border-color: rgba(17, 188, 136, 0.45);
  color: #19c58f;
}

.side-switch button.active[data-side="sell"] {
  background: rgba(111, 17, 41, 0.38);
  border-color: rgba(244, 88, 113, 0.45);
  color: #f6657c;
}

.order-tabs button.active {
  color: #e0e7f7;
  background: #162033;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: #6e7a90;
}

.field input {
  width: 100%;
  height: 42px;
  border: 1px solid #1b2434;
  border-radius: 8px;
  background: #0a111c;
  color: #dce3f4;
  font-size: 15px;
  padding: 0 10px;
}

.percent-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.percent-row button {
  background: #0d1522;
  color: #76819a;
  height: 30px;
  font-size: 12px;
}

.totals {
  display: grid;
  gap: 7px;
}

.totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #70829d;
  font-size: 12px;
}

.totals strong {
  font-size: 14px;
  color: #d9e0f1;
}

.action-btn {
  height: 40px;
  font-size: 15px;
  font-weight: 600;
}

.buy-btn {
  background: #00b67f;
  color: #eefef8;
  border-color: #00b67f;
}

.sell-btn {
  background: #f35067;
  color: #fff1f4;
  border-color: #f35067;
}

.bottom-panel {
  margin: 0 8px 8px;
  min-height: 245px;
}

.bottom-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #181f2e;
  overflow: auto;
}

.bottom-tabs button {
  border: 0;
  background: transparent;
  color: #7f8aa2;
  padding: 12px 14px;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.bottom-tabs button.active {
  color: #e8edf9;
  border-bottom-color: #edf2ff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #141b28;
  text-align: left;
}

.data-table th {
  color: #6d7890;
  font-weight: 500;
}

.side-buy {
  color: #16c98f;
  font-weight: 600;
}

.side-sell {
  color: #f5647a;
  font-weight: 600;
}

.pnl-pos {
  color: #11c88d;
}

.pnl-neg {
  color: #f45e75;
}

.table-empty {
  display: none;
  height: 130px;
  align-items: center;
  justify-content: center;
  color: #7b8598;
}

.table-empty.show {
  display: flex;
}

.hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .market-strip {
    grid-template-columns: 250px 210px 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    row-gap: 8px;
  }

  .trade-layout {
    grid-template-columns: minmax(520px, 1.5fr) minmax(260px, 0.8fr) minmax(250px, 0.8fr);
  }

  .main-links {
    gap: 10px;
    font-size: 13px;
  }
}

@media (max-width: 980px) {
  .top-nav {
    height: auto;
    padding: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .main-links {
    display: none;
  }

  .right-nav {
    width: 100%;
  }

  .search-box {
    flex: 1;
    min-width: 0;
  }

  .market-strip {
    grid-template-columns: 1fr;
  }

  .market-strip > * {
    border-right: 0;
    border-bottom: 1px solid #131a26;
  }

  .trade-layout {
    grid-template-columns: 1fr;
  }

  .chart-panel,
  .book-panel,
  .ticket-panel {
    min-height: 430px;
  }

  .chart-wrap {
    min-height: 360px;
    height: 360px;
  }

  .book-view,
  .trades-view {
    height: 360px;
  }

  .book-list {
    height: 164px;
  }
}

/* MEXC parity pass: keep the terminal dense and close to the live spot screen. */
:root {
  --bg: #000;
  --panel: #05080e;
  --line: #10151d;
  --line-soft: #151c28;
  --text: #d8deeb;
  --muted: #5d687c;
  --green: #00b783;
  --red: #e9475f;
  --blue: #174a40;
}

body {
  background: #000;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

.app-shell {
  background: #000;
  min-height: 100vh;
  padding-bottom: 28px;
}

.top-nav {
  height: 60px;
  padding: 0 15px;
  border-bottom-color: #090d13;
  background: #000;
}

.left-nav {
  gap: 0;
}

.brand {
  gap: 0;
  width: auto;
  min-width: 210px;
}

.brand-word {
  color: #f5f8ff;
  font-size: 25px;
  font-weight: 900;
  transform: none;
  letter-spacing: -0.035em;
}

.brand-main {
  color: #f8fbff;
  text-shadow: 0 0 18px rgba(23, 74, 64, 0.24);
}

.brand-sub {
  color: #35a486;
  text-shadow: 0 0 18px rgba(53, 164, 134, 0.26);
}

.main-links {
  gap: 19px;
  color: #b0b5c0;
  font-size: 14px;
}

.gold-pill {
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11px;
}

.genesis-link {
  color: #a3adbd;
  font-size: 14px;
  white-space: nowrap;
}

.search-box {
  width: 166px;
  height: 32px;
  border-color: #0b1018;
  background: #030509;
  color: #46536a;
  justify-content: center;
  border-radius: 16px;
  font-size: 13px;
}

.wallet-btn {
  height: 32px;
  min-width: 150px;
}

.market-strip {
  height: 56px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 240px 182px 1fr;
  border-bottom-color: #0b1018;
  background: #000;
}

.pair-ticker {
  height: 42px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #061915;
  border-bottom: 1px solid #0f2c25;
  font-size: 14px;
  font-weight: 600;
}

.pair-ticker-track {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.pair-ticker-track::-webkit-scrollbar {
  display: none;
}

.pair-ticker-item {
  min-width: max-content;
  height: 100%;
  border: 0;
  border-right: 1px solid rgba(120, 146, 178, 0.13);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #e8f1ff;
  font: inherit;
  cursor: pointer;
}

.pair-ticker-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.pair-ticker-item img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  background: #05070b;
}

.pair-ticker-symbol {
  color: #f5f8ff;
  font-weight: 800;
}

.pair-ticker-price {
  color: #9ca9bd;
  font-weight: 700;
}

.pair-ticker-change {
  font-weight: 800;
}

.pair-ticker-change.up {
  color: #11b981;
}

.pair-ticker-change.down {
  color: #f05b72;
}

.market-strip > * {
  padding: 9px 14px 8px;
  border-right-color: #0d121a;
}

.pair-block {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  gap: 10px;
  cursor: pointer;
}

.favorite-star {
  color: #333b49;
  font-size: 18px;
}

.pair-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
  color: #f2f4f8;
  background: #05070b;
}

.pair-title {
  color: #d4dae6;
  font-size: 16px;
  font-weight: 700;
  transform: none;
  letter-spacing: 0;
  line-height: 18px;
}

.pair-title span {
  color: #687589;
  font-size: 12px;
}

.pair-sub {
  color: #59657a;
  font-size: 13px;
  line-height: 18px;
}

.market-selector {
  position: static;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #05080e;
  border: 1px solid #0d121a;
  border-radius: 0;
  box-shadow: none;
}

.market-selector.open {
  display: flex;
}

.market-selector-head {
  height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.9fr);
  gap: 9px;
  align-items: center;
  padding: 10px 16px 7px 17px;
}

.market-selector-search,
.market-mover-btn {
  height: 32px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 8px;
  background: #0d131d;
  color: #626e80;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.market-selector-search {
  gap: 8px;
  padding: 0 13px;
}

.market-selector-search span,
.market-mover-btn {
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-mover-btn {
  justify-content: center;
  padding: 0 10px;
  cursor: pointer;
}

.market-selector-tabs {
  height: 43px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
  border-bottom: 1px solid #101620;
  overflow-x: auto;
  scrollbar-width: none;
}

.market-selector-tabs::-webkit-scrollbar {
  display: none;
}

.market-selector-tabs button {
  height: 30px;
  min-width: auto;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #657084;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.market-selector-tabs button.hot,
.market-selector-tabs button.active {
  border-color: rgba(48, 130, 111, 0.58);
  background: linear-gradient(180deg, #1d5f51 0%, #174a40 100%);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(3, 14, 12, 0.34), 0 5px 12px rgba(23, 74, 64, 0.22);
}

.market-selector-tabs button.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, #124137 0%, #07100e 100%);
  box-shadow: inset 0 -2px 0 #000, 0 5px 12px rgba(23, 74, 64, 0.22);
}

.market-selector-subtabs {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 17px;
  border-bottom: 1px solid #101620;
  overflow: hidden;
}

.market-selector-subtabs button {
  height: 25px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #737f92;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.market-selector-subtabs button.active {
  min-width: 31px;
  background: #111722;
  color: #ccd3df;
}

.market-selector-subtabs .chevron-tab {
  margin-left: auto;
  color: #687487;
  font-size: 25px;
  line-height: 1;
}

.market-selector-table {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 8px;
}

.market-selector-row {
  width: 100%;
  min-height: 53px;
  display: grid;
  grid-template-columns: 26px minmax(76px, 1fr) minmax(64px, 0.72fr) minmax(48px, 0.58fr) 16px;
  align-items: center;
  gap: 6px;
  padding: 4px 15px 4px 17px;
  border: 0;
  background: transparent;
  color: #d4dbe8;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.market-selector-row.active,
.market-selector-row:hover {
  background: #080d15;
}

.market-selector-title {
  min-height: 28px;
  color: #566173;
  font-size: 12px;
  cursor: default;
}

.market-selector-title span:nth-child(n + 3) {
  text-align: right;
}

.market-icon {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #05070b;
  object-fit: cover;
}

.mexc-icon {
  background: linear-gradient(135deg, #1a73ff, #54a4ff);
}

.btc-icon {
  background: #f59a23;
}

.eth-icon {
  background: linear-gradient(135deg, #7187cf, #354a9a);
}

.pepe-icon {
  background: linear-gradient(135deg, #36a64f, #176b30);
}

.ada-icon {
  background: radial-gradient(circle, #fff 0 14%, #3f6cff 15% 100%);
}

.aido-icon {
  background: linear-gradient(135deg, #17263c, #d8695c);
}

.avax-icon {
  background: #ec3f4c;
}

.luna-icon {
  background: linear-gradient(135deg, #ffd25a, #eb5c67);
}

.sol-icon {
  background: linear-gradient(135deg, #39e6b2, #9174ff);
}

.trx-icon {
  background: #f20f31;
}

.xrp-icon {
  background: #171b21;
}

.market-pair strong,
.market-price strong,
.market-change strong {
  display: block;
  overflow: hidden;
  color: #dce3ef;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-pair strong span {
  color: #7d8798;
  font-weight: 600;
}

.market-pair em,
.market-price em,
.market-change em {
  display: block;
  color: #738096;
  font-style: normal;
  font-size: 12px;
  line-height: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-price,
.market-change,
.row-star {
  text-align: right;
}

.market-pair,
.market-price,
.market-change {
  min-width: 0;
  overflow: hidden;
}

.market-change.up strong {
  color: #00b783;
}

.market-change.down strong {
  color: #ef4d62;
}

.row-star {
  color: #465265;
  font-size: 20px;
  line-height: 1;
}

.price-block {
  display: block;
}

.last-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--green);
  font-size: 22px;
  line-height: 24px;
  font-weight: 700;
  transform: none;
  letter-spacing: 0;
}

.last-price .price-change {
  font-size: 12px;
  font-weight: 500;
}

.usd-price {
  color: #5e697d;
  font-size: 12px;
  line-height: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-items: center;
  gap: 16px;
}

.stat-item {
  gap: 3px;
}

.stat-item span {
  color: #424b5d;
  font-size: 12px;
}

.stat-item strong {
  color: #959daf;
  font-size: 12px;
  font-weight: 600;
}

.trade-layout {
  display: grid;
  grid-template-columns: clamp(286px, 16.7vw, 306px) minmax(420px, 1fr) clamp(238px, 16.7vw, 306px) clamp(260px, 16.7vw, 306px);
  gap: 4px;
  padding: 0;
}

.panel {
  background: #05080e;
  border-color: #0d121a;
  border-radius: 0;
}

.market-selector,
.chart-panel,
.book-panel,
.ticket-panel {
  min-height: 520px;
  height: min(832px, calc(100vh - 186px));
}

.panel-tabs {
  height: 43px;
  padding: 0 17px;
  gap: 18px;
  border-bottom-color: #0e131c;
}

.tab {
  height: 43px;
  color: #3e4859;
  font-size: 14px;
  font-weight: 600;
}

.tab.active {
  color: #b8c0cf;
  border-bottom-color: #b8c0cf;
}

.timeframe-row {
  height: 33px;
  border-bottom-color: transparent;
  padding: 0 19px;
}

.time-tabs {
  gap: 15px;
}

.time-tabs button {
  height: 24px;
  padding: 0 0;
  color: #3e4859;
  font-size: 12px;
}

.time-tabs button.active {
  min-width: 33px;
  padding: 0 8px;
  background: #101720;
  color: #68758a;
}

.chart-tools {
  color: #263242;
}

.chart-info-strip {
  position: relative;
  z-index: 3;
  min-height: 52px;
  padding: 7px 21px 0;
  border-bottom: 0;
  color: #435b72;
  font-size: 12px;
  line-height: 21px;
}

.chart-meta,
.chart-ma-row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-ma-row {
  color: #4d5969;
}

.chart-ma-row .ma5 {
  color: #8c6d18;
}

.chart-ma-row .ma10 {
  color: #5a3fa3;
}

.chart-ma-row .ma20 {
  color: #587337;
}

.chart-wrap {
  position: relative;
  height: calc(100% - 128px);
  min-height: 0;
}

#chart-root {
  background: #020509;
}

.chart-watermark {
  position: absolute;
  z-index: 2;
  left: 15px;
  bottom: 95px;
  color: rgba(255, 255, 255, 0.025);
  font-size: 47px;
  font-weight: 700;
  pointer-events: none;
}

.chart-vol-row {
  position: absolute;
  z-index: 4;
  left: 21px;
  bottom: 52px;
  max-width: calc(100% - 140px);
  color: #314052;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.chart-vol-row .vol-up {
  color: #00785a;
}

.chart-vol-row .vol-down {
  color: #91414f;
}

.chart-last-badge {
  display: none;
}

#chart-root a {
  opacity: 0.45;
}

.compare-pop {
  position: absolute;
  z-index: 5;
  top: -34px;
  right: 18px;
  width: 291px;
  min-height: 128px;
  padding: 18px 16px 15px;
  background: #12366f;
  border-radius: 2px;
  color: #e7efff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.compare-pop::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 21px;
  width: 14px;
  height: 14px;
  background: #12366f;
  transform: rotate(45deg);
}

.compare-pop strong {
  display: block;
  margin-bottom: 11px;
  color: #c4cbe1;
  font-size: 16px;
}

.compare-pop span {
  display: block;
  color: #8292b4;
  font-size: 14px;
  line-height: 22px;
}

.compare-pop em {
  position: absolute;
  right: 18px;
  bottom: 10px;
  min-width: 78px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #bab8a9;
  color: #244369;
  font-style: normal;
}

.compare-pop button {
  position: absolute;
  right: -8px;
  top: 11px;
  border: 0;
  background: transparent;
  color: #606a7a;
  font-size: 31px;
  cursor: pointer;
}

.book-panel .panel-tabs {
  padding: 0 17px;
}

.book-head,
.trades-head {
  padding: 7px 16px;
  color: #4d596c;
  border-bottom: 0;
}

.book-view,
.trades-view {
  height: calc(100% - 72px);
}

.book-list {
  height: calc((100% - 34px) / 2);
  padding: 0;
}

.book-row {
  height: 20px;
  padding: 0 16px;
  font-size: 12px;
  line-height: 20px;
}

.book-row::before {
  opacity: 0.14;
}

.mid-price {
  height: 34px;
  border-color: #101720;
  font-size: 18px;
  color: var(--green);
}

.trade-row {
  height: 21px;
  padding: 0 16px;
}

.ticket-panel {
  padding: 12px 11px;
  gap: 12px;
}

.spot-label {
  height: 19px;
  color: #b7bfce;
  font-size: 16px;
}

.side-switch {
  height: 37px;
  padding: 3px;
  gap: 0;
  border-radius: 19px;
  background: #080b10;
}

.side-switch button {
  height: 31px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #323a49;
  font-weight: 600;
}

.side-switch button.active[data-side="buy"] {
  background: #003f2c;
  border: 0;
  color: #00a879;
}

.side-switch button.active[data-side="sell"] {
  background: #4a121d;
  border: 0;
  color: #d74c61;
}

.order-tabs {
  display: flex;
  gap: 20px;
  height: 30px;
  border-bottom: 1px solid #111722;
}

.order-tabs button {
  height: 30px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #394354;
  font-size: 14px;
  font-weight: 600;
}

.order-tabs button.active {
  background: transparent;
  color: #aaaebe;
  border-bottom-color: #a5a8b2;
}

.field {
  gap: 7px;
}

.field label {
  color: #485365;
  font-size: 12px;
}

.field input {
  height: 40px;
  border-color: #080c12;
  background: #080c12;
  border-radius: 8px;
  color: #6d7584;
  font-size: 14px;
}

.percent-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  height: 26px;
  margin: 2px 3px 0;
}

.percent-row::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 9px;
  height: 1px;
  background: #151b25;
}

.percent-row button {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  padding: 0;
  place-self: start center;
  border-radius: 50%;
  border-color: #101722;
  background: #05080e;
  color: transparent;
}

.percent-row button::after {
  content: attr(data-label);
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  color: #313a49;
  font-size: 11px;
}

.percent-row button:nth-child(1)::after {
  content: "25%";
}

.percent-row button:nth-child(2)::after {
  content: "50%";
}

.percent-row button:nth-child(3)::after {
  content: "75%";
}

.percent-row button:nth-child(4)::after {
  content: "100%";
}

.totals {
  gap: 8px;
}

.totals div {
  color: #465164;
}

.totals strong {
  color: #414b5e;
  font-size: 12px;
}

.tpsl-check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 26px;
  color: #4a5364;
  font-size: 13px;
}

.tpsl-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.action-btn {
  height: 42px;
  border: 0;
  border-radius: 21px;
  font-size: 14px;
}

.buy-btn {
  background: #174a40;
  color: #eafff8;
}

.sell-btn {
  background: #341018;
  color: #ad4655;
}

.bottom-panel {
  margin: 4px 0 0;
  min-height: 160px;
  background: #05080e;
}

.bottom-tabs {
  height: 40px;
  border-bottom-color: #111722;
}

.bottom-tabs button {
  padding: 0 17px;
  color: #3c4657;
}

.bottom-tabs button.active {
  color: #a9b1bf;
}

.data-table th,
.data-table td {
  border-bottom-color: #0e141d;
  color: #69758a;
}

.table-empty {
  height: 110px;
  color: #333c4b;
}

.exchange-footer {
  position: fixed;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-top: 1px solid #090d13;
  background: #020305;
  color: #384457;
  font-size: 12px;
}

.mobile-trade-cta {
  display: none;
}

.exchange-footer span {
  color: #5b6678;
  font-weight: 500;
}

.theme-btn {
  height: 32px;
  min-width: 62px;
  border: 1px solid #141b26;
  border-radius: 16px;
  background: #05080e;
  color: #8b96aa;
  font-size: 13px;
  cursor: pointer;
}

body.theme-light,
body.theme-light .app-shell {
  --blue: #174a40;
  background: #f4f7fb;
  color: #172033;
}

body.theme-light .top-nav,
body.theme-light .market-strip,
body.theme-light .exchange-footer {
  background: #fff;
  border-color: #e5eaf2;
}

body.theme-light .pair-ticker {
  background: #eef7f4;
  border-color: #d9e9e3;
}

body.theme-light .pair-ticker-item {
  border-right-color: #d9e9e3;
  color: #174a40;
}

body.theme-light .pair-ticker-item:hover {
  background: rgba(23, 74, 64, 0.07);
}

body.theme-light .pair-ticker-symbol {
  color: #174a40;
}

body.theme-light .pair-ticker-price {
  color: #526477;
}

body.theme-light .brand-word,
body.theme-light .pair-title,
body.theme-light .spot-label,
body.theme-light .tab.active,
body.theme-light .bottom-tabs button.active {
  color: #182235;
}

body.theme-light .brand-main {
  color: #101827;
  text-shadow: none;
}

body.theme-light .brand-logo {
  background: #fff;
  box-shadow: 0 0 0 1px rgba(23, 74, 64, 0.18), 0 6px 16px rgba(23, 74, 64, 0.12);
}

body.theme-light .brand-sub {
  color: #174a40;
  text-shadow: none;
}

body.theme-light .main-links,
body.theme-light .genesis-link {
  color: #4d596d;
}

body.theme-light .search-box,
body.theme-light .theme-btn {
  background: #f5f7fb;
  border-color: #dde5f0;
  color: #536176;
}

body.theme-light .wallet-btn {
  background: #174a40;
  color: #fff;
}

body.theme-light .wallet-btn:hover {
  background: #205f53;
}

body.theme-light .wallet-btn.connected {
  background: #eef7f4;
  color: #174a40;
  box-shadow: inset 0 0 0 1px #b8d5cc;
}

body.theme-light .pair-sub,
body.theme-light .stat-item span,
body.theme-light .usd-price,
body.theme-light .tab,
body.theme-light .time-tabs button,
body.theme-light .chart-tools,
body.theme-light .book-head,
body.theme-light .trades-head,
body.theme-light .field label,
body.theme-light .totals div,
body.theme-light .bottom-tabs button,
body.theme-light .data-table th,
body.theme-light .data-table td {
  color: #66758a;
}

body.theme-light .market-strip > *,
body.theme-light .panel,
body.theme-light .panel-tabs,
body.theme-light .bottom-tabs,
body.theme-light .mid-price,
body.theme-light .field input,
body.theme-light .order-tabs {
  border-color: #e5eaf2;
}

body.theme-light .panel,
body.theme-light .ticket-panel,
body.theme-light .bottom-panel,
body.theme-light #chart-root {
  background: #fff;
}

body.theme-light .stat-item strong,
body.theme-light .totals strong {
  color: #243046;
}

body.theme-light .time-tabs button.active,
body.theme-light .field input {
  background: #f2f5fa;
  color: #334155;
}

body.theme-light .chart-meta {
  color: #35775f;
}

body.theme-light .chart-info-strip {
  color: #35775f;
}

body.theme-light .chart-ma-row,
body.theme-light .chart-vol-row {
  color: #6b7280;
}

body.theme-light .chart-watermark {
  color: rgba(31, 41, 55, 0.045);
}

body.theme-light .compare-pop,
body.theme-light .compare-pop::before {
  background: #dcece7;
}

body.theme-light .compare-pop strong {
  color: #25334a;
}

body.theme-light .compare-pop span {
  color: #52657f;
}

body.theme-light .compare-pop em {
  background: #fff;
  color: #174a40;
}

body.theme-light .side-switch {
  background: #edf2f8;
}

body.theme-light .side-switch button {
  color: #64748b;
}

body.theme-light .side-switch button.active[data-side="buy"] {
  background: #d9f7ec;
  color: #008d67;
}

body.theme-light .side-switch button.active[data-side="sell"] {
  background: #ffe1e7;
  color: #d83b55;
}

body.theme-light .order-tabs button {
  color: #64748b;
}

body.theme-light .order-tabs button.active {
  color: #1f2937;
  border-bottom-color: #1f2937;
}

body.theme-light .book-row[data-side="ask"]::before {
  background: #ffdce3;
  opacity: 0.75;
}

body.theme-light .book-row[data-side="bid"]::before {
  background: #d9f7ec;
  opacity: 0.75;
}

body.theme-light .buy-btn {
  background: #174a40;
  color: #fff;
}

body.theme-light .mobile-trade-cta button:last-child {
  background: #174a40;
  color: #fff;
}

body.theme-light .sell-btn {
  background: #fff0f3;
  color: #d43b55;
}

body.theme-light .percent-row::before {
  background: #dce4ef;
}

body.theme-light .percent-row button {
  background: #fff;
  border-color: #cfd8e6;
}

body.theme-light .tpsl-check {
  color: #64748b;
}

body.theme-light .tpsl-check input {
  accent-color: #174a40;
}

body.theme-light .mobile-trade-cta {
  background: #fff;
  border-color: #e5eaf2;
}

body.theme-light .mobile-trade-cta button:first-child {
  background: #eef2f8;
  color: #243047;
}

body.theme-light .mobile-trade-cta .wallet-btn.connected {
  background: #eef7f4;
  color: #174a40;
}

body.theme-light .market-selector {
  background: #fff;
  border-color: #edf1f6;
  box-shadow: none;
}

body.theme-light .market-selector-tabs,
body.theme-light .market-selector-subtabs {
  border-color: #edf1f6;
}

body.theme-light .market-selector-search,
body.theme-light .market-mover-btn {
  background: #f2f5fa;
  color: #8a96a8;
}

body.theme-light .market-selector-subtabs button.active {
  background: #eef2f7;
  color: #1f2937;
}

body.theme-light .market-selector-row.active {
  background: #fbfcfe;
}

body.theme-light .market-selector-row:hover {
  background: #f7f9fc;
}

body.theme-light .market-selector-tabs button.active,
body.theme-light .market-selector-tabs button.hot {
  border-color: rgba(23, 74, 64, 0.2);
  background: linear-gradient(180deg, #1d5f51 0%, #174a40 100%);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(3, 14, 12, 0.24), 0 5px 12px rgba(23, 74, 64, 0.16);
}

body.theme-light .market-selector-tabs button.active {
  background: linear-gradient(180deg, #123f36 0%, #07100e 100%);
}

body.theme-light .market-selector-row,
body.theme-light .market-selector-title,
body.theme-light .market-selector-search,
body.theme-light .market-selector-tabs button,
body.theme-light .market-selector-subtabs button,
body.theme-light .market-pair em,
body.theme-light .market-price em,
body.theme-light .market-change em {
  color: #64748b;
}

body.theme-light .market-pair strong,
body.theme-light .market-price strong {
  color: #202938;
}

body.theme-light .market-pair strong span {
  color: #8b96a7;
}

body.theme-light .row-star {
  color: #b9c2d0;
}

body.theme-light .table-empty {
  color: #8a97aa;
}

@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .top-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    height: calc(46px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    flex-direction: row;
    align-items: center;
  }

  .brand {
    gap: 7px;
    width: auto;
    min-width: 0;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand-word {
    gap: 5px;
    font-size: 19px;
  }

  .genesis-link,
  .main-links {
    display: none;
  }

  .right-nav {
    width: auto;
    gap: 12px;
  }

  .search-box {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    color: transparent;
    background: transparent;
    font-size: 0;
  }

  .search-box::before {
    content: "⌕";
    color: #7a8290;
    font-size: 23px;
  }

  .wallet-btn {
    min-width: 132px;
    padding-right: 12px;
  }

  .market-strip {
    height: auto;
    grid-template-columns: 1fr;
  }

  .market-selector {
    width: 100%;
    height: min(420px, 54vh);
    min-height: 320px;
    max-height: 420px;
  }

  .market-selector-tabs {
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .market-selector-tabs::-webkit-scrollbar {
    display: none;
  }

  .market-selector-table {
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pair-ticker {
    position: sticky;
    top: calc(46px + env(safe-area-inset-top));
    z-index: 39;
    height: 34px;
    font-size: 13px;
  }

  .pair-ticker-item {
    padding: 0 12px;
    gap: 6px;
  }

  .pair-ticker-item img {
    width: 16px;
    height: 16px;
  }

  .market-strip > * {
    padding: 10px 14px;
    border-bottom-color: #0d121a;
  }

  .price-block {
    padding-top: 13px;
  }

  .last-price {
    display: block;
    font-size: 26px;
    line-height: 32px;
  }

  .last-price .price-change {
    display: block;
    font-size: 24px;
    line-height: 28px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .trade-layout {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 8px calc(16px + env(safe-area-inset-bottom));
  }

  .trade-layout > * {
    min-width: 0;
    max-width: 100%;
  }

  .chart-panel,
  .book-panel,
  .ticket-panel {
    height: auto;
    min-height: 0;
  }

  .chart-wrap {
    height: clamp(310px, 76vw, 390px);
  }

  .chart-info-strip {
    min-height: 63px;
    padding: 8px 21px 0;
    line-height: 17px;
  }

  .chart-meta,
  .chart-ma-row {
    white-space: normal;
  }

  .chart-vol-row {
    left: 21px;
    right: 68px;
    bottom: 46px;
    max-width: none;
  }


  .chart-panel .panel-tabs {
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chart-panel .panel-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-tab {
    display: inline-flex;
  }

  .compare-pop {
    display: none;
  }

  .book-view,
  .trades-view {
    height: min(374px, 62vh);
  }

  .ticket-panel {
    padding-bottom: 18px;
  }

  .bottom-panel {
    margin: 0 8px calc(96px + env(safe-area-inset-bottom));
  }

  .exchange-footer {
    display: none;
  }

  .mobile-trade-cta {
    position: fixed;
    z-index: 18;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom);
    height: 64px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: center;
    padding: 10px 16px;
    background: #000;
    border-top: 1px solid #111722;
  }

  .mobile-trade-cta button {
    height: 40px;
    border: 0;
    border-radius: 22px;
    color: #fff;
    background: #181e29;
    font-size: 14px;
    font-weight: 600;
  }

  .mobile-trade-cta .wallet-btn {
    min-width: 0;
    padding: 0 10px;
    background: #181e29;
    box-shadow: none;
  }

  body.theme-light .mobile-trade-cta .wallet-btn {
    background: #eef2f8;
    color: #243047;
  }

  body.theme-light .mobile-trade-cta .wallet-btn.connected {
    background: #eef7f4;
    color: #174a40;
  }

  .mobile-trade-cta button:last-child {
    background: #174a40;
  }

}

@media (max-width: 520px) {
  .top-nav {
    gap: 8px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
  }

  .brand-word {
    gap: 4px;
    font-size: 17px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .right-nav {
    gap: 7px;
  }

  .theme-btn {
    height: 30px;
    min-width: 52px;
    font-size: 12px;
  }

  .wallet-btn {
    height: 30px;
    min-width: 118px;
    padding: 0 9px 0 7px;
    gap: 6px;
    font-size: 12px;
  }

  .wallet-btn-icon {
    width: 18px;
    height: 18px;
  }

  .market-selector-row {
    grid-template-columns: 22px minmax(86px, 1fr) minmax(62px, 0.64fr) minmax(54px, 0.56fr) 12px;
    gap: 4px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .market-selector-head {
    gap: 8px;
    padding: 12px 18px 10px;
  }

  .chart-tools {
    display: none;
  }

  .time-tabs {
    gap: 5px;
  }

  .time-tabs button {
    min-width: 31px;
    padding: 0 6px;
  }
}

@media (max-width: 380px) {
  .brand-word {
    gap: 3px;
    font-size: 14px;
  }

  .brand-logo {
    width: 22px;
    height: 22px;
  }

  .right-nav {
    gap: 5px;
  }

  .theme-btn {
    min-width: 42px;
    padding: 0 7px;
  }

  .wallet-btn {
    min-width: 100px;
    font-size: 11px;
  }

  .wallet-btn-icon {
    width: 16px;
    height: 16px;
  }

  .mobile-trade-cta {
    gap: 10px;
    padding-inline: 12px;
  }
}

@media (max-width: 340px) {
  .top-nav {
    gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .brand {
    gap: 4px;
  }

  .brand-logo {
    width: 20px;
    height: 20px;
  }

  .brand-word {
    gap: 2px;
    font-size: 12px;
  }

  .right-nav {
    gap: 4px;
  }

  .theme-btn {
    min-width: 38px;
    padding: 0 6px;
    font-size: 11px;
  }

  .wallet-btn {
    min-width: 92px;
    padding: 0 7px 0 6px;
    gap: 4px;
    font-size: 10.5px;
  }

  .wallet-btn-icon {
    width: 15px;
    height: 15px;
  }
}
